Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, vkoul@kernel.org
Subject: Re: [PATCH 1/6] ASoC: Intel: boards: cleanup snd_mask_set usage
Date: Wed, 25 Jul 2018 08:54:54 -0500	[thread overview]
Message-ID: <1429709c-2ac3-be3a-c3da-b02a9b2c856c@linux.intel.com> (raw)
In-Reply-To: <s5h7eljyj2a.wl-tiwai@suse.de>

On 7/25/18 12:34 AM, Takashi Iwai wrote:
> 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] <noident>
>>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> ---
>>   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(&params->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.

I agree it's ugly, I was indeed hoping we'd fix this in a nicer way.

> 
> Will cook up the patch later.
> 
> 
> thanks,
> 
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

  reply	other threads:[~2018-07-25 13:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24 21:12 [PATCH 0/6] Fix Sparse warnings on sound/soc/intel Pierre-Louis Bossart
2018-07-24 21:12 ` [PATCH 1/6] ASoC: Intel: boards: cleanup snd_mask_set usage Pierre-Louis Bossart
2018-07-25  5:34   ` Takashi Iwai
2018-07-25 13:54     ` Pierre-Louis Bossart [this message]
2018-07-24 21:12 ` [PATCH 2/6] ASoC: Intel: Haswell: fix endianness handling Pierre-Louis Bossart
2018-07-25 16:40   ` Applied "ASoC: Intel: Haswell: fix endianness handling" to the asoc tree Mark Brown
2018-07-24 21:12 ` [PATCH 3/6] ASoC: Intel: Skylake: BDL definitions should be __le32 Pierre-Louis Bossart
2018-07-25 16:40   ` Applied "ASoC: Intel: Skylake: BDL definitions should be __le32" to the asoc tree Mark Brown
2018-07-24 21:12 ` [PATCH 4/6] ASoC: Intel: common: make sst_dma functions static Pierre-Louis Bossart
2018-07-25 16:40   ` Applied "ASoC: Intel: common: make sst_dma functions static" to the asoc tree Mark Brown
2018-07-24 21:12 ` [PATCH 5/6] ASoC: Intel: Atom: simplify iomem address and casts Pierre-Louis Bossart
2018-07-25 16:40   ` Applied "ASoC: Intel: Atom: simplify iomem address and casts" to the asoc tree Mark Brown
2018-07-24 21:12 ` [PATCH 6/6] ASoC: Intel: Atom: fix inversion between __iowrite32 and __ioread32 Pierre-Louis Bossart
2018-07-25 16:40   ` Applied "ASoC: Intel: Atom: fix inversion between __iowrite32 and __ioread32" to the asoc tree Mark Brown

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=1429709c-2ac3-be3a-c3da-b02a9b2c856c@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox