aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-05-01 17:26:32 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-01 17:26:32 -0400
commitb3e820968ad47219f7d559117a30e85cf96b4e4e (patch)
tree84e5ae3275cea6fa5074b0c9b08eaada55f02bea
parenta97f1ed090fc01a5876a7caf2cbdf93470436201 (diff)
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: Jean Delvare <khali@linux-fr.org>
-rw-r--r--Documentation/i2c/writing-clients5
-rw-r--r--drivers/i2c/i2c-core.c12
-rw-r--r--drivers/macintosh/therm_windtunnel.c3
-rw-r--r--include/linux/i2c.h2
4 files changed, 7 insertions, 15 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index e62fbfa1282d..f7e04ec849b1 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -586,10 +586,7 @@ the driver module is usually enough.
586 void foo_cleanup(void) 586 void foo_cleanup(void)
587 { 587 {
588 if (foo_initialized == 1) { 588 if (foo_initialized == 1) {
589 if ((res = i2c_del_driver(&foo_driver))) { 589 i2c_del_driver(&foo_driver);
590 printk("foo: Driver registration failed, module not removed.\n");
591 return;
592 }
593 foo_initialized --; 590 foo_initialized --;
594 } 591 }
595 } 592 }
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 0fd4acbffb78..a58f89a6418a 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -599,14 +599,12 @@ EXPORT_SYMBOL(i2c_register_driver);
599 * i2c_del_driver - unregister I2C driver 599 * i2c_del_driver - unregister I2C driver
600 * @driver: the driver being unregistered 600 * @driver: the driver being unregistered
601 */ 601 */
602int i2c_del_driver(struct i2c_driver *driver) 602void i2c_del_driver(struct i2c_driver *driver)
603{ 603{
604 struct list_head *item1, *item2, *_n; 604 struct list_head *item1, *item2, *_n;
605 struct i2c_client *client; 605 struct i2c_client *client;
606 struct i2c_adapter *adap; 606 struct i2c_adapter *adap;
607 607
608 int res = 0;
609
610 mutex_lock(&core_lists); 608 mutex_lock(&core_lists);
611 609
612 /* new-style driver? */ 610 /* new-style driver? */
@@ -620,11 +618,10 @@ int i2c_del_driver(struct i2c_driver *driver)
620 list_for_each(item1,&adapters) { 618 list_for_each(item1,&adapters) {
621 adap = list_entry(item1, struct i2c_adapter, list); 619 adap = list_entry(item1, struct i2c_adapter, list);
622 if (driver->detach_adapter) { 620 if (driver->detach_adapter) {
623 if ((res = driver->detach_adapter(adap))) { 621 if (driver->detach_adapter(adap)) {
624 dev_err(&adap->dev, "detach_adapter failed " 622 dev_err(&adap->dev, "detach_adapter failed "
625 "for driver [%s]\n", 623 "for driver [%s]\n",
626 driver->driver.name); 624 driver->driver.name);
627 goto out_unlock;
628 } 625 }
629 } else { 626 } else {
630 list_for_each_safe(item2, _n, &adap->clients) { 627 list_for_each_safe(item2, _n, &adap->clients) {
@@ -634,12 +631,11 @@ int i2c_del_driver(struct i2c_driver *driver)
634 dev_dbg(&adap->dev, "detaching client [%s] " 631 dev_dbg(&adap->dev, "detaching client [%s] "
635 "at 0x%02x\n", client->name, 632 "at 0x%02x\n", client->name,
636 client->addr); 633 client->addr);
637 if ((res = driver->detach_client(client))) { 634 if (driver->detach_client(client)) {
638 dev_err(&adap->dev, "detach_client " 635 dev_err(&adap->dev, "detach_client "
639 "failed for client [%s] at " 636 "failed for client [%s] at "
640 "0x%02x\n", client->name, 637 "0x%02x\n", client->name,
641 client->addr); 638 client->addr);
642 goto out_unlock;
643 } 639 }
644 } 640 }
645 } 641 }
@@ -650,9 +646,7 @@ int i2c_del_driver(struct i2c_driver *driver)
650 list_del(&driver->list); 646 list_del(&driver->list);
651 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); 647 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
652 648
653 out_unlock:
654 mutex_unlock(&core_lists); 649 mutex_unlock(&core_lists);
655 return 0;
656} 650}
657EXPORT_SYMBOL(i2c_del_driver); 651EXPORT_SYMBOL(i2c_del_driver);
658 652
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 35233de460ad..3d0354e96a97 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -459,7 +459,8 @@ therm_of_probe( struct of_device *dev, const struct of_device_id *match )
459static int 459static int
460therm_of_remove( struct of_device *dev ) 460therm_of_remove( struct of_device *dev )
461{ 461{
462 return i2c_del_driver( &g4fan_driver ); 462 i2c_del_driver( &g4fan_driver );
463 return 0;
463} 464}
464 465
465static struct of_device_id therm_of_match[] = {{ 466static struct of_device_id therm_of_match[] = {{
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 3af7111c6680..3fe2ad37da30 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -371,7 +371,7 @@ extern int i2c_del_adapter(struct i2c_adapter *);
371extern int i2c_add_numbered_adapter(struct i2c_adapter *); 371extern int i2c_add_numbered_adapter(struct i2c_adapter *);
372 372
373extern int i2c_register_driver(struct module *, struct i2c_driver *); 373extern int i2c_register_driver(struct module *, struct i2c_driver *);
374extern int i2c_del_driver(struct i2c_driver *); 374extern void i2c_del_driver(struct i2c_driver *);
375 375
376static inline int i2c_add_driver(struct i2c_driver *driver) 376static inline int i2c_add_driver(struct i2c_driver *driver)
377{ 377{