From patchwork Wed Mar 28 19:05:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 10313889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0DA260212 for ; Wed, 28 Mar 2018 19:05:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0C2C28FCF for ; Wed, 28 Mar 2018 19:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2530290C1; Wed, 28 Mar 2018 19:05:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95D3428FCF for ; Wed, 28 Mar 2018 19:05:52 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7E12626709D; Wed, 28 Mar 2018 21:05:48 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5AE4C2670D5; Wed, 28 Mar 2018 21:05:46 +0200 (CEST) Received: from smtp-proxy002.phy.lolipop.jp (smtp-proxy002.phy.lolipop.jp [157.7.104.43]) by alsa0.perex.cz (Postfix) with ESMTP id 388A8267063 for ; Wed, 28 Mar 2018 21:05:39 +0200 (CEST) Received: from smtp-proxy002.phy.lolipop.lan (HELO smtp-proxy002.phy.lolipop.jp) (172.19.44.43) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy002.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Thu, 29 Mar 2018 04:05:37 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy002.phy.lolipop.jp (LOLIPOP-Fsecure); Thu, 29 Mar 2018 04:05:34 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) To: Ranjani Sridharan , alsa-devel@alsa-project.org References: <20180328170904.19845-1-ranjani.sridharan@linux.intel.com> From: Takashi Sakamoto Message-ID: <63485cbc-83ec-7177-b586-986ae1e4a380@sakamocchi.jp> Date: Thu, 29 Mar 2018 04:05:33 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180328170904.19845-1-ranjani.sridharan@linux.intel.com> Content-Language: en-US Cc: liam.r.girdwood@linux.intel.com Subject: Re: [alsa-devel] [PATCH v2] ALSA: core api: define offsets for TLV items X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP Hi, On Mar 29 2018 02:09, Ranjani Sridharan wrote: > This patch defines accessor offsets for the type, length, min, > mute and step items in TLV data. These will be used by drivers to > extract the TLV data while loading topology. > > Signed-off-by: Ranjani Sridharan > --- > V2: removed redundant redefinitions and updated prefix > --- > include/uapi/sound/tlv.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h > index be5371f09a62..1fd786a5e57b 100644 > --- a/include/uapi/sound/tlv.h > +++ b/include/uapi/sound/tlv.h > @@ -98,4 +98,12 @@ > > #define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 > > +/* Accessor offsets for TLV data items */ > +#define SNDRV_CTL_TLV_OFFSET_TYPE 0 > +#define SNDRV_CTL_TLV_OFFSET_LEN 1 I suggest you to use these macros in declaration of 'SNDRV_CTL_TLVD_ITEM()' for self-described header. In short, I mean: $ diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h index be5371f09a62..76598609f349 100644 > +/* Accessor offsets for min, mute and step items in dB scale type TLV */ > +#define SNDRV_CTL_TLV_OFFSET_DB_MIN 2 > +#define SNDRV_CTL_TLV_OFFSET_DB_MUTE_AND_STEP 3 > + > #endif I wonder why you add the above macros just for data of 'SNDRV_CTL_TLVT_DB_MINMAX_MUTE'. In fact, this header defines below types of TLV data. - SNDRV_CTL_TLVT_CONTAINER - SNDRV_CTL_TLVT_DB_SCALE - SNDRV_CTL_TLVT_DB_LINEAR - SNDRV_CTL_TLVT_DB_RANGE - SNDRV_CTL_TLVT_DB_MINMAX - SNDRV_CTL_TLVT_DB_MINMAX_MUTE Would I request you to your reason not to add such offset macros for the others? At least, we should have a care for 'SNDRV_CTL_TLVT_DB_LINEAR' to keep consistency of defined macros. Regards Takashi Sakamoto --- a/include/uapi/sound/tlv.h +++ b/include/uapi/sound/tlv.h @@ -37,8 +37,15 @@ * block_length = (length + (sizeof(unsigned int) - 1)) & * ~(sizeof(unsigned int) - 1)) .... */ + +/* Accessor offsets for TLV data items */ +#define SNDRV_CTL_TLV_OFFSET_TYPE 0 +#define SNDRV_CTL_TLV_OFFSET_LEN 1 + #define SNDRV_CTL_TLVD_ITEM(type, ...) \ - (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ + [SNDRV_CTL_TLV_OFFSET_TYPE] = (type), \ + [SNDRV_CTL_TLV_OFFSET_LEN] = SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), \ + __VA_ARGS__ #define SNDRV_CTL_TLVD_LENGTH(...) \ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))