aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-01-27 12:14:49 -0500
committerJean Delvare <khali@hyperion.delvare>2008-01-27 12:14:49 -0500
commitcaada32afe0d181b1dc36ab3fc29628582776e09 (patch)
tree80ae435b982de2e8057e804f86220b3e2b274859
parent026526f5afcd421dce110f53e4c4e2b9e78753c2 (diff)
i2c: Rename main mutex
Rename the main mutex in i2c-core from core_lists to core_lock. This makes more sense now that the redundant lists are gone. Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/i2c/i2c-core.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 29d2a1b4b46..7161f913de1 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -39,7 +39,7 @@
39#include "i2c-core.h" 39#include "i2c-core.h"
40 40
41 41
42static DEFINE_MUTEX(core_lists); 42static DEFINE_MUTEX(core_lock);
43static DEFINE_IDR(i2c_adapter_idr); 43static DEFINE_IDR(i2c_adapter_idr);
44 44
45#define is_newstyle_driver(d) ((d)->probe || (d)->remove) 45#define is_newstyle_driver(d) ((d)->probe || (d)->remove)
@@ -339,7 +339,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
339 mutex_init(&adap->clist_lock); 339 mutex_init(&adap->clist_lock);
340 INIT_LIST_HEAD(&adap->clients); 340 INIT_LIST_HEAD(&adap->clients);
341 341
342 mutex_lock(&core_lists); 342 mutex_lock(&core_lock);
343 343
344 /* Add the adapter to the driver core. 344 /* Add the adapter to the driver core.
345 * If the parent pointer is not set up, 345 * If the parent pointer is not set up,
@@ -368,7 +368,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
368 i2c_do_add_adapter); 368 i2c_do_add_adapter);
369 369
370out_unlock: 370out_unlock:
371 mutex_unlock(&core_lists); 371 mutex_unlock(&core_lock);
372 return res; 372 return res;
373 373
374out_list: 374out_list:
@@ -397,11 +397,11 @@ retry:
397 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) 397 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0)
398 return -ENOMEM; 398 return -ENOMEM;
399 399
400 mutex_lock(&core_lists); 400 mutex_lock(&core_lock);
401 /* "above" here means "above or equal to", sigh */ 401 /* "above" here means "above or equal to", sigh */
402 res = idr_get_new_above(&i2c_adapter_idr, adapter, 402 res = idr_get_new_above(&i2c_adapter_idr, adapter,
403 __i2c_first_dynamic_bus_num, &id); 403 __i2c_first_dynamic_bus_num, &id);
404 mutex_unlock(&core_lists); 404 mutex_unlock(&core_lock);
405 405
406 if (res < 0) { 406 if (res < 0) {
407 if (res == -EAGAIN) 407 if (res == -EAGAIN)
@@ -446,7 +446,7 @@ retry:
446 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) 446 if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0)
447 return -ENOMEM; 447 return -ENOMEM;
448 448
449 mutex_lock(&core_lists); 449 mutex_lock(&core_lock);
450 /* "above" here means "above or equal to", sigh; 450 /* "above" here means "above or equal to", sigh;
451 * we need the "equal to" result to force the result 451 * we need the "equal to" result to force the result
452 */ 452 */
@@ -455,7 +455,7 @@ retry:
455 status = -EBUSY; 455 status = -EBUSY;
456 idr_remove(&i2c_adapter_idr, id); 456 idr_remove(&i2c_adapter_idr, id);
457 } 457 }
458 mutex_unlock(&core_lists); 458 mutex_unlock(&core_lock);
459 if (status == -EAGAIN) 459 if (status == -EAGAIN)
460 goto retry; 460 goto retry;
461 461
@@ -494,7 +494,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
494 struct i2c_client *client; 494 struct i2c_client *client;
495 int res = 0; 495 int res = 0;
496 496
497 mutex_lock(&core_lists); 497 mutex_lock(&core_lock);
498 498
499 /* First make sure that this adapter was ever added */ 499 /* First make sure that this adapter was ever added */
500 if (idr_find(&i2c_adapter_idr, adap->nr) != adap) { 500 if (idr_find(&i2c_adapter_idr, adap->nr) != adap) {
@@ -546,7 +546,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
546 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); 546 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
547 547
548 out_unlock: 548 out_unlock:
549 mutex_unlock(&core_lists); 549 mutex_unlock(&core_lock);
550 return res; 550 return res;
551} 551}
552EXPORT_SYMBOL(i2c_del_adapter); 552EXPORT_SYMBOL(i2c_del_adapter);
@@ -589,7 +589,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
589 if (res) 589 if (res)
590 return res; 590 return res;
591 591
592 mutex_lock(&core_lists); 592 mutex_lock(&core_lock);
593 593
594 pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); 594 pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
595 595
@@ -605,7 +605,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
605 up(&i2c_adapter_class.sem); 605 up(&i2c_adapter_class.sem);
606 } 606 }
607 607
608 mutex_unlock(&core_lists); 608 mutex_unlock(&core_lock);
609 return 0; 609 return 0;
610} 610}
611EXPORT_SYMBOL(i2c_register_driver); 611EXPORT_SYMBOL(i2c_register_driver);
@@ -621,7 +621,7 @@ void i2c_del_driver(struct i2c_driver *driver)
621 struct i2c_client *client; 621 struct i2c_client *client;
622 struct i2c_adapter *adap; 622 struct i2c_adapter *adap;
623 623
624 mutex_lock(&core_lists); 624 mutex_lock(&core_lock);
625 625
626 /* new-style driver? */ 626 /* new-style driver? */
627 if (is_newstyle_driver(driver)) 627 if (is_newstyle_driver(driver))
@@ -662,7 +662,7 @@ void i2c_del_driver(struct i2c_driver *driver)
662 driver_unregister(&driver->driver); 662 driver_unregister(&driver->driver);
663 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); 663 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
664 664
665 mutex_unlock(&core_lists); 665 mutex_unlock(&core_lock);
666} 666}
667EXPORT_SYMBOL(i2c_del_driver); 667EXPORT_SYMBOL(i2c_del_driver);
668 668
@@ -1121,12 +1121,12 @@ struct i2c_adapter* i2c_get_adapter(int id)
1121{ 1121{
1122 struct i2c_adapter *adapter; 1122 struct i2c_adapter *adapter;
1123 1123
1124 mutex_lock(&core_lists); 1124 mutex_lock(&core_lock);
1125 adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); 1125 adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
1126 if (adapter && !try_module_get(adapter->owner)) 1126 if (adapter && !try_module_get(adapter->owner))
1127 adapter = NULL; 1127 adapter = NULL;
1128 1128
1129 mutex_unlock(&core_lists); 1129 mutex_unlock(&core_lock);
1130 return adapter; 1130 return adapter;
1131} 1131}
1132EXPORT_SYMBOL(i2c_get_adapter); 1132EXPORT_SYMBOL(i2c_get_adapter);