Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
Hi Mark, On 2018/6/1 0:02, Mark Brown wrote: > On Thu, May 31, 2018 at 08:25:39PM +0800, Yisheng Xie wrote: > >> Anyway, Here is the cover letter of v1 and I have add v2's cover letter to >> you: >> https://lkml.org/lkml/2018/5/21/303 > >> Each patch in this patchset is a separate one, for what this patchset want >> to do >> is use match_string() helper for echo subsystem. > > For something like this it's generally easier to not send everything as > one big series - it avoids any confusion about dependencies and there's > no actual relationship between the patches. Instead just sending each > subsystem as a series or perhaps even just a bunch of separate patches > should make things smoother. Thanks, will take this suggestion maybe next time. Thanks Yisheng >
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
Hi Mark, On 2018/6/1 0:02, Mark Brown wrote: > On Thu, May 31, 2018 at 08:25:39PM +0800, Yisheng Xie wrote: > >> Anyway, Here is the cover letter of v1 and I have add v2's cover letter to >> you: >> https://lkml.org/lkml/2018/5/21/303 > >> Each patch in this patchset is a separate one, for what this patchset want >> to do >> is use match_string() helper for echo subsystem. > > For something like this it's generally easier to not send everything as > one big series - it avoids any confusion about dependencies and there's > no actual relationship between the patches. Instead just sending each > subsystem as a series or perhaps even just a bunch of separate patches > should make things smoother. Thanks, will take this suggestion maybe next time. Thanks Yisheng >
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
On Thu, May 31, 2018 at 08:25:39PM +0800, Yisheng Xie wrote: > Anyway, Here is the cover letter of v1 and I have add v2's cover letter to > you: > https://lkml.org/lkml/2018/5/21/303 > Each patch in this patchset is a separate one, for what this patchset want to > do > is use match_string() helper for echo subsystem. For something like this it's generally easier to not send everything as one big series - it avoids any confusion about dependencies and there's no actual relationship between the patches. Instead just sending each subsystem as a series or perhaps even just a bunch of separate patches should make things smoother. signature.asc Description: PGP signature
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
On Thu, May 31, 2018 at 08:25:39PM +0800, Yisheng Xie wrote: > Anyway, Here is the cover letter of v1 and I have add v2's cover letter to > you: > https://lkml.org/lkml/2018/5/21/303 > Each patch in this patchset is a separate one, for what this patchset want to > do > is use match_string() helper for echo subsystem. For something like this it's generally easier to not send everything as one big series - it avoids any confusion about dependencies and there's no actual relationship between the patches. Instead just sending each subsystem as a series or perhaps even just a bunch of separate patches should make things smoother. signature.asc Description: PGP signature
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
Hi Mark, On 2018/5/31 19:49, Mark Brown wrote: > On Thu, May 31, 2018 at 07:11:21PM +0800, Yisheng Xie wrote: >> match_string() returns the index of an array for a matching string, >> which can be used instead of open coded variant. > > I don't have either the cover letter or the rest of the series here so > I've no context - what is the story here with regard to dependencies and > things? Sorry about that I should have sent cover letter to you, but for too many maintainer to sent, I ignore this to avoid make too much noisy. Anyway, Here is the cover letter of v1 and I have add v2's cover letter to you: https://lkml.org/lkml/2018/5/21/303 Each patch in this patchset is a separate one, for what this patchset want to do is use match_string() helper for echo subsystem. Thanks Yisheng >
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
Hi Mark, On 2018/5/31 19:49, Mark Brown wrote: > On Thu, May 31, 2018 at 07:11:21PM +0800, Yisheng Xie wrote: >> match_string() returns the index of an array for a matching string, >> which can be used instead of open coded variant. > > I don't have either the cover letter or the rest of the series here so > I've no context - what is the story here with regard to dependencies and > things? Sorry about that I should have sent cover letter to you, but for too many maintainer to sent, I ignore this to avoid make too much noisy. Anyway, Here is the cover letter of v1 and I have add v2's cover letter to you: https://lkml.org/lkml/2018/5/21/303 Each patch in this patchset is a separate one, for what this patchset want to do is use match_string() helper for echo subsystem. Thanks Yisheng >
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
On Thu, May 31, 2018 at 07:11:21PM +0800, Yisheng Xie wrote: > match_string() returns the index of an array for a matching string, > which can be used instead of open coded variant. I don't have either the cover letter or the rest of the series here so I've no context - what is the story here with regard to dependencies and things? signature.asc Description: PGP signature
Re: [PATCH v2 16/21] ASoC: max98088: use match_string() helper
On Thu, May 31, 2018 at 07:11:21PM +0800, Yisheng Xie wrote: > match_string() returns the index of an array for a matching string, > which can be used instead of open coded variant. I don't have either the cover letter or the rest of the series here so I've no context - what is the story here with regard to dependencies and things? signature.asc Description: PGP signature
[PATCH v2 16/21] ASoC: max98088: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used instead of open coded variant. Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: alsa-de...@alsa-project.org Signed-off-by: Yisheng Xie --- v2: - split ret=xxx and move assignment to the line before 'if' - fix error return value - both per Andy sound/soc/codecs/max98088.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 865f64c..fb515aa 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1382,15 +1382,12 @@ static int max98088_set_bias_level(struct snd_soc_component *component, static int max98088_get_channel(struct snd_soc_component *component, const char *name) { - int i; + int ret; - for (i = 0; i < ARRAY_SIZE(eq_mode_name); i++) - if (strcmp(name, eq_mode_name[i]) == 0) - return i; - - /* Shouldn't happen */ - dev_err(component->dev, "Bad EQ channel name '%s'\n", name); - return -EINVAL; + ret = match_string(eq_mode_name, ARRAY_SIZE(eq_mode_name), name); + if (ret < 0) + dev_err(component->dev, "Bad EQ channel name '%s'\n", name); + return ret; } static void max98088_setup_eq1(struct snd_soc_component *component) -- 1.7.12.4
[PATCH v2 16/21] ASoC: max98088: use match_string() helper
match_string() returns the index of an array for a matching string, which can be used instead of open coded variant. Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: alsa-de...@alsa-project.org Signed-off-by: Yisheng Xie --- v2: - split ret=xxx and move assignment to the line before 'if' - fix error return value - both per Andy sound/soc/codecs/max98088.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 865f64c..fb515aa 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1382,15 +1382,12 @@ static int max98088_set_bias_level(struct snd_soc_component *component, static int max98088_get_channel(struct snd_soc_component *component, const char *name) { - int i; + int ret; - for (i = 0; i < ARRAY_SIZE(eq_mode_name); i++) - if (strcmp(name, eq_mode_name[i]) == 0) - return i; - - /* Shouldn't happen */ - dev_err(component->dev, "Bad EQ channel name '%s'\n", name); - return -EINVAL; + ret = match_string(eq_mode_name, ARRAY_SIZE(eq_mode_name), name); + if (ret < 0) + dev_err(component->dev, "Bad EQ channel name '%s'\n", name); + return ret; } static void max98088_setup_eq1(struct snd_soc_component *component) -- 1.7.12.4