From: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Linux I2C <i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org>,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Subject: Re: [PATCH] i2c: Simplify i2c_device_probe
Date: Wed, 4 Jun 2008 00:43:59 +0100 [thread overview]
Message-ID: <20080603234359.GF11277@trinity.fluff.org> (raw)
In-Reply-To: <20080603202954.64d5971c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
On Tue, Jun 03, 2008 at 08:29:54PM +0200, Jean Delvare wrote:
> i2c_driver.id_table is mandatory now, so we can simplify
> i2c_device_probe() a bit.
>
> Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> ---
> drivers/i2c/i2c-core.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> --- linux-2.6.26-rc4.orig/drivers/i2c/i2c-core.c 2008-06-03 10:57:55.000000000 +0200
> +++ linux-2.6.26-rc4/drivers/i2c/i2c-core.c 2008-06-03 16:38:37.000000000 +0200
> @@ -101,19 +101,14 @@ static int i2c_device_probe(struct devic
> {
> struct i2c_client *client = to_i2c_client(dev);
> struct i2c_driver *driver = to_i2c_driver(dev->driver);
> - const struct i2c_device_id *id;
> int status;
>
> - if (!driver->probe)
> + if (!driver->probe || !driver->id_table)
> return -ENODEV;
> client->driver = driver;
> dev_dbg(dev, "probe\n");
>
> - if (driver->id_table)
> - id = i2c_match_id(driver->id_table, client);
> - else
> - id = NULL;
> - status = driver->probe(client, id);
> + status = driver->probe(client, i2c_match_id(driver->id_table, client));
> if (status)
> client->driver = NULL;
> return status;
Looks ok, will give it a test tommorow if possible.
>
> --
> Jean Delvare
--
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
prev parent reply other threads:[~2008-06-03 23:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 18:29 [PATCH] i2c: Simplify i2c_device_probe Jean Delvare
[not found] ` <20080603202954.64d5971c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-03 23:43 ` Ben Dooks [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=20080603234359.GF11277@trinity.fluff.org \
--to=ben-linux-elnmno+kys3ytjvyw6ydsg@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.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