[alsa-devel] [PATCH 0/2] ASoC: omap: mcbsp: small cleanups for the sidetone code
Hello,
to make the code a bit nicer to look at.
This series is on top of the McBSP move changeset: http://mailman.alsa-project.org/pipermail/alsa-devel/2012-February/049628.ht...
Regards, Peter --- Peter Ujfalusi (2): ASoC: omap: mcbsp: Use uniform st_data pointer initialization ASoC: omap: mcbsp: Remove redundant checks for the st_data pointer
sound/soc/omap/mcbsp.c | 25 +++++++------------------ 1 files changed, 7 insertions(+), 18 deletions(-)
In this way we can save few lines, and have uniform way of initializing the st_data in all functions.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/mcbsp.c | 21 +++++---------------- 1 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index fe4734e..79f6da6 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -273,11 +273,9 @@ static void omap_st_chgain(struct omap_mcbsp *mcbsp)
int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain) { - struct omap_mcbsp_st_data *st_data; + struct omap_mcbsp_st_data *st_data = mcbsp->st_data; int ret = 0;
- st_data = mcbsp->st_data; - if (!st_data) return -ENOENT;
@@ -298,11 +296,9 @@ int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain)
int omap_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, s16 *chgain) { - struct omap_mcbsp_st_data *st_data; + struct omap_mcbsp_st_data *st_data = mcbsp->st_data; int ret = 0;
- st_data = mcbsp->st_data; - if (!st_data) return -ENOENT;
@@ -337,9 +333,7 @@ static int omap_st_start(struct omap_mcbsp *mcbsp)
int omap_st_enable(struct omap_mcbsp *mcbsp) { - struct omap_mcbsp_st_data *st_data; - - st_data = mcbsp->st_data; + struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
if (!st_data) return -ENODEV; @@ -368,11 +362,9 @@ static int omap_st_stop(struct omap_mcbsp *mcbsp)
int omap_st_disable(struct omap_mcbsp *mcbsp) { - struct omap_mcbsp_st_data *st_data; + struct omap_mcbsp_st_data *st_data = mcbsp->st_data; int ret = 0;
- st_data = mcbsp->st_data; - if (!st_data) return -ENODEV;
@@ -386,14 +378,11 @@ int omap_st_disable(struct omap_mcbsp *mcbsp)
int omap_st_is_enabled(struct omap_mcbsp *mcbsp) { - struct omap_mcbsp_st_data *st_data; - - st_data = mcbsp->st_data; + struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
if (!st_data) return -ENODEV;
- return st_data->enabled; }
On Tue, Feb 28, 2012 at 10:07:31AM +0200, Peter Ujfalusi wrote:
In this way we can save few lines, and have uniform way of initializing the st_data in all functions.
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
On 02/28/2012 02:40 PM, Mark Brown wrote:
On Tue, Feb 28, 2012 at 10:07:31AM +0200, Peter Ujfalusi wrote:
In this way we can save few lines, and have uniform way of initializing the st_data in all functions.
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
Acked-by: Jarkko Nikula jarkko.nikula@bitmer.com
The parent functions of omap_st_start/stop also checks the validity of the st_data pointer so we do not need to do it again inside of omap_st_start/stop
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/mcbsp.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index 79f6da6..5f6c21d 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -318,7 +318,7 @@ static int omap_st_start(struct omap_mcbsp *mcbsp) { struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
- if (st_data && st_data->enabled && !st_data->running) { + if (st_data->enabled && !st_data->running) { omap_st_fir_write(mcbsp, st_data->taps); omap_st_chgain(mcbsp);
@@ -350,7 +350,7 @@ static int omap_st_stop(struct omap_mcbsp *mcbsp) { struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
- if (st_data && st_data->running) { + if (st_data->running) { if (!mcbsp->free) { omap_st_off(mcbsp); st_data->running = 0;
On Tue, Feb 28, 2012 at 10:07:32AM +0200, Peter Ujfalusi wrote:
The parent functions of omap_st_start/stop also checks the validity of the st_data pointer so we do not need to do it again inside of omap_st_start/stop
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
On 02/28/2012 02:40 PM, Mark Brown wrote:
On Tue, Feb 28, 2012 at 10:07:32AM +0200, Peter Ujfalusi wrote:
The parent functions of omap_st_start/stop also checks the validity of the st_data pointer so we do not need to do it again inside of omap_st_start/stop
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
Acked-by: Jarkko Nikula jarkko.nikula@bitmer.com
participants (3)
-
Jarkko Nikula
-
Mark Brown
-
Peter Ujfalusi