lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a75b875a01e8697b5a3556d14f3ee9bd72d5050.camel@perches.com>
Date:   Mon, 09 Aug 2021 13:03:10 -0700
From:   Joe Perches <joe@...ches.com>
To:     Liam Beguin <liambeguin@...il.com>, lars@...afoo.de,
        Michael.Hennerich@...log.com, jic23@...nel.org,
        charles-antoine.couret@...ensium.com, Nuno.Sa@...log.com
Cc:     linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
        devicetree@...r.kernel.org, robh+dt@...nel.org
Subject: Re: [PATCH v5 1/5] iio: adc: ad7949: define and use bitfield names

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ