Skip to contentSkip to conversation

ASoC: omap: mcbsp: small cleanups for the sidetone code

PATCH In review Peter Ujfalusi 3 participants 7 messages Feb 28, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover 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.html

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(-)
Signature · 1 line
1.7.8.4
#1 lore raw

PATCH 1/2 ASoC: omap: mcbsp: Use uniform st_data pointer initialization

In this way we can save few lines, and have uniform way of initializing the st_data in all functions.

---
 sound/soc/omap/mcbsp.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)
sound/soc/omap/mcbsp.c +5 -16
index fe4734e..79f6da6 100644
@@ -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;
 }
 
Signature · 1 line
1.7.8.4
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] ASoC: omap: mcbsp: Use uniform st_data pointer initialization

Quoted 2 lines · Peter Ujfalusi

In this way we can save few lines, and have uniform way of initializing the st_data in all functions.

#4 lore raw

PATCH 2/2 ASoC: omap: mcbsp: Remove redundant checks for the st_data pointer

In reply to Peter Ujfalusi

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

---
 sound/soc/omap/mcbsp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/omap/mcbsp.c +2 -2
index 79f6da6..5f6c21d 100644
@@ -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;
Signature · 1 line
1.7.8.4
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] ASoC: omap: mcbsp: Remove redundant checks for the st_data pointer

Quoted 2 lines · Peter Ujfalusi

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
#6 lore raw

Re: [PATCH 2/2] ASoC: omap: mcbsp: Remove redundant checks for the st_data pointer

Quoted 5 lines · Mark Brown
Quoted 2 lines · Peter Ujfalusi

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