All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org, broonie@kernel.org
Subject: Re: [PATCH 6/6] ASoC: Intel: boards: use strcmp with constant literals
Date: Fri, 06 Oct 2017 14:50:34 +0300	[thread overview]
Message-ID: <1507290634.16112.280.camel@linux.intel.com> (raw)
In-Reply-To: <s5hfuaw7j0a.wl-tiwai@suse.de>

On Fri, 2017-10-06 at 10:55 +0200, Takashi Iwai wrote:
> On Thu, 05 Oct 2017 20:52:43 +0200,
> Pierre-Louis Bossart wrote:
> > 
> > we used strncmp in all audio machine drivers, this is not needed
> > when comparing against constant literals.
> > General replace of strncmp(a, b, strlen(b)) to strcmp(a,b)
> > 
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.inte
> > l.com>
> > ---
> >  sound/soc/intel/boards/bxt_da7219_max98357a.c   | 3 +--
> >  sound/soc/intel/boards/bytcht_es8316.c          | 3 +--
> >  sound/soc/intel/boards/bytcr_rt5640.c           | 6 ++----
> >  sound/soc/intel/boards/bytcr_rt5651.c           | 3 +--
> >  sound/soc/intel/boards/cht_bsw_max98090_ti.c    | 3 +--
> >  sound/soc/intel/boards/cht_bsw_rt5645.c         | 6 ++----
> >  sound/soc/intel/boards/cht_bsw_rt5672.c         | 3 +--
> >  sound/soc/intel/boards/skl_nau88l25_max98357a.c | 3 +--
> >  sound/soc/intel/boards/skl_nau88l25_ssm4567.c   | 3 +--
> >  9 files changed, 11 insertions(+), 22 deletions(-)
> 
> While we're at it: since all these do mostly same: wouldn't it make
> more sense to create a helper to scan over the rtd_list?
> 
> static inline snd_soc_intel_get_codec_dai(struct snd_soc_card *card,
> 					  const char *dai_name)
> {
> 	struct snd_soc_pcm_runtime *rtd;
> 
> 	list_for_each_entry(rtd, &card->rtd_list, list) {
> 		if (!strcmp(rtd->codec_dai->name, dai_name))
> 			return rtd->codec_dai;
> 	}
> 	
> 	return NULL;
> }

I like this!

> Some drivers require to check two names, but it can call this function
> twice.

It looks like not hot path, so, 2 passes instead of one might be not a
big deal.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2017-10-06 11:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05 18:52 [PATCH 0/6] Baytrail-Cherrytrail updates Pierre-Louis Bossart
2017-10-05 18:52 ` [PATCH 1/6] ASoC: Intel: bytcr_rt5651: add MCLK support and fix quirks Pierre-Louis Bossart
2017-10-05 18:52 ` [PATCH 2/6] ASoC: Intel: bytcr_rt5651: filter codec name and fix variable declarations Pierre-Louis Bossart
2017-10-05 18:52 ` [PATCH 3/6] ASoC: Intel: bytcr_rt5640: cosmetic fixes Pierre-Louis Bossart
2017-10-18 11:31   ` Applied "ASoC: Intel: bytcr_rt5640: cosmetic fixes" to the asoc tree Mark Brown
2017-10-05 18:52 ` [PATCH 4/6] ASoC: Intel: cht_bsw_rt5645: cosmetic fixes Pierre-Louis Bossart
2017-10-18 11:31   ` Applied "ASoC: Intel: cht_bsw_rt5645: cosmetic fixes" to the asoc tree Mark Brown
2017-10-05 18:52 ` [PATCH 5/6] ASoC: Intel: bytcht_da7213: cosmetic fixes Pierre-Louis Bossart
2017-10-18 11:31   ` Applied "ASoC: Intel: bytcht_da7213: cosmetic fixes" to the asoc tree Mark Brown
2017-10-05 18:52 ` [PATCH 6/6] ASoC: Intel: boards: use strcmp with constant literals Pierre-Louis Bossart
2017-10-06  8:55   ` Takashi Iwai
2017-10-06 11:50     ` Andy Shevchenko [this message]
2017-10-06 14:28       ` Pierre-Louis Bossart
2017-10-06 15:24         ` Pierre-Louis Bossart
2017-10-06 15:48           ` Takashi Iwai
2017-10-09  9:34     ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507290634.16112.280.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.