Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3036791pxt; Mon, 9 Aug 2021 15:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSQVj2A18I57Gpzamu5y3SHGmDmiey3/2yXV5O5vVgx5BpEEtnz3CK7Yoog/ZWi09HLV/T X-Received: by 2002:a05:6e02:1bcb:: with SMTP id x11mr185554ilv.168.1628547697880; Mon, 09 Aug 2021 15:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628547697; cv=none; d=google.com; s=arc-20160816; b=UWLMaZge/O1Osy98tWEJaeON9F0ArDH9nrn59KfpqPWDdNzAUi9zyxvLP3f5uBb+As RXhKNok6XjXbwQfe87dqrujp1YogRRcxpwYey8yB2H0EViT4LuOsmFBc7/OJ8FCHo16c tuPfmOm5bqLm9g5a6/Uc5Koupt7RleH9X7dKHTo/8sPPDR/U2yRqYmqcVNpZONf0RyZd BXYcfh3I++k3rMcCFerOmiurGj62Z9O5sy6AVxO59MVn9wXu28rp23liEj7u8qL1oYKz Nmqs4NCGbCaP8m4F64y3/7B2/NWYKE/8RZUD2EPVkXnYYk2PSKSxCzmxDkgmxap0vanv +5TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=+oIgv5e7o5xBXhwrBFGukzwoJYzS5xes6hNl9QEdI0Y=; b=q+gHAFczqzsf1IVNXqIaulGBfof7Qufqg4qc9LAp0CsuvYG1vZMiMZyWNbf7SQnsX8 N6o+GDy0KoYCwPaQ6vQBXAn4Dabu4SLGCYeqIL7d6/llwvw15DJmqZsr3tVW4dFBDFTq B/5iZeeQggPakCxll6FZIzLTonLYmwd4ufk66wy2EDWNTfTYr2LKA2e3KscgFkqjqzGL cQ3s90kVqgZl/AH3pmRDXhHmtpKJvBn3wWmEVD8A37FU1G1k7sOMPhWlVLZ6pV1R9sot V4/JX2tOwN+ItXRfRF+XQscrIk+AL89N65MBdzRX2npyjZZblDGn722xbMtMy1VqCzGf DaFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y196si9054585iof.86.2021.08.09.15.21.26; Mon, 09 Aug 2021 15:21:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235691AbhHIUDm (ORCPT + 99 others); Mon, 9 Aug 2021 16:03:42 -0400 Received: from smtprelay0112.hostedemail.com ([216.40.44.112]:37658 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236195AbhHIUDh (ORCPT ); Mon, 9 Aug 2021 16:03:37 -0400 Received: from omf05.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id E60851809CDF4; Mon, 9 Aug 2021 20:03:13 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA id 5B4E5B2797; Mon, 9 Aug 2021 20:03:12 +0000 (UTC) Message-ID: <6a75b875a01e8697b5a3556d14f3ee9bd72d5050.camel@perches.com> Subject: Re: [PATCH v5 1/5] iio: adc: ad7949: define and use bitfield names From: Joe Perches To: Liam Beguin , lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, charles-antoine.couret@essensium.com, Nuno.Sa@analog.com Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org Date: Mon, 09 Aug 2021 13:03:10 -0700 In-Reply-To: References: <20210808015659.2955443-1-liambeguin@gmail.com> <20210808015659.2955443-2-liambeguin@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamout03 X-Rspamd-Queue-Id: 5B4E5B2797 X-Spam-Status: No, score=-1.38 X-Stat-Signature: ponw9bnqokmxfbtn5trjcqttcnxy4tz6 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1878J4i44xS1a+IwmyG+Xhs1fXR3KBpfaM= X-HE-Tag: 1628539392-208200 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2021-08-08 at 18:46 -0400, Liam Beguin wrote: > On Sun Aug 8, 2021 at 12:51 PM EDT, Joe Perches wrote: > > On Sat, 2021-08-07 at 21:56 -0400, Liam Beguin wrote: > > > Replace raw configuration register values by using FIELD_PREP and > > > defines to improve readability. > > [] > > > diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c > > [] > > +#define AD7949_CFG_BIT_INCC GENMASK(12, 10) > > > > Hi Joe, > > > I think the naming is a bit confusing as it appears as if > > these bitfield ranges are single bits. > > That makes sense. > Would AD7949_CFG_BITS_* be good enough? Sure, or add MASK or something else like AD7949_CFG_MASK_INCC. It's pretty common to define _MASK and _SHIFT for these types of uses. For instance: include/drm/drm_dp_helper.h-# define DP_DSC_MAJOR_MASK (0xf << 0) include/drm/drm_dp_helper.h-# define DP_DSC_MINOR_MASK (0xf << 4) include/drm/drm_dp_helper.h:# define DP_DSC_MAJOR_SHIFT 0 include/drm/drm_dp_helper.h:# define DP_DSC_MINOR_SHIFT 4