ASoC: cs35l41: Fix use of an uninitialised variable
Subsystems (3)
PATCH 4/6 ASoC: cs35l41: Don't overwrite returned error code
In reply to Charles KeepaxIn multiple places the driver overwrites the error code returned with a static error code, this is not helpful for debugging. Update to pass the error codes straight through.
--- sound/soc/codecs/cs35l41.c | 8 -------- 1 file changed, 8 deletions(-)
sound/soc/codecs/cs35l41.c +0 -8
@@ -317,7 +317,6 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_read (cs35l41->regmap,CS35L41_OTPID , &otp_id_reg);if (ret <0 ) {dev_err (cs35l41->dev,"Read OTP ID failed\n" ); - ret = -EINVAL ; goto err_otp_unpack; }
@@ -337,7 +336,6 @@ static int cs35l41_otp_unpack(void *data) CS35L41_OTP_SIZE_WORDS);if (ret <0 ) {dev_err (cs35l41->dev,"Read OTP Mem failed\n" ); - ret = -EINVAL ; goto err_otp_unpack; }
@@ -352,13 +350,11 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x00000055 );if (ret <0 ) {dev_err (cs35l41->dev,"Write Unlock key failed 1/2\n" ); - ret = -EINVAL ; goto err_otp_unpack; } ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x000000AA );if (ret <0 ) {dev_err (cs35l41->dev,"Write Unlock key failed 2/2\n" ); - ret = -EINVAL ; goto err_otp_unpack; }
@@ -398,7 +394,6 @@ static int cs35l41_otp_unpack(void *data) otp_val << otp_map[i].shift);if (ret <0 ) {dev_err (cs35l41->dev,"Write OTP val failed\n" ); - ret = -EINVAL ; goto err_otp_unpack; } }
@@ -407,13 +402,11 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x000000CC );if (ret <0 ) {dev_err (cs35l41->dev,"Write Lock key failed 1/2\n" ); - ret = -EINVAL ; goto err_otp_unpack; } ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x00000033 );if (ret <0 ) {dev_err (cs35l41->dev,"Write Lock key failed 2/2\n" ); - ret = -EINVAL ; goto err_otp_unpack; } ret =0 ;
@@ -1413,7 +1406,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,/* CS35L41 needs INT for PDN_DONE */ if (ret !=0 ) {dev_err (cs35l41->dev,"Failed to request IRQ: %d\n" , ret); - ret = -ENODEV ; goto err; }
Signature · 1 line
2.11.0
PATCH 3/6 ASoC: cs35l41: Combine adjacent register writes
In reply to Charles Keepaxcs35l41 is often connected over I2C which is a very slow bus, as such timings can be greatly improved combining writes where acceptable. Update several points where the driver does multiple register writes when a single one would suffice.
--- sound/soc/codecs/cs35l41.c | 146 +++++++++++++++------------------------------ sound/soc/codecs/cs35l41.h | 1 + 2 files changed, 49 insertions(+), 98 deletions(-)
sound/soc/codecs/cs35l41.c +48 -98
@@ -712,24 +712,29 @@ static int cs35l41_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_num, {struct cs35l41_private *cs35l41 =snd_soc_component_get_drvdata (dai->component); +unsigned int val, mask;int i;if (tx_num >4 || rx_num >2 )return -EINVAL ; + val =0 ; + mask =0 ;for (i =0 ; i < rx_num; i++) { -dev_dbg (cs35l41->dev,"%s: rx slot %d position = %d\n" , - __func__, i, rx_slot[i]); -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FRAME_RX_SLOT , -0x3F << (i *8 ), rx_slot[i] << (i *8 )); +dev_dbg (cs35l41->dev,"rx slot %d position = %d\n" , i, rx_slot[i]); + val |= rx_slot[i] << (i *8 ); + mask |=0x3F << (i *8 ); } +regmap_update_bits (cs35l41->regmap,CS35L41_SP_FRAME_RX_SLOT , mask, val); + val =0 ; + mask =0 ;for (i =0 ; i < tx_num; i++) { -dev_dbg (cs35l41->dev,"%s: tx slot %d position = %d\n" , - __func__, i, tx_slot[i]); -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FRAME_TX_SLOT , -0x3F << (i *8 ), tx_slot[i] << (i *8 )); +dev_dbg (cs35l41->dev,"tx slot %d position = %d\n" , i, tx_slot[i]); + val |= tx_slot[i] << (i *8 ); + mask |=0x3F << (i *8 ); } +regmap_update_bits (cs35l41->regmap,CS35L41_SP_FRAME_TX_SLOT , mask, val);return 0 ; }
@@ -738,14 +743,13 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) {struct cs35l41_private *cs35l41 =snd_soc_component_get_drvdata (codec_dai->component); -unsigned int asp_fmt, lrclk_fmt, sclk_fmt, clock_provider; +unsigned int daifmt =0 ;switch (fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK ) {case SND_SOC_DAIFMT_CBP_CFP : - clock_provider =1 ; + daifmt |=CS35L41_SCLK_MSTR_MASK |CS35L41_LRCLK_MSTR_MASK ;break ;case SND_SOC_DAIFMT_CBC_CFC : - clock_provider =0 ;break ;default : dev_warn(cs35l41->dev,
@@ -754,19 +758,11 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)return -EINVAL ; } -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FORMAT , -CS35L41_SCLK_MSTR_MASK , - clock_provider <<CS35L41_SCLK_MSTR_SHIFT ); -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FORMAT , -CS35L41_LRCLK_MSTR_MASK , - clock_provider <<CS35L41_LRCLK_MSTR_SHIFT ); -switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_DSP_A : - asp_fmt =0 ;break ;case SND_SOC_DAIFMT_I2S : - asp_fmt =2 ; + daifmt |=2 <<CS35L41_ASP_FMT_SHIFT ;break ;default : dev_warn(cs35l41->dev,
@@ -774,26 +770,17 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)return -EINVAL ; } -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FORMAT , -CS35L41_ASP_FMT_MASK , - asp_fmt <<CS35L41_ASP_FMT_SHIFT ); -switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_NB_IF : - lrclk_fmt =1 ; - sclk_fmt =0 ; + daifmt |=CS35L41_LRCLK_INV_MASK ;break ;case SND_SOC_DAIFMT_IB_NF : - lrclk_fmt =0 ; - sclk_fmt =1 ; + daifmt |=CS35L41_SCLK_INV_MASK ;break ;case SND_SOC_DAIFMT_IB_IF : - lrclk_fmt =1 ; - sclk_fmt =1 ; + daifmt |=CS35L41_LRCLK_INV_MASK |CS35L41_SCLK_INV_MASK ;break ;case SND_SOC_DAIFMT_NB_NF : - lrclk_fmt =0 ; - sclk_fmt =0 ;break ;default : dev_warn(cs35l41->dev,
@@ -801,14 +788,10 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)return -EINVAL ; } -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FORMAT , -CS35L41_LRCLK_INV_MASK , - lrclk_fmt <<CS35L41_LRCLK_INV_SHIFT ); -regmap_update_bits (cs35l41->regmap,CS35L41_SP_FORMAT , -CS35L41_SCLK_INV_MASK , - sclk_fmt <<CS35L41_SCLK_INV_SHIFT ); - -return 0 ; +return regmap_update_bits (cs35l41->regmap,CS35L41_SP_FORMAT , +CS35L41_SCLK_MSTR_MASK |CS35L41_LRCLK_MSTR_MASK | +CS35L41_ASP_FMT_MASK |CS35L41_LRCLK_INV_MASK | +CS35L41_SCLK_INV_MASK , daifmt); }struct cs35l41_global_fs_config {
@@ -1041,37 +1024,23 @@ static int cs35l41_boost_config(struct cs35l41_private *cs35l41, } ret =regmap_update_bits (regmap,CS35L41_BSTCVRT_COEFF , -CS35L41_BST_K1_MASK , - cs35l41_bst_k1_table[bst_lbst_val][bst_cbst_range] - <<CS35L41_BST_K1_SHIFT ); -if (ret) { -dev_err (dev,"Failed to write boost K1 coefficient\n" ); -return ret; - } - - ret =regmap_update_bits (regmap,CS35L41_BSTCVRT_COEFF , -CS35L41_BST_K2_MASK , - cs35l41_bst_k2_table[bst_lbst_val][bst_cbst_range] - <<CS35L41_BST_K2_SHIFT ); -if (ret) { -dev_err (dev,"Failed to write boost K2 coefficient\n" ); -return ret; - } - - ret =regmap_update_bits (regmap,CS35L41_BSTCVRT_SLOPE_LBST , -CS35L41_BST_SLOPE_MASK , - cs35l41_bst_slope_table[bst_lbst_val] - <<CS35L41_BST_SLOPE_SHIFT ); +CS35L41_BST_K1_MASK |CS35L41_BST_K2_MASK , + cs35l41_bst_k1_table[bst_lbst_val][bst_cbst_range] + <<CS35L41_BST_K1_SHIFT | + cs35l41_bst_k2_table[bst_lbst_val][bst_cbst_range] + <<CS35L41_BST_K2_SHIFT );if (ret) { -dev_err (dev,"Failed to write boost slope coefficient\n" ); +dev_err (dev,"Failed to write boost coefficients: %d\n" , ret);return ret; } ret =regmap_update_bits (regmap,CS35L41_BSTCVRT_SLOPE_LBST , -CS35L41_BST_LBST_VAL_MASK , - bst_lbst_val <<CS35L41_BST_LBST_VAL_SHIFT ); +CS35L41_BST_SLOPE_MASK |CS35L41_BST_LBST_VAL_MASK , + cs35l41_bst_slope_table[bst_lbst_val] + <<CS35L41_BST_SLOPE_SHIFT | + bst_lbst_val <<CS35L41_BST_LBST_VAL_SHIFT );if (ret) { -dev_err (dev,"Failed to write boost inductor value\n" ); +dev_err (dev,"Failed to write boost slope/inductor value: %d\n" , ret);return ret; }
@@ -1129,39 +1098,20 @@ static int cs35l41_irq_gpio_config(struct cs35l41_private *cs35l41)struct cs35l41_irq_cfg *irq_gpio_cfg2 = &cs35l41->pdata.irq_config2;int irq_pol =IRQF_TRIGGER_NONE ; -if (irq_gpio_cfg1->irq_pol_inv) -regmap_update_bits (cs35l41->regmap, -CS35L41_GPIO1_CTRL1 , -CS35L41_GPIO_POL_MASK , -CS35L41_GPIO_POL_MASK ); -if (irq_gpio_cfg1->irq_out_en) -regmap_update_bits (cs35l41->regmap, -CS35L41_GPIO1_CTRL1 , -CS35L41_GPIO_DIR_MASK , -0 ); -if (irq_gpio_cfg1->irq_src_sel) -regmap_update_bits (cs35l41->regmap, -CS35L41_GPIO_PAD_CONTROL , -CS35L41_GPIO1_CTRL_MASK , - irq_gpio_cfg1->irq_src_sel << -CS35L41_GPIO1_CTRL_SHIFT ); - -if (irq_gpio_cfg2->irq_pol_inv) -regmap_update_bits (cs35l41->regmap, -CS35L41_GPIO2_CTRL1 , -CS35L41_GPIO_POL_MASK , -CS35L41_GPIO_POL_MASK ); -if (irq_gpio_cfg2->irq_out_en) -regmap_update_bits (cs35l41->regmap, -CS35L41_GPIO2_CTRL1 , -CS35L41_GPIO_DIR_MASK , -0 ); -if (irq_gpio_cfg2->irq_src_sel) -regmap_update_bits (cs35l41->regmap, -CS35L41_GPIO_PAD_CONTROL , -CS35L41_GPIO2_CTRL_MASK , - irq_gpio_cfg2->irq_src_sel << -CS35L41_GPIO2_CTRL_SHIFT ); +regmap_update_bits (cs35l41->regmap,CS35L41_GPIO1_CTRL1 , +CS35L41_GPIO_POL_MASK |CS35L41_GPIO_DIR_MASK , + irq_gpio_cfg1->irq_pol_inv <<CS35L41_GPIO_POL_SHIFT | + !irq_gpio_cfg1->irq_out_en <<CS35L41_GPIO_DIR_SHIFT ); + +regmap_update_bits (cs35l41->regmap,CS35L41_GPIO2_CTRL1 , +CS35L41_GPIO_POL_MASK |CS35L41_GPIO_DIR_MASK , + irq_gpio_cfg1->irq_pol_inv <<CS35L41_GPIO_POL_SHIFT | + !irq_gpio_cfg1->irq_out_en <<CS35L41_GPIO_DIR_SHIFT ); + +regmap_update_bits (cs35l41->regmap,CS35L41_GPIO_PAD_CONTROL , +CS35L41_GPIO1_CTRL_MASK |CS35L41_GPIO2_CTRL_MASK , + irq_gpio_cfg1->irq_src_sel <<CS35L41_GPIO1_CTRL_SHIFT | + irq_gpio_cfg2->irq_src_sel <<CS35L41_GPIO2_CTRL_SHIFT ); if ((irq_gpio_cfg2->irq_src_sel == (CS35L41_GPIO_CTRL_ACTV_LO | CS35L41_VALID_PDATA)) ||
sound/soc/codecs/cs35l41.h +1 -0
@@ -697,6 +697,7 @@#define CS35L41_INT1_UNMASK_PDN 0xFF7FFFFF#define CS35L41_GPIO_DIR_MASK 0x80000000 +#define CS35L41_GPIO_DIR_SHIFT 31#define CS35L41_GPIO1_CTRL_MASK 0x00030000#define CS35L41_GPIO1_CTRL_SHIFT 16#define CS35L41_GPIO2_CTRL_MASK 0x07000000
Signature · 1 line
2.11.0
PATCH 1/6 ASoC: cs35l41: Fix use of an uninitialised variable
The loop checking PDN_DONE doesn't check the return value from regmap_read, nor does it initialise val. This means if regmap_read fails val will be checked for the PDN_DONE bit whilst being uninitialised.
Fix this up by switching to regmap_read_poll_timeout which tidies up the code and avoids the uninitialised variable.
--- sound/soc/codecs/cs35l41.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
sound/soc/codecs/cs35l41.c +5 -14
@@ -580,7 +580,6 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,unsigned int val;int ret =0 ;bool pdn; -int i;switch (event) {case SND_SOC_DAPM_POST_PMU :
@@ -599,19 +598,11 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w, CS35L41_GLOBAL_EN_MASK, 0); pdn = false; -for (i =0 ; i <100 ; i++) { -regmap_read (cs35l41->regmap, -CS35L41_IRQ1_STATUS1 , - &val); -if (val &CS35L41_PDN_DONE_MASK ) { - pdn = true; -break ; - } -usleep_range (1000 ,1100 ); - } - -if (!pdn) -dev_warn (cs35l41->dev,"PDN failed\n" ); + ret =regmap_read_poll_timeout (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , + val, val &CS35L41_PDN_DONE_MASK , +1000 ,100000 ); +if (ret) +dev_warn (cs35l41->dev,"PDN failed: %d\n" , ret);regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 ,CS35L41_PDN_DONE_MASK );
Signature · 1 line
2.11.0
PATCH 2/6 ASoC: cs35l41: Use regmap_read_poll_timeout to wait for OTP boot
Just clean up the code a little by using the helper rather than open coding waiting for OTP_BOOT_DONE.
--- sound/soc/codecs/cs35l41.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
sound/soc/codecs/cs35l41.c +8 -13
@@ -1323,7 +1323,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, {u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match;int irq_pol =0 ; -int timeout;int ret;if (pdata) {
@@ -1377,18 +1376,14 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,usleep_range (2000 ,2100 ); - timeout =100 ; -do { -if (timeout ==0 ) { -dev_err (cs35l41->dev, -"Timeout waiting for OTP_BOOT_DONE\n" ); - ret = -EBUSY ; - goto err; - } -usleep_range (1000 ,1100 ); -regmap_read (cs35l41->regmap,CS35L41_IRQ1_STATUS4 , &int_status); - timeout--; - }while (!(int_status &CS35L41_OTP_BOOT_DONE )); + ret =regmap_read_poll_timeout (cs35l41->regmap,CS35L41_IRQ1_STATUS4 , + int_status, int_status &CS35L41_OTP_BOOT_DONE , +1000 ,100000 ); +if (ret) { +dev_err (cs35l41->dev, +"Failed waiting for OTP_BOOT_DONE: %d\n" , ret); + goto err; + }regmap_read (cs35l41->regmap,CS35L41_IRQ1_STATUS3 , &int_status);if (int_status &CS35L41_OTP_BOOT_ERR ) {
Signature · 1 line
2.11.0
PATCH 5/6 ASoC: cs35l41: Fixup the error messages
In reply to Charles KeepaxIt is not idiomatic for ASoC to print the function name in the error messages, however it is expected to show the return code. Update the error messages to follow these conventions.
--- sound/soc/codecs/cs35l41.c | 53 +++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 29 deletions(-)
sound/soc/codecs/cs35l41.c +24 -29
@@ -316,7 +316,7 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_read (cs35l41->regmap,CS35L41_OTPID , &otp_id_reg);if (ret <0 ) { -dev_err (cs35l41->dev,"Read OTP ID failed\n" ); +dev_err (cs35l41->dev,"Read OTP ID failed: %d\n" , ret); goto err_otp_unpack; }
@@ -335,7 +335,7 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_bulk_read (cs35l41->regmap,CS35L41_OTP_MEM0 , otp_mem,CS35L41_OTP_SIZE_WORDS );if (ret <0 ) { -dev_err (cs35l41->dev,"Read OTP Mem failed\n" ); +dev_err (cs35l41->dev,"Read OTP Mem failed: %d\n" , ret); goto err_otp_unpack; }
@@ -349,12 +349,12 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x00000055 );if (ret <0 ) { -dev_err (cs35l41->dev,"Write Unlock key failed 1/2\n" ); +dev_err (cs35l41->dev,"Write Unlock key failed 1/2: %d\n" , ret); goto err_otp_unpack; } ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x000000AA );if (ret <0 ) { -dev_err (cs35l41->dev,"Write Unlock key failed 2/2\n" ); +dev_err (cs35l41->dev,"Write Unlock key failed 2/2: %d\n" , ret); goto err_otp_unpack; }
@@ -393,7 +393,7 @@ static int cs35l41_otp_unpack(void *data) otp_map[i].shift), otp_val << otp_map[i].shift);if (ret <0 ) { -dev_err (cs35l41->dev,"Write OTP val failed\n" ); +dev_err (cs35l41->dev,"Write OTP val failed: %d\n" , ret); goto err_otp_unpack; } }
@@ -401,12 +401,12 @@ static int cs35l41_otp_unpack(void *data) ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x000000CC );if (ret <0 ) { -dev_err (cs35l41->dev,"Write Lock key failed 1/2\n" ); +dev_err (cs35l41->dev,"Write Lock key failed 1/2: %d\n" , ret); goto err_otp_unpack; } ret =regmap_write (cs35l41->regmap,CS35L41_TEST_KEY_CTL ,0x00000033 );if (ret <0 ) { -dev_err (cs35l41->dev,"Write Lock key failed 2/2\n" ); +dev_err (cs35l41->dev,"Write Lock key failed 2/2: %d\n" , ret); goto err_otp_unpack; } ret =0 ;
@@ -745,9 +745,7 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)case SND_SOC_DAIFMT_CBC_CFC :break ;default : -dev_warn (cs35l41->dev, -"%s: Mixed provider/consumer mode unsupported\n" , - __func__); +dev_warn (cs35l41->dev,"Mixed provider/consumer mode unsupported\n" );return -EINVAL ; }
@@ -758,8 +756,7 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) daifmt |=2 <<CS35L41_ASP_FMT_SHIFT ;break ;default : -dev_warn (cs35l41->dev, -"%s: Invalid or unsupported DAI format\n" , __func__); +dev_warn (cs35l41->dev,"Invalid or unsupported DAI format\n" );return -EINVAL ; }
@@ -776,8 +773,7 @@ static int cs35l41_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)case SND_SOC_DAIFMT_NB_NF :break ;default : -dev_warn (cs35l41->dev, -"%s: Invalid DAI clock INV\n" , __func__); +dev_warn (cs35l41->dev,"Invalid DAI clock INV\n" );return -EINVAL ; }
@@ -824,8 +820,7 @@ static int cs35l41_pcm_hw_params(struct snd_pcm_substream *substream, }if (i >=ARRAY_SIZE (cs35l41_fs_rates)) { -dev_err (cs35l41->dev,"%s: Unsupported rate: %u\n" , - __func__, rate); +dev_err (cs35l41->dev,"Unsupported rate: %u\n" , rate);return -EINVAL ; }
@@ -1048,7 +1043,7 @@ static int cs35l41_boost_config(struct cs35l41_private *cs35l41,CS35L41_BST_IPK_MASK , bst_ipk_scaled << CS35L41_BST_IPK_SHIFT);if (ret) { -dev_err (dev,"Failed to write boost inductor peak current\n" ); +dev_err (dev,"Failed to write boost inductor peak current: %d\n" , ret);return ret; }
@@ -1067,7 +1062,7 @@ static int cs35l41_set_pdata(struct cs35l41_private *cs35l41) cs35l41->pdata.bst_cap, cs35l41->pdata.bst_ipk);if (ret) { -dev_err (cs35l41->dev,"Error in Boost DT config\n" ); +dev_err (cs35l41->dev,"Error in Boost DT config: %d\n" , ret);return ret; } }else {
@@ -1337,13 +1332,13 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ret =regmap_read (cs35l41->regmap,CS35L41_DEVID , ®id);if (ret <0 ) { -dev_err (cs35l41->dev,"Get Device ID failed\n" ); +dev_err (cs35l41->dev,"Get Device ID failed: %d\n" , ret); goto err; } ret =regmap_read (cs35l41->regmap,CS35L41_REVID , ®_revid);if (ret <0 ) { -dev_err (cs35l41->dev,"Get Revision ID failed\n" ); +dev_err (cs35l41->dev,"Get Revision ID failed: %d\n" , ret); goto err; }
@@ -1367,7 +1362,7 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ARRAY_SIZE(cs35l41_reva0_errata_patch));if (ret <0 ) {dev_err (cs35l41->dev, -"Failed to apply A0 errata patch %d\n" , ret); +"Failed to apply A0 errata patch: %d\n" , ret); goto err; }break ;
@@ -1377,7 +1372,7 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ARRAY_SIZE(cs35l41_revb0_errata_patch));if (ret <0 ) {dev_err (cs35l41->dev, -"Failed to apply B0 errata patch %d\n" , ret); +"Failed to apply B0 errata patch: %d\n" , ret); goto err; }break ;
@@ -1387,7 +1382,7 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ARRAY_SIZE(cs35l41_revb2_errata_patch));if (ret <0 ) {dev_err (cs35l41->dev, -"Failed to apply B2 errata patch %d\n" , ret); +"Failed to apply B2 errata patch: %d\n" , ret); goto err; }break ;
@@ -1411,33 +1406,33 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ret =cs35l41_otp_unpack (cs35l41);if (ret <0 ) { -dev_err (cs35l41->dev,"OTP Unpack failed\n" ); +dev_err (cs35l41->dev,"OTP Unpack failed: %d\n" , ret); goto err; } ret =regmap_write (cs35l41->regmap,CS35L41_DSP1_CCM_CORE_CTRL ,0 );if (ret <0 ) { -dev_err (cs35l41->dev,"Write CCM_CORE_CTRL failed\n" ); +dev_err (cs35l41->dev,"Write CCM_CORE_CTRL failed: %d\n" , ret); goto err; } ret =regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 ,CS35L41_AMP_EN_MASK ,0 );if (ret <0 ) { -dev_err (cs35l41->dev,"Write CS35L41_PWR_CTRL2 failed\n" ); +dev_err (cs35l41->dev,"Write CS35L41_PWR_CTRL2 failed: %d\n" , ret); goto err; } ret =regmap_update_bits (cs35l41->regmap,CS35L41_AMP_GAIN_CTRL ,CS35L41_AMP_GAIN_PCM_MASK ,0 );if (ret <0 ) { -dev_err (cs35l41->dev,"Write CS35L41_AMP_GAIN_CTRL failed\n" ); +dev_err (cs35l41->dev,"Write CS35L41_AMP_GAIN_CTRL failed: %d\n" , ret); goto err; } ret =cs35l41_set_pdata (cs35l41);if (ret <0 ) { -dev_err (cs35l41->dev,"%s: Set pdata failed\n" , __func__); +dev_err (cs35l41->dev,"Set pdata failed: %d\n" , ret); goto err; }
@@ -1445,7 +1440,7 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, &soc_component_dev_cs35l41, cs35l41_dai, ARRAY_SIZE(cs35l41_dai));if (ret <0 ) { -dev_err (cs35l41->dev,"%s: Register codec failed\n" , __func__); +dev_err (cs35l41->dev,"Register codec failed: %d\n" , ret); goto err; }
Signature · 1 line
2.11.0
PATCH 6/6 ASoC: cs35l41: Fix a bunch of trivial code formating/style issues
In reply to Charles Keepax--- sound/soc/codecs/cs35l41-i2c.c | 5 +- sound/soc/codecs/cs35l41-spi.c | 13 +- sound/soc/codecs/cs35l41-tables.c | 477 +++++++++++++++++++------------------- sound/soc/codecs/cs35l41.c | 387 +++++++++++++++---------------- sound/soc/codecs/cs35l41.h | 81 ++++--- 5 files changed, 467 insertions(+), 496 deletions(-)
sound/soc/codecs/cs35l41-i2c.c +2 -3
@@ -44,7 +44,7 @@ static const struct i2c_device_id cs35l41_id_i2c[] = {MODULE_DEVICE_TABLE (i2c, cs35l41_id_i2c);static int cs35l41_i2c_probe (struct i2c_client *client, -const struct i2c_device_id *id) +const struct i2c_device_id *id) {struct cs35l41_private *cs35l41;struct device *dev = &client->dev;
@@ -64,8 +64,7 @@ static int cs35l41_i2c_probe(struct i2c_client *client, cs35l41->regmap =devm_regmap_init_i2c (client, regmap_config);if (IS_ERR (cs35l41->regmap)) { ret =PTR_ERR (cs35l41->regmap); -dev_err (cs35l41->dev,"Failed to allocate register map: %d\n" , - ret); +dev_err (cs35l41->dev,"Failed to allocate register map: %d\n" , ret);return ret; }
sound/soc/codecs/cs35l41-spi.c +4 -9
@@ -43,7 +43,7 @@ static const struct spi_device_id cs35l41_id_spi[] = {MODULE_DEVICE_TABLE (spi, cs35l41_id_spi);static void cs35l41_spi_otp_setup (struct cs35l41_private *cs35l41, -bool is_pre_setup,unsigned int *freq) +bool is_pre_setup,unsigned int *freq) {struct spi_device *spi;u32 orig_spi_freq;
@@ -73,24 +73,19 @@ static void cs35l41_spi_otp_setup(struct cs35l41_private *cs35l41,static int cs35l41_spi_probe (struct spi_device *spi) {const struct regmap_config *regmap_config = &cs35l41_regmap_spi; -struct cs35l41_platform_data *pdata = -dev_get_platdata (&spi->dev); +struct cs35l41_platform_data *pdata =dev_get_platdata (&spi->dev);struct cs35l41_private *cs35l41;int ret; - cs35l41 =devm_kzalloc (&spi->dev, -sizeof (struct cs35l41_private ), -GFP_KERNEL ); + cs35l41 =devm_kzalloc (&spi->dev,sizeof (struct cs35l41_private ),GFP_KERNEL );if (!cs35l41)return -ENOMEM ; -spi_set_drvdata (spi, cs35l41); cs35l41->regmap =devm_regmap_init_spi (spi, regmap_config);if (IS_ERR (cs35l41->regmap)) { ret =PTR_ERR (cs35l41->regmap); -dev_err (&spi->dev,"Failed to allocate register map: %d\n" , - ret); +dev_err (&spi->dev,"Failed to allocate register map: %d\n" , ret);return ret; }
sound/soc/codecs/cs35l41-tables.c +237 -240
495 lines not on this page · raw message
sound/soc/codecs/cs35l41.c +184 -203
806 lines not on this page · raw message
sound/soc/codecs/cs35l41.h +40 -41
114 lines not on this page · raw message
Signature · 1 line
2.11.0
Mark Brown
maintainerRe: [PATCH 6/6] ASoC: cs35l41: Fix a bunch of trivial code formating/style issues
Quoted 7 lines · Charles Keepax
Signed-off-by Charles Keepax <[email protected]>--- sound/soc/codecs/cs35l41-i2c.c | 5 +- sound/soc/codecs/cs35l41-spi.c | 13 +- sound/soc/codecs/cs35l41-tables.c | 477 +++++++++++++++++++------------------- sound/soc/codecs/cs35l41.c | 387 +++++++++++++++---------------- sound/soc/codecs/cs35l41.h | 81 ++++---
This was upstreamed with your review a week ago :/
Re: [PATCH 6/6] ASoC: cs35l41: Fix a bunch of trivial code formating/style issues
Quoted 10 lines · Mark Brown
Quoted 7 lines · Charles Keepax
Signed-off-by Charles Keepax <[email protected]>--- sound/soc/codecs/cs35l41-i2c.c | 5 +- sound/soc/codecs/cs35l41-spi.c | 13 +- sound/soc/codecs/cs35l41-tables.c | 477 +++++++++++++++++++------------------- sound/soc/codecs/cs35l41.c | 387 +++++++++++++++---------------- sound/soc/codecs/cs35l41.h | 81 ++++---This was upstreamed with your review a week ago :/
Yeah sorry about that, they are all trivial patches (with the exception of the first patch which I did only notice whilst fixing up the other stuff) it didn't seem worth delaying the series for another couple of rounds for such trivial commments.
Apologies if that was the wrong call.
Thanks,
Charles
Mark Brown
maintainerRe: [PATCH 6/6] ASoC: cs35l41: Fix a bunch of trivial code formating/style issues
Quoted 10 lines · Charles Keepax
Quoted 8 lines · Mark Brown
Quoted 7 lines · Charles Keepax
Signed-off-by Charles Keepax <[email protected]>sound/soc/codecs/cs35l41-i2c.c | 5 +- sound/soc/codecs/cs35l41-spi.c | 13 +- sound/soc/codecs/cs35l41-tables.c | 477 +++++++++++++++++++------------------- sound/soc/codecs/cs35l41.c | 387 +++++++++++++++---------------- sound/soc/codecs/cs35l41.h | 81 ++++---
Quoted 8 lines
Quoted 1 line
This was upstreamed with your review a week ago :/
Yeah sorry about that, they are all trivial patches (with the exception of the first patch which I did only notice whilst fixing up the other stuff) it didn't seem worth delaying the series for another couple of rounds for such trivial commments.
Apologies if that was the wrong call.
These are pretty large changes, it's not just a couple of small cleanups
- especially this one is pretty huge. Also note that Rob found a bunch of errors in the DT binding that need fixing.
Mark Brown
maintainerQuoted 8 lines · Charles Keepax
The loop checking
PDN_DONEdoesn't check the return value fromregmap_read, nor does it initialise val. This means ifregmap_readfails val will be checked for thePDN_DONEbit whilst being uninitialised.Fix this up by switching to
regmap_read_poll_timeoutwhich tidies up the code and avoids the uninitialised variable.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: cs35l41: Fix use of an uninitialised variable
commit: c2f14cc2bcdd532f8a18450407ffc27bbbff2319
[2/6] ASoC: cs35l41: Use regmap_read_poll_timeout to wait for OTP boot
commit: 3a2eb0b4b02060340af10a1db3c452472471be2f
[3/6] ASoC: cs35l41: Combine adjacent register writes
commit: fe1024d50477becf35128f3ef03bf3525a2cd140
[4/6] ASoC: cs35l41: Don't overwrite returned error code
commit: e371eadf2a93a653211331b66beaac3b1bcbc931
[5/6] ASoC: cs35l41: Fixup the error messages
commit: 3e60abeb5cb51bccc8bcc6808eef2037ab412334
[6/6] ASoC: cs35l41: Fix a bunch of trivial code formating/style issues
commit: 4295c8cc17481e0d7d4c3a404eaf87dc8dfc26beAll being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark