From: Takashi Iwai Subject: Re: [PATCH 1/6] ASoC: Intel: boards: cleanup snd_mask_set usage Date: Wed, 25 Jul 2018 07:34:53 +0200 Message-ID: References: <20180724211248.29427-1-pierre-louis.bossart@linux.intel.com> <20180724211248.29427-2-pierre-louis.bossart@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DDE7B26772E for ; Wed, 25 Jul 2018 07:34:53 +0200 (CEST) In-Reply-To: <20180724211248.29427-2-pierre-louis.bossart@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org, broonie@kernel.org, vkoul@kernel.org List-Id: alsa-devel@alsa-project.org On Tue, 24 Jul 2018 23:12:43 +0200, Pierre-Louis Bossart wrote: > > Sparse reports a ton of warnings when snd_mask_set is used (see > e.g. below). Fix by adding the right typecast with the __force > attribute. The code is less readable but with fewer warnings it's > easier to track the real issues and improve the rest of the code. > > CHECK sound/soc/intel/boards/skl_nau88l25_max98357a.c > sound/soc/intel/boards/skl_nau88l25_max98357a.c:160:27: warning: incorrect type in argument 2 (different base types) > sound/soc/intel/boards/skl_nau88l25_max98357a.c:160:27: expected unsigned int [unsigned] val > sound/soc/intel/boards/skl_nau88l25_max98357a.c:160:27: got restricted snd_pcm_format_t [usertype] > > Signed-off-by: Pierre-Louis Bossart > --- > sound/soc/intel/boards/bdw-rt5677.c | 2 +- > sound/soc/intel/boards/bxt_da7219_max98357a.c | 2 +- > sound/soc/intel/boards/bxt_rt298.c | 2 +- > sound/soc/intel/boards/glk_rt5682_max98357a.c | 2 +- > sound/soc/intel/boards/kbl_da7219_max98357a.c | 2 +- > sound/soc/intel/boards/kbl_rt5663_max98927.c | 6 ++++-- > sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 6 ++++-- > sound/soc/intel/boards/skl_nau88l25_max98357a.c | 2 +- > sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 2 +- > sound/soc/intel/boards/skl_rt286.c | 2 +- > 10 files changed, 16 insertions(+), 12 deletions(-) > > diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c > index 6ea360f33575..17037892c16b 100644 > --- a/sound/soc/intel/boards/bdw-rt5677.c > +++ b/sound/soc/intel/boards/bdw-rt5677.c > @@ -156,7 +156,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, > /* set SSP0 to 16 bit */ > snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - > SNDRV_PCM_HW_PARAM_FIRST_MASK], > - SNDRV_PCM_FORMAT_S16_LE); > + (__force unsigned int)SNDRV_PCM_FORMAT_S16_LE); I believe we should provide a specific type of snd_mask_set(), e.g. snd_mask_set_format(), snd_mask_set_access(), etc, which receives the right type as the argument, instead of this kind of ugly cast. Will cook up the patch later. thanks, Takashi