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: <CAHp75VcKxZdp=Rmkt=K+yHq2aFAfSsD+SrKvPsSCCVLmLgc1pA@mail.gmail.com>
Date:   Mon, 11 Jun 2018 15:47:27 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Rob Herring <robh@...nel.org>, Johan Hovold <johan@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jslaby@...e.com>
Subject: Re: [PATCH v2 20/24] serdev: Make match_id accessible by drivers

On Mon, Jun 11, 2018 at 2:52 PM, Ricardo Ribalda Delgado
<ricardo.ribalda@...il.com> wrote:
> Drivers that make use of the driver_data field require to transverse the
> id_table. There is no reason to have one implementation per driver.

> +const struct serdev_device_id *serdev_match_id(
> +                       const struct serdev_device_id *id,
> +                       const struct serdev_device *sdev)

I think slightly better would be

const strunct serdev_device *
serdev_match_id(const struct serdev_device_id *id,
                       const struct serdev_device *sdev)

>  {
>         while (id->name[0]) {
>                 if (!strcmp(sdev->modalias, id->name))
> -                       return 1;
> +                       return id;
>                 id++;
>         }
>
> -       return 0;
> +       return NULL;
>  }
> +EXPORT_SYMBOL_GPL(serdev_match_id);

Can we avoid ping-pong changes in the series? I mean to introduce this
helper in this form in the first place?


> -               return serdev_match_id(sdrv->id_table, sdev);
> +               return serdev_match_id(sdrv->id_table, sdev) != NULL;

return !!serdev_match_id(...);
?


> +const struct serdev_device_id *serdev_match_id(
> +               const struct serdev_device_id *id,
> +               const struct serdev_device *sdev);

Same as above.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ