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]
Date:   Thu, 10 Dec 2020 09:23:25 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Cc:     Marek Vasut <marek.vasut+renesas@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Khiem Nguyen <khiem.nguyen.xt@...esas.com>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] mfd: bd9571mwv: Make the driver more generic

Hi Shimoda-san,

On Thu, Dec 10, 2020 at 5:10 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@...esas.com> wrote:
> > From: Geert Uytterhoeven, Sent: Wednesday, December 9, 2020 10:26 PM
> > On Tue, Dec 8, 2020 at 9:06 AM Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@...esas.com> wrote:
> <snip>
> > > index 80c6ef0..57bdb6a 100644
> > > --- a/drivers/mfd/bd9571mwv.c
> > > +++ b/drivers/mfd/bd9571mwv.c
> >
> > > @@ -127,13 +137,12 @@ static int bd9571mwv_identify(struct bd9571mwv *bd)
> > >                         ret);
> > >                 return ret;
> > >         }
> > > -
> > > -       if (value != BD9571MWV_PRODUCT_CODE_VAL) {
> > > +       /* Confirm the product code */
> > > +       if (value != bd->data->product_code_val) {
> > >                 dev_err(dev, "Invalid product code ID %02x (expected %02x)\n",
> > > -                       value, BD9571MWV_PRODUCT_CODE_VAL);
> > > +                       value, bd->data->product_code_val);
> > >                 return -EINVAL;
> > >         }
> >
> > Reading the product code register, and checking the product code value
> > can be removed, as bd9571mwv_probe() has verified it already.
>
> Indeed. I'll remove this.

OK.

> > > --- a/include/linux/mfd/bd9571mwv.h
> > > +++ b/include/linux/mfd/bd9571mwv.h

> > > + */
> > > +struct bd957x_data {
> > > +       int product_code_val;
> >
> > unsigned int?
>
> We can remove this member.

True.

> Or, keeping this member and then we check the product code by this member
> instead of switch() like below?
>
> /* No build test, JFYI */
> struct bd957x_data *data_array[] = {
>         &bd9571mwv_data,
>         &bd9574mwf_data,
> };
>
> for (i = 0; I < ARRAY_SIZE(data_array); i++) {
>         if (val == data_array[i].product_code_val) {
>                 bd->data = data_array[i];
>                 break;
>         }
> }

Given we probably won't have more than a handful variants, I'm
leaning towards the switch() approach.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ