aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-06-03 18:44:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-06-03 18:44:43 -0400
commitceadda057c000fa82e6bbe508923d8181414dea7 (patch)
treec57eeb217dba5d74c3e46d483f10714f5ac7c518 /drivers
parent95619be590638bd48469ac81c0f6236f349f5640 (diff)
parentfbae3fb1546e199ab0cd185348f8124411a1ca9d (diff)
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: i2c: Remove all i2c_set_clientdata(client, NULL) in drivers i2c/busses: Move two drivers to embedded section i2c: Rename i2c_check_addr to i2c_check_addr_busy i2c: Document reserved I2C addresses i2c: Check for address validity on client registration i2c: Share the I2C device presence detection code Documentation/i2c: Checkpatch cleanup
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/adt7411.c2
-rw-r--r--drivers/hwmon/asc7621.c2
-rw-r--r--drivers/hwmon/f75375s.c2
-rw-r--r--drivers/hwmon/g760a.c2
-rw-r--r--drivers/hwmon/lm73.c1
-rw-r--r--drivers/hwmon/lm75.c2
-rw-r--r--drivers/hwmon/lm95241.c1
-rw-r--r--drivers/hwmon/tmp102.c2
-rw-r--r--drivers/hwmon/tmp421.c2
-rw-r--r--drivers/hwmon/w83781d.c2
-rw-r--r--drivers/i2c/busses/Kconfig40
-rw-r--r--drivers/i2c/busses/Makefile6
-rw-r--r--drivers/i2c/i2c-core.c179
-rw-r--r--drivers/i2c/i2c-smbus.c1
-rw-r--r--drivers/input/keyboard/adp5588-keys.c1
-rw-r--r--drivers/input/keyboard/lm8323.c2
-rw-r--r--drivers/input/keyboard/max7359_keypad.c1
-rw-r--r--drivers/input/keyboard/qt2160.c1
-rw-r--r--drivers/input/keyboard/tca6416-keypad.c2
-rw-r--r--drivers/input/misc/ad714x-i2c.c1
-rw-r--r--drivers/input/misc/pcf8574_keypad.c2
-rw-r--r--drivers/input/mouse/synaptics_i2c.c1
-rw-r--r--drivers/input/touchscreen/ad7879.c5
-rw-r--r--drivers/input/touchscreen/eeti_ts.c2
-rw-r--r--drivers/input/touchscreen/mcs5000_ts.c1
-rw-r--r--drivers/input/touchscreen/tsc2007.c2
-rw-r--r--drivers/leds/leds-bd2802.c2
-rw-r--r--drivers/leds/leds-lp3944.c1
-rw-r--r--drivers/leds/leds-pca9532.c5
-rw-r--r--drivers/leds/leds-pca955x.c2
-rw-r--r--drivers/macintosh/therm_adt746x.c2
-rw-r--r--drivers/macintosh/windfarm_lm75_sensor.c5
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c1
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c1
-rw-r--r--drivers/media/radio/si470x/radio-si470x-i2c.c1
-rw-r--r--drivers/media/video/mt9m001.c2
-rw-r--r--drivers/media/video/mt9m111.c2
-rw-r--r--drivers/media/video/mt9t031.c2
-rw-r--r--drivers/media/video/mt9t112.c2
-rw-r--r--drivers/media/video/mt9v022.c2
-rw-r--r--drivers/media/video/ov772x.c2
-rw-r--r--drivers/media/video/ov9640.c2
-rw-r--r--drivers/media/video/rj54n1cb0c.c2
-rw-r--r--drivers/media/video/tcm825x.c8
-rw-r--r--drivers/media/video/tw9910.c2
-rw-r--r--drivers/mfd/88pm860x-i2c.c2
-rw-r--r--drivers/mfd/ab3100-core.c2
-rw-r--r--drivers/mfd/ab3550-core.c1
-rw-r--r--drivers/mfd/adp5520.c2
-rw-r--r--drivers/mfd/da903x.c2
-rw-r--r--drivers/mfd/max8925-i2c.c1
-rw-r--r--drivers/mfd/menelaus.c2
-rw-r--r--drivers/mfd/pcf50633-core.c2
-rw-r--r--drivers/mfd/tc35892.c2
-rw-r--r--drivers/mfd/tps65010.c1
-rw-r--r--drivers/mfd/wm8350-i2c.c2
-rw-r--r--drivers/mfd/wm8400-core.c2
-rw-r--r--drivers/misc/eeprom/at24.c1
-rw-r--r--drivers/mtd/maps/pismo.c2
-rw-r--r--drivers/power/max17040_battery.c2
-rw-r--r--drivers/regulator/lp3971.c2
-rw-r--r--drivers/regulator/max1586.c1
-rw-r--r--drivers/regulator/max8649.c2
-rw-r--r--drivers/regulator/max8660.c1
-rw-r--r--drivers/regulator/tps65023-regulator.c3
-rw-r--r--drivers/rtc/rtc-ds1374.c2
-rw-r--r--drivers/rtc/rtc-rx8025.c2
-rw-r--r--drivers/rtc/rtc-s35390a.c2
-rw-r--r--drivers/staging/dream/synaptics_i2c_rmi.c2
-rw-r--r--drivers/staging/go7007/wis-saa7113.c2
-rw-r--r--drivers/staging/go7007/wis-saa7115.c2
-rw-r--r--drivers/staging/go7007/wis-sony-tuner.c1
-rw-r--r--drivers/staging/go7007/wis-tw2804.c1
-rw-r--r--drivers/staging/go7007/wis-tw9903.c2
-rw-r--r--drivers/staging/iio/adc/max1363_core.c2
-rw-r--r--drivers/staging/iio/light/tsl2563.c2
-rw-r--r--drivers/video/backlight/adp8860_bl.c2
-rw-r--r--drivers/video/backlight/tosa_bl.c2
78 files changed, 137 insertions, 233 deletions
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
index 4086c7257f91..f13c843a2964 100644
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -316,7 +316,6 @@ static int __devinit adt7411_probe(struct i2c_client *client,
316 exit_remove: 316 exit_remove:
317 sysfs_remove_group(&client->dev.kobj, &adt7411_attr_grp); 317 sysfs_remove_group(&client->dev.kobj, &adt7411_attr_grp);
318 exit_free: 318 exit_free:
319 i2c_set_clientdata(client, NULL);
320 kfree(data); 319 kfree(data);
321 return ret; 320 return ret;
322} 321}
@@ -327,7 +326,6 @@ static int __devexit adt7411_remove(struct i2c_client *client)
327 326
328 hwmon_device_unregister(data->hwmon_dev); 327 hwmon_device_unregister(data->hwmon_dev);
329 sysfs_remove_group(&client->dev.kobj, &adt7411_attr_grp); 328 sysfs_remove_group(&client->dev.kobj, &adt7411_attr_grp);
330 i2c_set_clientdata(client, NULL);
331 kfree(data); 329 kfree(data);
332 return 0; 330 return 0;
333} 331}
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index 0f388adc6187..3b973f30b1f6 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -1141,7 +1141,6 @@ exit_remove:
1141 &(asc7621_params[i].sda.dev_attr)); 1141 &(asc7621_params[i].sda.dev_attr));
1142 } 1142 }
1143 1143
1144 i2c_set_clientdata(client, NULL);
1145 kfree(data); 1144 kfree(data);
1146 return err; 1145 return err;
1147} 1146}
@@ -1196,7 +1195,6 @@ static int asc7621_remove(struct i2c_client *client)
1196 &(asc7621_params[i].sda.dev_attr)); 1195 &(asc7621_params[i].sda.dev_attr));
1197 } 1196 }
1198 1197
1199 i2c_set_clientdata(client, NULL);
1200 kfree(data); 1198 kfree(data);
1201 return 0; 1199 return 0;
1202} 1200}
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index bad2cf3ef4a4..0f58ecc5334d 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -662,7 +662,6 @@ exit_remove:
662 sysfs_remove_group(&client->dev.kobj, &f75375_group); 662 sysfs_remove_group(&client->dev.kobj, &f75375_group);
663exit_free: 663exit_free:
664 kfree(data); 664 kfree(data);
665 i2c_set_clientdata(client, NULL);
666 return err; 665 return err;
667} 666}
668 667
@@ -672,7 +671,6 @@ static int f75375_remove(struct i2c_client *client)
672 hwmon_device_unregister(data->hwmon_dev); 671 hwmon_device_unregister(data->hwmon_dev);
673 sysfs_remove_group(&client->dev.kobj, &f75375_group); 672 sysfs_remove_group(&client->dev.kobj, &f75375_group);
674 kfree(data); 673 kfree(data);
675 i2c_set_clientdata(client, NULL);
676 return 0; 674 return 0;
677} 675}
678 676
diff --git a/drivers/hwmon/g760a.c b/drivers/hwmon/g760a.c
index 09ea12e0a551..1f63d1a3af5e 100644
--- a/drivers/hwmon/g760a.c
+++ b/drivers/hwmon/g760a.c
@@ -236,7 +236,6 @@ error_hwmon_device_register:
236 sysfs_remove_group(&client->dev.kobj, &g760a_group); 236 sysfs_remove_group(&client->dev.kobj, &g760a_group);
237error_sysfs_create_group: 237error_sysfs_create_group:
238 kfree(data); 238 kfree(data);
239 i2c_set_clientdata(client, NULL);
240 239
241 return err; 240 return err;
242} 241}
@@ -247,7 +246,6 @@ static int g760a_remove(struct i2c_client *client)
247 hwmon_device_unregister(data->hwmon_dev); 246 hwmon_device_unregister(data->hwmon_dev);
248 sysfs_remove_group(&client->dev.kobj, &g760a_group); 247 sysfs_remove_group(&client->dev.kobj, &g760a_group);
249 kfree(data); 248 kfree(data);
250 i2c_set_clientdata(client, NULL);
251 249
252 return 0; 250 return 0;
253} 251}
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 4d1b76bc8148..29b9030d42c3 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -136,7 +136,6 @@ static int lm73_remove(struct i2c_client *client)
136 136
137 hwmon_device_unregister(hwmon_dev); 137 hwmon_device_unregister(hwmon_dev);
138 sysfs_remove_group(&client->dev.kobj, &lm73_group); 138 sysfs_remove_group(&client->dev.kobj, &lm73_group);
139 i2c_set_clientdata(client, NULL);
140 return 0; 139 return 0;
141} 140}
142 141
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 56463428a419..393f354f92a4 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -192,7 +192,6 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
192exit_remove: 192exit_remove:
193 sysfs_remove_group(&client->dev.kobj, &lm75_group); 193 sysfs_remove_group(&client->dev.kobj, &lm75_group);
194exit_free: 194exit_free:
195 i2c_set_clientdata(client, NULL);
196 kfree(data); 195 kfree(data);
197 return status; 196 return status;
198} 197}
@@ -204,7 +203,6 @@ static int lm75_remove(struct i2c_client *client)
204 hwmon_device_unregister(data->hwmon_dev); 203 hwmon_device_unregister(data->hwmon_dev);
205 sysfs_remove_group(&client->dev.kobj, &lm75_group); 204 sysfs_remove_group(&client->dev.kobj, &lm75_group);
206 lm75_write_value(client, LM75_REG_CONF, data->orig_conf); 205 lm75_write_value(client, LM75_REG_CONF, data->orig_conf);
207 i2c_set_clientdata(client, NULL);
208 kfree(data); 206 kfree(data);
209 return 0; 207 return 0;
210} 208}
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
index 8fc8eb8cba47..94741d42112d 100644
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -399,7 +399,6 @@ static int lm95241_remove(struct i2c_client *client)
399 hwmon_device_unregister(data->hwmon_dev); 399 hwmon_device_unregister(data->hwmon_dev);
400 sysfs_remove_group(&client->dev.kobj, &lm95241_group); 400 sysfs_remove_group(&client->dev.kobj, &lm95241_group);
401 401
402 i2c_set_clientdata(client, NULL);
403 kfree(data); 402 kfree(data);
404 return 0; 403 return 0;
405} 404}
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index 8013895a1faf..93187c3cb5e7 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -224,7 +224,6 @@ fail_remove_sysfs:
224fail_restore_config: 224fail_restore_config:
225 tmp102_write_reg(client, TMP102_CONF_REG, tmp102->config_orig); 225 tmp102_write_reg(client, TMP102_CONF_REG, tmp102->config_orig);
226fail_free: 226fail_free:
227 i2c_set_clientdata(client, NULL);
228 kfree(tmp102); 227 kfree(tmp102);
229 228
230 return status; 229 return status;
@@ -247,7 +246,6 @@ static int __devexit tmp102_remove(struct i2c_client *client)
247 config | TMP102_CONF_SD); 246 config | TMP102_CONF_SD);
248 } 247 }
249 248
250 i2c_set_clientdata(client, NULL);
251 kfree(tmp102); 249 kfree(tmp102);
252 250
253 return 0; 251 return 0;
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 738c472ece27..6b4165c12092 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -295,7 +295,6 @@ exit_remove:
295 sysfs_remove_group(&client->dev.kobj, &tmp421_group); 295 sysfs_remove_group(&client->dev.kobj, &tmp421_group);
296 296
297exit_free: 297exit_free:
298 i2c_set_clientdata(client, NULL);
299 kfree(data); 298 kfree(data);
300 299
301 return err; 300 return err;
@@ -308,7 +307,6 @@ static int tmp421_remove(struct i2c_client *client)
308 hwmon_device_unregister(data->hwmon_dev); 307 hwmon_device_unregister(data->hwmon_dev);
309 sysfs_remove_group(&client->dev.kobj, &tmp421_group); 308 sysfs_remove_group(&client->dev.kobj, &tmp421_group);
310 309
311 i2c_set_clientdata(client, NULL);
312 kfree(data); 310 kfree(data);
313 311
314 return 0; 312 return 0;
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 32d4adee73db..c84b9b4e6960 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1197,7 +1197,6 @@ ERROR4:
1197 if (data->lm75[1]) 1197 if (data->lm75[1])
1198 i2c_unregister_device(data->lm75[1]); 1198 i2c_unregister_device(data->lm75[1]);
1199ERROR3: 1199ERROR3:
1200 i2c_set_clientdata(client, NULL);
1201 kfree(data); 1200 kfree(data);
1202ERROR1: 1201ERROR1:
1203 return err; 1202 return err;
@@ -1219,7 +1218,6 @@ w83781d_remove(struct i2c_client *client)
1219 if (data->lm75[1]) 1218 if (data->lm75[1])
1220 i2c_unregister_device(data->lm75[1]); 1219 i2c_unregister_device(data->lm75[1]);
1221 1220
1222 i2c_set_clientdata(client, NULL);
1223 kfree(data); 1221 kfree(data);
1224 1222
1225 return 0; 1223 return 0;
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 87ab0568bb0e..bceafbfa7268 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -475,6 +475,26 @@ config I2C_PASEMI
475 help 475 help
476 Supports the PA Semi PWRficient on-chip SMBus interfaces. 476 Supports the PA Semi PWRficient on-chip SMBus interfaces.
477 477
478config I2C_PCA_PLATFORM
479 tristate "PCA9564/PCA9665 as platform device"
480 select I2C_ALGOPCA
481 default n
482 help
483 This driver supports a memory mapped Philips PCA9564/PCA9665
484 parallel bus to I2C bus controller.
485
486 This driver can also be built as a module. If so, the module
487 will be called i2c-pca-platform.
488
489config I2C_PMCMSP
490 tristate "PMC MSP I2C TWI Controller"
491 depends on PMC_MSP
492 help
493 This driver supports the PMC TWI controller on MSP devices.
494
495 This driver can also be built as module. If so, the module
496 will be called i2c-pmcmsp.
497
478config I2C_PNX 498config I2C_PNX
479 tristate "I2C bus support for Philips PNX targets" 499 tristate "I2C bus support for Philips PNX targets"
480 depends on ARCH_PNX4008 500 depends on ARCH_PNX4008
@@ -711,26 +731,6 @@ config I2C_PCA_ISA
711 delays when I2C/SMBus chip drivers are loaded (e.g. at boot 731 delays when I2C/SMBus chip drivers are loaded (e.g. at boot
712 time). If unsure, say N. 732 time). If unsure, say N.
713 733
714config I2C_PCA_PLATFORM
715 tristate "PCA9564/PCA9665 as platform device"
716 select I2C_ALGOPCA
717 default n
718 help
719 This driver supports a memory mapped Philips PCA9564/PCA9665
720 parallel bus to I2C bus controller.
721
722 This driver can also be built as a module. If so, the module
723 will be called i2c-pca-platform.
724
725config I2C_PMCMSP
726 tristate "PMC MSP I2C TWI Controller"
727 depends on PMC_MSP
728 help
729 This driver supports the PMC TWI controller on MSP devices.
730
731 This driver can also be built as module. If so, the module
732 will be called i2c-pmcmsp.
733
734config I2C_SIBYTE 734config I2C_SIBYTE
735 tristate "SiByte SMBus interface" 735 tristate "SiByte SMBus interface"
736 depends on SIBYTE_SB1xxx_SOC 736 depends on SIBYTE_SB1xxx_SOC
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 097236f631e8..936880bd1dc5 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -27,7 +27,7 @@ obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o
27obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o 27obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o
28obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o 28obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o
29 29
30# Embebbed system I2C/SMBus host controller drivers 30# Embedded system I2C/SMBus host controller drivers
31obj-$(CONFIG_I2C_AT91) += i2c-at91.o 31obj-$(CONFIG_I2C_AT91) += i2c-at91.o
32obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o 32obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
33obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o 33obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
@@ -46,6 +46,8 @@ obj-$(CONFIG_I2C_NOMADIK) += i2c-nomadik.o
46obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o 46obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o
47obj-$(CONFIG_I2C_OMAP) += i2c-omap.o 47obj-$(CONFIG_I2C_OMAP) += i2c-omap.o
48obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o 48obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o
49obj-$(CONFIG_I2C_PCA_PLATFORM) += i2c-pca-platform.o
50obj-$(CONFIG_I2C_PMCMSP) += i2c-pmcmsp.o
49obj-$(CONFIG_I2C_PNX) += i2c-pnx.o 51obj-$(CONFIG_I2C_PNX) += i2c-pnx.o
50obj-$(CONFIG_I2C_PXA) += i2c-pxa.o 52obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
51obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o 53obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
@@ -68,8 +70,6 @@ obj-$(CONFIG_I2C_TINY_USB) += i2c-tiny-usb.o
68obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o 70obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o
69obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o 71obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
70obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o 72obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
71obj-$(CONFIG_I2C_PCA_PLATFORM) += i2c-pca-platform.o
72obj-$(CONFIG_I2C_PMCMSP) += i2c-pmcmsp.o
73obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o 73obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
74obj-$(CONFIG_I2C_STUB) += i2c-stub.o 74obj-$(CONFIG_I2C_STUB) += i2c-stub.o
75obj-$(CONFIG_SCx200_ACB) += scx200_acb.o 75obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e0f833cca3f1..1cca2631e5b3 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -47,7 +47,6 @@ static DEFINE_MUTEX(core_lock);
47static DEFINE_IDR(i2c_adapter_idr); 47static DEFINE_IDR(i2c_adapter_idr);
48 48
49static struct device_type i2c_client_type; 49static struct device_type i2c_client_type;
50static int i2c_check_addr(struct i2c_adapter *adapter, int addr);
51static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); 50static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
52 51
53/* ------------------------------------------------------------------------- */ 52/* ------------------------------------------------------------------------- */
@@ -371,6 +370,59 @@ struct i2c_client *i2c_verify_client(struct device *dev)
371EXPORT_SYMBOL(i2c_verify_client); 370EXPORT_SYMBOL(i2c_verify_client);
372 371
373 372
373/* This is a permissive address validity check, I2C address map constraints
374 * are purposedly not enforced, except for the general call address. */
375static int i2c_check_client_addr_validity(const struct i2c_client *client)
376{
377 if (client->flags & I2C_CLIENT_TEN) {
378 /* 10-bit address, all values are valid */
379 if (client->addr > 0x3ff)
380 return -EINVAL;
381 } else {
382 /* 7-bit address, reject the general call address */
383 if (client->addr == 0x00 || client->addr > 0x7f)
384 return -EINVAL;
385 }
386 return 0;
387}
388
389/* And this is a strict address validity check, used when probing. If a
390 * device uses a reserved address, then it shouldn't be probed. 7-bit
391 * addressing is assumed, 10-bit address devices are rare and should be
392 * explicitly enumerated. */
393static int i2c_check_addr_validity(unsigned short addr)
394{
395 /*
396 * Reserved addresses per I2C specification:
397 * 0x00 General call address / START byte
398 * 0x01 CBUS address
399 * 0x02 Reserved for different bus format
400 * 0x03 Reserved for future purposes
401 * 0x04-0x07 Hs-mode master code
402 * 0x78-0x7b 10-bit slave addressing
403 * 0x7c-0x7f Reserved for future purposes
404 */
405 if (addr < 0x08 || addr > 0x77)
406 return -EINVAL;
407 return 0;
408}
409
410static int __i2c_check_addr_busy(struct device *dev, void *addrp)
411{
412 struct i2c_client *client = i2c_verify_client(dev);
413 int addr = *(int *)addrp;
414
415 if (client && client->addr == addr)
416 return -EBUSY;
417 return 0;
418}
419
420static int i2c_check_addr_busy(struct i2c_adapter *adapter, int addr)
421{
422 return device_for_each_child(&adapter->dev, &addr,
423 __i2c_check_addr_busy);
424}
425
374/** 426/**
375 * i2c_new_device - instantiate an i2c device 427 * i2c_new_device - instantiate an i2c device
376 * @adap: the adapter managing the device 428 * @adap: the adapter managing the device
@@ -410,8 +462,16 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
410 462
411 strlcpy(client->name, info->type, sizeof(client->name)); 463 strlcpy(client->name, info->type, sizeof(client->name));
412 464
465 /* Check for address validity */
466 status = i2c_check_client_addr_validity(client);
467 if (status) {
468 dev_err(&adap->dev, "Invalid %d-bit I2C address 0x%02hx\n",
469 client->flags & I2C_CLIENT_TEN ? 10 : 7, client->addr);
470 goto out_err_silent;
471 }
472
413 /* Check for address business */ 473 /* Check for address business */
414 status = i2c_check_addr(adap, client->addr); 474 status = i2c_check_addr_busy(adap, client->addr);
415 if (status) 475 if (status)
416 goto out_err; 476 goto out_err;
417 477
@@ -436,6 +496,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
436out_err: 496out_err:
437 dev_err(&adap->dev, "Failed to register i2c client %s at 0x%02x " 497 dev_err(&adap->dev, "Failed to register i2c client %s at 0x%02x "
438 "(%d)\n", client->name, client->addr, status); 498 "(%d)\n", client->name, client->addr, status);
499out_err_silent:
439 kfree(client); 500 kfree(client);
440 return NULL; 501 return NULL;
441} 502}
@@ -561,15 +622,9 @@ i2c_sysfs_new_device(struct device *dev, struct device_attribute *attr,
561 return -EINVAL; 622 return -EINVAL;
562 } 623 }
563 624
564 if (info.addr < 0x03 || info.addr > 0x77) {
565 dev_err(dev, "%s: Invalid I2C address 0x%hx\n", "new_device",
566 info.addr);
567 return -EINVAL;
568 }
569
570 client = i2c_new_device(adap, &info); 625 client = i2c_new_device(adap, &info);
571 if (!client) 626 if (!client)
572 return -EEXIST; 627 return -EINVAL;
573 628
574 /* Keep track of the added device */ 629 /* Keep track of the added device */
575 i2c_lock_adapter(adap); 630 i2c_lock_adapter(adap);
@@ -1024,21 +1079,6 @@ EXPORT_SYMBOL(i2c_del_driver);
1024 1079
1025/* ------------------------------------------------------------------------- */ 1080/* ------------------------------------------------------------------------- */
1026 1081
1027static int __i2c_check_addr(struct device *dev, void *addrp)
1028{
1029 struct i2c_client *client = i2c_verify_client(dev);
1030 int addr = *(int *)addrp;
1031
1032 if (client && client->addr == addr)
1033 return -EBUSY;
1034 return 0;
1035}
1036
1037static int i2c_check_addr(struct i2c_adapter *adapter, int addr)
1038{
1039 return device_for_each_child(&adapter->dev, &addr, __i2c_check_addr);
1040}
1041
1042/** 1082/**
1043 * i2c_use_client - increments the reference count of the i2c client structure 1083 * i2c_use_client - increments the reference count of the i2c client structure
1044 * @client: the client being referenced 1084 * @client: the client being referenced
@@ -1277,6 +1317,41 @@ EXPORT_SYMBOL(i2c_master_recv);
1277 * ---------------------------------------------------- 1317 * ----------------------------------------------------
1278 */ 1318 */
1279 1319
1320/*
1321 * Legacy default probe function, mostly relevant for SMBus. The default
1322 * probe method is a quick write, but it is known to corrupt the 24RF08
1323 * EEPROMs due to a state machine bug, and could also irreversibly
1324 * write-protect some EEPROMs, so for address ranges 0x30-0x37 and 0x50-0x5f,
1325 * we use a short byte read instead. Also, some bus drivers don't implement
1326 * quick write, so we fallback to a byte read in that case too.
1327 * On x86, there is another special case for FSC hardware monitoring chips,
1328 * which want regular byte reads (address 0x73.) Fortunately, these are the
1329 * only known chips using this I2C address on PC hardware.
1330 * Returns 1 if probe succeeded, 0 if not.
1331 */
1332static int i2c_default_probe(struct i2c_adapter *adap, unsigned short addr)
1333{
1334 int err;
1335 union i2c_smbus_data dummy;
1336
1337#ifdef CONFIG_X86
1338 if (addr == 0x73 && (adap->class & I2C_CLASS_HWMON)
1339 && i2c_check_functionality(adap, I2C_FUNC_SMBUS_READ_BYTE_DATA))
1340 err = i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_READ, 0,
1341 I2C_SMBUS_BYTE_DATA, &dummy);
1342 else
1343#endif
1344 if ((addr & ~0x07) == 0x30 || (addr & ~0x0f) == 0x50
1345 || !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK))
1346 err = i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_READ, 0,
1347 I2C_SMBUS_BYTE, &dummy);
1348 else
1349 err = i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_WRITE, 0,
1350 I2C_SMBUS_QUICK, NULL);
1351
1352 return err >= 0;
1353}
1354
1280static int i2c_detect_address(struct i2c_client *temp_client, 1355static int i2c_detect_address(struct i2c_client *temp_client,
1281 struct i2c_driver *driver) 1356 struct i2c_driver *driver)
1282{ 1357{
@@ -1286,34 +1361,20 @@ static int i2c_detect_address(struct i2c_client *temp_client,
1286 int err; 1361 int err;
1287 1362
1288 /* Make sure the address is valid */ 1363 /* Make sure the address is valid */
1289 if (addr < 0x03 || addr > 0x77) { 1364 err = i2c_check_addr_validity(addr);
1365 if (err) {
1290 dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", 1366 dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
1291 addr); 1367 addr);
1292 return -EINVAL; 1368 return err;
1293 } 1369 }
1294 1370
1295 /* Skip if already in use */ 1371 /* Skip if already in use */
1296 if (i2c_check_addr(adapter, addr)) 1372 if (i2c_check_addr_busy(adapter, addr))
1297 return 0; 1373 return 0;
1298 1374
1299 /* Make sure there is something at this address */ 1375 /* Make sure there is something at this address */
1300 if (addr == 0x73 && (adapter->class & I2C_CLASS_HWMON)) { 1376 if (!i2c_default_probe(adapter, addr))
1301 /* Special probe for FSC hwmon chips */ 1377 return 0;
1302 union i2c_smbus_data dummy;
1303
1304 if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_READ, 0,
1305 I2C_SMBUS_BYTE_DATA, &dummy) < 0)
1306 return 0;
1307 } else {
1308 if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
1309 I2C_SMBUS_QUICK, NULL) < 0)
1310 return 0;
1311
1312 /* Prevent 24RF08 corruption */
1313 if ((addr & ~0x0f) == 0x50)
1314 i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
1315 I2C_SMBUS_QUICK, NULL);
1316 }
1317 1378
1318 /* Finally call the custom detection function */ 1379 /* Finally call the custom detection function */
1319 memset(&info, 0, sizeof(struct i2c_board_info)); 1380 memset(&info, 0, sizeof(struct i2c_board_info));
@@ -1407,42 +1468,22 @@ i2c_new_probed_device(struct i2c_adapter *adap,
1407 1468
1408 for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) { 1469 for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) {
1409 /* Check address validity */ 1470 /* Check address validity */
1410 if (addr_list[i] < 0x03 || addr_list[i] > 0x77) { 1471 if (i2c_check_addr_validity(addr_list[i]) < 0) {
1411 dev_warn(&adap->dev, "Invalid 7-bit address " 1472 dev_warn(&adap->dev, "Invalid 7-bit address "
1412 "0x%02x\n", addr_list[i]); 1473 "0x%02x\n", addr_list[i]);
1413 continue; 1474 continue;
1414 } 1475 }
1415 1476
1416 /* Check address availability */ 1477 /* Check address availability */
1417 if (i2c_check_addr(adap, addr_list[i])) { 1478 if (i2c_check_addr_busy(adap, addr_list[i])) {
1418 dev_dbg(&adap->dev, "Address 0x%02x already in " 1479 dev_dbg(&adap->dev, "Address 0x%02x already in "
1419 "use, not probing\n", addr_list[i]); 1480 "use, not probing\n", addr_list[i]);
1420 continue; 1481 continue;
1421 } 1482 }
1422 1483
1423 /* Test address responsiveness 1484 /* Test address responsiveness */
1424 The default probe method is a quick write, but it is known 1485 if (i2c_default_probe(adap, addr_list[i]))
1425 to corrupt the 24RF08 EEPROMs due to a state machine bug, 1486 break;
1426 and could also irreversibly write-protect some EEPROMs, so
1427 for address ranges 0x30-0x37 and 0x50-0x5f, we use a byte
1428 read instead. Also, some bus drivers don't implement
1429 quick write, so we fallback to a byte read it that case
1430 too. */
1431 if ((addr_list[i] & ~0x07) == 0x30
1432 || (addr_list[i] & ~0x0f) == 0x50
1433 || !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) {
1434 union i2c_smbus_data data;
1435
1436 if (i2c_smbus_xfer(adap, addr_list[i], 0,
1437 I2C_SMBUS_READ, 0,
1438 I2C_SMBUS_BYTE, &data) >= 0)
1439 break;
1440 } else {
1441 if (i2c_smbus_xfer(adap, addr_list[i], 0,
1442 I2C_SMBUS_WRITE, 0,
1443 I2C_SMBUS_QUICK, NULL) >= 0)
1444 break;
1445 }
1446 } 1487 }
1447 1488
1448 if (addr_list[i] == I2C_CLIENT_END) { 1489 if (addr_list[i] == I2C_CLIENT_END) {
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index a24e0bfe9201..f61ccc1e5ea3 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -173,7 +173,6 @@ static int smbalert_remove(struct i2c_client *ara)
173 173
174 cancel_work_sync(&alert->alert); 174 cancel_work_sync(&alert->alert);
175 175
176 i2c_set_clientdata(ara, NULL);
177 kfree(alert); 176 kfree(alert);
178 return 0; 177 return 0;
179} 178}
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 4771ab172b59..744600eff222 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -287,7 +287,6 @@ static int __devexit adp5588_remove(struct i2c_client *client)
287 free_irq(client->irq, kpad); 287 free_irq(client->irq, kpad);
288 cancel_delayed_work_sync(&kpad->work); 288 cancel_delayed_work_sync(&kpad->work);
289 input_unregister_device(kpad->input); 289 input_unregister_device(kpad->input);
290 i2c_set_clientdata(client, NULL);
291 kfree(kpad); 290 kfree(kpad);
292 291
293 return 0; 292 return 0;
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
index bc696931fed7..40b032f0e32c 100644
--- a/drivers/input/keyboard/lm8323.c
+++ b/drivers/input/keyboard/lm8323.c
@@ -778,8 +778,6 @@ static int __devexit lm8323_remove(struct i2c_client *client)
778 struct lm8323_chip *lm = i2c_get_clientdata(client); 778 struct lm8323_chip *lm = i2c_get_clientdata(client);
779 int i; 779 int i;
780 780
781 i2c_set_clientdata(client, NULL);
782
783 disable_irq_wake(client->irq); 781 disable_irq_wake(client->irq);
784 free_irq(client->irq, lm); 782 free_irq(client->irq, lm);
785 cancel_work_sync(&lm->work); 783 cancel_work_sync(&lm->work);
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c
index 7fc8185e5c1b..9091ff5ea808 100644
--- a/drivers/input/keyboard/max7359_keypad.c
+++ b/drivers/input/keyboard/max7359_keypad.c
@@ -265,7 +265,6 @@ static int __devexit max7359_remove(struct i2c_client *client)
265 265
266 free_irq(client->irq, keypad); 266 free_irq(client->irq, keypad);
267 input_unregister_device(keypad->input_dev); 267 input_unregister_device(keypad->input_dev);
268 i2c_set_clientdata(client, NULL);
269 kfree(keypad); 268 kfree(keypad);
270 269
271 return 0; 270 return 0;
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c
index 31f30087b591..fac695157e8a 100644
--- a/drivers/input/keyboard/qt2160.c
+++ b/drivers/input/keyboard/qt2160.c
@@ -358,7 +358,6 @@ static int __devexit qt2160_remove(struct i2c_client *client)
358 input_unregister_device(qt2160->input); 358 input_unregister_device(qt2160->input);
359 kfree(qt2160); 359 kfree(qt2160);
360 360
361 i2c_set_clientdata(client, NULL);
362 return 0; 361 return 0;
363} 362}
364 363
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c
index 493c93f25e2a..00137bebcf97 100644
--- a/drivers/input/keyboard/tca6416-keypad.c
+++ b/drivers/input/keyboard/tca6416-keypad.c
@@ -316,8 +316,6 @@ static int __devexit tca6416_keypad_remove(struct i2c_client *client)
316 input_unregister_device(chip->input); 316 input_unregister_device(chip->input);
317 kfree(chip); 317 kfree(chip);
318 318
319 i2c_set_clientdata(client, NULL);
320
321 return 0; 319 return 0;
322} 320}
323 321
diff --git a/drivers/input/misc/ad714x-i2c.c b/drivers/input/misc/ad714x-i2c.c
index e9adbe49f6a4..2bef8fa56c94 100644
--- a/drivers/input/misc/ad714x-i2c.c
+++ b/drivers/input/misc/ad714x-i2c.c
@@ -97,7 +97,6 @@ static int __devexit ad714x_i2c_remove(struct i2c_client *client)
97 struct ad714x_chip *chip = i2c_get_clientdata(client); 97 struct ad714x_chip *chip = i2c_get_clientdata(client);
98 98
99 ad714x_remove(chip); 99 ad714x_remove(chip);
100 i2c_set_clientdata(client, NULL);
101 100
102 return 0; 101 return 0;
103} 102}
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
index 5c3ac4e0b055..0ac47d2898ec 100644
--- a/drivers/input/misc/pcf8574_keypad.c
+++ b/drivers/input/misc/pcf8574_keypad.c
@@ -168,8 +168,6 @@ static int __devexit pcf8574_kp_remove(struct i2c_client *client)
168 input_unregister_device(lp->idev); 168 input_unregister_device(lp->idev);
169 kfree(lp); 169 kfree(lp);
170 170
171 i2c_set_clientdata(client, NULL);
172
173 return 0; 171 return 0;
174} 172}
175 173
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index 8291e7399ffa..0ae62f0bcb32 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -613,7 +613,6 @@ static int __devexit synaptics_i2c_remove(struct i2c_client *client)
613 free_irq(client->irq, touch); 613 free_irq(client->irq, touch);
614 614
615 input_unregister_device(touch->input); 615 input_unregister_device(touch->input);
616 i2c_set_clientdata(client, NULL);
617 kfree(touch); 616 kfree(touch);
618 617
619 return 0; 618 return 0;
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 794d070c6900..4b32fb4704cd 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -812,10 +812,8 @@ static int __devinit ad7879_probe(struct i2c_client *client,
812 ts->bus = client; 812 ts->bus = client;
813 813
814 error = ad7879_construct(client, ts); 814 error = ad7879_construct(client, ts);
815 if (error) { 815 if (error)
816 i2c_set_clientdata(client, NULL);
817 kfree(ts); 816 kfree(ts);
818 }
819 817
820 return error; 818 return error;
821} 819}
@@ -825,7 +823,6 @@ static int __devexit ad7879_remove(struct i2c_client *client)
825 struct ad7879 *ts = dev_get_drvdata(&client->dev); 823 struct ad7879 *ts = dev_get_drvdata(&client->dev);
826 824
827 ad7879_destroy(client, ts); 825 ad7879_destroy(client, ts);
828 i2c_set_clientdata(client, NULL);
829 kfree(ts); 826 kfree(ts);
830 827
831 return 0; 828 return 0;
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 75f8b73010fa..7a3a916f84a8 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -238,7 +238,6 @@ err2:
238 input = NULL; /* so we dont try to free it below */ 238 input = NULL; /* so we dont try to free it below */
239err1: 239err1:
240 input_free_device(input); 240 input_free_device(input);
241 i2c_set_clientdata(client, NULL);
242 kfree(priv); 241 kfree(priv);
243err0: 242err0:
244 return err; 243 return err;
@@ -256,7 +255,6 @@ static int __devexit eeti_ts_remove(struct i2c_client *client)
256 enable_irq(priv->irq); 255 enable_irq(priv->irq);
257 256
258 input_unregister_device(priv->input); 257 input_unregister_device(priv->input);
259 i2c_set_clientdata(client, NULL);
260 kfree(priv); 258 kfree(priv);
261 259
262 return 0; 260 return 0;
diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c
index ce8ab0269f6f..1fb0c2f06a44 100644
--- a/drivers/input/touchscreen/mcs5000_ts.c
+++ b/drivers/input/touchscreen/mcs5000_ts.c
@@ -256,7 +256,6 @@ static int __devexit mcs5000_ts_remove(struct i2c_client *client)
256 free_irq(client->irq, data); 256 free_irq(client->irq, data);
257 input_unregister_device(data->input_dev); 257 input_unregister_device(data->input_dev);
258 kfree(data); 258 kfree(data);
259 i2c_set_clientdata(client, NULL);
260 259
261 return 0; 260 return 0;
262} 261}
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 769b479fcaa6..be23780e8a3e 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -347,8 +347,6 @@ static int __devexit tsc2007_remove(struct i2c_client *client)
347 struct tsc2007 *ts = i2c_get_clientdata(client); 347 struct tsc2007 *ts = i2c_get_clientdata(client);
348 struct tsc2007_platform_data *pdata = client->dev.platform_data; 348 struct tsc2007_platform_data *pdata = client->dev.platform_data;
349 349
350 i2c_set_clientdata(client, NULL);
351
352 tsc2007_free_irq(ts); 350 tsc2007_free_irq(ts);
353 351
354 if (pdata->exit_platform_hw) 352 if (pdata->exit_platform_hw)
diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c
index 286b501a3573..5dcdf9d69b3a 100644
--- a/drivers/leds/leds-bd2802.c
+++ b/drivers/leds/leds-bd2802.c
@@ -742,7 +742,6 @@ failed_unregister_dev_file:
742 for (i--; i >= 0; i--) 742 for (i--; i >= 0; i--)
743 device_remove_file(&led->client->dev, bd2802_attributes[i]); 743 device_remove_file(&led->client->dev, bd2802_attributes[i]);
744failed_free: 744failed_free:
745 i2c_set_clientdata(client, NULL);
746 kfree(led); 745 kfree(led);
747 746
748 return ret; 747 return ret;
@@ -759,7 +758,6 @@ static int __exit bd2802_remove(struct i2c_client *client)
759 bd2802_disable_adv_conf(led); 758 bd2802_disable_adv_conf(led);
760 for (i = 0; i < ARRAY_SIZE(bd2802_attributes); i++) 759 for (i = 0; i < ARRAY_SIZE(bd2802_attributes); i++)
761 device_remove_file(&led->client->dev, bd2802_attributes[i]); 760 device_remove_file(&led->client->dev, bd2802_attributes[i]);
762 i2c_set_clientdata(client, NULL);
763 kfree(led); 761 kfree(led);
764 762
765 return 0; 763 return 0;
diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c
index 932a58da76c4..9010c054615e 100644
--- a/drivers/leds/leds-lp3944.c
+++ b/drivers/leds/leds-lp3944.c
@@ -432,7 +432,6 @@ static int __devexit lp3944_remove(struct i2c_client *client)
432 } 432 }
433 433
434 kfree(data); 434 kfree(data);
435 i2c_set_clientdata(client, NULL);
436 435
437 return 0; 436 return 0;
438} 437}
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 6682175fa9f7..43d08756d823 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -320,10 +320,8 @@ static int pca9532_probe(struct i2c_client *client,
320 mutex_init(&data->update_lock); 320 mutex_init(&data->update_lock);
321 321
322 err = pca9532_configure(client, data, pca9532_pdata); 322 err = pca9532_configure(client, data, pca9532_pdata);
323 if (err) { 323 if (err)
324 kfree(data); 324 kfree(data);
325 i2c_set_clientdata(client, NULL);
326 }
327 325
328 return err; 326 return err;
329} 327}
@@ -351,7 +349,6 @@ static int pca9532_remove(struct i2c_client *client)
351 } 349 }
352 350
353 kfree(data); 351 kfree(data);
354 i2c_set_clientdata(client, NULL);
355 return 0; 352 return 0;
356} 353}
357 354
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 8ff50f234190..66aa3e8e786f 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -342,7 +342,6 @@ exit:
342 } 342 }
343 343
344 kfree(pca955x); 344 kfree(pca955x);
345 i2c_set_clientdata(client, NULL);
346 345
347 return err; 346 return err;
348} 347}
@@ -358,7 +357,6 @@ static int __devexit pca955x_remove(struct i2c_client *client)
358 } 357 }
359 358
360 kfree(pca955x); 359 kfree(pca955x);
361 i2c_set_clientdata(client, NULL);
362 360
363 return 0; 361 return 0;
364} 362}
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 16d82f17ae82..c42eeb43042d 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -182,7 +182,6 @@ remove_thermostat(struct i2c_client *client)
182 182
183 thermostat = NULL; 183 thermostat = NULL;
184 184
185 i2c_set_clientdata(client, NULL);
186 kfree(th); 185 kfree(th);
187 186
188 return 0; 187 return 0;
@@ -400,7 +399,6 @@ static int probe_thermostat(struct i2c_client *client,
400 rc = read_reg(th, CONFIG_REG); 399 rc = read_reg(th, CONFIG_REG);
401 if (rc < 0) { 400 if (rc < 0) {
402 dev_err(&client->dev, "Thermostat failed to read config!\n"); 401 dev_err(&client->dev, "Thermostat failed to read config!\n");
403 i2c_set_clientdata(client, NULL);
404 kfree(th); 402 kfree(th);
405 return -ENODEV; 403 return -ENODEV;
406 } 404 }
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index d8257d35afde..647c6add2193 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -107,10 +107,8 @@ static int wf_lm75_probe(struct i2c_client *client,
107 i2c_set_clientdata(client, lm); 107 i2c_set_clientdata(client, lm);
108 108
109 rc = wf_register_sensor(&lm->sens); 109 rc = wf_register_sensor(&lm->sens);
110 if (rc) { 110 if (rc)
111 i2c_set_clientdata(client, NULL);
112 kfree(lm); 111 kfree(lm);
113 }
114 112
115 return rc; 113 return rc;
116} 114}
@@ -216,7 +214,6 @@ static int wf_lm75_remove(struct i2c_client *client)
216 /* release sensor */ 214 /* release sensor */
217 wf_unregister_sensor(&lm->sens); 215 wf_unregister_sensor(&lm->sens);
218 216
219 i2c_set_clientdata(client, NULL);
220 return 0; 217 return 0;
221} 218}
222 219
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index b486eb929fde..8204113268f4 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -81,7 +81,6 @@ static int wf_max6690_probe(struct i2c_client *client,
81 81
82 rc = wf_register_sensor(&max->sens); 82 rc = wf_register_sensor(&max->sens);
83 if (rc) { 83 if (rc) {
84 i2c_set_clientdata(client, NULL);
85 kfree(max); 84 kfree(max);
86 } 85 }
87 86
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index e20330a28959..65a8ff3e1f8e 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -376,7 +376,6 @@ static int wf_sat_remove(struct i2c_client *client)
376 /* XXX TODO */ 376 /* XXX TODO */
377 377
378 sat->i2c = NULL; 378 sat->i2c = NULL;
379 i2c_set_clientdata(client, NULL);
380 return 0; 379 return 0;
381} 380}
382 381
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index a5844d08d8b7..67a4ec8768a6 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -482,7 +482,6 @@ static __devexit int si470x_i2c_remove(struct i2c_client *client)
482 cancel_work_sync(&radio->radio_work); 482 cancel_work_sync(&radio->radio_work);
483 video_unregister_device(radio->videodev); 483 video_unregister_device(radio->videodev);
484 kfree(radio); 484 kfree(radio);
485 i2c_set_clientdata(client, NULL);
486 485
487 return 0; 486 return 0;
488} 487}
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index b62c0bd3f8ea..e3b9a8ab37f4 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -785,7 +785,6 @@ static int mt9m001_probe(struct i2c_client *client,
785 ret = mt9m001_video_probe(icd, client); 785 ret = mt9m001_video_probe(icd, client);
786 if (ret) { 786 if (ret) {
787 icd->ops = NULL; 787 icd->ops = NULL;
788 i2c_set_clientdata(client, NULL);
789 kfree(mt9m001); 788 kfree(mt9m001);
790 } 789 }
791 790
@@ -799,7 +798,6 @@ static int mt9m001_remove(struct i2c_client *client)
799 798
800 icd->ops = NULL; 799 icd->ops = NULL;
801 mt9m001_video_remove(icd); 800 mt9m001_video_remove(icd);
802 i2c_set_clientdata(client, NULL);
803 client->driver = NULL; 801 client->driver = NULL;
804 kfree(mt9m001); 802 kfree(mt9m001);
805 803
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index d35f536f9fc3..e42162c50f0a 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -1068,7 +1068,6 @@ static int mt9m111_probe(struct i2c_client *client,
1068 ret = mt9m111_video_probe(icd, client); 1068 ret = mt9m111_video_probe(icd, client);
1069 if (ret) { 1069 if (ret) {
1070 icd->ops = NULL; 1070 icd->ops = NULL;
1071 i2c_set_clientdata(client, NULL);
1072 kfree(mt9m111); 1071 kfree(mt9m111);
1073 } 1072 }
1074 1073
@@ -1081,7 +1080,6 @@ static int mt9m111_remove(struct i2c_client *client)
1081 struct soc_camera_device *icd = client->dev.platform_data; 1080 struct soc_camera_device *icd = client->dev.platform_data;
1082 1081
1083 icd->ops = NULL; 1082 icd->ops = NULL;
1084 i2c_set_clientdata(client, NULL);
1085 client->driver = NULL; 1083 client->driver = NULL;
1086 kfree(mt9m111); 1084 kfree(mt9m111);
1087 1085
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index 78b4e091d2d5..9f5ff2547f19 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -883,7 +883,6 @@ static int mt9t031_probe(struct i2c_client *client,
883 if (ret) { 883 if (ret) {
884 if (icd) 884 if (icd)
885 icd->ops = NULL; 885 icd->ops = NULL;
886 i2c_set_clientdata(client, NULL);
887 kfree(mt9t031); 886 kfree(mt9t031);
888 } 887 }
889 888
@@ -897,7 +896,6 @@ static int mt9t031_remove(struct i2c_client *client)
897 896
898 if (icd) 897 if (icd)
899 icd->ops = NULL; 898 icd->ops = NULL;
900 i2c_set_clientdata(client, NULL);
901 client->driver = NULL; 899 client->driver = NULL;
902 kfree(mt9t031); 900 kfree(mt9t031);
903 901
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index 7438f8d775ba..aa4fce95098f 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -1119,7 +1119,6 @@ static int mt9t112_probe(struct i2c_client *client,
1119 ret = mt9t112_camera_probe(icd, client); 1119 ret = mt9t112_camera_probe(icd, client);
1120 if (ret) { 1120 if (ret) {
1121 icd->ops = NULL; 1121 icd->ops = NULL;
1122 i2c_set_clientdata(client, NULL);
1123 kfree(priv); 1122 kfree(priv);
1124 } 1123 }
1125 1124
@@ -1132,7 +1131,6 @@ static int mt9t112_remove(struct i2c_client *client)
1132 struct soc_camera_device *icd = client->dev.platform_data; 1131 struct soc_camera_device *icd = client->dev.platform_data;
1133 1132
1134 icd->ops = NULL; 1133 icd->ops = NULL;
1135 i2c_set_clientdata(client, NULL);
1136 kfree(priv); 1134 kfree(priv);
1137 return 0; 1135 return 0;
1138} 1136}
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index e5bae4c9393b..fb44ff006628 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -920,7 +920,6 @@ static int mt9v022_probe(struct i2c_client *client,
920 ret = mt9v022_video_probe(icd, client); 920 ret = mt9v022_video_probe(icd, client);
921 if (ret) { 921 if (ret) {
922 icd->ops = NULL; 922 icd->ops = NULL;
923 i2c_set_clientdata(client, NULL);
924 kfree(mt9v022); 923 kfree(mt9v022);
925 } 924 }
926 925
@@ -934,7 +933,6 @@ static int mt9v022_remove(struct i2c_client *client)
934 933
935 icd->ops = NULL; 934 icd->ops = NULL;
936 mt9v022_video_remove(icd); 935 mt9v022_video_remove(icd);
937 i2c_set_clientdata(client, NULL);
938 client->driver = NULL; 936 client->driver = NULL;
939 kfree(mt9v022); 937 kfree(mt9v022);
940 938
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 7f8ece30c77b..c33acc94b747 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -1159,7 +1159,6 @@ static int ov772x_probe(struct i2c_client *client,
1159 ret = ov772x_video_probe(icd, client); 1159 ret = ov772x_video_probe(icd, client);
1160 if (ret) { 1160 if (ret) {
1161 icd->ops = NULL; 1161 icd->ops = NULL;
1162 i2c_set_clientdata(client, NULL);
1163 kfree(priv); 1162 kfree(priv);
1164 } 1163 }
1165 1164
@@ -1172,7 +1171,6 @@ static int ov772x_remove(struct i2c_client *client)
1172 struct soc_camera_device *icd = client->dev.platform_data; 1171 struct soc_camera_device *icd = client->dev.platform_data;
1173 1172
1174 icd->ops = NULL; 1173 icd->ops = NULL;
1175 i2c_set_clientdata(client, NULL);
1176 kfree(priv); 1174 kfree(priv);
1177 return 0; 1175 return 0;
1178} 1176}
diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c
index 36599a65f548..035e9ecb0c75 100644
--- a/drivers/media/video/ov9640.c
+++ b/drivers/media/video/ov9640.c
@@ -783,7 +783,6 @@ static int ov9640_probe(struct i2c_client *client,
783 783
784 if (ret) { 784 if (ret) {
785 icd->ops = NULL; 785 icd->ops = NULL;
786 i2c_set_clientdata(client, NULL);
787 kfree(priv); 786 kfree(priv);
788 } 787 }
789 788
@@ -794,7 +793,6 @@ static int ov9640_remove(struct i2c_client *client)
794{ 793{
795 struct ov9640_priv *priv = i2c_get_clientdata(client); 794 struct ov9640_priv *priv = i2c_get_clientdata(client);
796 795
797 i2c_set_clientdata(client, NULL);
798 kfree(priv); 796 kfree(priv);
799 return 0; 797 return 0;
800} 798}
diff --git a/drivers/media/video/rj54n1cb0c.c b/drivers/media/video/rj54n1cb0c.c
index bbd9c11e2c5a..2c3b58c99e18 100644
--- a/drivers/media/video/rj54n1cb0c.c
+++ b/drivers/media/video/rj54n1cb0c.c
@@ -1444,7 +1444,6 @@ static int rj54n1_probe(struct i2c_client *client,
1444 ret = rj54n1_video_probe(icd, client, rj54n1_priv); 1444 ret = rj54n1_video_probe(icd, client, rj54n1_priv);
1445 if (ret < 0) { 1445 if (ret < 0) {
1446 icd->ops = NULL; 1446 icd->ops = NULL;
1447 i2c_set_clientdata(client, NULL);
1448 kfree(rj54n1); 1447 kfree(rj54n1);
1449 return ret; 1448 return ret;
1450 } 1449 }
@@ -1461,7 +1460,6 @@ static int rj54n1_remove(struct i2c_client *client)
1461 icd->ops = NULL; 1460 icd->ops = NULL;
1462 if (icl->free_bus) 1461 if (icl->free_bus)
1463 icl->free_bus(icl); 1462 icl->free_bus(icl);
1464 i2c_set_clientdata(client, NULL);
1465 client->driver = NULL; 1463 client->driver = NULL;
1466 kfree(rj54n1); 1464 kfree(rj54n1);
1467 1465
diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c
index b90e9da3167d..54681a535822 100644
--- a/drivers/media/video/tcm825x.c
+++ b/drivers/media/video/tcm825x.c
@@ -850,7 +850,6 @@ static int tcm825x_probe(struct i2c_client *client,
850 const struct i2c_device_id *did) 850 const struct i2c_device_id *did)
851{ 851{
852 struct tcm825x_sensor *sensor = &tcm825x; 852 struct tcm825x_sensor *sensor = &tcm825x;
853 int rval;
854 853
855 if (i2c_get_clientdata(client)) 854 if (i2c_get_clientdata(client))
856 return -EBUSY; 855 return -EBUSY;
@@ -871,11 +870,7 @@ static int tcm825x_probe(struct i2c_client *client,
871 sensor->pix.height = tcm825x_sizes[QVGA].height; 870 sensor->pix.height = tcm825x_sizes[QVGA].height;
872 sensor->pix.pixelformat = V4L2_PIX_FMT_RGB565; 871 sensor->pix.pixelformat = V4L2_PIX_FMT_RGB565;
873 872
874 rval = v4l2_int_device_register(sensor->v4l2_int_device); 873 return v4l2_int_device_register(sensor->v4l2_int_device);
875 if (rval)
876 i2c_set_clientdata(client, NULL);
877
878 return rval;
879} 874}
880 875
881static int tcm825x_remove(struct i2c_client *client) 876static int tcm825x_remove(struct i2c_client *client)
@@ -886,7 +881,6 @@ static int tcm825x_remove(struct i2c_client *client)
886 return -ENODEV; /* our client isn't attached */ 881 return -ENODEV; /* our client isn't attached */
887 882
888 v4l2_int_device_unregister(sensor->v4l2_int_device); 883 v4l2_int_device_unregister(sensor->v4l2_int_device);
889 i2c_set_clientdata(client, NULL);
890 884
891 return 0; 885 return 0;
892} 886}
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 76be733eabfd..6eb3395def07 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -977,7 +977,6 @@ static int tw9910_probe(struct i2c_client *client,
977 ret = tw9910_video_probe(icd, client); 977 ret = tw9910_video_probe(icd, client);
978 if (ret) { 978 if (ret) {
979 icd->ops = NULL; 979 icd->ops = NULL;
980 i2c_set_clientdata(client, NULL);
981 kfree(priv); 980 kfree(priv);
982 } 981 }
983 982
@@ -990,7 +989,6 @@ static int tw9910_remove(struct i2c_client *client)
990 struct soc_camera_device *icd = client->dev.platform_data; 989 struct soc_camera_device *icd = client->dev.platform_data;
991 990
992 icd->ops = NULL; 991 icd->ops = NULL;
993 i2c_set_clientdata(client, NULL);
994 kfree(priv); 992 kfree(priv);
995 return 0; 993 return 0;
996} 994}
diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
index c933b64d1283..bc02e6b21608 100644
--- a/drivers/mfd/88pm860x-i2c.c
+++ b/drivers/mfd/88pm860x-i2c.c
@@ -200,8 +200,6 @@ static int __devexit pm860x_remove(struct i2c_client *client)
200 200
201 pm860x_device_exit(chip); 201 pm860x_device_exit(chip);
202 i2c_unregister_device(chip->companion); 202 i2c_unregister_device(chip->companion);
203 i2c_set_clientdata(chip->client, NULL);
204 i2c_set_clientdata(client, NULL);
205 kfree(chip); 203 kfree(chip);
206 return 0; 204 return 0;
207} 205}
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 53ebfee548fa..66379b413906 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -957,7 +957,6 @@ static int __init ab3100_probe(struct i2c_client *client,
957 i2c_unregister_device(ab3100->testreg_client); 957 i2c_unregister_device(ab3100->testreg_client);
958 exit_no_testreg_client: 958 exit_no_testreg_client:
959 exit_no_detect: 959 exit_no_detect:
960 i2c_set_clientdata(client, NULL);
961 kfree(ab3100); 960 kfree(ab3100);
962 return err; 961 return err;
963} 962}
@@ -979,7 +978,6 @@ static int __exit ab3100_remove(struct i2c_client *client)
979 * their notifiers so deactivate IRQ 978 * their notifiers so deactivate IRQ
980 */ 979 */
981 free_irq(client->irq, ab3100); 980 free_irq(client->irq, ab3100);
982 i2c_set_clientdata(client, NULL);
983 kfree(ab3100); 981 kfree(ab3100);
984 return 0; 982 return 0;
985} 983}
diff --git a/drivers/mfd/ab3550-core.c b/drivers/mfd/ab3550-core.c
index 1060f8e1c40a..f54ab62e7bc6 100644
--- a/drivers/mfd/ab3550-core.c
+++ b/drivers/mfd/ab3550-core.c
@@ -1362,7 +1362,6 @@ static int __exit ab3550_remove(struct i2c_client *client)
1362 * their notifiers so deactivate IRQ 1362 * their notifiers so deactivate IRQ
1363 */ 1363 */
1364 free_irq(client->irq, ab); 1364 free_irq(client->irq, ab);
1365 i2c_set_clientdata(client, NULL);
1366 kfree(ab); 1365 kfree(ab);
1367 return 0; 1366 return 0;
1368} 1367}
diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index 005532865654..3122139b4300 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -302,7 +302,6 @@ out_free_irq:
302 free_irq(chip->irq, chip); 302 free_irq(chip->irq, chip);
303 303
304out_free_chip: 304out_free_chip:
305 i2c_set_clientdata(client, NULL);
306 kfree(chip); 305 kfree(chip);
307 306
308 return ret; 307 return ret;
@@ -317,7 +316,6 @@ static int __devexit adp5520_remove(struct i2c_client *client)
317 316
318 adp5520_remove_subdevs(chip); 317 adp5520_remove_subdevs(chip);
319 adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); 318 adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
320 i2c_set_clientdata(client, NULL);
321 kfree(chip); 319 kfree(chip);
322 return 0; 320 return 0;
323} 321}
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index 3ad915d0589c..c07aece900fb 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -534,7 +534,6 @@ static int __devinit da903x_probe(struct i2c_client *client,
534out_free_irq: 534out_free_irq:
535 free_irq(client->irq, chip); 535 free_irq(client->irq, chip);
536out_free_chip: 536out_free_chip:
537 i2c_set_clientdata(client, NULL);
538 kfree(chip); 537 kfree(chip);
539 return ret; 538 return ret;
540} 539}
@@ -544,7 +543,6 @@ static int __devexit da903x_remove(struct i2c_client *client)
544 struct da903x_chip *chip = i2c_get_clientdata(client); 543 struct da903x_chip *chip = i2c_get_clientdata(client);
545 544
546 da903x_remove_subdevs(chip); 545 da903x_remove_subdevs(chip);
547 i2c_set_clientdata(client, NULL);
548 kfree(chip); 546 kfree(chip);
549 return 0; 547 return 0;
550} 548}
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index e73f3f5252a8..0219115e00c7 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -173,7 +173,6 @@ static int __devexit max8925_remove(struct i2c_client *client)
173 max8925_device_exit(chip); 173 max8925_device_exit(chip);
174 i2c_unregister_device(chip->adc); 174 i2c_unregister_device(chip->adc);
175 i2c_unregister_device(chip->rtc); 175 i2c_unregister_device(chip->rtc);
176 i2c_set_clientdata(chip->i2c, NULL);
177 kfree(chip); 176 kfree(chip);
178 return 0; 177 return 0;
179} 178}
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index 721948be12c7..a3fb4bcb9889 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -1228,7 +1228,6 @@ fail2:
1228 free_irq(client->irq, menelaus); 1228 free_irq(client->irq, menelaus);
1229 flush_scheduled_work(); 1229 flush_scheduled_work();
1230fail1: 1230fail1:
1231 i2c_set_clientdata(client, NULL);
1232 kfree(menelaus); 1231 kfree(menelaus);
1233 return err; 1232 return err;
1234} 1233}
@@ -1238,7 +1237,6 @@ static int __exit menelaus_remove(struct i2c_client *client)
1238 struct menelaus_chip *menelaus = i2c_get_clientdata(client); 1237 struct menelaus_chip *menelaus = i2c_get_clientdata(client);
1239 1238
1240 free_irq(client->irq, menelaus); 1239 free_irq(client->irq, menelaus);
1241 i2c_set_clientdata(client, NULL);
1242 kfree(menelaus); 1240 kfree(menelaus);
1243 the_menelaus = NULL; 1241 the_menelaus = NULL;
1244 return 0; 1242 return 0;
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 704736e6e9b9..23e585527285 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -336,7 +336,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
336 return 0; 336 return 0;
337 337
338err_free: 338err_free:
339 i2c_set_clientdata(client, NULL);
340 kfree(pcf); 339 kfree(pcf);
341 340
342 return ret; 341 return ret;
@@ -357,7 +356,6 @@ static int __devexit pcf50633_remove(struct i2c_client *client)
357 for (i = 0; i < PCF50633_NUM_REGULATORS; i++) 356 for (i = 0; i < PCF50633_NUM_REGULATORS; i++)
358 platform_device_unregister(pcf->regulator_pdev[i]); 357 platform_device_unregister(pcf->regulator_pdev[i]);
359 358
360 i2c_set_clientdata(client, NULL);
361 kfree(pcf); 359 kfree(pcf);
362 360
363 return 0; 361 return 0;
diff --git a/drivers/mfd/tc35892.c b/drivers/mfd/tc35892.c
index 715f095dd7a6..e619e2a55997 100644
--- a/drivers/mfd/tc35892.c
+++ b/drivers/mfd/tc35892.c
@@ -296,7 +296,6 @@ out_freeirq:
296out_removeirq: 296out_removeirq:
297 tc35892_irq_remove(tc35892); 297 tc35892_irq_remove(tc35892);
298out_free: 298out_free:
299 i2c_set_clientdata(i2c, NULL);
300 kfree(tc35892); 299 kfree(tc35892);
301 return ret; 300 return ret;
302} 301}
@@ -310,7 +309,6 @@ static int __devexit tc35892_remove(struct i2c_client *client)
310 free_irq(tc35892->i2c->irq, tc35892); 309 free_irq(tc35892->i2c->irq, tc35892);
311 tc35892_irq_remove(tc35892); 310 tc35892_irq_remove(tc35892);
312 311
313 i2c_set_clientdata(client, NULL);
314 kfree(tc35892); 312 kfree(tc35892);
315 313
316 return 0; 314 return 0;
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 9b22a77f70f5..d0016b67d125 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -530,7 +530,6 @@ static int __exit tps65010_remove(struct i2c_client *client)
530 cancel_delayed_work(&tps->work); 530 cancel_delayed_work(&tps->work);
531 flush_scheduled_work(); 531 flush_scheduled_work();
532 debugfs_remove(tps->file); 532 debugfs_remove(tps->file);
533 i2c_set_clientdata(client, NULL);
534 kfree(tps); 533 kfree(tps);
535 the_tps = NULL; 534 the_tps = NULL;
536 return 0; 535 return 0;
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 7795af4b1fe1..5fe5de166adb 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -80,7 +80,6 @@ static int wm8350_i2c_probe(struct i2c_client *i2c,
80 return ret; 80 return ret;
81 81
82err: 82err:
83 i2c_set_clientdata(i2c, NULL);
84 kfree(wm8350); 83 kfree(wm8350);
85 return ret; 84 return ret;
86} 85}
@@ -90,7 +89,6 @@ static int wm8350_i2c_remove(struct i2c_client *i2c)
90 struct wm8350 *wm8350 = i2c_get_clientdata(i2c); 89 struct wm8350 *wm8350 = i2c_get_clientdata(i2c);
91 90
92 wm8350_device_exit(wm8350); 91 wm8350_device_exit(wm8350);
93 i2c_set_clientdata(i2c, NULL);
94 kfree(wm8350); 92 kfree(wm8350);
95 93
96 return 0; 94 return 0;
diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c
index e08aafa663dc..1bfef4846b07 100644
--- a/drivers/mfd/wm8400-core.c
+++ b/drivers/mfd/wm8400-core.c
@@ -415,7 +415,6 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
415 return 0; 415 return 0;
416 416
417struct_err: 417struct_err:
418 i2c_set_clientdata(i2c, NULL);
419 kfree(wm8400); 418 kfree(wm8400);
420err: 419err:
421 return ret; 420 return ret;
@@ -426,7 +425,6 @@ static int wm8400_i2c_remove(struct i2c_client *i2c)
426 struct wm8400 *wm8400 = i2c_get_clientdata(i2c); 425 struct wm8400 *wm8400 = i2c_get_clientdata(i2c);
427 426
428 wm8400_release(wm8400); 427 wm8400_release(wm8400);
429 i2c_set_clientdata(i2c, NULL);
430 kfree(wm8400); 428 kfree(wm8400);
431 429
432 return 0; 430 return 0;
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index f7ca3a42b490..559b0b3c16c3 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -643,7 +643,6 @@ static int __devexit at24_remove(struct i2c_client *client)
643 643
644 kfree(at24->writebuf); 644 kfree(at24->writebuf);
645 kfree(at24); 645 kfree(at24);
646 i2c_set_clientdata(client, NULL);
647 return 0; 646 return 0;
648} 647}
649 648
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
index eb476b7f8d11..f4ce273e93fd 100644
--- a/drivers/mtd/maps/pismo.c
+++ b/drivers/mtd/maps/pismo.c
@@ -234,7 +234,6 @@ static int __devexit pismo_remove(struct i2c_client *client)
234 /* FIXME: set_vpp needs saner arguments */ 234 /* FIXME: set_vpp needs saner arguments */
235 pismo_setvpp_remove_fix(pismo); 235 pismo_setvpp_remove_fix(pismo);
236 236
237 i2c_set_clientdata(client, NULL);
238 kfree(pismo); 237 kfree(pismo);
239 238
240 return 0; 239 return 0;
@@ -286,7 +285,6 @@ static int __devinit pismo_probe(struct i2c_client *client,
286 return 0; 285 return 0;
287 286
288 exit_free: 287 exit_free:
289 i2c_set_clientdata(client, NULL);
290 kfree(pismo); 288 kfree(pismo);
291 return ret; 289 return ret;
292} 290}
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c
index f3e22c9fe20a..2f2f9a6f54fa 100644
--- a/drivers/power/max17040_battery.c
+++ b/drivers/power/max17040_battery.c
@@ -225,7 +225,6 @@ static int __devinit max17040_probe(struct i2c_client *client,
225 ret = power_supply_register(&client->dev, &chip->battery); 225 ret = power_supply_register(&client->dev, &chip->battery);
226 if (ret) { 226 if (ret) {
227 dev_err(&client->dev, "failed: power supply register\n"); 227 dev_err(&client->dev, "failed: power supply register\n");
228 i2c_set_clientdata(client, NULL);
229 kfree(chip); 228 kfree(chip);
230 return ret; 229 return ret;
231 } 230 }
@@ -245,7 +244,6 @@ static int __devexit max17040_remove(struct i2c_client *client)
245 244
246 power_supply_unregister(&chip->battery); 245 power_supply_unregister(&chip->battery);
247 cancel_delayed_work(&chip->work); 246 cancel_delayed_work(&chip->work);
248 i2c_set_clientdata(client, NULL);
249 kfree(chip); 247 kfree(chip);
250 return 0; 248 return 0;
251} 249}
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 671a7d1f1f0e..8ae3732eb24b 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -519,8 +519,6 @@ static int __devexit lp3971_i2c_remove(struct i2c_client *i2c)
519 struct lp3971 *lp3971 = i2c_get_clientdata(i2c); 519 struct lp3971 *lp3971 = i2c_get_clientdata(i2c);
520 int i; 520 int i;
521 521
522 i2c_set_clientdata(i2c, NULL);
523
524 for (i = 0; i < lp3971->num_regulators; i++) 522 for (i = 0; i < lp3971->num_regulators; i++)
525 regulator_unregister(lp3971->rdev[i]); 523 regulator_unregister(lp3971->rdev[i]);
526 524
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index b3c1afc16889..2b54d9d75f11 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -244,7 +244,6 @@ static int __devexit max1586_pmic_remove(struct i2c_client *client)
244 for (i = 0; i <= MAX1586_V6; i++) 244 for (i = 0; i <= MAX1586_V6; i++)
245 if (rdev[i]) 245 if (rdev[i])
246 regulator_unregister(rdev[i]); 246 regulator_unregister(rdev[i]);
247 i2c_set_clientdata(client, NULL);
248 kfree(rdev); 247 kfree(rdev);
249 248
250 return 0; 249 return 0;
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index bfc4c5ffdc96..4520ace3f7e7 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -357,7 +357,6 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
357 dev_info(info->dev, "Max8649 regulator device is detected.\n"); 357 dev_info(info->dev, "Max8649 regulator device is detected.\n");
358 return 0; 358 return 0;
359out: 359out:
360 i2c_set_clientdata(client, NULL);
361 kfree(info); 360 kfree(info);
362 return ret; 361 return ret;
363} 362}
@@ -369,7 +368,6 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)
369 if (info) { 368 if (info) {
370 if (info->regulator) 369 if (info->regulator)
371 regulator_unregister(info->regulator); 370 regulator_unregister(info->regulator);
372 i2c_set_clientdata(client, NULL);
373 kfree(info); 371 kfree(info);
374 } 372 }
375 373
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 3790b21879ff..d97220efae5a 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -471,7 +471,6 @@ static int __devexit max8660_remove(struct i2c_client *client)
471 for (i = 0; i < MAX8660_V_END; i++) 471 for (i = 0; i < MAX8660_V_END; i++)
472 if (rdev[i]) 472 if (rdev[i])
473 regulator_unregister(rdev[i]); 473 regulator_unregister(rdev[i]);
474 i2c_set_clientdata(client, NULL);
475 kfree(rdev); 474 kfree(rdev);
476 475
477 return 0; 476 return 0;
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 8e2f2098b005..f50afc9f287a 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -538,9 +538,6 @@ static int __devexit tps_65023_remove(struct i2c_client *client)
538 struct tps_pmic *tps = i2c_get_clientdata(client); 538 struct tps_pmic *tps = i2c_get_clientdata(client);
539 int i; 539 int i;
540 540
541 /* clear the client data in i2c */
542 i2c_set_clientdata(client, NULL);
543
544 for (i = 0; i < TPS65023_NUM_REGULATOR; i++) 541 for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
545 regulator_unregister(tps->rdev[i]); 542 regulator_unregister(tps->rdev[i]);
546 543
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 61945734ad00..1f0007fd4431 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -403,7 +403,6 @@ out_irq:
403 free_irq(client->irq, client); 403 free_irq(client->irq, client);
404 404
405out_free: 405out_free:
406 i2c_set_clientdata(client, NULL);
407 kfree(ds1374); 406 kfree(ds1374);
408 return ret; 407 return ret;
409} 408}
@@ -422,7 +421,6 @@ static int __devexit ds1374_remove(struct i2c_client *client)
422 } 421 }
423 422
424 rtc_device_unregister(ds1374->rtc); 423 rtc_device_unregister(ds1374->rtc);
425 i2c_set_clientdata(client, NULL);
426 kfree(ds1374); 424 kfree(ds1374);
427 return 0; 425 return 0;
428} 426}
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index b65c82f792d9..789f62f9b47d 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -632,7 +632,6 @@ errout_reg:
632 rtc_device_unregister(rx8025->rtc); 632 rtc_device_unregister(rx8025->rtc);
633 633
634errout_free: 634errout_free:
635 i2c_set_clientdata(client, NULL);
636 kfree(rx8025); 635 kfree(rx8025);
637 636
638errout: 637errout:
@@ -656,7 +655,6 @@ static int __devexit rx8025_remove(struct i2c_client *client)
656 655
657 rx8025_sysfs_unregister(&client->dev); 656 rx8025_sysfs_unregister(&client->dev);
658 rtc_device_unregister(rx8025->rtc); 657 rtc_device_unregister(rx8025->rtc);
659 i2c_set_clientdata(client, NULL);
660 kfree(rx8025); 658 kfree(rx8025);
661 return 0; 659 return 0;
662} 660}
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index def4d396d0b0..f789e002c9b0 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -275,7 +275,6 @@ exit_dummy:
275 if (s35390a->client[i]) 275 if (s35390a->client[i])
276 i2c_unregister_device(s35390a->client[i]); 276 i2c_unregister_device(s35390a->client[i]);
277 kfree(s35390a); 277 kfree(s35390a);
278 i2c_set_clientdata(client, NULL);
279 278
280exit: 279exit:
281 return err; 280 return err;
@@ -292,7 +291,6 @@ static int s35390a_remove(struct i2c_client *client)
292 291
293 rtc_device_unregister(s35390a->rtc); 292 rtc_device_unregister(s35390a->rtc);
294 kfree(s35390a); 293 kfree(s35390a);
295 i2c_set_clientdata(client, NULL);
296 294
297 return 0; 295 return 0;
298} 296}
diff --git a/drivers/staging/dream/synaptics_i2c_rmi.c b/drivers/staging/dream/synaptics_i2c_rmi.c
index 1f020dad6234..3320359408a9 100644
--- a/drivers/staging/dream/synaptics_i2c_rmi.c
+++ b/drivers/staging/dream/synaptics_i2c_rmi.c
@@ -519,7 +519,6 @@ err_input_register_device_failed:
519err_input_dev_alloc_failed: 519err_input_dev_alloc_failed:
520err_detect_failed: 520err_detect_failed:
521err_power_failed: 521err_power_failed:
522 i2c_set_clientdata(client, NULL);
523 kfree(ts); 522 kfree(ts);
524err_alloc_data_failed: 523err_alloc_data_failed:
525err_check_functionality_failed: 524err_check_functionality_failed:
@@ -537,7 +536,6 @@ static int synaptics_ts_remove(struct i2c_client *client)
537 else 536 else
538 hrtimer_cancel(&ts->timer); 537 hrtimer_cancel(&ts->timer);
539 input_unregister_device(ts->input_dev); 538 input_unregister_device(ts->input_dev);
540 i2c_set_clientdata(client, NULL);
541 kfree(ts); 539 kfree(ts);
542 return 0; 540 return 0;
543} 541}
diff --git a/drivers/staging/go7007/wis-saa7113.c b/drivers/staging/go7007/wis-saa7113.c
index bd925457f8b7..72f5c1f56d19 100644
--- a/drivers/staging/go7007/wis-saa7113.c
+++ b/drivers/staging/go7007/wis-saa7113.c
@@ -289,7 +289,6 @@ static int wis_saa7113_probe(struct i2c_client *client,
289 if (write_regs(client, initial_registers) < 0) { 289 if (write_regs(client, initial_registers) < 0) {
290 printk(KERN_ERR 290 printk(KERN_ERR
291 "wis-saa7113: error initializing SAA7113\n"); 291 "wis-saa7113: error initializing SAA7113\n");
292 i2c_set_clientdata(client, NULL);
293 kfree(dec); 292 kfree(dec);
294 return -ENODEV; 293 return -ENODEV;
295 } 294 }
@@ -301,7 +300,6 @@ static int wis_saa7113_remove(struct i2c_client *client)
301{ 300{
302 struct wis_saa7113 *dec = i2c_get_clientdata(client); 301 struct wis_saa7113 *dec = i2c_get_clientdata(client);
303 302
304 i2c_set_clientdata(client, NULL);
305 kfree(dec); 303 kfree(dec);
306 return 0; 304 return 0;
307} 305}
diff --git a/drivers/staging/go7007/wis-saa7115.c b/drivers/staging/go7007/wis-saa7115.c
index b2eb804c1954..cd950b61cf70 100644
--- a/drivers/staging/go7007/wis-saa7115.c
+++ b/drivers/staging/go7007/wis-saa7115.c
@@ -422,7 +422,6 @@ static int wis_saa7115_probe(struct i2c_client *client,
422 if (write_regs(client, initial_registers) < 0) { 422 if (write_regs(client, initial_registers) < 0) {
423 printk(KERN_ERR 423 printk(KERN_ERR
424 "wis-saa7115: error initializing SAA7115\n"); 424 "wis-saa7115: error initializing SAA7115\n");
425 i2c_set_clientdata(client, NULL);
426 kfree(dec); 425 kfree(dec);
427 return -ENODEV; 426 return -ENODEV;
428 } 427 }
@@ -434,7 +433,6 @@ static int wis_saa7115_remove(struct i2c_client *client)
434{ 433{
435 struct wis_saa7115 *dec = i2c_get_clientdata(client); 434 struct wis_saa7115 *dec = i2c_get_clientdata(client);
436 435
437 i2c_set_clientdata(client, NULL);
438 kfree(dec); 436 kfree(dec);
439 return 0; 437 return 0;
440} 438}
diff --git a/drivers/staging/go7007/wis-sony-tuner.c b/drivers/staging/go7007/wis-sony-tuner.c
index b1013291190f..981c9b311b8b 100644
--- a/drivers/staging/go7007/wis-sony-tuner.c
+++ b/drivers/staging/go7007/wis-sony-tuner.c
@@ -684,7 +684,6 @@ static int wis_sony_tuner_remove(struct i2c_client *client)
684{ 684{
685 struct wis_sony_tuner *t = i2c_get_clientdata(client); 685 struct wis_sony_tuner *t = i2c_get_clientdata(client);
686 686
687 i2c_set_clientdata(client, NULL);
688 kfree(t); 687 kfree(t);
689 return 0; 688 return 0;
690} 689}
diff --git a/drivers/staging/go7007/wis-tw2804.c b/drivers/staging/go7007/wis-tw2804.c
index 315268d130dd..ee28a99dc388 100644
--- a/drivers/staging/go7007/wis-tw2804.c
+++ b/drivers/staging/go7007/wis-tw2804.c
@@ -323,7 +323,6 @@ static int wis_tw2804_remove(struct i2c_client *client)
323{ 323{
324 struct wis_tw2804 *dec = i2c_get_clientdata(client); 324 struct wis_tw2804 *dec = i2c_get_clientdata(client);
325 325
326 i2c_set_clientdata(client, NULL);
327 kfree(dec); 326 kfree(dec);
328 return 0; 327 return 0;
329} 328}
diff --git a/drivers/staging/go7007/wis-tw9903.c b/drivers/staging/go7007/wis-tw9903.c
index 2afea09091b9..80d47269b1c0 100644
--- a/drivers/staging/go7007/wis-tw9903.c
+++ b/drivers/staging/go7007/wis-tw9903.c
@@ -294,7 +294,6 @@ static int wis_tw9903_probe(struct i2c_client *client,
294 294
295 if (write_regs(client, initial_registers) < 0) { 295 if (write_regs(client, initial_registers) < 0) {
296 printk(KERN_ERR "wis-tw9903: error initializing TW9903\n"); 296 printk(KERN_ERR "wis-tw9903: error initializing TW9903\n");
297 i2c_set_clientdata(client, NULL);
298 kfree(dec); 297 kfree(dec);
299 return -ENODEV; 298 return -ENODEV;
300 } 299 }
@@ -306,7 +305,6 @@ static int wis_tw9903_remove(struct i2c_client *client)
306{ 305{
307 struct wis_tw9903 *dec = i2c_get_clientdata(client); 306 struct wis_tw9903 *dec = i2c_get_clientdata(client);
308 307
309 i2c_set_clientdata(client, NULL);
310 kfree(dec); 308 kfree(dec);
311 return 0; 309 return 0;
312} 310}
diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 20e267448d1f..905f8560d31f 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -1011,7 +1011,6 @@ error_put_reg:
1011 if (!IS_ERR(st->reg)) 1011 if (!IS_ERR(st->reg))
1012 regulator_put(st->reg); 1012 regulator_put(st->reg);
1013error_free_st: 1013error_free_st:
1014 i2c_set_clientdata(client, NULL);
1015 kfree(st); 1014 kfree(st);
1016 1015
1017error_ret: 1016error_ret:
@@ -1030,7 +1029,6 @@ static int max1363_remove(struct i2c_client *client)
1030 regulator_disable(st->reg); 1029 regulator_disable(st->reg);
1031 regulator_put(st->reg); 1030 regulator_put(st->reg);
1032 } 1031 }
1033 i2c_set_clientdata(client, NULL);
1034 kfree(st); 1032 kfree(st);
1035 1033
1036 return 0; 1034 return 0;
diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index 43aaacff4e74..e4b0a5ef1c1f 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -694,7 +694,6 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
694fail2: 694fail2:
695 iio_device_unregister(chip->indio_dev); 695 iio_device_unregister(chip->indio_dev);
696fail1: 696fail1:
697 i2c_set_clientdata(client, NULL);
698 kfree(chip); 697 kfree(chip);
699 return err; 698 return err;
700} 699}
@@ -705,7 +704,6 @@ static int tsl2563_remove(struct i2c_client *client)
705 704
706 iio_device_unregister(chip->indio_dev); 705 iio_device_unregister(chip->indio_dev);
707 706
708 i2c_set_clientdata(client, NULL);
709 kfree(chip); 707 kfree(chip);
710 return 0; 708 return 0;
711} 709}
diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
index 921ca37398f3..3ec24609151e 100644
--- a/drivers/video/backlight/adp8860_bl.c
+++ b/drivers/video/backlight/adp8860_bl.c
@@ -756,7 +756,6 @@ out:
756out1: 756out1:
757 backlight_device_unregister(bl); 757 backlight_device_unregister(bl);
758out2: 758out2:
759 i2c_set_clientdata(client, NULL);
760 kfree(data); 759 kfree(data);
761 760
762 return ret; 761 return ret;
@@ -776,7 +775,6 @@ static int __devexit adp8860_remove(struct i2c_client *client)
776 &adp8860_bl_attr_group); 775 &adp8860_bl_attr_group);
777 776
778 backlight_device_unregister(data->bl); 777 backlight_device_unregister(data->bl);
779 i2c_set_clientdata(client, NULL);
780 kfree(data); 778 kfree(data);
781 779
782 return 0; 780 return 0;
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index e03e60bbfd85..2a04b382ec48 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -119,7 +119,6 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
119 119
120err_reg: 120err_reg:
121 data->bl = NULL; 121 data->bl = NULL;
122 i2c_set_clientdata(client, NULL);
123err_gpio_dir: 122err_gpio_dir:
124 gpio_free(TOSA_GPIO_BL_C20MA); 123 gpio_free(TOSA_GPIO_BL_C20MA);
125err_gpio_bl: 124err_gpio_bl:
@@ -133,7 +132,6 @@ static int __devexit tosa_bl_remove(struct i2c_client *client)
133 132
134 backlight_device_unregister(data->bl); 133 backlight_device_unregister(data->bl);
135 data->bl = NULL; 134 data->bl = NULL;
136 i2c_set_clientdata(client, NULL);
137 135
138 gpio_free(TOSA_GPIO_BL_C20MA); 136 gpio_free(TOSA_GPIO_BL_C20MA);
139 137