diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-03-07 03:22:51 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-05-10 04:23:22 -0400 |
commit | a60f22c4af3382b86301d64d6a9d68f30191d4c9 (patch) | |
tree | c55ae981b73ab53647fdd0c3028b8d877acfa03a /drivers | |
parent | 6d59622e52c296cad8702c483a0092f428b794ef (diff) |
pcmcia: remove pcmcia_add_device_lock
As all cards to pcmcia_device_add() are already locked by skt_mutex, and
the critical sections inside this function are further protected by
ops_mutex, there's no need to keep a third lock around. Therfore, remove
pcmcia_add_device_lock.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pcmcia/ds.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 0e12d85dd723..7ef7adee5e4f 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -477,15 +477,6 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
477 | } | 477 | } |
478 | 478 | ||
479 | 479 | ||
480 | /* device_add_lock is needed to avoid double registration by cardmgr and kernel. | ||
481 | * Serializes pcmcia_device_add; will most likely be removed in future. | ||
482 | * | ||
483 | * While it has the caveat that adding new PCMCIA devices inside(!) device_register() | ||
484 | * won't work, this doesn't matter much at the moment: the driver core doesn't | ||
485 | * support it either. | ||
486 | */ | ||
487 | static DEFINE_MUTEX(device_add_lock); | ||
488 | |||
489 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) | 480 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) |
490 | { | 481 | { |
491 | struct pcmcia_device *p_dev, *tmp_dev; | 482 | struct pcmcia_device *p_dev, *tmp_dev; |
@@ -495,8 +486,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
495 | if (!s) | 486 | if (!s) |
496 | return NULL; | 487 | return NULL; |
497 | 488 | ||
498 | mutex_lock(&device_add_lock); | ||
499 | |||
500 | pr_debug("adding device to %d, function %d\n", s->sock, function); | 489 | pr_debug("adding device to %d, function %d\n", s->sock, function); |
501 | 490 | ||
502 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); | 491 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); |
@@ -536,8 +525,8 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
536 | 525 | ||
537 | /* | 526 | /* |
538 | * p_dev->function_config must be the same for all card functions. | 527 | * p_dev->function_config must be the same for all card functions. |
539 | * Note that this is serialized by the device_add_lock, so that | 528 | * Note that this is serialized by ops_mutex, so that only one |
540 | * only one such struct will be created. | 529 | * such struct will be created. |
541 | */ | 530 | */ |
542 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) | 531 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) |
543 | if (p_dev->func == tmp_dev->func) { | 532 | if (p_dev->func == tmp_dev->func) { |
@@ -575,8 +564,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
575 | if (device_register(&p_dev->dev)) | 564 | if (device_register(&p_dev->dev)) |
576 | goto err_unreg; | 565 | goto err_unreg; |
577 | 566 | ||
578 | mutex_unlock(&device_add_lock); | ||
579 | |||
580 | return p_dev; | 567 | return p_dev; |
581 | 568 | ||
582 | err_unreg: | 569 | err_unreg: |
@@ -594,7 +581,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
594 | kfree(p_dev->devname); | 581 | kfree(p_dev->devname); |
595 | kfree(p_dev); | 582 | kfree(p_dev); |
596 | err_put: | 583 | err_put: |
597 | mutex_unlock(&device_add_lock); | ||
598 | pcmcia_put_socket(s); | 584 | pcmcia_put_socket(s); |
599 | 585 | ||
600 | return NULL; | 586 | return NULL; |