diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-18 17:16:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-23 17:21:51 -0500 |
commit | 5c085d369c2c4f18942ec8951466e186366d5c78 (patch) | |
tree | 22ca525700049a402281a0503b07db0645075f58 /drivers/i2c/i2c-core.c | |
parent | 7656032b904b936eca65a41afa1f2b3603195657 (diff) |
[PATCH] i2c: Semaphore to mutex conversions, part 2
semaphore to mutex conversion.
the conversion was generated via scripts, and the result was validated
automatically via a script as well.
build tested.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 2b0c555aa011..975cb647da10 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -169,8 +169,8 @@ int i2c_add_adapter(struct i2c_adapter *adap) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | adap->nr = id & MAX_ID_MASK; | 171 | adap->nr = id & MAX_ID_MASK; |
172 | init_MUTEX(&adap->bus_lock); | 172 | mutex_init(&adap->bus_lock); |
173 | init_MUTEX(&adap->clist_lock); | 173 | mutex_init(&adap->clist_lock); |
174 | list_add_tail(&adap->list,&adapters); | 174 | list_add_tail(&adap->list,&adapters); |
175 | INIT_LIST_HEAD(&adap->clients); | 175 | INIT_LIST_HEAD(&adap->clients); |
176 | 176 | ||
@@ -385,9 +385,9 @@ int i2c_check_addr(struct i2c_adapter *adapter, int addr) | |||
385 | { | 385 | { |
386 | int rval; | 386 | int rval; |
387 | 387 | ||
388 | down(&adapter->clist_lock); | 388 | mutex_lock(&adapter->clist_lock); |
389 | rval = __i2c_check_addr(adapter, addr); | 389 | rval = __i2c_check_addr(adapter, addr); |
390 | up(&adapter->clist_lock); | 390 | mutex_unlock(&adapter->clist_lock); |
391 | 391 | ||
392 | return rval; | 392 | return rval; |
393 | } | 393 | } |
@@ -396,13 +396,13 @@ int i2c_attach_client(struct i2c_client *client) | |||
396 | { | 396 | { |
397 | struct i2c_adapter *adapter = client->adapter; | 397 | struct i2c_adapter *adapter = client->adapter; |
398 | 398 | ||
399 | down(&adapter->clist_lock); | 399 | mutex_lock(&adapter->clist_lock); |
400 | if (__i2c_check_addr(client->adapter, client->addr)) { | 400 | if (__i2c_check_addr(client->adapter, client->addr)) { |
401 | up(&adapter->clist_lock); | 401 | mutex_unlock(&adapter->clist_lock); |
402 | return -EBUSY; | 402 | return -EBUSY; |
403 | } | 403 | } |
404 | list_add_tail(&client->list,&adapter->clients); | 404 | list_add_tail(&client->list,&adapter->clients); |
405 | up(&adapter->clist_lock); | 405 | mutex_unlock(&adapter->clist_lock); |
406 | 406 | ||
407 | if (adapter->client_register) { | 407 | if (adapter->client_register) { |
408 | if (adapter->client_register(client)) { | 408 | if (adapter->client_register(client)) { |
@@ -451,12 +451,12 @@ int i2c_detach_client(struct i2c_client *client) | |||
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | down(&adapter->clist_lock); | 454 | mutex_lock(&adapter->clist_lock); |
455 | list_del(&client->list); | 455 | list_del(&client->list); |
456 | init_completion(&client->released); | 456 | init_completion(&client->released); |
457 | device_remove_file(&client->dev, &dev_attr_client_name); | 457 | device_remove_file(&client->dev, &dev_attr_client_name); |
458 | device_unregister(&client->dev); | 458 | device_unregister(&client->dev); |
459 | up(&adapter->clist_lock); | 459 | mutex_unlock(&adapter->clist_lock); |
460 | wait_for_completion(&client->released); | 460 | wait_for_completion(&client->released); |
461 | 461 | ||
462 | out: | 462 | out: |
@@ -514,19 +514,19 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) | |||
514 | struct list_head *item; | 514 | struct list_head *item; |
515 | struct i2c_client *client; | 515 | struct i2c_client *client; |
516 | 516 | ||
517 | down(&adap->clist_lock); | 517 | mutex_lock(&adap->clist_lock); |
518 | list_for_each(item,&adap->clients) { | 518 | list_for_each(item,&adap->clients) { |
519 | client = list_entry(item, struct i2c_client, list); | 519 | client = list_entry(item, struct i2c_client, list); |
520 | if (!try_module_get(client->driver->driver.owner)) | 520 | if (!try_module_get(client->driver->driver.owner)) |
521 | continue; | 521 | continue; |
522 | if (NULL != client->driver->command) { | 522 | if (NULL != client->driver->command) { |
523 | up(&adap->clist_lock); | 523 | mutex_unlock(&adap->clist_lock); |
524 | client->driver->command(client,cmd,arg); | 524 | client->driver->command(client,cmd,arg); |
525 | down(&adap->clist_lock); | 525 | mutex_lock(&adap->clist_lock); |
526 | } | 526 | } |
527 | module_put(client->driver->driver.owner); | 527 | module_put(client->driver->driver.owner); |
528 | } | 528 | } |
529 | up(&adap->clist_lock); | 529 | mutex_unlock(&adap->clist_lock); |
530 | } | 530 | } |
531 | 531 | ||
532 | static int __init i2c_init(void) | 532 | static int __init i2c_init(void) |
@@ -570,9 +570,9 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) | |||
570 | } | 570 | } |
571 | #endif | 571 | #endif |
572 | 572 | ||
573 | down(&adap->bus_lock); | 573 | mutex_lock(&adap->bus_lock); |
574 | ret = adap->algo->master_xfer(adap,msgs,num); | 574 | ret = adap->algo->master_xfer(adap,msgs,num); |
575 | up(&adap->bus_lock); | 575 | mutex_unlock(&adap->bus_lock); |
576 | 576 | ||
577 | return ret; | 577 | return ret; |
578 | } else { | 578 | } else { |
@@ -1116,10 +1116,10 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, | |||
1116 | flags &= I2C_M_TEN | I2C_CLIENT_PEC; | 1116 | flags &= I2C_M_TEN | I2C_CLIENT_PEC; |
1117 | 1117 | ||
1118 | if (adapter->algo->smbus_xfer) { | 1118 | if (adapter->algo->smbus_xfer) { |
1119 | down(&adapter->bus_lock); | 1119 | mutex_lock(&adapter->bus_lock); |
1120 | res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write, | 1120 | res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write, |
1121 | command,size,data); | 1121 | command,size,data); |
1122 | up(&adapter->bus_lock); | 1122 | mutex_unlock(&adapter->bus_lock); |
1123 | } else | 1123 | } else |
1124 | res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, | 1124 | res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, |
1125 | command,size,data); | 1125 | command,size,data); |