[PATCH] pcmcia driver model support [5/5]

From: Adam Belay (ambx1_at_neo.rr.com)
Date: 08/06/04

  • Next message: Raf D'Halleweyn (list): "Re: Firewire hard drives"
    Date:	Thu, 5 Aug 2004 22:32:16 +0000
    To: rmk@arm.linux.org.uk
    
    

    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.

    [PCMCIA] add *hotplug support

    This patch allows for hotplug events. It reports vers_1 information.

    --- a/drivers/pcmcia/ds.c 2004-08-05 21:28:48.000000000 +0000
    +++ b/drivers/pcmcia/ds.c 2004-08-05 21:34:29.000000000 +0000
    @@ -577,6 +577,59 @@
             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 @@
     
     struct bus_type pcmcia_bus_type = {
             .name = "pcmcia",
    + .hotplug = pcmcia_bus_hotplug,
     };
     
     EXPORT_SYMBOL(pcmcia_bus_type);
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Raf D'Halleweyn (list): "Re: Firewire hard drives"

    Relevant Pages

    • Re: IDE Hotswap
      ... If you grab the 2.6.8.1-ac patch you can do IDE controller hotplugging ... For new controllers use Jeff Garzik's serial ATA layer as ... understanding of hotplug management. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • take3: Updated CPU Hotplug patches for IA64 (pj blessed) Patch [1/7]
      ... Here are the next set of patches for supporting CPU hotplug. ... overall acceptability of the patch. ... files changed, 2 insertions, 2 deletionsdiff -puN kernel/sched.c~core_kernel_init kernel/sched.c ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Re: Linux 2.4.22-pre10-ac1
      ... > The call_helperfuntcion needs to be put into #idef's. ... hotplug it doesn't make any sense. ... The patch may not be it, but, IMHO, the way to go is making ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [patch 0/3] memory hotplug prototype
      ... I think his patch is orthogonal to mine. ... boot time or hotplug events, ... Where does these RAM block appear in physical space, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Avoiding external fragmentation with a placement policy Version 12
      ... I've been combining Mel's defragmenting patch ... >>with the memory hotplug patch set. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)