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: <20180622102441.35856a50@bbrezillon>
Date:   Fri, 22 Jun 2018 10:24:41 +0200
From:   Boris Brezillon <boris.brezillon@...tlin.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Wolfram Sang <wsa@...-dreams.de>, linux-i2c@...r.kernel.org,
        Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        Przemyslaw Sroka <psroka@...ence.com>,
        Arkadiusz Golec <agolec@...ence.com>,
        Alan Douglas <adouglas@...ence.com>,
        Bartosz Folta <bfolta@...ence.com>,
        Damian Kos <dkos@...ence.com>,
        Alicja Jurasik-Urbaniak <alicja@...ence.com>,
        Cyprian Wronka <cwronka@...ence.com>,
        Suresh Punnoose <sureshp@...ence.com>,
        Rafal Ciepiela <rafalc@...ence.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Nishanth Menon <nm@...com>, Rob Herring <robh+dt@...nel.org>,
        Pawel Moll <pawel.moll@....com>,
        Mark Rutland <mark.rutland@....com>,
        Ian Campbell <ijc+devicetree@...lion.org.uk>,
        Kumar Gala <galak@...eaurora.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Vitor Soares <Vitor.Soares@...opsys.com>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Xiang Lin <Xiang.Lin@...aptics.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v4 09/10] gpio: Add a driver for Cadence I3C GPIO
 expander

Hi Linus,

I realize I never replied to this review.

On Thu, 26 Apr 2018 10:44:26 +0200
Linus Walleij <linus.walleij@...aro.org> wrote:

> On Fri, Mar 30, 2018 at 9:47 AM, Boris Brezillon
> <boris.brezillon@...tlin.com> wrote:
> 
> > Add a driver for Cadence I3C GPIO expander.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@...tlin.com>  
> 
> This is pretty much OK, and I don't want to raise the bar
> even higher for you to get this code into the kernel, so:
> Acked-by: Linus Walleij <linus.walleij@...aro.org>

Thanks.

> 
> The following is an observation for future improvement:
> 
> > +static int cdns_i3c_gpio_read_reg(struct cdns_i3c_gpio *gpioc, u8 reg,
> > +                                 u8 *val)
> > +{
> > +       struct i3c_priv_xfer xfers[] = {
> > +               {
> > +                       .len = sizeof(reg),
> > +                       .data.out = &reg,
> > +               },
> > +               {
> > +                       .rnw = true,
> > +                       .len = sizeof(*val),
> > +                       .data.in = val,
> > +               },
> > +       };
> > +
> > +       return i3c_device_do_priv_xfers(gpioc->i3cdev, xfers,
> > +                                       ARRAY_SIZE(xfers));
> > +}
> > +
> > +static int cdns_i3c_gpio_write_reg(struct cdns_i3c_gpio *gpioc, u8 reg,
> > +                                  u8 val)
> > +{
> > +       struct i3c_priv_xfer xfers[] = {
> > +               {
> > +                       .len = sizeof(reg),
> > +                       .data.out = &reg,
> > +               },
> > +               {
> > +                       .len = sizeof(val),
> > +                       .data.out = &val,
> > +               },
> > +       };
> > +
> > +       return i3c_device_do_priv_xfers(gpioc->i3cdev, xfers,
> > +                                       ARRAY_SIZE(xfers));
> > +}  
> 
> This is starting to resemble
> drivers/base/regmap/regmap-i2c.c
> 
> Maybe we should very quickly add regmap-i3c.c as this
> infrastructre has had a great positive effect on may kernel
> subsystems.

Yes I considered that too, I was just waiting for at least one
other user before adding this regmap-i3c implementation.

> 
> > +static int cdns_i3c_gpio_get_direction(struct gpio_chip *g, unsigned offset)
> > +{
> > +       struct cdns_i3c_gpio *gpioc = gpioc_to_cdns_gpioc(g);
> > +
> > +       return gpioc->dir & BIT(offset);  
> 
> I would:
> 
> return !!(gpioc->dir & BIT(offset));
> 
> So you clamp it to bit 0.

Will fix that in my v5.

Thanks for your review.

Boris

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ