All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Belay <ambx1@neo.rr.com>
To: rmk@arm.linux.org.uk
Cc: linux@dominikbrodowski.de, akpm@osdl.org, rml@ximian.com,
	linux-kernel@vger.kernel.org, linux-pcmcia@lists.infradead.org
Subject: [PATCH] pcmcia driver model support [5/5]
Date: Thu, 5 Aug 2004 22:32:16 +0000	[thread overview]
Message-ID: <20040805223216.GF11641@neo.rr.com> (raw)

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);

                 reply	other threads:[~2004-08-06  2:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040805223216.GF11641@neo.rr.com \
    --to=ambx1@neo.rr.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=linux@dominikbrodowski.de \
    --cc=rmk@arm.linux.org.uk \
    --cc=rml@ximian.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.