linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: rely on driver core when sanitizing devices
@ 2014-01-21 16:48 Wolfram Sang
  2014-01-24 18:53 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2014-01-21 16:48 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, Mika Westerberg, Wolfram Sang

Commit 0998d0631001 (device-core: Ensure drvdata = NULL when no driver
is bound) modified the driver core to always clear .driver and .drvdata
on remove or probe error. No need for the I2C core to do it.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---
 drivers/i2c/i2c-core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d74c0b3..dd3a4db 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -256,10 +256,9 @@ static int i2c_device_probe(struct device *dev)
 
 	acpi_dev_pm_attach(&client->dev, true);
 	status = driver->probe(client, i2c_match_id(driver->id_table, client));
-	if (status) {
-		i2c_set_clientdata(client, NULL);
+	if (status)
 		acpi_dev_pm_detach(&client->dev, true);
-	}
+
 	return status;
 }
 
@@ -267,7 +266,7 @@ static int i2c_device_remove(struct device *dev)
 {
 	struct i2c_client	*client = i2c_verify_client(dev);
 	struct i2c_driver	*driver;
-	int			status;
+	int status = 0;
 
 	if (!client || !dev->driver)
 		return 0;
@@ -276,12 +275,8 @@ static int i2c_device_remove(struct device *dev)
 	if (driver->remove) {
 		dev_dbg(dev, "remove\n");
 		status = driver->remove(client);
-	} else {
-		dev->driver = NULL;
-		status = 0;
 	}
-	if (status == 0)
-		i2c_set_clientdata(client, NULL);
+
 	acpi_dev_pm_detach(&client->dev, true);
 	return status;
 }
-- 
1.8.5.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: rely on driver core when sanitizing devices
  2014-01-21 16:48 [PATCH] i2c: rely on driver core when sanitizing devices Wolfram Sang
@ 2014-01-24 18:53 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2014-01-24 18:53 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, Mika Westerberg

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

On Tue, Jan 21, 2014 at 05:48:34PM +0100, Wolfram Sang wrote:
> Commit 0998d0631001 (device-core: Ensure drvdata = NULL when no driver
> is bound) modified the driver core to always clear .driver and .drvdata
> on remove or probe error. No need for the I2C core to do it.
> 
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

Applied to for-current, thanks!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-24 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-21 16:48 [PATCH] i2c: rely on driver core when sanitizing devices Wolfram Sang
2014-01-24 18:53 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).