Commit b3e82096 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

i2c: Make i2c_del_driver a void function

Make i2c_del_driver a void function, like all other driver removal
functions. It always returned 0 even when errors occured, and nobody
ever actually checked the return value anyway. And we cannot fail
a module removal anyway.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent a97f1ed0
...@@ -586,10 +586,7 @@ the driver module is usually enough. ...@@ -586,10 +586,7 @@ the driver module is usually enough.
void foo_cleanup(void) void foo_cleanup(void)
{ {
if (foo_initialized == 1) { if (foo_initialized == 1) {
if ((res = i2c_del_driver(&foo_driver))) { i2c_del_driver(&foo_driver);
printk("foo: Driver registration failed, module not removed.\n");
return;
}
foo_initialized --; foo_initialized --;
} }
} }
......
...@@ -599,14 +599,12 @@ EXPORT_SYMBOL(i2c_register_driver); ...@@ -599,14 +599,12 @@ EXPORT_SYMBOL(i2c_register_driver);
* i2c_del_driver - unregister I2C driver * i2c_del_driver - unregister I2C driver
* @driver: the driver being unregistered * @driver: the driver being unregistered
*/ */
int i2c_del_driver(struct i2c_driver *driver) void i2c_del_driver(struct i2c_driver *driver)
{ {
struct list_head *item1, *item2, *_n; struct list_head *item1, *item2, *_n;
struct i2c_client *client; struct i2c_client *client;
struct i2c_adapter *adap; struct i2c_adapter *adap;
int res = 0;
mutex_lock(&core_lists); mutex_lock(&core_lists);
/* new-style driver? */ /* new-style driver? */
...@@ -620,11 +618,10 @@ int i2c_del_driver(struct i2c_driver *driver) ...@@ -620,11 +618,10 @@ int i2c_del_driver(struct i2c_driver *driver)
list_for_each(item1,&adapters) { list_for_each(item1,&adapters) {
adap = list_entry(item1, struct i2c_adapter, list); adap = list_entry(item1, struct i2c_adapter, list);
if (driver->detach_adapter) { if (driver->detach_adapter) {
if ((res = driver->detach_adapter(adap))) { if (driver->detach_adapter(adap)) {
dev_err(&adap->dev, "detach_adapter failed " dev_err(&adap->dev, "detach_adapter failed "
"for driver [%s]\n", "for driver [%s]\n",
driver->driver.name); driver->driver.name);
goto out_unlock;
} }
} else { } else {
list_for_each_safe(item2, _n, &adap->clients) { list_for_each_safe(item2, _n, &adap->clients) {
...@@ -634,12 +631,11 @@ int i2c_del_driver(struct i2c_driver *driver) ...@@ -634,12 +631,11 @@ int i2c_del_driver(struct i2c_driver *driver)
dev_dbg(&adap->dev, "detaching client [%s] " dev_dbg(&adap->dev, "detaching client [%s] "
"at 0x%02x\n", client->name, "at 0x%02x\n", client->name,
client->addr); client->addr);
if ((res = driver->detach_client(client))) { if (driver->detach_client(client)) {
dev_err(&adap->dev, "detach_client " dev_err(&adap->dev, "detach_client "
"failed for client [%s] at " "failed for client [%s] at "
"0x%02x\n", client->name, "0x%02x\n", client->name,
client->addr); client->addr);
goto out_unlock;
} }
} }
} }
...@@ -650,9 +646,7 @@ int i2c_del_driver(struct i2c_driver *driver) ...@@ -650,9 +646,7 @@ int i2c_del_driver(struct i2c_driver *driver)
list_del(&driver->list); list_del(&driver->list);
pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
out_unlock:
mutex_unlock(&core_lists); mutex_unlock(&core_lists);
return 0;
} }
EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_del_driver);
......
...@@ -459,7 +459,8 @@ therm_of_probe( struct of_device *dev, const struct of_device_id *match ) ...@@ -459,7 +459,8 @@ therm_of_probe( struct of_device *dev, const struct of_device_id *match )
static int static int
therm_of_remove( struct of_device *dev ) therm_of_remove( struct of_device *dev )
{ {
return i2c_del_driver( &g4fan_driver ); i2c_del_driver( &g4fan_driver );
return 0;
} }
static struct of_device_id therm_of_match[] = {{ static struct of_device_id therm_of_match[] = {{
......
...@@ -371,7 +371,7 @@ extern int i2c_del_adapter(struct i2c_adapter *); ...@@ -371,7 +371,7 @@ extern int i2c_del_adapter(struct i2c_adapter *);
extern int i2c_add_numbered_adapter(struct i2c_adapter *); extern int i2c_add_numbered_adapter(struct i2c_adapter *);
extern int i2c_register_driver(struct module *, struct i2c_driver *); extern int i2c_register_driver(struct module *, struct i2c_driver *);
extern int i2c_del_driver(struct i2c_driver *); extern void i2c_del_driver(struct i2c_driver *);
static inline int i2c_add_driver(struct i2c_driver *driver) static inline int i2c_add_driver(struct i2c_driver *driver)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment