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] [day] [month] [year] [list]
Message-ID: <CAMRc=MeVBJAcMx8pR5gY2j2LZcZqs6sP3XXnREXDd=5xKDbYkw@mail.gmail.com>
Date:   Mon, 17 Oct 2022 10:37:10 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Stephen Kitt <steve@....org>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/gpio: use simple i2c probe

On Wed, Oct 12, 2022 at 4:25 PM Stephen Kitt <steve@....org> wrote:
>
> All these drivers have an i2c probe function which doesn't use the
> "struct i2c_device_id *id" parameter, so they can trivially be
> converted to the "probe_new" style of probe with a single argument.
>
> This is part of an ongoing transition to single-argument i2c probe
> functions. Old-style probe functions involve a call to i2c_match_id:
> in drivers/i2c/i2c-core-base.c,
>
>          /*
>           * When there are no more users of probe(),
>           * rename probe_new to probe.
>           */
>          if (driver->probe_new)
>                  status = driver->probe_new(client);
>          else if (driver->probe)
>                  status = driver->probe(client,
>                                         i2c_match_id(driver->id_table, client));
>          else
>                  status = -EINVAL;
>
> Drivers which don't need the second parameter can be declared using
> probe_new instead, avoiding the call to i2c_match_id. Drivers which do
> can still be converted to probe_new-style, calling i2c_match_id
> themselves (as is done currently for of_match_id).
>
> This change was done using the following Coccinelle script, and fixed
> up for whitespace changes:
>
> @ rule1 @
> identifier fn;
> identifier client, id;
> @@
>
> - static int fn(struct i2c_client *client, const struct i2c_device_id *id)
> + static int fn(struct i2c_client *client)
> {
> ...when != id
> }
>
> @ rule2 depends on rule1 @
> identifier rule1.fn;
> identifier driver;
> @@
>
> struct i2c_driver driver = {
> -       .probe
> +       .probe_new
>                 =
> (
>                    fn
> |
> -                  &fn
> +                  fn
> )
>                 ,
> };
>
> Signed-off-by: Stephen Kitt <steve@....org>
> ---

Applied, thanks!

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ