diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-03-09 03:16:44 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-04-02 01:03:28 -0400 |
commit | 19baba4cb6843bbe3dfde87e1e913f6a9cd27da9 (patch) | |
tree | ee31c87c789cf205102678193d4c4fc06c14783b /drivers/i2c/i2c-core.c | |
parent | 600abeadf318fbdb25e1e3e4379f6a7bb1952d5b (diff) |
i2c: Remove detach_adapter
The detach_adapter callback has been deprecated for quite some time and has no
user left. Keeping it alive blocks other cleanups, so remove it.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 0d873ba2e82e..f7cd05b4f327 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | /* core_lock protects i2c_adapter_idr, and guarantees | 50 | /* core_lock protects i2c_adapter_idr, and guarantees |
51 | that device detection, deletion of detected devices, and attach_adapter | 51 | that device detection, deletion of detected devices, and attach_adapter |
52 | and detach_adapter calls are serialized */ | 52 | calls are serialized */ |
53 | static DEFINE_MUTEX(core_lock); | 53 | static DEFINE_MUTEX(core_lock); |
54 | static DEFINE_IDR(i2c_adapter_idr); | 54 | static DEFINE_IDR(i2c_adapter_idr); |
55 | 55 | ||
@@ -1172,11 +1172,10 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adap) | |||
1172 | } | 1172 | } |
1173 | EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter); | 1173 | EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter); |
1174 | 1174 | ||
1175 | static int i2c_do_del_adapter(struct i2c_driver *driver, | 1175 | static void i2c_do_del_adapter(struct i2c_driver *driver, |
1176 | struct i2c_adapter *adapter) | 1176 | struct i2c_adapter *adapter) |
1177 | { | 1177 | { |
1178 | struct i2c_client *client, *_n; | 1178 | struct i2c_client *client, *_n; |
1179 | int res; | ||
1180 | 1179 | ||
1181 | /* Remove the devices we created ourselves as the result of hardware | 1180 | /* Remove the devices we created ourselves as the result of hardware |
1182 | * probing (using a driver's detect method) */ | 1181 | * probing (using a driver's detect method) */ |
@@ -1188,16 +1187,6 @@ static int i2c_do_del_adapter(struct i2c_driver *driver, | |||
1188 | i2c_unregister_device(client); | 1187 | i2c_unregister_device(client); |
1189 | } | 1188 | } |
1190 | } | 1189 | } |
1191 | |||
1192 | if (!driver->detach_adapter) | ||
1193 | return 0; | ||
1194 | dev_warn(&adapter->dev, "%s: detach_adapter method is deprecated\n", | ||
1195 | driver->driver.name); | ||
1196 | res = driver->detach_adapter(adapter); | ||
1197 | if (res) | ||
1198 | dev_err(&adapter->dev, "detach_adapter failed (%d) " | ||
1199 | "for driver [%s]\n", res, driver->driver.name); | ||
1200 | return res; | ||
1201 | } | 1190 | } |
1202 | 1191 | ||
1203 | static int __unregister_client(struct device *dev, void *dummy) | 1192 | static int __unregister_client(struct device *dev, void *dummy) |
@@ -1218,7 +1207,8 @@ static int __unregister_dummy(struct device *dev, void *dummy) | |||
1218 | 1207 | ||
1219 | static int __process_removed_adapter(struct device_driver *d, void *data) | 1208 | static int __process_removed_adapter(struct device_driver *d, void *data) |
1220 | { | 1209 | { |
1221 | return i2c_do_del_adapter(to_i2c_driver(d), data); | 1210 | i2c_do_del_adapter(to_i2c_driver(d), data); |
1211 | return 0; | ||
1222 | } | 1212 | } |
1223 | 1213 | ||
1224 | /** | 1214 | /** |
@@ -1231,7 +1221,6 @@ static int __process_removed_adapter(struct device_driver *d, void *data) | |||
1231 | */ | 1221 | */ |
1232 | int i2c_del_adapter(struct i2c_adapter *adap) | 1222 | int i2c_del_adapter(struct i2c_adapter *adap) |
1233 | { | 1223 | { |
1234 | int res = 0; | ||
1235 | struct i2c_adapter *found; | 1224 | struct i2c_adapter *found; |
1236 | struct i2c_client *client, *next; | 1225 | struct i2c_client *client, *next; |
1237 | 1226 | ||
@@ -1247,11 +1236,9 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
1247 | 1236 | ||
1248 | /* Tell drivers about this removal */ | 1237 | /* Tell drivers about this removal */ |
1249 | mutex_lock(&core_lock); | 1238 | mutex_lock(&core_lock); |
1250 | res = bus_for_each_drv(&i2c_bus_type, NULL, adap, | 1239 | bus_for_each_drv(&i2c_bus_type, NULL, adap, |
1251 | __process_removed_adapter); | 1240 | __process_removed_adapter); |
1252 | mutex_unlock(&core_lock); | 1241 | mutex_unlock(&core_lock); |
1253 | if (res) | ||
1254 | return res; | ||
1255 | 1242 | ||
1256 | /* Remove devices instantiated from sysfs */ | 1243 | /* Remove devices instantiated from sysfs */ |
1257 | mutex_lock_nested(&adap->userspace_clients_lock, | 1244 | mutex_lock_nested(&adap->userspace_clients_lock, |
@@ -1270,8 +1257,8 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
1270 | * we can't remove the dummy devices during the first pass: they | 1257 | * we can't remove the dummy devices during the first pass: they |
1271 | * could have been instantiated by real devices wishing to clean | 1258 | * could have been instantiated by real devices wishing to clean |
1272 | * them up properly, so we give them a chance to do that first. */ | 1259 | * them up properly, so we give them a chance to do that first. */ |
1273 | res = device_for_each_child(&adap->dev, NULL, __unregister_client); | 1260 | device_for_each_child(&adap->dev, NULL, __unregister_client); |
1274 | res = device_for_each_child(&adap->dev, NULL, __unregister_dummy); | 1261 | device_for_each_child(&adap->dev, NULL, __unregister_dummy); |
1275 | 1262 | ||
1276 | #ifdef CONFIG_I2C_COMPAT | 1263 | #ifdef CONFIG_I2C_COMPAT |
1277 | class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, | 1264 | class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, |
@@ -1367,9 +1354,9 @@ EXPORT_SYMBOL(i2c_register_driver); | |||
1367 | 1354 | ||
1368 | static int __process_removed_driver(struct device *dev, void *data) | 1355 | static int __process_removed_driver(struct device *dev, void *data) |
1369 | { | 1356 | { |
1370 | if (dev->type != &i2c_adapter_type) | 1357 | if (dev->type == &i2c_adapter_type) |
1371 | return 0; | 1358 | i2c_do_del_adapter(data, to_i2c_adapter(dev)); |
1372 | return i2c_do_del_adapter(data, to_i2c_adapter(dev)); | 1359 | return 0; |
1373 | } | 1360 | } |
1374 | 1361 | ||
1375 | /** | 1362 | /** |