aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-01-16 07:06:40 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2010-02-17 11:48:23 -0500
commit3f565232c561fbd9d5e03354aac29b90cb2bc78a (patch)
treee8da4dc6a2ed90777f9d122fd86eea92c47d61a1 /drivers/pcmcia
parent94a819f80297e1f635a7cde4ed5317612e512ba7 (diff)
pcmcia: use mutex for dynid lock
Even though we weren't calling a blocking function within the dynid spinlock, we do not need a spinlock here but can and should be using a mutex. Reported-by: Jiri Slaby <jirislaby@gmail.com> Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/ds.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 83b51ddd3da3..253d9aca5f77 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -124,9 +124,9 @@ pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
124 dynid->id.device_no = device_no; 124 dynid->id.device_no = device_no;
125 memcpy(dynid->id.prod_id_hash, prod_id_hash, sizeof(__u32) * 4); 125 memcpy(dynid->id.prod_id_hash, prod_id_hash, sizeof(__u32) * 4);
126 126
127 spin_lock(&pdrv->dynids.lock); 127 mutex_lock(&pdrv->dynids.lock);
128 list_add_tail(&dynid->node, &pdrv->dynids.list); 128 list_add_tail(&dynid->node, &pdrv->dynids.list);
129 spin_unlock(&pdrv->dynids.lock); 129 mutex_unlock(&pdrv->dynids.lock);
130 130
131 if (get_driver(&pdrv->drv)) { 131 if (get_driver(&pdrv->drv)) {
132 retval = driver_attach(&pdrv->drv); 132 retval = driver_attach(&pdrv->drv);
@@ -144,12 +144,12 @@ pcmcia_free_dynids(struct pcmcia_driver *drv)
144{ 144{
145 struct pcmcia_dynid *dynid, *n; 145 struct pcmcia_dynid *dynid, *n;
146 146
147 spin_lock(&drv->dynids.lock); 147 mutex_lock(&drv->dynids.lock);
148 list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) { 148 list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) {
149 list_del(&dynid->node); 149 list_del(&dynid->node);
150 kfree(dynid); 150 kfree(dynid);
151 } 151 }
152 spin_unlock(&drv->dynids.lock); 152 mutex_unlock(&drv->dynids.lock);
153} 153}
154 154
155static int 155static int
@@ -180,7 +180,7 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
180 /* initialize common fields */ 180 /* initialize common fields */
181 driver->drv.bus = &pcmcia_bus_type; 181 driver->drv.bus = &pcmcia_bus_type;
182 driver->drv.owner = driver->owner; 182 driver->drv.owner = driver->owner;
183 spin_lock_init(&driver->dynids.lock); 183 mutex_init(&driver->dynids.lock);
184 INIT_LIST_HEAD(&driver->dynids.list); 184 INIT_LIST_HEAD(&driver->dynids.list);
185 185
186 pr_debug("registering driver %s\n", driver->drv.name); 186 pr_debug("registering driver %s\n", driver->drv.name);
@@ -894,16 +894,16 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
894 struct pcmcia_dynid *dynid; 894 struct pcmcia_dynid *dynid;
895 895
896 /* match dynamic devices first */ 896 /* match dynamic devices first */
897 spin_lock(&p_drv->dynids.lock); 897 mutex_lock(&p_drv->dynids.lock);
898 list_for_each_entry(dynid, &p_drv->dynids.list, node) { 898 list_for_each_entry(dynid, &p_drv->dynids.list, node) {
899 dev_dbg(dev, "trying to match to %s\n", drv->name); 899 dev_dbg(dev, "trying to match to %s\n", drv->name);
900 if (pcmcia_devmatch(p_dev, &dynid->id)) { 900 if (pcmcia_devmatch(p_dev, &dynid->id)) {
901 dev_dbg(dev, "matched to %s\n", drv->name); 901 dev_dbg(dev, "matched to %s\n", drv->name);
902 spin_unlock(&p_drv->dynids.lock); 902 mutex_unlock(&p_drv->dynids.lock);
903 return 1; 903 return 1;
904 } 904 }
905 } 905 }
906 spin_unlock(&p_drv->dynids.lock); 906 mutex_unlock(&p_drv->dynids.lock);
907 907
908#ifdef CONFIG_PCMCIA_IOCTL 908#ifdef CONFIG_PCMCIA_IOCTL
909 /* matching by cardmgr */ 909 /* matching by cardmgr */