summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-01-17 19:31:45 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2010-02-17 17:48:24 +0100
commitcfe5d809518eda3d5e2da87c5ccbe8647143573a (patch)
treedd61ec285412fc0de8090ef5743b824447a9eeda /drivers/pcmcia/cs.c
parent3f565232c561fbd9d5e03354aac29b90cb2bc78a (diff)
downloadlinux-cfe5d809518eda3d5e2da87c5ccbe8647143573a.tar.gz
linux-cfe5d809518eda3d5e2da87c5ccbe8647143573a.tar.bz2
linux-cfe5d809518eda3d5e2da87c5ccbe8647143573a.zip
pcmcia: use ops_mutex for rsrc_{mgr,nonstatic} locking
Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cs.c')
-rw-r--r--drivers/pcmcia/cs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 13277eebe46a..7ba45b0cca6b 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -224,7 +224,9 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
spin_lock_init(&socket->thread_lock);
if (socket->resource_ops->init) {
+ mutex_lock(&socket->ops_mutex);
ret = socket->resource_ops->init(socket);
+ mutex_unlock(&socket->ops_mutex);
if (ret)
goto err;
}
@@ -282,8 +284,11 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
up_write(&pcmcia_socket_list_rwsem);
/* wait for sysfs to drop all references */
- if (socket->resource_ops->exit)
+ if (socket->resource_ops->exit) {
+ mutex_lock(&socket->ops_mutex);
socket->resource_ops->exit(socket);
+ mutex_unlock(&socket->ops_mutex);
+ }
wait_for_completion(&socket->socket_released);
} /* pcmcia_unregister_socket */
EXPORT_SYMBOL(pcmcia_unregister_socket);