* [PATCH 0/2] Baytrail/Cherrytrail audio fixes - take2 @ 2017-02-01 18:27 Pierre-Louis Bossart 2017-02-01 18:27 ` [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection Pierre-Louis Bossart 2017-02-01 18:27 ` [PATCH 2/2] ASoC: cht-bsw-rt5645: fix unused variable compiler warning Pierre-Louis Bossart 0 siblings, 2 replies; 7+ messages in thread From: Pierre-Louis Bossart @ 2017-02-01 18:27 UTC (permalink / raw) To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart Correction to previous series (applies on top for Mark's for-next) - better handling of missing gpiod, continue only on -ENOENT - compiler warning Pierre-Louis Bossart (2): ASoC: rt5645: fix error handling for gpio detection ASoC: cht-bsw-rt5645: fix unused variable compiler warning sound/soc/codecs/rt5645.c | 10 ++++++++-- sound/soc/intel/boards/cht_bsw_rt5645.c | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection 2017-02-01 18:27 [PATCH 0/2] Baytrail/Cherrytrail audio fixes - take2 Pierre-Louis Bossart @ 2017-02-01 18:27 ` Pierre-Louis Bossart 2017-02-02 2:40 ` Takashi Sakamoto 2017-02-02 11:06 ` Applied "ASoC: rt5645: fix error handling for gpio detection" to the asoc tree Mark Brown 2017-02-01 18:27 ` [PATCH 2/2] ASoC: cht-bsw-rt5645: fix unused variable compiler warning Pierre-Louis Bossart 1 sibling, 2 replies; 7+ messages in thread From: Pierre-Louis Bossart @ 2017-02-01 18:27 UTC (permalink / raw) To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart Optional gpio handling should not cause an error status and prevent probing if it's missing. Remove error return for -ENOENT case and move error message to dev_info Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- sound/soc/codecs/rt5645.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 65ac841..e149f3c 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3660,8 +3660,14 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, GPIOD_IN); if (IS_ERR(rt5645->gpiod_hp_det)) { - dev_err(&i2c->dev, "failed to initialize gpiod\n"); - return PTR_ERR(rt5645->gpiod_hp_det); + dev_info(&i2c->dev, "failed to initialize gpiod\n"); + ret = PTR_ERR(rt5645->gpiod_hp_det); + /* + * Continue if optional gpiod is missing, bail for all other + * errors, including -EPROBE_DEFER + */ + if (ret != -ENOENT) + return ret; } for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection 2017-02-01 18:27 ` [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection Pierre-Louis Bossart @ 2017-02-02 2:40 ` Takashi Sakamoto 2017-02-02 5:41 ` Pierre-Louis Bossart 2017-02-02 11:06 ` Applied "ASoC: rt5645: fix error handling for gpio detection" to the asoc tree Mark Brown 1 sibling, 1 reply; 7+ messages in thread From: Takashi Sakamoto @ 2017-02-02 2:40 UTC (permalink / raw) To: Pierre-Louis Bossart, alsa-devel; +Cc: tiwai, broonie Hi, On Feb 2 2017 03:27, Pierre-Louis Bossart wrote: > Optional gpio handling should not cause an error status and prevent > probing if it's missing. Remove error return for -ENOENT case and > move error message to dev_info > > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > --- > sound/soc/codecs/rt5645.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c > index 65ac841..e149f3c 100644 > --- a/sound/soc/codecs/rt5645.c > +++ b/sound/soc/codecs/rt5645.c > @@ -3660,8 +3660,14 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, > GPIOD_IN); > > if (IS_ERR(rt5645->gpiod_hp_det)) { > - dev_err(&i2c->dev, "failed to initialize gpiod\n"); > - return PTR_ERR(rt5645->gpiod_hp_det); > + dev_info(&i2c->dev, "failed to initialize gpiod\n"); > + ret = PTR_ERR(rt5645->gpiod_hp_det); > + /* > + * Continue if optional gpiod is missing, bail for all other > + * errors, including -EPROBE_DEFER > + */ > + if (ret != -ENOENT) > + return ret; > } > > for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) (sound/soc/codecs/rt5645.c) rt5645_i2c_probe() (drivers/gpio/devres.c) ->devm_gpiod_get_optional() ->devm_gpiod_get_index_optional() As long as seeing current implementation of 'devm_gpiod_get_index_optional()', this function never returns ENOENT. In this case, it returns NULL. https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/devres.c#n185 IS_ERR(NULL) is false, thus the additional condition is useless. When entering the branch, error code should be always returned. For your purpose, checking NULL at first, then handles the error properly, like: $ git diff diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 1ac96ef..a588454 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3656,10 +3656,15 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", GPIOD_IN); - - if (IS_ERR(rt5645->gpiod_hp_det)) { - dev_err(&i2c->dev, "failed to initialize gpiod\n"); - return PTR_ERR(rt5645->gpiod_hp_det); + if (rt5645->gpiod_hp_det && IS_ERR(rt5645->gpiod_hp_det)) { + dev_info(&i2c->dev, "failed to initialize gpiod\n"); + ret = PTR_ERR(rt5645->gpiod_hp_det); + /* + * Continue if optional gpiod is missing, bail for all other + * errors, including -EPROBE_DEFER. -ENOENT is never returns + * according to implementation of devm_gpiod_get_optional(). + */ + return ret; } for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) Regards Takashi Sakamoto ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection 2017-02-02 2:40 ` Takashi Sakamoto @ 2017-02-02 5:41 ` Pierre-Louis Bossart 0 siblings, 0 replies; 7+ messages in thread From: Pierre-Louis Bossart @ 2017-02-02 5:41 UTC (permalink / raw) To: Takashi Sakamoto, alsa-devel; +Cc: tiwai, broonie >> if (IS_ERR(rt5645->gpiod_hp_det)) { >> - dev_err(&i2c->dev, "failed to initialize gpiod\n"); >> - return PTR_ERR(rt5645->gpiod_hp_det); >> + dev_info(&i2c->dev, "failed to initialize gpiod\n"); >> + ret = PTR_ERR(rt5645->gpiod_hp_det); >> + /* >> + * Continue if optional gpiod is missing, bail for all other >> + * errors, including -EPROBE_DEFER >> + */ >> + if (ret != -ENOENT) >> + return ret; >> } >> >> for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) > > (sound/soc/codecs/rt5645.c) > rt5645_i2c_probe() > (drivers/gpio/devres.c) > ->devm_gpiod_get_optional() > ->devm_gpiod_get_index_optional() > > As long as seeing current implementation of > 'devm_gpiod_get_index_optional()', this function never returns ENOENT. > In this case, it returns NULL. > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/devres.c#n185 > Thanks for pointing this out, I didn't see it and naively thought that everyone followed the same conventions. Oh well. I'll respin a v2. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Applied "ASoC: rt5645: fix error handling for gpio detection" to the asoc tree 2017-02-01 18:27 ` [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection Pierre-Louis Bossart 2017-02-02 2:40 ` Takashi Sakamoto @ 2017-02-02 11:06 ` Mark Brown 1 sibling, 0 replies; 7+ messages in thread From: Mark Brown @ 2017-02-02 11:06 UTC (permalink / raw) To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie The patch ASoC: rt5645: fix error handling for gpio detection has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All 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 >From cec55827dde1e87f6b91e34f205744d70a7225bc Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Date: Wed, 1 Feb 2017 12:27:04 -0600 Subject: [PATCH] ASoC: rt5645: fix error handling for gpio detection Optional gpio handling should not cause an error status and prevent probing if it's missing. Remove error return for -ENOENT case and move error message to dev_info Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/codecs/rt5645.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 37fb2b6c34a5..e09fa19f44c0 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3658,8 +3658,14 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, GPIOD_IN); if (IS_ERR(rt5645->gpiod_hp_det)) { - dev_err(&i2c->dev, "failed to initialize gpiod\n"); - return PTR_ERR(rt5645->gpiod_hp_det); + dev_info(&i2c->dev, "failed to initialize gpiod\n"); + ret = PTR_ERR(rt5645->gpiod_hp_det); + /* + * Continue if optional gpiod is missing, bail for all other + * errors, including -EPROBE_DEFER + */ + if (ret != -ENOENT) + return ret; } for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) -- 2.11.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ASoC: cht-bsw-rt5645: fix unused variable compiler warning 2017-02-01 18:27 [PATCH 0/2] Baytrail/Cherrytrail audio fixes - take2 Pierre-Louis Bossart 2017-02-01 18:27 ` [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection Pierre-Louis Bossart @ 2017-02-01 18:27 ` Pierre-Louis Bossart 2017-02-02 11:06 ` Applied "ASoC: cht-bsw-rt5645: fix unused variable compiler warning" to the asoc tree Mark Brown 1 sibling, 1 reply; 7+ messages in thread From: Pierre-Louis Bossart @ 2017-02-01 18:27 UTC (permalink / raw) To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart Missed unused variable in previous changes, oops. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- sound/soc/intel/boards/cht_bsw_rt5645.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index b972b65..5bcde01 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -262,7 +262,6 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) int jack_type; struct snd_soc_codec *codec = runtime->codec; struct snd_soc_card *card = runtime->card; - struct snd_soc_dai *codec_dai = runtime->codec_dai; struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); if ((cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) || -- 2.7.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Applied "ASoC: cht-bsw-rt5645: fix unused variable compiler warning" to the asoc tree 2017-02-01 18:27 ` [PATCH 2/2] ASoC: cht-bsw-rt5645: fix unused variable compiler warning Pierre-Louis Bossart @ 2017-02-02 11:06 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2017-02-02 11:06 UTC (permalink / raw) To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie The patch ASoC: cht-bsw-rt5645: fix unused variable compiler warning has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All 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 >From 77e546b7ba3e39e8a739cb18489582044222b7ba Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Date: Wed, 1 Feb 2017 12:27:05 -0600 Subject: [PATCH] ASoC: cht-bsw-rt5645: fix unused variable compiler warning Missed unused variable in previous changes, oops. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/intel/boards/cht_bsw_rt5645.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index b972b6526176..5bcde01d15e6 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -262,7 +262,6 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) int jack_type; struct snd_soc_codec *codec = runtime->codec; struct snd_soc_card *card = runtime->card; - struct snd_soc_dai *codec_dai = runtime->codec_dai; struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); if ((cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) || -- 2.11.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-02 11:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-02-01 18:27 [PATCH 0/2] Baytrail/Cherrytrail audio fixes - take2 Pierre-Louis Bossart 2017-02-01 18:27 ` [PATCH 1/2] ASoC: rt5645: fix error handling for gpio detection Pierre-Louis Bossart 2017-02-02 2:40 ` Takashi Sakamoto 2017-02-02 5:41 ` Pierre-Louis Bossart 2017-02-02 11:06 ` Applied "ASoC: rt5645: fix error handling for gpio detection" to the asoc tree Mark Brown 2017-02-01 18:27 ` [PATCH 2/2] ASoC: cht-bsw-rt5645: fix unused variable compiler warning Pierre-Louis Bossart 2017-02-02 11:06 ` Applied "ASoC: cht-bsw-rt5645: fix unused variable compiler warning" to the asoc tree Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).