diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-03-18 22:39:55 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-03-18 22:39:55 +0100 |
commit | 38f6b38dbb0896511c509fbb6ceabbedbee8e87d (patch) | |
tree | 00553b841e8af3add37162c6a189991d7dba30df /drivers/pnp/card.c | |
parent | aee94467d9858b5441c278ffa39dcd19bef548cf (diff) |
PNP: Convert pnp_lock into a mutex
pnp_lock is a spinlock, but it is only acquired from process context,
so it may be a mutex just fine.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pnp/card.c')
-rw-r--r-- | drivers/pnp/card.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 874c236ac1a7..31ad9fc3f701 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -5,6 +5,7 @@ */ #include <linux/module.h> +#include <linux/mutex.h> #include <linux/ctype.h> #include <linux/slab.h> #include <linux/pnp.h> @@ -244,10 +245,10 @@ int pnp_add_card(struct pnp_card *card) } pnp_interface_attach_card(card); - spin_lock(&pnp_lock); + mutex_lock(&pnp_lock); list_add_tail(&card->global_list, &pnp_cards); list_add_tail(&card->protocol_list, &card->protocol->cards); - spin_unlock(&pnp_lock); + mutex_unlock(&pnp_lock); /* we wait until now to add devices in order to ensure the drivers * will be able to use all of the related devices on the card @@ -276,10 +277,10 @@ void pnp_remove_card(struct pnp_card *card) struct list_head *pos, *temp; device_unregister(&card->dev); - spin_lock(&pnp_lock); + mutex_lock(&pnp_lock); list_del(&card->global_list); list_del(&card->protocol_list); - spin_unlock(&pnp_lock); + mutex_unlock(&pnp_lock); list_for_each_safe(pos, temp, &card->devices) { struct pnp_dev *dev = card_to_pnp_dev(pos); pnp_remove_card_device(dev); @@ -297,10 +298,10 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) dev->card_link = NULL; dev_set_name(&dev->dev, "%02x:%02x.%02x", dev->protocol->number, card->number, dev->number); - spin_lock(&pnp_lock); + mutex_lock(&pnp_lock); dev->card = card; list_add_tail(&dev->card_list, &card->devices); - spin_unlock(&pnp_lock); + mutex_unlock(&pnp_lock); return 0; } @@ -310,10 +311,10 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) */ void pnp_remove_card_device(struct pnp_dev *dev) { - spin_lock(&pnp_lock); + mutex_lock(&pnp_lock); dev->card = NULL; list_del(&dev->card_list); - spin_unlock(&pnp_lock); + mutex_unlock(&pnp_lock); __pnp_remove_device(dev); } @@ -426,9 +427,9 @@ int pnp_register_card_driver(struct pnp_card_driver *drv) if (error < 0) return error; - spin_lock(&pnp_lock); + mutex_lock(&pnp_lock); list_add_tail(&drv->global_list, &pnp_card_drivers); - spin_unlock(&pnp_lock); + mutex_unlock(&pnp_lock); list_for_each_safe(pos, temp, &pnp_cards) { struct pnp_card *card = @@ -444,9 +445,9 @@ int pnp_register_card_driver(struct pnp_card_driver *drv) */ void pnp_unregister_card_driver(struct pnp_card_driver *drv) { - spin_lock(&pnp_lock); + mutex_lock(&pnp_lock); list_del(&drv->global_list); - spin_unlock(&pnp_lock); + mutex_unlock(&pnp_lock); pnp_unregister_driver(&drv->link); } |