[PATCH] pcmcia: hotplug event for PCMCIA socket devices
authorDominik Brodowski <linux@dominikbrodowski.net>
Mon, 27 Jun 2005 23:28:05 +0000 (16:28 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 28 Jun 2005 01:03:06 +0000 (18:03 -0700)
Generate hotplug event for PCMCIA sockets being registered.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pcmcia/cs.c

index 48e4f04530d886d14d1ad9e3fa0f92a762b40614..fec9e03047386a6f59c31c88f6fcec729e62ffbb 100644 (file)
@@ -1866,6 +1866,21 @@ int pcmcia_insert_card(struct pcmcia_socket *skt)
        return ret;
 } /* insert_card */
 
+static int pcmcia_socket_hotplug(struct class_device *dev, char **envp,
+                               int num_envp, char *buffer, int buffer_size)
+{
+       struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
+       int i = 0, length = 0;
+
+       if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
+                               &length, "SOCKET_NO=%u", s->sock))
+               return -ENOMEM;
+
+       envp[i] = NULL;
+
+       return 0;
+}
+
 /*======================================================================
 
     OS-specific module glue goes here
@@ -1895,6 +1910,7 @@ EXPORT_SYMBOL(pcmcia_parse_events);
 
 struct class pcmcia_socket_class = {
        .name = "pcmcia_socket",
+        .hotplug = pcmcia_socket_hotplug,
        .release = pcmcia_release_socket,
 };
 EXPORT_SYMBOL(pcmcia_socket_class);