Skip to contentSkip to conversation

ASoC: max98090: Remove unneeded version.h header include

PATCH Applied Sachin Kamat 2 participants 11 messages Feb 18, 2013 – Feb 25, 2013

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

PATCH 1/5 ASoC: max98090: Remove unneeded version.h header include

version.h header file inclusion is not required as detected by versioncheck.

---
All patches in this series are build tested and based on for-next branch of
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git tree.

---
 sound/soc/codecs/max98090.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
sound/soc/codecs/max98090.c +0 -2
index fc17604..9ea73aa 100755
@@ -23,8 +23,6 @@
 #include <sound/max98090.h>
 #include "max98090.h"
 
-#include <linux/version.h>
-
 #define DEBUG
 #define EXTMIC_METHOD
 #define EXTMIC_METHOD_TEST
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/5 ASoC: max98090: Convert to devm_regmap_init_i2c()

devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler.

---
 sound/soc/codecs/max98090.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
sound/soc/codecs/max98090.c +1 -6
index 9ea73aa..fef370e 100755
@@ -2322,7 +2322,7 @@ static int max98090_i2c_probe(struct i2c_client *i2c,
 	max98090->pdata = i2c->dev.platform_data;
 	max98090->irq = i2c->irq;
 
-	max98090->regmap = regmap_init_i2c(i2c, &max98090_regmap);
+	max98090->regmap = devm_regmap_init_i2c(i2c, &max98090_regmap);
 	if (IS_ERR(max98090->regmap)) {
 		ret = PTR_ERR(max98090->regmap);
 		dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -2332,18 +2332,13 @@ static int max98090_i2c_probe(struct i2c_client *i2c,
 	ret = snd_soc_register_codec(&i2c->dev,
 			&soc_codec_dev_max98090, max98090_dai,
 			ARRAY_SIZE(max98090_dai));
-	if (ret < 0)
-		regmap_exit(max98090->regmap);
-
 err_enable:
 	return ret;
 }
 
 static int max98090_i2c_remove(struct i2c_client *client)
 {
-	struct max98090_priv *max98090 = dev_get_drvdata(&client->dev);
 	snd_soc_unregister_codec(&client->dev);
-	regmap_exit(max98090->regmap);
 	return 0;
 }
 
Signature · 1 line
1.7.4.1
Applied
#2 lore raw

Re: [PATCH 2/5] ASoC: max98090: Convert to devm_regmap_init_i2c()

Quoted 2 lines · Sachin Kamat

devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler.

Applied, thanks.

#3 lore raw

PATCH 3/5 ASoC: max98090: Make struct dev_pm_ops const

In reply to Sachin Kamat

Silences the following checkpatch warning:
WARNING: struct dev_pm_ops should normally be const.

---
 sound/soc/codecs/max98090.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/max98090.c +1 -1
index fef370e..1cf017f 100755
@@ -2362,7 +2362,7 @@ static int max98090_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static struct dev_pm_ops max98090_pm = {
+static const struct dev_pm_ops max98090_pm = {
 	SET_RUNTIME_PM_OPS(max98090_runtime_suspend,
 		max98090_runtime_resume, NULL)
 };
Signature · 1 line
1.7.4.1
Applied
#4 lore raw

Re: [PATCH 3/5] ASoC: max98090: Make struct dev_pm_ops const

Quoted 2 lines · Sachin Kamat

Silences the following checkpatch warning:
WARNING: struct dev_pm_ops should normally be const.

Applied, thanks.

#5 lore raw

PATCH 4/5 ASoC: max98090: Remove unnecessary braces

In reply to Sachin Kamat

Braces are not required for single line statements. Silences the following checkpatch warnings:
WARNING: braces {} are not necessary for single statement blocks.

---
 sound/soc/codecs/max98090.c |   28 ++++++++++------------------
 1 files changed, 10 insertions(+), 18 deletions(-)
sound/soc/codecs/max98090.c +10 -18
index 1cf017f..4e8f88e 100755
@@ -805,12 +805,11 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
 		val = (val & M98090_MIC_PA2EN_MASK) >> M98090_MIC_PA2EN_SHIFT;
 
 
-	if (val >= 1) {
-		if (w->reg == M98090_REG_MIC1_INPUT_LEVEL) {
+	if (val >= 1){
+		if (w->reg == M98090_REG_MIC1_INPUT_LEVEL)
 			max98090->pa1en = val - 1; /* Update for volatile */
-		} else {
+		else
 			max98090->pa2en = val - 1; /* Update for volatile */
-		}
 	}
 
 	switch (event) {
@@ -1701,9 +1700,8 @@ static int max98090_dai_set_fmt(struct snd_soc_dai *codec_dai,
 		 * seen for the case of TDM mode. The remaining cases have
 		 * normal logic.
 		 */
-		if (max98090->tdm_slots > 1) {
+		if (max98090->tdm_slots > 1)
 			regval ^= M98090_BCI_MASK;
-		}
 
 		snd_soc_write(codec,
 			M98090_REG_INTERFACE_FORMAT, regval);
@@ -1858,9 +1856,8 @@ static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
 
 	/* Check for supported PCLK to LRCLK ratios */
 	for (j = 0; j < ARRAY_SIZE(comp_pclk_rates); j++) {
-		if (comp_pclk_rates[j] == max98090->sysclk) {
+		if (comp_pclk_rates[j] == max98090->sysclk)
 			break;
-		}
 	}
 
 	for (i = 0; i < ARRAY_SIZE(comp_lrclk_rates) - 1; i++) {
@@ -2057,17 +2054,14 @@ static irqreturn_t max98090_interrupt(int irq, void *data)
 	if (!active)
 		return IRQ_NONE;
 
-	if (active & M98090_CLD_MASK) {
+	if (active & M98090_CLD_MASK)
 		dev_err(codec->dev, "M98090_CLD_MASK\n");
-	}
 
-	if (active & M98090_SLD_MASK) {
+	if (active & M98090_SLD_MASK)
 		dev_dbg(codec->dev, "M98090_SLD_MASK\n");
-	}
 
-	if (active & M98090_ULK_MASK) {
+	if (active & M98090_ULK_MASK)
 		dev_err(codec->dev, "M98090_ULK_MASK\n");
-	}
 
 	if (active & M98090_JDET_MASK) {
 		dev_dbg(codec->dev, "M98090_JDET_MASK\n");
@@ -2078,13 +2072,11 @@ static irqreturn_t max98090_interrupt(int irq, void *data)
 			msecs_to_jiffies(100));
 	}
 
-	if (active & M98090_DRCACT_MASK) {
+	if (active & M98090_DRCACT_MASK)
 		dev_dbg(codec->dev, "M98090_DRCACT_MASK\n");
-	}
 
-	if (active & M98090_DRCCLP_MASK) {
+	if (active & M98090_DRCCLP_MASK)
 		dev_err(codec->dev, "M98090_DRCCLP_MASK\n");
-	}
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
1.7.4.1
#6 lore raw

Re: [PATCH 4/5] ASoC: max98090: Remove unnecessary braces

sound/soc/codecs/max98090.c static int max98090_micinput_event(struct snd_soc_dapm_widget *w, · line 808

Quoted 3 lines · Sachin Kamat
sound/soc/codecs/max98090.c +1 -2
-	if (val >= 1) {
-		if (w->reg == M98090_REG_MIC1_INPUT_LEVEL) {
+	if (val >= 1){

Your coding style fixes shouldn't introduce new coding style issues and...

sound/soc/codecs/max98090.c static int max98090_micinput_event(struct snd_soc_dapm_widget *w, · line 809

Quoted 1 line
sound/soc/codecs/max98090.c +1 -0
+		if (w->reg == M98090_REG_MIC1_INPUT_LEVEL)

...in cases where you're nesting with other if statements it's often clearer to have the braces consistently over all levels of the conditional.

For the isolated if statements this is fine though.

#7 lore raw

Re: [PATCH 4/5] ASoC: max98090: Remove unnecessary braces

Quoted 7 lines · Mark Brown

sound/soc/codecs/max98090.c static int max98090_micinput_event(struct snd_soc_dapm_widget *w, · line 808

Quoted 3 lines · Sachin Kamat
sound/soc/codecs/max98090.c +1 -2
-     if (val >= 1) {
-             if (w->reg == M98090_REG_MIC1_INPUT_LEVEL) {
+     if (val >= 1){

Your coding style fixes shouldn't introduce new coding style issues

Sorry for the error on my part. I have fixed this in the updated version.

Quoted 7 lines

and...

Quoted 1 line

+ if (w->reg == M98090_REG_MIC1_INPUT_LEVEL)

...in cases where you're nesting with other if statements it's often clearer to have the braces consistently over all levels of the conditional.

Right. I have retained them in nested cases.

#8 lore raw

PATCH 5/5 ASoC: max98090: Fix checkpatch errors related to spacing

In reply to Sachin Kamat

Fixes the following type of checkpatch errors:
ERROR: "foo * bar" should be "foo *bar"
ERROR: space required before the open brace '{'

---
 sound/soc/codecs/max98090.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
sound/soc/codecs/max98090.c +9 -9
index 4e8f88e..baebe2e 100755
@@ -507,16 +507,16 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-static const char * max98090_perf_pwr_text[] =
+static const char *max98090_perf_pwr_text[] =
 	{ "High Performance", "Low Power" };
-static const char * max98090_pwr_perf_text[] =
+static const char *max98090_pwr_perf_text[] =
 	{ "Low Power", "High Performance" };
 
 static const struct soc_enum max98090_vcmbandgap_enum =
 	SOC_ENUM_SINGLE(M98090_REG_BIAS_CONTROL, M98090_VCM_MODE_SHIFT,
 		ARRAY_SIZE(max98090_pwr_perf_text), max98090_pwr_perf_text);
 
-static const char * max98090_osr128_text[] = { "64*fs", "128*fs" };
+static const char *max98090_osr128_text[] = { "64*fs", "128*fs" };
 
 static const struct soc_enum max98090_osr128_enum =
 	SOC_ENUM_SINGLE(M98090_REG_ADC_CONTROL, M98090_OSR128_SHIFT,
@@ -533,28 +533,28 @@ static const struct soc_enum max98090_filter_dmic34mode_enum =
 		M98090_FLT_DMIC34MODE_SHIFT,
 		ARRAY_SIZE(max98090_mode_text), max98090_mode_text);
 
-static const char * max98090_drcatk_text[] =
+static const char *max98090_drcatk_text[] =
 	{ "0.5ms", "1ms", "5ms", "10ms", "25ms", "50ms", "100ms", "200ms" };
 
 static const struct soc_enum max98090_drcatk_enum =
 	SOC_ENUM_SINGLE(M98090_REG_DRC_TIMING, M98090_DRCATK_SHIFT,
 		ARRAY_SIZE(max98090_drcatk_text), max98090_drcatk_text);
 
-static const char * max98090_drcrls_text[] =
+static const char *max98090_drcrls_text[] =
 	{ "8s", "4s", "2s", "1s", "0.5s", "0.25s", "0.125s", "0.0625s" };
 
 static const struct soc_enum max98090_drcrls_enum =
 	SOC_ENUM_SINGLE(M98090_REG_DRC_TIMING, M98090_DRCRLS_SHIFT,
 		ARRAY_SIZE(max98090_drcrls_text), max98090_drcrls_text);
 
-static const char * max98090_alccmp_text[] =
+static const char *max98090_alccmp_text[] =
 	{ "1:1", "1:1.5", "1:2", "1:4", "1:INF" };
 
 static const struct soc_enum max98090_alccmp_enum =
 	SOC_ENUM_SINGLE(M98090_REG_DRC_COMPRESSOR, M98090_DRCCMP_SHIFT,
 		ARRAY_SIZE(max98090_alccmp_text), max98090_alccmp_text);
 
-static const char * max98090_drcexp_text[] = { "1:1", "2:1", "3:1" };
+static const char *max98090_drcexp_text[] = { "1:1", "2:1", "3:1" };
 
 static const struct soc_enum max98090_drcexp_enum =
 	SOC_ENUM_SINGLE(M98090_REG_DRC_EXPANDER, M98090_DRCEXP_SHIFT,
@@ -805,7 +805,7 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
 		val = (val & M98090_MIC_PA2EN_MASK) >> M98090_MIC_PA2EN_SHIFT;
 
 
-	if (val >= 1){
+	if (val >= 1) {
 		if (w->reg == M98090_REG_MIC1_INPUT_LEVEL)
 			max98090->pa1en = val - 1; /* Update for volatile */
 		else
@@ -856,7 +856,7 @@ static const struct soc_enum mic2_mux_enum =
 static const struct snd_kcontrol_new max98090_mic2_mux =
 	SOC_DAPM_ENUM("MIC2 Mux", mic2_mux_enum);
 
-static const char * max98090_micpre_text[] = { "Off", "On" };
+static const char *max98090_micpre_text[] = { "Off", "On" };
 
 static const struct soc_enum max98090_pa1en_enum =
 	SOC_ENUM_SINGLE(M98090_REG_MIC1_INPUT_LEVEL, M98090_MIC_PA1EN_SHIFT,
Signature · 1 line
1.7.4.1
#9 lore raw

Re: [PATCH 5/5] ASoC: max98090: Fix checkpatch errors related to spacing

Quoted 3 lines · Sachin Kamat

Fixes the following type of checkpatch errors:
ERROR: "foo * bar" should be "foo *bar"
ERROR: space required before the open brace '{'

This doesn't apply, probably due to depending on patch 4.