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>
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);
}
s->state &= ~SOCKET_INUSE;
- mutex_unlock(&s->ops_mutex);
}
static int socket_setup(struct pcmcia_socket *skt, int initial_delay)