aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-18 18:50:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-18 18:50:07 -0500
commit13509c3a9d20a9df93dc9b944e8bd20fe1b454a7 (patch)
treed7a97d1d10e88bcb93852cb0143a000710e9e246 /drivers/i2c/i2c-core.c
parent1ea406c0e08c717241275064046d29b5bac1b1db (diff)
parentcfff1f4a9367bfe0d88413e8807f8369e9564729 (diff)
Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c changes from Wolfram Sang: - new drivers for exynos5, bcm kona, and st micro - bigger overhauls for drivers mxs and rcar - typical driver bugfixes, cleanups, improvements - got rid of the superfluous 'driver' member in i2c_client struct This touches a few drivers in other subsystems. All acked. * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (38 commits) i2c: bcm-kona: fix error return code in bcm_kona_i2c_probe() i2c: i2c-eg20t: do not print error message in syslog if no ACK received i2c: bcm-kona: Introduce Broadcom I2C Driver i2c: cbus-gpio: Fix device tree binding i2c: wmt: add missing clk_disable_unprepare() on error i2c: designware: add new ACPI IDs i2c: i801: Add Device IDs for Intel Wildcat Point-LP PCH i2c: exynos5: Remove incorrect clk_disable_unprepare i2c: i2c-st: Add ST I2C controller i2c: exynos5: add High Speed I2C controller driver i2c: rcar: fixup rcar type naming i2c: scmi: remove some bogus NULL checks i2c: sh_mobile & rcar: Enable the driver on all ARM platforms i2c: sh_mobile: Convert to clk_prepare/unprepare i2c: mux: gpio: use reg value for i2c_add_mux_adapter i2c: mux: gpio: use gpio_set_value_cansleep() i2c: Include linux/of.h header i2c: mxs: Fix PIO mode on i.MX23 i2c: mxs: Rework the PIO mode operation i2c: mxs: distinguish i.MX23 and i.MX28 based I2C controller ...
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 75ba8608383e..5923cfa390c8 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -248,7 +248,7 @@ static int i2c_device_probe(struct device *dev)
248 driver = to_i2c_driver(dev->driver); 248 driver = to_i2c_driver(dev->driver);
249 if (!driver->probe || !driver->id_table) 249 if (!driver->probe || !driver->id_table)
250 return -ENODEV; 250 return -ENODEV;
251 client->driver = driver; 251
252 if (!device_can_wakeup(&client->dev)) 252 if (!device_can_wakeup(&client->dev))
253 device_init_wakeup(&client->dev, 253 device_init_wakeup(&client->dev,
254 client->flags & I2C_CLIENT_WAKE); 254 client->flags & I2C_CLIENT_WAKE);
@@ -257,7 +257,6 @@ static int i2c_device_probe(struct device *dev)
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 client->driver = NULL;
261 i2c_set_clientdata(client, NULL); 260 i2c_set_clientdata(client, NULL);
262 acpi_dev_pm_detach(&client->dev, true); 261 acpi_dev_pm_detach(&client->dev, true);
263 } 262 }
@@ -281,10 +280,8 @@ static int i2c_device_remove(struct device *dev)
281 dev->driver = NULL; 280 dev->driver = NULL;
282 status = 0; 281 status = 0;
283 } 282 }
284 if (status == 0) { 283 if (status == 0)
285 client->driver = NULL;
286 i2c_set_clientdata(client, NULL); 284 i2c_set_clientdata(client, NULL);
287 }
288 acpi_dev_pm_detach(&client->dev, true); 285 acpi_dev_pm_detach(&client->dev, true);
289 return status; 286 return status;
290} 287}
@@ -1614,9 +1611,14 @@ static int i2c_cmd(struct device *dev, void *_arg)
1614{ 1611{
1615 struct i2c_client *client = i2c_verify_client(dev); 1612 struct i2c_client *client = i2c_verify_client(dev);
1616 struct i2c_cmd_arg *arg = _arg; 1613 struct i2c_cmd_arg *arg = _arg;
1614 struct i2c_driver *driver;
1615
1616 if (!client || !client->dev.driver)
1617 return 0;
1617 1618
1618 if (client && client->driver && client->driver->command) 1619 driver = to_i2c_driver(client->dev.driver);
1619 client->driver->command(client, arg->cmd, arg->arg); 1620 if (driver->command)
1621 driver->command(client, arg->cmd, arg->arg);
1620 return 0; 1622 return 0;
1621} 1623}
1622 1624