From: Adam Belay I'm alright with dropping this patch if it creates a potential compatibility problem with possible 2.6 future *hotplug interfaces, but I do think that it is rather reasonable and close to whatever the final interface will be. This patch allows for hotplug events. It reports vers_1 information. Signed-off-by: Andrew Morton --- 25-akpm/drivers/pcmcia/ds.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+) diff -puN drivers/pcmcia/ds.c~pcmcia-add-hotplug-support drivers/pcmcia/ds.c --- 25/drivers/pcmcia/ds.c~pcmcia-add-hotplug-support 2004-08-06 00:52:59.837082688 -0700 +++ 25-akpm/drivers/pcmcia/ds.c 2004-08-06 00:52:59.842081928 -0700 @@ -577,6 +577,59 @@ static void pcmcia_bus_remove_card(struc up(&s->device_mutex); } +#ifdef CONFIG_HOTPLUG + +int pcmcia_bus_hotplug(struct device *pdev, char **envp, int num_envp, + char *buffer, int buffer_size) +{ + struct pcmcia_device *dev; + char *scratch; + int i = 0; + int length = 0; + + if (!pdev) + return -ENODEV; + + dev = to_pcmcia_device(pdev); + + scratch = buffer; + + /* stuff we want to pass to /sbin/hotplug */ + envp[i++] = scratch; + length += snprintf (scratch, buffer_size - length, "PRODUCT="); + for (i = 0; i < dev->vers_1.ns; i++) { + length += snprintf(scratch,buffer_size - length, "%s\"%s\"", (i>0) ? "," : "", + dev->vers_1.str+dev->vers_1.ofs[i]); + } + + if ((buffer_size - length <= 0) || (i >= num_envp)) + return -ENOMEM; + ++length; + scratch += length; + + envp [i++] = scratch; + length += snprintf (scratch, buffer_size - length, "MANFID=0x%04x,0x%04x", + dev->manfid.manf, dev->manfid.card); + if ((buffer_size - length <= 0) || (i >= num_envp)) + return -ENOMEM; + ++length; + scratch += length; + + envp[i] = 0; + + return 0; +} + +#else /* CONFIG_HOTPLUG */ + +int pcmcia_bus_hotplug(struct device *pdev, char **envp, int num_envp, + char *buffer, int buffer_size) +{ + return -ENODEV; +} + +#endif /* CONFIG_HOTPLUG */ + /*====================================================================== These manage a ring buffer of events pending for one user process @@ -1332,6 +1385,7 @@ static struct class_interface pcmcia_bus struct bus_type pcmcia_bus_type = { .name = "pcmcia", + .hotplug = pcmcia_bus_hotplug, }; EXPORT_SYMBOL(pcmcia_bus_type); _