summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-01-18 08:43:39 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2010-02-17 17:48:28 +0100
commitc3bfc96ef7366aa996fb8286a36f3333a3b4ff25 (patch)
tree6f1430068891518bfe8c72b835783bb8302429cc /drivers/pcmcia
parentaa584ca4cdd8db370a524c61fd3ca408303281e9 (diff)
pcmcia: avoid sysfs-related lockup for cardbus
In cb_free(), we remove some sysfs files -- other sysfs files might grab ops_mutex, so we cannot hold it while removing sysfs files. This fixes http://lkml.org/lkml/2010/1/17/88 . 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/cs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index d529e02c2d5..9a49c394f04 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -400,10 +400,19 @@ static void socket_shutdown(struct pcmcia_socket *s)
s->lock_count = 0;
kfree(s->fake_cis);
s->fake_cis = NULL;
+ s->functions = 0;
+
+ /* From here on we can be sure that only we (that is, the
+ * pccardd thread) accesses this socket, and all (16-bit)
+ * PCMCIA interactions are gone. Therefore, release
+ * ops_mutex so that we don't get a sysfs-related lockdep
+ * warning.
+ */
+ mutex_unlock(&s->ops_mutex);
+
#ifdef CONFIG_CARDBUS
cb_free(s);
#endif
- s->functions = 0;
/* give socket some time to power down */
msleep(100);
@@ -415,7 +424,6 @@ static void socket_shutdown(struct pcmcia_socket *s)
}
s->state &= ~SOCKET_INUSE;
- mutex_unlock(&s->ops_mutex);
}
static int socket_setup(struct pcmcia_socket *skt, int initial_delay)