aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2010-06-03 05:33:58 -0400
committerJean Delvare <khali@linux-fr.org>2010-06-03 05:33:58 -0400
commitfbae3fb1546e199ab0cd185348f8124411a1ca9d (patch)
tree928881dc419348268cbc8208a41fe0d038035114 /drivers/hwmon
parent35bfc353dcaecc99c277e3646564f3f785760bde (diff)
i2c: Remove all i2c_set_clientdata(client, NULL) in drivers
I2C drivers can use the clientdata-pointer to point to private data. As I2C devices are not really unregistered, but merely detached from their driver, it used to be the drivers obligation to clear this pointer during remove() or a failed probe(). As a couple of drivers forgot to do this, it was agreed that it was cleaner if the i2c-core does this clearance when appropriate, as there is no guarantee for the lifetime of the clientdata-pointer after remove() anyhow. This feature was added to the core with commit e4a7b9b04de15f6b63da5ccdd373ffa3057a3681 to fix the faulty drivers. As there is no need anymore to clear the clientdata-pointer, remove all current occurrences in the drivers to simplify the code and prevent confusion. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Richard Purdie <rpurdie@linux.intel.com> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-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
10 files changed, 0 insertions, 18 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;