From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Linux I2C <i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org>,
David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
Subject: [PATCH] i2c: Keep client->driver and client->dev.driver in sync
Date: Sat, 8 Mar 2008 21:49:11 +0100 [thread overview]
Message-ID: <20080308214911.5344eba9@hyperion.delvare> (raw)
From: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
Ensures that client->driver is set to NULL if the probe() returns an
error (this keeps client->driver and client->dev.driver in sync).
Signed-off-by: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
---
Hans, I've updated your patch a bit to make i2c_device_probe() look
more like i2c_device_remove(); hope you don't mind.
David, this fix looks correct to me, I'll send it to Linus quickly if
you have no objection.
drivers/i2c/i2c-core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- linux-2.6.25-rc4.orig/drivers/i2c/i2c-core.c 2008-03-08 17:57:52.000000000 +0100
+++ linux-2.6.25-rc4/drivers/i2c/i2c-core.c 2008-03-08 21:43:11.000000000 +0100
@@ -90,12 +90,15 @@ static int i2c_device_probe(struct devic
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_driver *driver = to_i2c_driver(dev->driver);
+ int status;
if (!driver->probe)
return -ENODEV;
- client->driver = driver;
dev_dbg(dev, "probe\n");
- return driver->probe(client);
+ status = driver->probe(client);
+ if (status == 0)
+ client->driver = driver;
+ return status;
}
static int i2c_device_remove(struct device *dev)
--
Jean Delvare
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
next reply other threads:[~2008-03-08 20:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-08 20:49 Jean Delvare [this message]
[not found] ` <20080308214911.5344eba9-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-03-08 21:12 ` [PATCH] i2c: Keep client->driver and client->dev.driver in sync David Brownell
[not found] ` <200803081312.36524.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-03-09 10:16 ` Jean Delvare
[not found] ` <20080309111626.1d531cd4-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-03-09 15:23 ` David Brownell
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=20080308214911.5344eba9@hyperion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@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