Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp295689pxk; Thu, 24 Sep 2020 06:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTMJ6s11tW4/Nxm8+G5qBCLa2YRnptq88+ErNz/Vc2D0qkyBrKWWZI4syPVkN0K2/6a3Mz X-Received: by 2002:a7b:c925:: with SMTP id h5mr4635569wml.28.1600952741365; Thu, 24 Sep 2020 06:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600952741; cv=none; d=google.com; s=arc-20160816; b=siuLVl3JvA+OIJvIH2PSgciquYsRObAxNk7gqlC6imf3ki2S5OZZOmKmBqOuNbffxY py1+gj1/YQa7Tfr2AOCdxW3VQCWH38WCbjPfQZr7YsW01R4GXSwQ0+TzqP2/gxNkoCtg c7Db8lhLapaDe6MB7bTnmKvRaeTRweJzNh8KxohkhPvca2fqz3a+BVv1mhsYU5u+0UV9 +YzdrGMxlhCrZnjcKiE+fsWpreHFFz5V87rh5i1U9yxrgaFu5RDK0QNyBfqgBFttqwQV o44KDIP6F9msm72uZBS55QiJuRUc+orETmcZ1UXtV8eFCbhLzD4/tSGblDqKc1kcWn+a bnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=zPB7jULHIg1msvTaEkWc/XGqvJfOwCy594X3DY/QjvE=; b=ow+qbMdlKrKMNUkruRAU3NZBdcQ1V6kzKXCZynIgTfxEdbxohCXNqYTPc8US+jZOR3 gxuQxfF3rSNVSrB8RxVP/j5uXJxXODigSM+lNP8GfBWZ6WWv7N5dGpO2GzE7696EmKb1 vU75v8NdsE3Y/WKMDfgxXM1r+aym0TT6IptXgN9RgCYMwLC0UANUYVPnTlZgtFnQ7uBx a+QhY1lzgv2VxL2DDv9mLDF7mPb/i1uJtOO4qTJmQDiUwttEYZGVtUhZf9lyE0oNCbXh YtOikAHrLquZFBW5X4CMi3s/XOaLAMGpJti6j9QMD5o//j4knK903DULO/W+U3zC4SCR bICQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E9iKMC1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si2105025edr.520.2020.09.24.06.05.13; Thu, 24 Sep 2020 06:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E9iKMC1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbgIXNBN (ORCPT + 99 others); Thu, 24 Sep 2020 09:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727738AbgIXNBN (ORCPT ); Thu, 24 Sep 2020 09:01:13 -0400 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4155C0613CE for ; Thu, 24 Sep 2020 06:01:12 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id q5so3054807ilj.1 for ; Thu, 24 Sep 2020 06:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zPB7jULHIg1msvTaEkWc/XGqvJfOwCy594X3DY/QjvE=; b=E9iKMC1wzBPaarlgtDzjwt1puGwye2dLf3QCw5dE87ph22iQOTFPvbj0p71swE/7Ym 6GAB/CqYTvqJT5J6Uy810Q+tUnL8PR1GHu3p63aM1gkgjpjxQIlNCiu5n8quNn7oRNSO j4AReEHo5TFvAIZagxSwDwEvQjMw41VKGxpy3akkBwFrY4/xC3NBuWKNrAbqYoRed7dC 7AX2cp0VdRivFRYyECmTKZCDYNbyHKHXsXpt8YL9r36IQMuVAwsSn/MfRCSDjvAP+5Ii qZPORrIG9elIZ3xbc1Towl/EgD28MtYgrx1GA2KG3916r/9WPu+rLFIdOaWdUCjuRqoc 7u8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zPB7jULHIg1msvTaEkWc/XGqvJfOwCy594X3DY/QjvE=; b=q4AXLsSQ1dSmIFz4Kt7NgS0D0vVaKI6DKQOAqfbHEkV1Zp/xvYHXLK2IDShQhgS+af HGz3aJMLaXDKH8ux07NKsO7S7vVGgr4t9T83pS548yQIQl0ZFcpkeOTV4oPlhB228SsS TQoqdYTo9y+kFRlkV+N6dHRFCViojK75KghYZutydGN5ykCCP4H/K30GeVI1sbXuIwxv huL+NPdMe1WRLV6Db7ofEgcnsh3R4rbfv+iL7LiOn1eSlirCJ1j2oOhPYW+vVUSzB8VG jGS2B8cmFZwvmxZHPqNGD0POxaLNcsEKFVD385GnQHb1KlVrD687O3Bp30bOzvJzJj7l s05w== X-Gm-Message-State: AOAM531RQgumXcpDHWqg2chbvoZjuNGchx9ZONK9NgVrHaCRJfoCj9Ff JTWAlT1eiW6ykRPcKVdKI/23LwJHT8I7qw== X-Received: by 2002:a92:9e0f:: with SMTP id q15mr4093943ili.286.1600952471522; Thu, 24 Sep 2020 06:01:11 -0700 (PDT) Received: from [172.22.22.26] (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.googlemail.com with ESMTPSA id q5sm1613477ile.63.2020.09.24.06.01.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Sep 2020 06:01:10 -0700 (PDT) Subject: Re: [greybus-dev] [PATCH 3/3] [PATCH] staging: greybus: __u8 is sufficient for snd_ctl_elem_type_t and snd_ctl_elem_iface_t To: Coiby Xu , devel@driverdev.osuosl.org Cc: "moderated list:SOUND" , Alex Elder , Takashi Iwai , Johan Hovold , Jaroslav Kysela , "moderated list:GREYBUS SUBSYSTEM" , open list References: <20200924102039.43895-1-coiby.xu@gmail.com> <20200924102039.43895-3-coiby.xu@gmail.com> From: Alex Elder Message-ID: <772d78de-630f-4b0f-16cc-4e67b8f98907@linaro.org> Date: Thu, 24 Sep 2020 08:01:09 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200924102039.43895-3-coiby.xu@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/24/20 5:20 AM, Coiby Xu wrote: > Use __8 to replace int and remove the unnecessary __bitwise type attribute. > > Found by sparse, Greg's right, don't change the public header. You could try this in the Greybus code to eliminate the warning, but I haven't tried it (and for all I know it's not a good idea): uinfo->type = (__force snd_ctl_elem_type_t)info->type; -Alex > $ make C=2 drivers/staging/greybus/ > drivers/staging/greybus/audio_topology.c:185:24: warning: cast to restricted snd_ctl_elem_type_t > drivers/staging/greybus/audio_topology.c:679:14: warning: restricted snd_ctl_elem_iface_t degrades to integer > drivers/staging/greybus/audio_topology.c:906:14: warning: restricted snd_ctl_elem_iface_t degrades to integer > > Signed-off-by: Coiby Xu > --- > drivers/staging/greybus/audio_topology.c | 2 +- > include/uapi/sound/asound.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c > index 56bf1a4f95ad..f6023ff390c2 100644 > --- a/drivers/staging/greybus/audio_topology.c > +++ b/drivers/staging/greybus/audio_topology.c > @@ -182,7 +182,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, > /* update uinfo */ > uinfo->access = data->access; > uinfo->count = data->vcount; > - uinfo->type = (snd_ctl_elem_type_t)info->type; > + uinfo->type = info->type; > > switch (info->type) { > case GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN: > diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h > index 535a7229e1d9..8e71a95644ab 100644 > --- a/include/uapi/sound/asound.h > +++ b/include/uapi/sound/asound.h > @@ -950,7 +950,7 @@ struct snd_ctl_card_info { > unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ > }; > > -typedef int __bitwise snd_ctl_elem_type_t; > +typedef __u8 snd_ctl_elem_type_t; > #define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ > #define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ > #define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ > @@ -960,7 +960,7 @@ typedef int __bitwise snd_ctl_elem_type_t; > #define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ > #define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 > > -typedef int __bitwise snd_ctl_elem_iface_t; > +typedef __u8 snd_ctl_elem_iface_t; > #define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ > #define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ > #define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ >