[PATCH 7/8] pcmcia: fix 'rmmod pcmcia' with leftover devices

Dominik Brodowski linux at dominikbrodowski.net
Sun Nov 19 11:44:06 EST 2006


From: Dominik Brodowski <linux at dominikbrodowski.net>
Date: Sun, 19 Nov 2006 11:11:22 -0500
Subject: [PATCH] pcmcia: fix 'rmmod pcmcia' with leftover devices

When removing the pcmcia module, all pcmcia devices currently registered
must be removed, so that doing 'find /sys' does not result in an oops.
(bugzilla #7481). Debugged and original fix by Daniel Ritz.

Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
---
 drivers/pcmcia/cs.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index f9cd831..7291db2 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -728,11 +728,12 @@ int pccard_register_pcmcia(struct pcmcia
 		}
 
 		s->callback = c;
-
-		if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
-			send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
 	} else
 		s->callback = NULL;
+
+	if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
+		send_event(s, c ? CS_EVENT_CARD_INSERTION :
+			   CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_LOW);
  err:
 	mutex_unlock(&s->skt_mutex);
 
-- 
1.4.4




More information about the linux-pcmcia mailing list