aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2014-01-21 11:48:34 -0500
committerWolfram Sang <wsa@the-dreams.de>2014-01-24 13:52:25 -0500
commit72fa818e8a3145ab3e345acbd3eccfa71a120702 (patch)
tree052a8a84656ea64ca4383ec4804f99b7e65f9cc2 /drivers/i2c/i2c-core.c
parent21d0b7c0faf2f780afa2bef72cc921ace10a7356 (diff)
i2c: rely on driver core when sanitizing devices
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>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d74c0b34248e..dd3a4dbb4718 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)
256 256
257 acpi_dev_pm_attach(&client->dev, true); 257 acpi_dev_pm_attach(&client->dev, true);
258 status = driver->probe(client, i2c_match_id(driver->id_table, client)); 258 status = driver->probe(client, i2c_match_id(driver->id_table, client));
259 if (status) { 259 if (status)
260 i2c_set_clientdata(client, NULL);
261 acpi_dev_pm_detach(&client->dev, true); 260 acpi_dev_pm_detach(&client->dev, true);
262 } 261
263 return status; 262 return status;
264} 263}
265 264
@@ -267,7 +266,7 @@ static int i2c_device_remove(struct device *dev)
267{ 266{
268 struct i2c_client *client = i2c_verify_client(dev); 267 struct i2c_client *client = i2c_verify_client(dev);
269 struct i2c_driver *driver; 268 struct i2c_driver *driver;
270 int status; 269 int status = 0;
271 270
272 if (!client || !dev->driver) 271 if (!client || !dev->driver)
273 return 0; 272 return 0;
@@ -276,12 +275,8 @@ static int i2c_device_remove(struct device *dev)
276 if (driver->remove) { 275 if (driver->remove) {
277 dev_dbg(dev, "remove\n"); 276 dev_dbg(dev, "remove\n");
278 status = driver->remove(client); 277 status = driver->remove(client);
279 } else {
280 dev->driver = NULL;
281 status = 0;
282 } 278 }
283 if (status == 0) 279
284 i2c_set_clientdata(client, NULL);
285 acpi_dev_pm_detach(&client->dev, true); 280 acpi_dev_pm_detach(&client->dev, true);
286 return status; 281 return status;
287} 282}