summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-01-02 23:19:45 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2010-01-24 19:57:47 +0100
commit3970dd8c5169505f0cc5e4c3e2fde7bdd9bbad3e (patch)
tree86113b333d7de9d5e6f65b2dc077e44c6656c90b /drivers/pcmcia/cs.c
parent593f010bc0d8f7fde2ce948cac3f77f6a3d9db2b (diff)
downloadlinux-3970dd8c5169505f0cc5e4c3e2fde7bdd9bbad3e.tar.bz2
pcmcia: do not lock socket driver module on card insert
Do not lock the socket driver module on card insert, as the PCMCIA core can handle a socket module removal, at least if we add a call to socket_remove() on pccardd()'s shutdown. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cs.c')
-rw-r--r--drivers/pcmcia/cs.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index f0630a61da90..137a5db2eca2 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -407,7 +407,7 @@ static void socket_shutdown(struct pcmcia_socket *s)
"*** DANGER *** unable to remove socket power\n");
}
- cs_socket_put(s);
+ s->state &= ~SOCKET_INUSE;
}
static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
@@ -496,8 +496,8 @@ static int socket_insert(struct pcmcia_socket *skt)
dev_dbg(&skt->dev, "insert\n");
- if (!cs_socket_get(skt))
- return -ENODEV;
+ WARN_ON(skt->state & SOCKET_INUSE);
+ skt->state |= SOCKET_INUSE;
ret = socket_setup(skt, setup_delay);
if (ret == 0) {
@@ -697,6 +697,13 @@ static int pccardd(void *__skt)
/* make sure we are running before we exit */
set_current_state(TASK_RUNNING);
+ /* shut down socket, if a device is still present */
+ if (skt->state & SOCKET_PRESENT) {
+ mutex_lock(&skt->skt_mutex);
+ socket_remove(skt);
+ mutex_unlock(&skt->skt_mutex);
+ }
+
/* remove from the device core */
pccard_sysfs_remove_socket(&skt->dev);
device_unregister(&skt->dev);