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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vcrjpxcf7LAQwaZfH-Z5QXM0waf7HH2QrFHuWiNWdjiwA@mail.gmail.com>
Date: Thu, 4 Dec 2025 14:59:54 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Michael Hennerich <Michael.Hennerich@...log.com>, 
	Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>, 
	Nuno Sá <nuno.sa@...log.com>, 
	Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, linux-iio@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] iio: amplifiers: adl8113: add driver support

On Thu, Dec 4, 2025 at 2:47 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Fri, Nov 28, 2025 at 4:45 PM Antoniu Miclaus
> <antoniu.miclaus@...log.com> wrote:

...

> > +static int adl8113_set_path(struct adl8113_state *st,
> > +                           enum adl8113_signal_path path)
> > +{
> > +       DECLARE_BITMAP(values, 2);
> > +       int ret;
>
> > +       bitmap_zero(values, 2);
>
> Move this to the switch case...
>
> > +       /* Determine GPIO values based on signal path */

Note, you may extend this comment to show the mapping, e.g.,

       /*
        * Determine GPIO values based on signal path.
        * Va: bit 0, Vb: bit 1.
        */

> > +       switch (path) {
> > +       case ADL8113_INTERNAL_AMP:
>
> > +               /* va=0, vb=0 - already zero */
>
> Unneeded comment here and below, just put a number to the bitmap
>
>   bitmap_write(..., 0x00);
>
> > +               break;
> > +       case ADL8113_INTERNAL_BYPASS:
> > +               /* va=1, vb=1 */
> > +               __set_bit(0, values);
> > +               __set_bit(1, values);
>
>   bitmap_write(..., 0x03);
>
> > +               break;
> > +       case ADL8113_EXTERNAL_A:
> > +               /* va=0, vb=1 */
> > +               __set_bit(1, values);
>
>   bitmap_write(..., 0x02);
>
> > +               break;
> > +       case ADL8113_EXTERNAL_B:
> > +               /* va=1, vb=0 */
> > +               __set_bit(0, values);
>
>   bitmap_write(..., 0x01);
>
> > +               break;
> > +       default:
> > +               return -EINVAL;
> > +       }
> > +
> > +       ret = gpiod_set_array_value_cansleep(st->gpios->ndescs, st->gpios->desc,
> > +                                            st->gpios->info, values);
> > +       if (ret)
> > +               return ret;
> > +
> > +       st->current_path = path;
> > +       return 0;
> > +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ