All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] More Driver Core patches for 2.6.10-rc1
Date: Fri, 12 Nov 2004 15:00:07 -0800	[thread overview]
Message-ID: <11003004072900@kroah.com> (raw)
In-Reply-To: <11003004071194@kroah.com>

ChangeSet 1.2098, 2004/11/12 11:43:27-08:00, kay.sievers@vrfy.org

[PATCH] add the bus name to the hotplug environment

Add the name of the bus and the driver to the hotplug event for
/sys/devices/*. With this addition, userspace knows what it can
expect from sysfs to show up, instead of waiting for a timeout
for devices without a bus.

  ACTION=add
  DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1
  SUBSYSTEM=usb
  SEQNUM=978
  PHYSDEVBUS=usb
  PHYSDEVDRIVER=usb

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/base/bus.c  |    2 +-
 drivers/base/core.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)


diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c	2004-11-12 14:53:04 -08:00
+++ b/drivers/base/bus.c	2004-11-12 14:53:04 -08:00
@@ -247,7 +247,7 @@
  *	device_bind_driver - bind a driver to one device.
  *	@dev:	device.
  *
- *	Allow manual attachment of a driver to a deivce.
+ *	Allow manual attachment of a driver to a device.
  *	Caller must have already set @dev->driver.
  *
  *	Note that this does not modify the bus reference count
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c	2004-11-12 14:53:04 -08:00
+++ b/drivers/base/core.c	2004-11-12 14:53:04 -08:00
@@ -116,7 +116,28 @@
 			int num_envp, char *buffer, int buffer_size)
 {
 	struct device *dev = to_dev(kobj);
+	int i = 0;
+	int length = 0;
 	int retval = 0;
+
+	/* add bus name of physical device */
+	if (dev->bus)
+		add_hotplug_env_var(envp, num_envp, &i,
+				    buffer, buffer_size, &length,
+				    "PHYSDEVBUS=%s", dev->bus->name);
+
+	/* add driver name of physical device */
+	if (dev->driver)
+		add_hotplug_env_var(envp, num_envp, &i,
+				    buffer, buffer_size, &length,
+				    "PHYSDEVDRIVER=%s", dev->driver->name);
+
+	/* terminate, set to next free slot, shrink available space */
+	envp[i] = NULL;
+	envp = &envp[i];
+	num_envp -= i;
+	buffer = &buffer[length];
+	buffer_size -= length;
 
 	if (dev->bus->hotplug) {
 		/* have the bus specific function add its stuff */


  reply	other threads:[~2004-11-12 23:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-12 22:58 [BK PATCH] More Driver Core patches for 2.6.10-rc1 Greg KH
2004-11-12 23:00 ` [PATCH] " Greg KH
2004-11-12 23:00   ` Greg KH
2004-11-12 23:00     ` Greg KH
2004-11-12 23:00       ` Greg KH
2004-11-12 23:00         ` Greg KH
2004-11-12 23:00           ` Greg KH [this message]
2004-11-12 23:00             ` Greg KH
2004-11-12 23:00               ` Greg KH
2004-11-12 23:00                 ` Greg KH
     [not found]     ` <20041113000052.GC346@electric-eye.fr.zoreil.com>
     [not found]       ` <200411130020.17494.lists@kenneth.aafloy.net>
2004-11-13  0:44         ` Greg KH
2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds
2004-11-13 21:10   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05  0:35 [BK PATCH] More USB " Greg KH
2004-11-05  0:48 ` [PATCH] More Driver Core " Greg KH
2004-11-05  0:48   ` Greg KH
2004-11-05  0:48     ` Greg KH
2004-11-05  0:48       ` Greg KH
2004-11-05  0:48         ` Greg KH
2004-11-05  0:48           ` Greg KH
2004-11-05  0:48             ` Greg KH
2004-11-05  0:48               ` Greg KH
2004-11-05  0:48                 ` Greg KH
2004-11-05  0:48                   ` Greg KH
2004-11-05  0:48                     ` Greg KH
2004-11-05  0:48                       ` Greg KH

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=11003004072900@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.