public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: Stephen Kitt <steve@sk2.org>
Cc: Guenter Roeck <linux@roeck-us.net>, Peter Rosin <peda@axentia.se>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/i2c: use simple i2c probe
Date: Mon, 5 Dec 2022 10:43:39 +0100	[thread overview]
Message-ID: <Y429SywVngrf2Q9I@ninjato> (raw)
In-Reply-To: <20221012163647.3930565-1-steve@sk2.org>

[-- Attachment #1: Type: text/plain, Size: 1980 bytes --]

On Wed, Oct 12, 2022 at 06:36:47PM +0200, Stephen Kitt 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@sk2.org>

Dropped the mux-part because I applied an older patch doing the same.
Despite that, applied the rest to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-12-05  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 16:36 [PATCH] drivers/i2c: use simple i2c probe Stephen Kitt
2022-12-05  9:43 ` Wolfram Sang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y429SywVngrf2Q9I@ninjato \
    --to=wsa@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peda@axentia.se \
    --cc=steve@sk2.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox