Skip to contentSkip to conversation

Driver Core patches for 2.6.15

PATCH In review Greg KH 6 participants 33 messages Jan 5, 2006

Subsystems (32)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Driver Core patches for 2.6.15

Here are a lot of driver core patches for 2.6.15. They have all been in the past few -mm releases with no problems. They contain the following things:
- sysfs fixes.
- klist fixes.
- input build fixes.
- platform driver interface additions
- uevent and hotplug merge together
- block device symlink fixes
- lots of other good stuff, see the changelog below.

Please pull from:
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
or if master.kernel.org hasn't synced up yet:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/

The full patch set will be sent to the linux-kernel mailing list, if anyone wants to see them.

thanks,

greg k-h

 Documentation/powerpc/eeh-pci-error-recovery.txt |   31 -
 MAINTAINERS                                      |    6 
 arch/arm/common/amba.c                           |    6 
 arch/ia64/sn/kernel/tiocx.c                      |    4 
 arch/powerpc/kernel/vio.c                        |    2 
 block/genhd.c                                    |   48 +-
 drivers/acpi/container.c                         |    8 
 drivers/acpi/processor_core.c                    |    8 
 drivers/acpi/scan.c                              |   14 
 drivers/base/Kconfig                             |    4 
 drivers/base/bus.c                               |   41 ++
 drivers/base/class.c                             |   68 ++--
 drivers/base/core.c                              |   42 +-
 drivers/base/cpu.c                               |    4 
 drivers/base/dd.c                                |   15 
 drivers/base/firmware_class.c                    |   45 +-
 drivers/base/memory.c                            |   12 
 drivers/base/platform.c                          |   68 ++--
 drivers/base/power/runtime.c                     |    2 
 drivers/ide/ide-cd.c                             |    1 
 drivers/ide/ide-disk.c                           |    1 
 drivers/ide/ide-floppy.c                         |    1 
 drivers/ide/ide-tape.c                           |    1 
 drivers/ide/ide.c                                |   60 +++
 drivers/ieee1394/nodemgr.c                       |   20 -
 drivers/infiniband/core/sysfs.c                  |   16 
 drivers/input/input.c                            |   54 ++-
 drivers/input/serio/serio.c                      |   22 -
 drivers/macintosh/macio_asic.c                   |    4 
 drivers/mmc/mmc_sysfs.c                          |    4 
 drivers/pci/hotplug.c                            |   44 +-
 drivers/pci/pci-driver.c                         |    6 
 drivers/pci/pci.h                                |    4 
 drivers/pcmcia/cs.c                              |   10 
 drivers/pcmcia/ds.c                              |   50 +--
 drivers/pnp/pnpbios/core.c                       |    8 
 drivers/s390/cio/ccwgroup.c                      |    4 
 drivers/s390/cio/device.c                        |    4 
 drivers/s390/crypto/z90main.c                    |    1 
 drivers/scsi/ipr.c                               |    4 
 drivers/usb/core/usb.c                           |   86 ++---
 drivers/usb/host/hc_crisv10.c                    |    2 
 drivers/w1/w1.c                                  |   14 
 fs/partitions/check.c                            |   33 +-
 fs/super.c                                       |   15 
 fs/sysfs/dir.c                                   |    6 
 include/linux/device.h                           |   14 
 include/linux/firmware.h                         |    2 
 include/linux/input.h                            |   81 ++--
 include/linux/kobject.h                          |  110 +++---
 include/linux/kobject_uevent.h                   |   57 ---
 include/linux/platform_device.h                  |    1 
 include/linux/sysctl.h                           |    2 
 include/linux/usb.h                              |    2 
 init/Kconfig                                     |   36 --
 kernel/ksysfs.c                                  |   42 +-
 kernel/sysctl.c                                  |    8 
 lib/klist.c                                      |    2 
 lib/kobject.c                                    |    4 
 lib/kobject_uevent.c                             |  379 ++++++++---------------
 net/bluetooth/hci_sysfs.c                        |    4 
 net/bridge/br_sysfs_if.c                         |    4 
 net/core/net-sysfs.c                             |   76 +---
 scripts/mod/file2alias.c                         |   62 +++
 64 files changed, 921 insertions(+), 868 deletions(-)

Adrian Bunk:
drivers/base/power/runtime.c: #if 0 dpm_set_power_state()

Alan Stern:
Hold the device's parent's lock during probe and remove

Andrew Morton:
kobject_uevent CONFIG_NET=n fix

Dmitry Torokhov:
Driver Core: Add platform_device_del() Driver Core: Rearrange exports in platform.c

Frank Pavlic:
klist: Fix broken kref counting in find functions

Greg Kroah-Hartman:
HOTPLUG: always enable the .config option, unless EMBEDDED Driver core: Make block devices create the proper symlink name Driver core: only all userspace bind/unbind if CONFIG_HOTPLUG is enabled

Kay Sievers:
remove CONFIG_KOBJECT_UEVENT option
remove mount/umount uevents from superblock handling keep pnpbios usermod_helper away from hotplug_path[] add uevent_helper control in /sys/kernel/
merge kobject_uevent and kobject_hotplug
driver core: replace "hotplug" by "uevent"
ide: MODALIAS support for autoloading of ide-cd, ide-disk, ...
net: swich device attribute creation to default attrs

Kumar Gala:
Allow overlapping resources for platform devices

Paul Jackson:
driver kill hotplug word from sn and others fix

Rusty Russell:
Input: add modalias support
Input: fix add modalias support build error

Steven Rostedt:
sysfs: handle failures in sysfs_make_dirent

author
#1 lore raw

PATCH 1/1 remove CONFIG_KOBJECT_UEVENT option

[PATCH] remove CONFIG_KOBJECT_UEVENT option

It makes zero sense to have hotplug, but not the netlink events enabled today. Remove this option and merge the kobject_uevent.h header into the kobject.h header file.

---
commit 0296b2281352e4794e174b393c37f131502e09f0
tree 874e1de7ffaf56ab14f031d2818b69853c4914d8
parent 034382117725f6b6b26fbb138498139c5c012c1b
author Kay Sievers <[email protected]> Fri, 11 Nov 2005 05:33:52 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:07 -0800

 MAINTAINERS                    |    6 ----
 drivers/input/input.c          |    1 -
 drivers/s390/crypto/z90main.c  |    1 -
 include/linux/kobject.h        |   35 ++++++++++++++++++++++++-
 include/linux/kobject_uevent.h |   57 ----------------------------------------
 init/Kconfig                   |   19 -------------
 kernel/sysctl.c                |    4 +--
 lib/kobject_uevent.c           |   24 ++++-------------
 8 files changed, 40 insertions(+), 107 deletions(-)
MAINTAINERS +0 -6
index 6af6830..b49a4ad 100644
@@ -1476,12 +1476,6 @@ W:	http://nfs.sourceforge.net/
 W:	http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/
 S:	Maintained
 
-KERNEL EVENT LAYER (KOBJECT_UEVENT)
-P:	Robert Love
-M:	[email protected]
-L:	[email protected]
-S:	Maintained
-
 KEXEC
 P:	Eric Biederman
 P:	Randy Dunlap
drivers/input/input.c +0 -1
index bdd2a7f..43b49cc 100644
@@ -18,7 +18,6 @@
 #include <linux/random.h>
 #include <linux/major.h>
 #include <linux/proc_fs.h>
-#include <linux/kobject_uevent.h>
 #include <linux/interrupt.h>
 #include <linux/poll.h>
 #include <linux/device.h>
drivers/s390/crypto/z90main.c +0 -1
index 4010f2b..790fcbb 100644
@@ -34,7 +34,6 @@
 #include <linux/miscdevice.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/kobject_uevent.h>
 #include <linux/proc_fs.h>
 #include <linux/syscalls.h>
 #include "z90crypt.h"
include/linux/kobject.h +34 -1
index 7f7403a..baf5251 100644
@@ -23,15 +23,31 @@
 #include <linux/spinlock.h>
 #include <linux/rwsem.h>
 #include <linux/kref.h>
-#include <linux/kobject_uevent.h>
 #include <linux/kernel.h>
 #include <asm/atomic.h>
 
 #define KOBJ_NAME_LEN	20
 
+#define HOTPLUG_PATH_LEN	256
+
+/* path to the userspace helper executed on an event */
+extern char hotplug_path[];
+
 /* counter to tag the hotplug event, read only except for the kobject core */
 extern u64 hotplug_seqnum;
 
+/* the actions here must match the proper string in lib/kobject_uevent.c */
+typedef int __bitwise kobject_action_t;
+enum kobject_action {
+	KOBJ_ADD	= (__force kobject_action_t) 0x01,	/* add event, for hotplug */
+	KOBJ_REMOVE	= (__force kobject_action_t) 0x02,	/* remove event, for hotplug */
+	KOBJ_CHANGE	= (__force kobject_action_t) 0x03,	/* a sysfs attribute file has changed */
+	KOBJ_MOUNT	= (__force kobject_action_t) 0x04,	/* mount event for block devices */
+	KOBJ_UMOUNT	= (__force kobject_action_t) 0x05,	/* umount event for block devices */
+	KOBJ_OFFLINE	= (__force kobject_action_t) 0x06,	/* offline event for hotplug devices */
+	KOBJ_ONLINE	= (__force kobject_action_t) 0x07,	/* online event for hotplug devices */
+};
+
 struct kobject {
 	const char		* k_name;
 	char			name[KOBJ_NAME_LEN];
@@ -243,16 +259,33 @@ extern void subsys_remove_file(struct su
 
 #ifdef CONFIG_HOTPLUG
 void kobject_hotplug(struct kobject *kobj, enum kobject_action action);
+
 int add_hotplug_env_var(char **envp, int num_envp, int *cur_index,
 			char *buffer, int buffer_size, int *cur_len,
 			const char *format, ...)
 	__attribute__((format (printf, 7, 8)));
+
+int kobject_uevent(struct kobject *kobj,
+		   enum kobject_action action,
+		   struct attribute *attr);
+int kobject_uevent_atomic(struct kobject *kobj,
+			  enum kobject_action action,
+			  struct attribute *attr);
+
 #else
 static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { }
 static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 
 				      char *buffer, int buffer_size, int *cur_len, 
 				      const char *format, ...)
 { return 0; }
+int kobject_uevent(struct kobject *kobj,
+		   enum kobject_action action,
+		   struct attribute *attr)
+{ return 0; }
+int kobject_uevent_atomic(struct kobject *kobj,
+			  enum kobject_action action,
+			  struct attribute *attr)
+{ return 0; }
 #endif
 
 #endif /* __KERNEL__ */
include/linux/kobject_uevent.h deleted +0 -57

57 lines not on this page · raw message

init/Kconfig +0 -19
index 9fc0759..0de8b77 100644
@@ -205,25 +205,6 @@ config HOTPLUG
 	  modules require HOTPLUG functionality, but a module built
 	  outside the kernel tree does. Such modules require Y here.
 
-config KOBJECT_UEVENT
-	bool "Kernel Userspace Events" if EMBEDDED
-	depends on NET
-	default y
-	help
-	  This option enables the kernel userspace event layer, which is a
-	  simple mechanism for kernel-to-user communication over a netlink
-	  socket.
-	  The goal of the kernel userspace events layer is to provide a simple
-	  and efficient events system, that notifies userspace about kobject
-	  state changes. This will enable applications to just listen for
-	  events instead of polling system devices and files.
-	  Hotplug events (kobject addition and removal) are also available on
-	  the netlink socket in addition to the execution of /sbin/hotplug if
-	  CONFIG_HOTPLUG is enabled.
-
-	  Say Y, unless you are building a system requiring minimal memory
-	  consumption.
-
 config IKCONFIG
 	bool "Kernel .config support"
 	---help---
kernel/sysctl.c +1 -3
index b53115b..6a51e25 100644
@@ -31,6 +31,7 @@
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/kobject.h>
 #include <linux/net.h>
 #include <linux/sysrq.h>
 #include <linux/highuid.h>
@@ -83,9 +84,6 @@ static int ngroups_max = NGROUPS_MAX;
 #ifdef CONFIG_KMOD
 extern char modprobe_path[];
 #endif
-#ifdef CONFIG_HOTPLUG
-extern char hotplug_path[];
-#endif
 #ifdef CONFIG_CHR_DEV_SG
 extern int sg_big_buff;
 #endif
lib/kobject_uevent.c +5 -19
index 3ab3754..1f90eea 100644
@@ -19,14 +19,17 @@
 #include <linux/skbuff.h>
 #include <linux/netlink.h>
 #include <linux/string.h>
-#include <linux/kobject_uevent.h>
 #include <linux/kobject.h>
 #include <net/sock.h>
 
 #define BUFFER_SIZE	1024	/* buffer for the hotplug env */
 #define NUM_ENVP	32	/* number of env pointers */
 
-#if defined(CONFIG_KOBJECT_UEVENT) || defined(CONFIG_HOTPLUG)
+#if defined(CONFIG_HOTPLUG)
+char hotplug_path[HOTPLUG_PATH_LEN] = "/sbin/hotplug";
+u64 hotplug_seqnum;
+static DEFINE_SPINLOCK(sequence_lock);
+
 static char *action_to_string(enum kobject_action action)
 {
 	switch (action) {
@@ -48,9 +51,7 @@ static char *action_to_string(enum kobje
 		return NULL;
 	}
 }
-#endif
 
-#ifdef CONFIG_KOBJECT_UEVENT
 static struct sock *uevent_sock;
 
 /**
@@ -168,21 +169,6 @@ static int __init kobject_uevent_init(vo
 
 postcore_initcall(kobject_uevent_init);
 
-#else
-static inline int send_uevent(const char *signal, const char *obj,
-			      char **envp, int gfp_mask)
-{
-	return 0;
-}
-
-#endif /* CONFIG_KOBJECT_UEVENT */
-
-
-#ifdef CONFIG_HOTPLUG
-char hotplug_path[HOTPLUG_PATH_LEN] = "/sbin/hotplug";
-u64 hotplug_seqnum;
-static DEFINE_SPINLOCK(sequence_lock);
-
 /**
  * kobject_hotplug - notify userspace by executing /sbin/hotplug
  *
author
#2 lore raw

PATCH 1/1 remove mount/umount uevents from superblock handling

[PATCH] remove mount/umount uevents from superblock handling

The names of these events have been confusing from the beginning on, as they have been more like claim/release events. We needed these events for noticing HAL if storage devices have been mounted.

Thanks to Al, we have the proper solution now and can poll() /proc/mounts instead to get notfied about mount tree changes.

---
commit 033b96fd30db52a710d97b06f87d16fc59fee0f1
tree 00fbccf2cf478307e213f298a221e330f3ba12ae
parent 0f76e5acf9dc788e664056dda1e461f0bec93948
author Kay Sievers <[email protected]> Fri, 11 Nov 2005 06:09:55 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:07 -0800

 fs/super.c              |   15 +--------------
 include/linux/kobject.h |    6 ++----
 lib/kobject_uevent.c    |    4 ----
 3 files changed, 3 insertions(+), 22 deletions(-)
fs/super.c +1 -14
index 6689dde..5a347a4 100644
@@ -665,16 +665,6 @@ static int test_bdev_super(struct super_
 	return (void *)s->s_bdev == data;
 }
 
-static void bdev_uevent(struct block_device *bdev, enum kobject_action action)
-{
-	if (bdev->bd_disk) {
-		if (bdev->bd_part)
-			kobject_uevent(&bdev->bd_part->kobj, action, NULL);
-		else
-			kobject_uevent(&bdev->bd_disk->kobj, action, NULL);
-	}
-}
-
 struct super_block *get_sb_bdev(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data,
 	int (*fill_super)(struct super_block *, void *, int))
@@ -717,10 +707,8 @@ struct super_block *get_sb_bdev(struct f
 			up_write(&s->s_umount);
 			deactivate_super(s);
 			s = ERR_PTR(error);
-		} else {
+		} else
 			s->s_flags |= MS_ACTIVE;
-			bdev_uevent(bdev, KOBJ_MOUNT);
-		}
 	}
 
 	return s;
@@ -736,7 +724,6 @@ void kill_block_super(struct super_block
 {
 	struct block_device *bdev = sb->s_bdev;
 
-	bdev_uevent(bdev, KOBJ_UMOUNT);
 	generic_shutdown_super(sb);
 	sync_blockdev(bdev);
 	close_bdev_excl(bdev);
include/linux/kobject.h +2 -4
index baf5251..e6926b3 100644
@@ -42,10 +42,8 @@ enum kobject_action {
 	KOBJ_ADD	= (__force kobject_action_t) 0x01,	/* add event, for hotplug */
 	KOBJ_REMOVE	= (__force kobject_action_t) 0x02,	/* remove event, for hotplug */
 	KOBJ_CHANGE	= (__force kobject_action_t) 0x03,	/* a sysfs attribute file has changed */
-	KOBJ_MOUNT	= (__force kobject_action_t) 0x04,	/* mount event for block devices */
-	KOBJ_UMOUNT	= (__force kobject_action_t) 0x05,	/* umount event for block devices */
-	KOBJ_OFFLINE	= (__force kobject_action_t) 0x06,	/* offline event for hotplug devices */
-	KOBJ_ONLINE	= (__force kobject_action_t) 0x07,	/* online event for hotplug devices */
+	KOBJ_OFFLINE	= (__force kobject_action_t) 0x04,	/* offline event for hotplug devices */
+	KOBJ_ONLINE	= (__force kobject_action_t) 0x05,	/* online event for hotplug devices */
 };
 
 struct kobject {
lib/kobject_uevent.c +0 -4
index 1f90eea..845bf67 100644
@@ -39,10 +39,6 @@ static char *action_to_string(enum kobje
 		return "remove";
 	case KOBJ_CHANGE:
 		return "change";
-	case KOBJ_MOUNT:
-		return "mount";
-	case KOBJ_UMOUNT:
-		return "umount";
 	case KOBJ_OFFLINE:
 		return "offline";
 	case KOBJ_ONLINE:
author
#3 lore raw

PATCH 1/1 keep pnpbios usermod_helper away from hotplug_path[]

[PATCH] keep pnpbios usermod_helper away from hotplug_path[]

These days we use udev to manage all kernel events. /proc/sys/kernel/hotplug will usually be disabled by an init-script. pnpnbios is not integrated with the driver core and should stay away from the now disabled /sbin/hotplug.

Set the helper to /sbin/phpbios, even when there is probably no current user of this faciliy. If it's needed, it should definitely get proper driver core integration instead of forking binaries from the kernel.

---
commit 034382117725f6b6b26fbb138498139c5c012c1b
tree 2f920e992b26b35924753d06765a5d525a364a5c
parent 88026842b0a760145aa71d69e74fbc9ec118ca44
author Kay Sievers <[email protected]> Fri, 11 Nov 2005 04:25:06 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:07 -0800

 drivers/pnp/pnpbios/core.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/pnp/pnpbios/core.c +3 -5
index f49674f..b154b3f 100644
@@ -56,7 +56,6 @@
 #include <linux/mm.h>
 #include <linux/smp.h>
 #include <linux/slab.h>
-#include <linux/kobject_uevent.h>
 #include <linux/completion.h>
 #include <linux/spinlock.h>
 #include <linux/dmi.h>
@@ -106,8 +105,6 @@ static int pnp_dock_event(int dock, stru
 	char *argv [3], **envp, *buf, *scratch;
 	int i = 0, value;
 
-	if (!hotplug_path [0])
-		return -ENOENT;
 	if (!current->fs->root) {
 		return -EAGAIN;
 	}
@@ -119,8 +116,9 @@ static int pnp_dock_event(int dock, stru
 		return -ENOMEM;
 	}
 
-	/* only one standardized param to hotplug command: type */
-	argv [0] = hotplug_path;
+	/* FIXME: if there are actual users of this, it should be integrated into
+	 * the driver core and use the usual infrastructure like sysfs and uevents */
+	argv [0] = "/sbin/pnpbios";
 	argv [1] = "dock";
 	argv [2] = NULL;
 
author
#4 lore raw

PATCH 1/1 add uevent_helper control in /sys/kernel/

[PATCH] add uevent_helper control in /sys/kernel/

This deprecates the /proc/sys/kernel/hotplug file, as all this stuff should be in /sys some day, right? :)
In /sys/kernel/ we have now uevent_seqnum and uevent_helper. The seqnum is no longer used by udev, as the version for this kernel depends on netlink which events will never get out-of-order.

Recent udev versions disable the /sbin/hotplug helper with an init script, cause it leads to OOM on big boxes by running hundreds of shells in parallel. It should be done now by:
echo "" > /sys/kernel/uevent_helper

(Note that "-n" does not work, cause neighter proc nor sysfs support truncate().)

---
commit 0f76e5acf9dc788e664056dda1e461f0bec93948
tree fdb7db438cb03fb3e0508d582a7cc1321c62efed
parent 0296b2281352e4794e174b393c37f131502e09f0
author Kay Sievers <[email protected]> Fri, 11 Nov 2005 04:58:04 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:07 -0800

 kernel/ksysfs.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)
kernel/ksysfs.c +22 -3
index 015fb69..e975a76 100644
@@ -23,11 +23,29 @@ static struct subsys_attribute _name##_a
 	__ATTR(_name, 0644, _name##_show, _name##_store)
 
 #ifdef CONFIG_HOTPLUG
-static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page)
+/* current uevent sequence number */
+static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page)
 {
 	return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum);
 }
-KERNEL_ATTR_RO(hotplug_seqnum);
+KERNEL_ATTR_RO(uevent_seqnum);
+
+/* uevent helper program, used during early boo */
+static ssize_t uevent_helper_show(struct subsystem *subsys, char *page)
+{
+	return sprintf(page, "%s\n", hotplug_path);
+}
+static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count)
+{
+	if (count+1 > HOTPLUG_PATH_LEN)
+		return -ENOENT;
+	memcpy(hotplug_path, page, count);
+	hotplug_path[count] = '\0';
+	if (count && hotplug_path[count-1] == '\n')
+		hotplug_path[count-1] = '\0';
+	return count;
+}
+KERNEL_ATTR_RW(uevent_helper);
 #endif
 
 #ifdef CONFIG_KEXEC
@@ -45,7 +63,8 @@ EXPORT_SYMBOL_GPL(kernel_subsys);
 
 static struct attribute * kernel_attrs[] = {
 #ifdef CONFIG_HOTPLUG
-	&hotplug_seqnum_attr.attr,
+	&uevent_seqnum_attr.attr,
+	&uevent_helper_attr.attr,
 #endif
 #ifdef CONFIG_KEXEC
 	&crash_notes_attr.attr,
author
#5 lore raw

PATCH 1/1 merge kobject_uevent and kobject_hotplug

[PATCH] merge kobject_uevent and kobject_hotplug

The distinction between hotplug and uevent does not make sense these days, netlink events are the default.

udev depends entirely on netlink uevents. Only during early boot and in initramfs, /sbin/hotplug is needed. So merge the two functions and provide only one interface without all the options.

The netlink layer got a nice generic interface with named slots recently, which is probably a better facility to plug events for subsystem specific events.
Also the new poll() interface to /proc/mounts is a nicer way to notify about changes than sending events through the core. The uevents should only be used for driver core related requests to userspace now.

---
commit 5f123fbd80f4f788554636f02bf73e40f914e0d6
tree dbb7db4c62fa8130a393ce772cf819fcffe2606b
parent 033b96fd30db52a710d97b06f87d16fc59fee0f1
author Kay Sievers <[email protected]> Fri, 11 Nov 2005 14:43:07 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:07 -0800

 drivers/scsi/ipr.c      |    2 
 include/linux/kobject.h |   27 +---
 lib/kobject_uevent.c    |  283 ++++++++++++++++-------------------------------
 3 files changed, 104 insertions(+), 208 deletions(-)
drivers/scsi/ipr.c +1 -1
index fa2cb35..bf44a40 100644
@@ -2132,7 +2132,7 @@ restart:
 	}
 
 	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
-	kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE, NULL);
+	kobject_hotplug(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE);
 	LEAVE;
 }
 
include/linux/kobject.h +6 -21
index e6926b3..5b08248 100644
@@ -39,11 +39,11 @@ extern u64 hotplug_seqnum;
 /* the actions here must match the proper string in lib/kobject_uevent.c */
 typedef int __bitwise kobject_action_t;
 enum kobject_action {
-	KOBJ_ADD	= (__force kobject_action_t) 0x01,	/* add event, for hotplug */
-	KOBJ_REMOVE	= (__force kobject_action_t) 0x02,	/* remove event, for hotplug */
-	KOBJ_CHANGE	= (__force kobject_action_t) 0x03,	/* a sysfs attribute file has changed */
-	KOBJ_OFFLINE	= (__force kobject_action_t) 0x04,	/* offline event for hotplug devices */
-	KOBJ_ONLINE	= (__force kobject_action_t) 0x05,	/* online event for hotplug devices */
+	KOBJ_ADD	= (__force kobject_action_t) 0x01,	/* exclusive to core */
+	KOBJ_REMOVE	= (__force kobject_action_t) 0x02,	/* exclusive to core */
+	KOBJ_CHANGE	= (__force kobject_action_t) 0x03,	/* device state change */
+	KOBJ_OFFLINE	= (__force kobject_action_t) 0x04,	/* device offline */
+	KOBJ_ONLINE	= (__force kobject_action_t) 0x05,	/* device online */
 };
 
 struct kobject {
@@ -262,28 +262,13 @@ int add_hotplug_env_var(char **envp, int
 			char *buffer, int buffer_size, int *cur_len,
 			const char *format, ...)
 	__attribute__((format (printf, 7, 8)));
-
-int kobject_uevent(struct kobject *kobj,
-		   enum kobject_action action,
-		   struct attribute *attr);
-int kobject_uevent_atomic(struct kobject *kobj,
-			  enum kobject_action action,
-			  struct attribute *attr);
-
 #else
 static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { }
+
 static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 
 				      char *buffer, int buffer_size, int *cur_len, 
 				      const char *format, ...)
 { return 0; }
-int kobject_uevent(struct kobject *kobj,
-		   enum kobject_action action,
-		   struct attribute *attr)
-{ return 0; }
-int kobject_uevent_atomic(struct kobject *kobj,
-			  enum kobject_action action,
-			  struct attribute *attr)
-{ return 0; }
 #endif
 
 #endif /* __KERNEL__ */
lib/kobject_uevent.c +97 -186

352 lines not on this page · raw message

author
#6 lore raw

PATCH 1/1 driver core: replace "hotplug" by "uevent"

[PATCH] driver core: replace "hotplug" by "uevent"

Leave the overloaded "hotplug" word to susbsystems which are handling real devices. The driver core does not "plug" anything, it just exports the state to userspace and generates events.

---
commit 312c004d36ce6c739512bac83b452f4c20ab1f62
tree e61e8331680a0da29557fe21414d3b31e62c9293
parent 5f123fbd80f4f788554636f02bf73e40f914e0d6
author Kay Sievers <[email protected]> Wed, 16 Nov 2005 09:00:00 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 Documentation/powerpc/eeh-pci-error-recovery.txt |   31 ++++----
 arch/powerpc/kernel/vio.c                        |    2 -
 block/genhd.c                                    |   48 ++++++------
 drivers/acpi/container.c                         |    8 +-
 drivers/acpi/processor_core.c                    |    8 +-
 drivers/acpi/scan.c                              |   14 ++--
 drivers/base/Kconfig                             |    4 +
 drivers/base/class.c                             |   68 +++++++++--------
 drivers/base/core.c                              |   42 +++++------
 drivers/base/cpu.c                               |    4 +
 drivers/base/firmware_class.c                    |   45 ++++++------
 drivers/base/memory.c                            |   12 ++-
 drivers/ieee1394/nodemgr.c                       |   20 +++--
 drivers/infiniband/core/sysfs.c                  |   16 ++--
 drivers/input/input.c                            |   14 ++--
 drivers/input/serio/serio.c                      |   22 +++---
 drivers/macintosh/macio_asic.c                   |    4 +
 drivers/mmc/mmc_sysfs.c                          |    4 +
 drivers/pci/hotplug.c                            |   44 ++++++-----
 drivers/pci/pci-driver.c                         |    6 +-
 drivers/pci/pci.h                                |    4 +
 drivers/pcmcia/cs.c                              |   10 +--
 drivers/pcmcia/ds.c                              |   50 ++++++-------
 drivers/scsi/ipr.c                               |    2 -
 drivers/usb/core/usb.c                           |   86 ++++++++++------------
 drivers/usb/host/hc_crisv10.c                    |    2 -
 drivers/w1/w1.c                                  |   14 ++--
 fs/partitions/check.c                            |    6 +-
 include/linux/device.h                           |   14 ++--
 include/linux/firmware.h                         |    2 -
 include/linux/kobject.h                          |   40 +++++-----
 include/linux/sysctl.h                           |    2 -
 include/linux/usb.h                              |    2 -
 kernel/ksysfs.c                                  |   14 ++--
 kernel/sysctl.c                                  |    4 +
 lib/kobject.c                                    |    4 +
 lib/kobject_uevent.c                             |   64 ++++++++--------
 net/bluetooth/hci_sysfs.c                        |    4 +
 net/bridge/br_sysfs_if.c                         |    4 +
 net/core/net-sysfs.c                             |    8 +-
 40 files changed, 373 insertions(+), 379 deletions(-)
Documentation/powerpc/eeh-pci-error-recovery.txt +16 -15
index e75d747..67a11a3 100644
@@ -115,7 +115,7 @@ Current PPC64 Linux EEH Implementation
 At this time, a generic EEH recovery mechanism has been implemented,
 so that individual device drivers do not need to be modified to support
 EEH recovery.  This generic mechanism piggy-backs on the PCI hotplug
-infrastructure,  and percolates events up through the hotplug/udev
+infrastructure,  and percolates events up through the userspace/udev
 infrastructure.  Followiing is a detailed description of how this is
 accomplished.
 
@@ -172,7 +172,7 @@ A handler for the EEH notifier_block eve
 drivers/pci/hotplug/pSeries_pci.c, called handle_eeh_events().
 It saves the device BAR's and then calls rpaphp_unconfig_pci_adapter().
 This last call causes the device driver for the card to be stopped,
-which causes hotplug events to go out to user space. This triggers
+which causes uevents to go out to user space. This triggers
 user-space scripts that might issue commands such as "ifdown eth0"
 for ethernet cards, and so on.  This handler then sleeps for 5 seconds,
 hoping to give the user-space scripts enough time to complete.
@@ -258,29 +258,30 @@ rpa_php_unconfig_pci_adapter() {        
     calls
     pci_destroy_dev (struct pci_dev *) {
       calls
-      device_unregister (&dev->dev) {      // in /drivers/base/core.c
+      device_unregister (&dev->dev) {        // in /drivers/base/core.c
         calls
-        device_del(struct device * dev) {  // in /drivers/base/core.c
+        device_del(struct device * dev) {    // in /drivers/base/core.c
           calls
-          kobject_del() {                  //in /libs/kobject.c
+          kobject_del() {                    //in /libs/kobject.c
             calls
-            kobject_hotplug() {            // in /libs/kobject.c
+            kobject_uevent() {               // in /libs/kobject.c
               calls
-              kset_hotplug() {             // in /lib/kobject.c
+              kset_uevent() {                // in /lib/kobject.c
                 calls
-                kset->hotplug_ops->hotplug() which is really just
+                kset->uevent_ops->uevent()   // which is really just
                 a call to
-                dev_hotplug() {           // in /drivers/base/core.c
+                dev_uevent() {               // in /drivers/base/core.c
                   calls
-                  dev->bus->hotplug() which is really just a call to
-                  pci_hotplug () {      // in drivers/pci/hotplug.c
+                  dev->bus->uevent() which is really just a call to
+                  pci_uevent () {            // in drivers/pci/hotplug.c
                     which prints device name, etc....
                  }
                }
-               then kset_hotplug() calls
-                call_usermodehelper () with
-                   argv[0]=hotplug_path[] which is "/sbin/hotplug"
-             --> event to userspace,
+               then kobject_uevent() sends a netlink uevent to userspace
+               --> userspace uevent
+               (during early boot, nobody listens to netlink events and
+               kobject_uevent() executes uevent_helper[], which runs the
+               event process /sbin/hotplug)
            }
          }
          kobject_del() then calls sysfs_remove_dir(), which would
arch/powerpc/kernel/vio.c +1 -1
index 71a6add..13c4149 100644
@@ -293,6 +293,6 @@ static int vio_hotplug(struct device *de
 
 struct bus_type vio_bus_type = {
 	.name = "vio",
-	.hotplug = vio_hotplug,
+	.uevent = vio_hotplug,
 	.match = vio_bus_match,
 };
block/genhd.c +24 -24

98 lines not on this page · raw message

drivers/acpi/container.c +4 -4
index 27ec12c..b69a8ca 100644
@@ -172,21 +172,21 @@ static void container_notify_cb(acpi_han
 			if (ACPI_FAILURE(status) || !device) {
 				result = container_device_add(&device, handle);
 				if (!result)
-					kobject_hotplug(&device->kobj,
-							KOBJ_ONLINE);
+					kobject_uevent(&device->kobj,
+						       KOBJ_ONLINE);
 				else
 					printk("Failed to add container\n");
 			}
 		} else {
 			if (ACPI_SUCCESS(status)) {
 				/* device exist and this is a remove request */
-				kobject_hotplug(&device->kobj, KOBJ_OFFLINE);
+				kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 			}
 		}
 		break;
 	case ACPI_NOTIFY_EJECT_REQUEST:
 		if (!acpi_bus_get_device(handle, &device) && device) {
-			kobject_hotplug(&device->kobj, KOBJ_OFFLINE);
+			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 		}
 		break;
 	default:
drivers/acpi/processor_core.c +4 -4
index 0c561c5..1278aca 100644
@@ -748,7 +748,7 @@ int acpi_processor_device_add(acpi_handl
 		return_VALUE(-ENODEV);
 
 	if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
-		kobject_hotplug(&(*device)->kobj, KOBJ_ONLINE);
+		kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
 	}
 	return_VALUE(0);
 }
@@ -788,13 +788,13 @@ acpi_processor_hotplug_notify(acpi_handl
 		}
 
 		if (pr->id >= 0 && (pr->id < NR_CPUS)) {
-			kobject_hotplug(&device->kobj, KOBJ_OFFLINE);
+			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 			break;
 		}
 
 		result = acpi_processor_start(device);
 		if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) {
-			kobject_hotplug(&device->kobj, KOBJ_ONLINE);
+			kobject_uevent(&device->kobj, KOBJ_ONLINE);
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 					  "Device [%s] failed to start\n",
@@ -818,7 +818,7 @@ acpi_processor_hotplug_notify(acpi_handl
 		}
 
 		if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
-			kobject_hotplug(&device->kobj, KOBJ_OFFLINE);
+			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
drivers/acpi/scan.c +7 -7
index 31218e1..0745d20 100644
@@ -78,7 +78,7 @@ static struct kobj_type ktype_acpi_ns = 
 	.release = acpi_device_release,
 };
 
-static int namespace_hotplug(struct kset *kset, struct kobject *kobj,
+static int namespace_uevent(struct kset *kset, struct kobject *kobj,
 			     char **envp, int num_envp, char *buffer,
 			     int buffer_size)
 {
@@ -89,8 +89,8 @@ static int namespace_hotplug(struct kset
 	if (!dev->driver)
 		return 0;
 
-	if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len,
-				"PHYSDEVDRIVER=%s", dev->driver->name))
+	if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
+			   "PHYSDEVDRIVER=%s", dev->driver->name))
 		return -ENOMEM;
 
 	envp[i] = NULL;
@@ -98,8 +98,8 @@ static int namespace_hotplug(struct kset
 	return 0;
 }
 
-static struct kset_hotplug_ops namespace_hotplug_ops = {
-	.hotplug = &namespace_hotplug,
+static struct kset_uevent_ops namespace_uevent_ops = {
+	.uevent = &namespace_uevent,
 };
 
 static struct kset acpi_namespace_kset = {
@@ -108,7 +108,7 @@ static struct kset acpi_namespace_kset =
 		 },
 	.subsys = &acpi_subsys,
 	.ktype = &ktype_acpi_ns,
-	.hotplug_ops = &namespace_hotplug_ops,
+	.uevent_ops = &namespace_uevent_ops,
 };
 
 static void acpi_device_register(struct acpi_device *device,
@@ -347,7 +347,7 @@ static int acpi_bus_get_wakeup_device_fl
 }
 
 /* --------------------------------------------------------------------------
-		ACPI hotplug sysfs device file support
+		ACPI sysfs device file support
    -------------------------------------------------------------------------- */
 static ssize_t acpi_eject_store(struct acpi_device *device,
 				const char *buf, size_t count);
drivers/base/Kconfig +2 -2
index 934149c..f0eff3d 100644
@@ -19,11 +19,11 @@ config PREVENT_FIRMWARE_BUILD
 	  If unsure say Y here.
 
 config FW_LOADER
-	tristate "Hotplug firmware loading support"
+	tristate "Userspace firmware loading support"
 	select HOTPLUG
 	---help---
 	  This option is provided for the case where no in-kernel-tree modules
-	  require hotplug firmware loading support, but a module built outside
+	  require userspace firmware loading support, but a module built outside
 	  the kernel tree does.
 
 config DEBUG_DRIVER
drivers/base/class.c +34 -34

149 lines not on this page · raw message

drivers/base/core.c +21 -21

112 lines not on this page · raw message

drivers/base/cpu.c +2 -2
index a958447..281d267 100644
@@ -41,14 +41,14 @@ static ssize_t store_online(struct sys_d
 	case '0':
 		ret = cpu_down(cpu->sysdev.id);
 		if (!ret)
-			kobject_hotplug(&dev->kobj, KOBJ_OFFLINE);
+			kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
 		break;
 	case '1':
 		ret = smp_prepare_cpu(cpu->sysdev.id);
 		if (!ret)
 			ret = cpu_up(cpu->sysdev.id);
 		if (!ret)
-			kobject_hotplug(&dev->kobj, KOBJ_ONLINE);
+			kobject_uevent(&dev->kobj, KOBJ_ONLINE);
 		break;
 	default:
 		ret = -EINVAL;
drivers/base/firmware_class.c +22 -23

149 lines not on this page · raw message

drivers/base/memory.c +6 -6
index bc3ca6a..7e1d077 100644
@@ -29,12 +29,12 @@ static struct sysdev_class memory_sysdev
 	set_kset_name(MEMORY_CLASS_NAME),
 };
 
-static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj)
+static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
 {
 	return MEMORY_CLASS_NAME;
 }
 
-static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
+static int memory_uevent(struct kset *kset, struct kobject *kobj, char **envp,
 			int num_envp, char *buffer, int buffer_size)
 {
 	int retval = 0;
@@ -42,9 +42,9 @@ static int memory_hotplug(struct kset *k
 	return retval;
 }
 
-static struct kset_hotplug_ops memory_hotplug_ops = {
-	.name		= memory_hotplug_name,
-	.hotplug	= memory_hotplug,
+static struct kset_uevent_ops memory_uevent_ops = {
+	.name		= memory_uevent_name,
+	.uevent		= memory_uevent,
 };
 
 static struct notifier_block *memory_chain;
@@ -431,7 +431,7 @@ int __init memory_dev_init(void)
 	unsigned int i;
 	int ret;
 
-	memory_sysdev_class.kset.hotplug_ops = &memory_hotplug_ops;
+	memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops;
 	ret = sysdev_class_register(&memory_sysdev_class);
 
 	/*
drivers/ieee1394/nodemgr.c +10 -10
index 0ea37b1..f245366 100644
@@ -121,8 +121,8 @@ struct host_info {
 };
 
 static int nodemgr_bus_match(struct device * dev, struct device_driver * drv);
-static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
-			   char *buffer, int buffer_size);
+static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
+			  char *buffer, int buffer_size);
 static void nodemgr_resume_ne(struct node_entry *ne);
 static void nodemgr_remove_ne(struct node_entry *ne);
 static struct node_entry *find_entry_by_guid(u64 guid);
@@ -162,7 +162,7 @@ static void ud_cls_release(struct class_
 static struct class nodemgr_ud_class = {
 	.name		= "ieee1394",
 	.release	= ud_cls_release,
-	.hotplug	= nodemgr_hotplug,
+	.uevent		= nodemgr_uevent,
 };
 
 static struct hpsb_highlevel nodemgr_highlevel;
@@ -966,7 +966,7 @@ static struct unit_directory *nodemgr_pr
 				if (ud_child == NULL)
 					break;
 				
-				/* inherit unspecified values so hotplug picks it up */
+				/* inherit unspecified values, the driver core picks it up */
 				if ((ud->flags & UNIT_DIRECTORY_MODEL_ID) &&
 				    !(ud_child->flags & UNIT_DIRECTORY_MODEL_ID))
 				{
@@ -1062,8 +1062,8 @@ static void nodemgr_process_root_directo
 
 #ifdef CONFIG_HOTPLUG
 
-static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
-			   char *buffer, int buffer_size)
+static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
+			  char *buffer, int buffer_size)
 {
 	struct unit_directory *ud;
 	int i = 0;
@@ -1112,8 +1112,8 @@ do {								\
 
 #else
 
-static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
-			   char *buffer, int buffer_size)
+static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
+			  char *buffer, int buffer_size)
 {
 	return -ENODEV;
 }
@@ -1618,8 +1618,8 @@ static int nodemgr_host_thread(void *__h
 
 		/* Scan our nodes to get the bus options and create node
 		 * entries. This does not do the sysfs stuff, since that
-		 * would trigger hotplug callbacks and such, which is a
-		 * bad idea at this point. */
+		 * would trigger uevents and such, which is a bad idea at
+		 * this point. */
 		nodemgr_node_scan(hi, generation);
 
 		/* This actually does the full probe, with sysfs
drivers/infiniband/core/sysfs.c +8 -8
index 08648b1..1f1743c 100644
@@ -434,24 +434,24 @@ static void ib_device_release(struct cla
 	kfree(dev);
 }
 
-static int ib_device_hotplug(struct class_device *cdev, char **envp,
-			     int num_envp, char *buf, int size)
+static int ib_device_uevent(struct class_device *cdev, char **envp,
+			    int num_envp, char *buf, int size)
 {
 	struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
 	int i = 0, len = 0;
 
-	if (add_hotplug_env_var(envp, num_envp, &i, buf, size, &len,
-				"NAME=%s", dev->name))
+	if (add_uevent_var(envp, num_envp, &i, buf, size, &len,
+			   "NAME=%s", dev->name))
 		return -ENOMEM;
 
 	/*
-	 * It might be nice to pass the node GUID to hotplug, but
+	 * It might be nice to pass the node GUID with the event, but
 	 * right now the only way to get it is to query the device
 	 * provider, and this can crash during device removal because
 	 * we are will be running after driver removal has started.
 	 * We could add a node_guid field to struct ib_device, or we
-	 * could just let the hotplug script read the node GUID from
-	 * sysfs when devices are added.
+	 * could just let userspace read the node GUID from sysfs when
+	 * devices are added.
 	 */
 
 	envp[i] = NULL;
@@ -653,7 +653,7 @@ static struct class_device_attribute *ib
 static struct class ib_class = {
 	.name    = "infiniband",
 	.release = ib_device_release,
-	.hotplug = ib_device_hotplug,
+	.uevent = ib_device_uevent,
 };
 
 int ib_device_register_sysfs(struct ib_device *device)
drivers/input/input.c +7 -7
index 43b49cc..2d37b39 100644
@@ -610,10 +610,10 @@ static void input_dev_release(struct cla
 }
 
 /*
- * Input hotplugging interface - loading event handlers based on
+ * Input uevent interface - loading event handlers based on
  * device bitfields.
  */
-static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index,
+static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index,
 				    char *buffer, int buffer_size, int *cur_len,
 				    const char *name, unsigned long *bitmap, int max)
 {
@@ -638,7 +638,7 @@ static int input_add_hotplug_bm_var(char
 
 #define INPUT_ADD_HOTPLUG_VAR(fmt, val...)				\
 	do {								\
-		int err = add_hotplug_env_var(envp, num_envp, &i,	\
+		int err = add_uevent_var(envp, num_envp, &i,	\
 					buffer, buffer_size, &len,	\
 					fmt, val);			\
 		if (err)						\
@@ -647,15 +647,15 @@ static int input_add_hotplug_bm_var(char
 
 #define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max)				\
 	do {								\
-		int err = input_add_hotplug_bm_var(envp, num_envp, &i,	\
+		int err = input_add_uevent_bm_var(envp, num_envp, &i,	\
 					buffer, buffer_size, &len,	\
 					name, bm, max);			\
 		if (err)						\
 			return err;					\
 	} while (0)
 
-static int input_dev_hotplug(struct class_device *cdev, char **envp,
-			     int num_envp, char *buffer, int buffer_size)
+static int input_dev_uevent(struct class_device *cdev, char **envp,
+			    int num_envp, char *buffer, int buffer_size)
 {
 	struct input_dev *dev = to_input_dev(cdev);
 	int i = 0;
@@ -697,7 +697,7 @@ static int input_dev_hotplug(struct clas
 struct class input_class = {
 	.name			= "input",
 	.release		= input_dev_release,
-	.hotplug		= input_dev_hotplug,
+	.uevent			= input_dev_uevent,
 };
 
 struct input_dev *input_allocate_device(void)
drivers/input/serio/serio.c +11 -11
index fbb69ef..8e530cc 100644
@@ -800,16 +800,16 @@ static int serio_bus_match(struct device
 
 #ifdef CONFIG_HOTPLUG
 
-#define SERIO_ADD_HOTPLUG_VAR(fmt, val...)				\
+#define SERIO_ADD_UEVENT_VAR(fmt, val...)				\
 	do {								\
-		int err = add_hotplug_env_var(envp, num_envp, &i,	\
+		int err = add_uevent_var(envp, num_envp, &i,	\
 					buffer, buffer_size, &len,	\
 					fmt, val);			\
 		if (err)						\
 			return err;					\
 	} while (0)
 
-static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
+static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
 {
 	struct serio *serio;
 	int i = 0;
@@ -820,21 +820,21 @@ static int serio_hotplug(struct device *
 
 	serio = to_serio_port(dev);
 
-	SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type);
-	SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto);
-	SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id);
-	SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra);
-	SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
+	SERIO_ADD_UEVENT_VAR("SERIO_TYPE=%02x", serio->id.type);
+	SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
+	SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
+	SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
+	SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
 				serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
 	envp[i] = NULL;
 
 	return 0;
 }
-#undef SERIO_ADD_HOTPLUG_VAR
+#undef SERIO_ADD_UEVENT_VAR
 
 #else
 
-static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
+static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
 {
 	return -ENODEV;
 }
@@ -908,7 +908,7 @@ static int __init serio_init(void)
 	serio_bus.dev_attrs = serio_device_attrs;
 	serio_bus.drv_attrs = serio_driver_attrs;
 	serio_bus.match = serio_bus_match;
-	serio_bus.hotplug = serio_hotplug;
+	serio_bus.uevent = serio_uevent;
 	serio_bus.resume = serio_resume;
 	bus_register(&serio_bus);
 
drivers/macintosh/macio_asic.c +2 -2
index c34c96d..228e185 100644
@@ -128,7 +128,7 @@ static int macio_device_resume(struct de
 	return 0;
 }
 
-static int macio_hotplug (struct device *dev, char **envp, int num_envp,
+static int macio_uevent(struct device *dev, char **envp, int num_envp,
                           char *buffer, int buffer_size)
 {
 	struct macio_dev * macio_dev;
@@ -203,7 +203,7 @@ extern struct device_attribute macio_dev
 struct bus_type macio_bus_type = {
        .name	= "macio",
        .match	= macio_bus_match,
-       .hotplug = macio_hotplug,
+       .uevent = macio_uevent,
        .suspend	= macio_device_suspend,
        .resume	= macio_device_resume,
        .dev_attrs = macio_dev_attrs,
drivers/mmc/mmc_sysfs.c +2 -2
index 3f4a66c..ec70166 100644
@@ -80,7 +80,7 @@ static int mmc_bus_match(struct device *
 }
 
 static int
-mmc_bus_hotplug(struct device *dev, char **envp, int num_envp, char *buf,
+mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
 		int buf_size)
 {
 	struct mmc_card *card = dev_to_mmc_card(dev);
@@ -140,7 +140,7 @@ static struct bus_type mmc_bus_type = {
 	.name		= "mmc",
 	.dev_attrs	= mmc_dev_attrs,
 	.match		= mmc_bus_match,
-	.hotplug	= mmc_bus_hotplug,
+	.uevent		= mmc_bus_uevent,
 	.suspend	= mmc_bus_suspend,
 	.resume		= mmc_bus_resume,
 };
drivers/pci/hotplug.c +22 -22

64 lines not on this page · raw message

drivers/pci/pci-driver.c +3 -3
index a9046d4..7146b69 100644
@@ -502,8 +502,8 @@ void pci_dev_put(struct pci_dev *dev)
 }
 
 #ifndef CONFIG_HOTPLUG
-int pci_hotplug (struct device *dev, char **envp, int num_envp,
-		 char *buffer, int buffer_size)
+int pci_uevent(struct device *dev, char **envp, int num_envp,
+	       char *buffer, int buffer_size)
 {
 	return -ENODEV;
 }
@@ -512,7 +512,7 @@ int pci_hotplug (struct device *dev, cha
 struct bus_type pci_bus_type = {
 	.name		= "pci",
 	.match		= pci_bus_match,
-	.hotplug	= pci_hotplug,
+	.uevent		= pci_uevent,
 	.suspend	= pci_device_suspend,
 	.resume		= pci_device_resume,
 	.dev_attrs	= pci_dev_attrs,
drivers/pci/pci.h +2 -2
index 6527b36..294849d 100644
@@ -1,7 +1,7 @@
 /* Functions internal to the PCI core code */
 
-extern int pci_hotplug (struct device *dev, char **envp, int num_envp,
-			 char *buffer, int buffer_size);
+extern int pci_uevent(struct device *dev, char **envp, int num_envp,
+		      char *buffer, int buffer_size);
 extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_cleanup_rom(struct pci_dev *dev);
drivers/pcmcia/cs.c +5 -5
index a30aa74..7cf0908 100644
@@ -901,14 +901,14 @@ int pcmcia_insert_card(struct pcmcia_soc
 EXPORT_SYMBOL(pcmcia_insert_card);
 
 
-static int pcmcia_socket_hotplug(struct class_device *dev, char **envp,
-				int num_envp, char *buffer, int buffer_size)
+static int pcmcia_socket_uevent(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))
+	if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
+			   &length, "SOCKET_NO=%u", s->sock))
 		return -ENOMEM;
 
 	envp[i] = NULL;
@@ -927,7 +927,7 @@ static void pcmcia_release_socket_class(
 
 struct class pcmcia_socket_class = {
 	.name = "pcmcia_socket",
-        .hotplug = pcmcia_socket_hotplug,
+	.uevent = pcmcia_socket_uevent,
 	.release = pcmcia_release_socket,
 	.class_release = pcmcia_release_socket_class,
 };
drivers/pcmcia/ds.c +25 -25

78 lines not on this page · raw message

drivers/scsi/ipr.c +1 -1
index bf44a40..07ddf9a 100644
@@ -2132,7 +2132,7 @@ restart:
 	}
 
 	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
-	kobject_hotplug(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE);
+	kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE);
 	LEAVE;
 }
 
drivers/usb/core/usb.c +41 -45

139 lines not on this page · raw message

drivers/usb/host/hc_crisv10.c +1 -1
index 0eaabeb..641268d 100644
@@ -4397,7 +4397,7 @@ static int __init etrax_usb_hc_init(void
         device_initialize(&fake_device);
         kobject_set_name(&fake_device.kobj, "etrax_usb");
         kobject_add(&fake_device.kobj);
-        kobject_hotplug(&fake_device.kobj, KOBJ_ADD);
+	kobject_uevent(&fake_device.kobj, KOBJ_ADD);
         hc->bus->controller = &fake_device;
 	usb_register_bus(hc->bus);
 
drivers/w1/w1.c +7 -7
index 14016b1..024206c 100644
@@ -142,12 +142,12 @@ static struct bin_attribute w1_slave_att
 /* Default family */
 static struct w1_family w1_default_family;
 
-static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size);
+static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size);
 
 static struct bus_type w1_bus_type = {
 	.name = "w1",
 	.match = w1_master_match,
-	.hotplug = w1_hotplug,
+	.uevent = w1_uevent,
 };
 
 struct device_driver w1_master_driver = {
@@ -361,7 +361,7 @@ void w1_destroy_master_attributes(struct
 }
 
 #ifdef CONFIG_HOTPLUG
-static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
+static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
 {
 	struct w1_master *md = NULL;
 	struct w1_slave *sl = NULL;
@@ -377,7 +377,7 @@ static int w1_hotplug(struct device *dev
 		event_owner = "slave";
 		name = sl->name;
 	} else {
-		dev_dbg(dev, "Unknown hotplug event.\n");
+		dev_dbg(dev, "Unknown event.\n");
 		return -EINVAL;
 	}
 
@@ -386,18 +386,18 @@ static int w1_hotplug(struct device *dev
 	if (dev->driver != &w1_slave_driver || !sl)
 		return 0;
 
-	err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family);
+	err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family);
 	if (err)
 		return err;
 
-	err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id);
+	err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id);
 	if (err)
 		return err;
 
 	return 0;
 };
 #else
-static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
+static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
 {
 	return 0;
 }
fs/partitions/check.c +3 -3
index 8dc1822..7187a57 100644
@@ -226,7 +226,7 @@ static struct sysfs_ops part_sysfs_ops =
 static ssize_t part_uevent_store(struct hd_struct * p,
 				 const char *page, size_t count)
 {
-	kobject_hotplug(&p->kobj, KOBJ_ADD);
+	kobject_uevent(&p->kobj, KOBJ_ADD);
 	return count;
 }
 static ssize_t part_dev_read(struct hd_struct * p, char *page)
@@ -360,7 +360,7 @@ void register_disk(struct gendisk *disk)
 	if ((err = kobject_add(&disk->kobj)))
 		return;
 	disk_sysfs_symlinks(disk);
-	kobject_hotplug(&disk->kobj, KOBJ_ADD);
+	kobject_uevent(&disk->kobj, KOBJ_ADD);
 
 	/* No minors to use for partitions */
 	if (disk->minors == 1) {
@@ -465,6 +465,6 @@ void del_gendisk(struct gendisk *disk)
 		sysfs_remove_link(&disk->driverfs_dev->kobj, "block");
 		put_device(disk->driverfs_dev);
 	}
-	kobject_hotplug(&disk->kobj, KOBJ_REMOVE);
+	kobject_uevent(&disk->kobj, KOBJ_REMOVE);
 	kobject_del(&disk->kobj);
 }
include/linux/device.h +7 -7
index 17cbc6d..0cdee78 100644
@@ -47,8 +47,8 @@ struct bus_type {
 	struct driver_attribute	* drv_attrs;
 
 	int		(*match)(struct device * dev, struct device_driver * drv);
-	int		(*hotplug) (struct device *dev, char **envp, 
-				    int num_envp, char *buffer, int buffer_size);
+	int		(*uevent)(struct device *dev, char **envp,
+				  int num_envp, char *buffer, int buffer_size);
 	int		(*suspend)(struct device * dev, pm_message_t state);
 	int		(*resume)(struct device * dev);
 };
@@ -151,7 +151,7 @@ struct class {
 	struct class_attribute		* class_attrs;
 	struct class_device_attribute	* class_dev_attrs;
 
-	int	(*hotplug)(struct class_device *dev, char **envp, 
+	int	(*uevent)(struct class_device *dev, char **envp,
 			   int num_envp, char *buffer, int buffer_size);
 
 	void	(*release)(struct class_device *dev);
@@ -209,9 +209,9 @@ extern int class_device_create_file(stru
  * set, this will be called instead of the class specific release function.
  * Only use this if you want to override the default release function, like
  * when you are nesting class_device structures.
- * @hotplug: pointer to a hotplug function for this struct class_device.  If
- * set, this will be called instead of the class specific hotplug function.
- * Only use this if you want to override the default hotplug function, like
+ * @uevent: pointer to a uevent function for this struct class_device.  If
+ * set, this will be called instead of the class specific uevent function.
+ * Only use this if you want to override the default uevent function, like
  * when you are nesting class_device structures.
  */
 struct class_device {
@@ -227,7 +227,7 @@ struct class_device {
 	struct class_device	*parent;	/* parent of this child device, if there is one */
 
 	void	(*release)(struct class_device *dev);
-	int	(*hotplug)(struct class_device *dev, char **envp,
+	int	(*uevent)(struct class_device *dev, char **envp,
 			   int num_envp, char *buffer, int buffer_size);
 	char	class_id[BUS_ID_SIZE];	/* unique to this class */
 };
include/linux/firmware.h +1 -1
index 2063c08..2d71608 100644
@@ -14,7 +14,7 @@ struct device;
 int request_firmware(const struct firmware **fw, const char *name,
 		     struct device *device);
 int request_firmware_nowait(
-	struct module *module, int hotplug,
+	struct module *module, int uevent,
 	const char *name, struct device *device, void *context,
 	void (*cont)(const struct firmware *fw, void *context));
 
include/linux/kobject.h +19 -21
index 5b08248..8eb21f2 100644
@@ -26,15 +26,14 @@
 #include <linux/kernel.h>
 #include <asm/atomic.h>
 
-#define KOBJ_NAME_LEN	20
-
-#define HOTPLUG_PATH_LEN	256
+#define KOBJ_NAME_LEN			20
+#define UEVENT_HELPER_PATH_LEN		256
 
 /* path to the userspace helper executed on an event */
-extern char hotplug_path[];
+extern char uevent_helper[];
 
-/* counter to tag the hotplug event, read only except for the kobject core */
-extern u64 hotplug_seqnum;
+/* counter to tag the uevent, read only except for the kobject core */
+extern u64 uevent_seqnum;
 
 /* the actions here must match the proper string in lib/kobject_uevent.c */
 typedef int __bitwise kobject_action_t;
@@ -101,15 +100,14 @@ struct kobj_type {
  *	of object; multiple ksets can belong to one subsystem. All 
  *	ksets of a subsystem share the subsystem's lock.
  *
- *      Each kset can support hotplugging; if it does, it will be given
- *      the opportunity to filter out specific kobjects from being
- *      reported, as well as to add its own "data" elements to the
- *      environment being passed to the hotplug helper.
+ *	Each kset can support specific event variables; it can
+ *	supress the event generation or add subsystem specific
+ *	variables carried with the event.
  */
-struct kset_hotplug_ops {
+struct kset_uevent_ops {
 	int (*filter)(struct kset *kset, struct kobject *kobj);
 	const char *(*name)(struct kset *kset, struct kobject *kobj);
-	int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp,
+	int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
 			int num_envp, char *buffer, int buffer_size);
 };
 
@@ -119,7 +117,7 @@ struct kset {
 	struct list_head	list;
 	spinlock_t		list_lock;
 	struct kobject		kobj;
-	struct kset_hotplug_ops	* hotplug_ops;
+	struct kset_uevent_ops	* uevent_ops;
 };
 
 
@@ -167,20 +165,20 @@ struct subsystem {
 	struct rw_semaphore	rwsem;
 };
 
-#define decl_subsys(_name,_type,_hotplug_ops) \
+#define decl_subsys(_name,_type,_uevent_ops) \
 struct subsystem _name##_subsys = { \
 	.kset = { \
 		.kobj = { .name = __stringify(_name) }, \
 		.ktype = _type, \
-		.hotplug_ops =_hotplug_ops, \
+		.uevent_ops =_uevent_ops, \
 	} \
 }
-#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \
+#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
 struct subsystem _varname##_subsys = { \
 	.kset = { \
 		.kobj = { .name = __stringify(_name) }, \
 		.ktype = _type, \
-		.hotplug_ops =_hotplug_ops, \
+		.uevent_ops =_uevent_ops, \
 	} \
 }
 
@@ -256,16 +254,16 @@ extern int subsys_create_file(struct sub
 extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
 
 #ifdef CONFIG_HOTPLUG
-void kobject_hotplug(struct kobject *kobj, enum kobject_action action);
+void kobject_uevent(struct kobject *kobj, enum kobject_action action);
 
-int add_hotplug_env_var(char **envp, int num_envp, int *cur_index,
+int add_uevent_var(char **envp, int num_envp, int *cur_index,
 			char *buffer, int buffer_size, int *cur_len,
 			const char *format, ...)
 	__attribute__((format (printf, 7, 8)));
 #else
-static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { }
+static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
 
-static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 
+static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
 				      char *buffer, int buffer_size, int *cur_len, 
 				      const char *format, ...)
 { return 0; }
include/linux/sysctl.h +1 -1
index 4be34ef..5015642 100644
@@ -124,7 +124,7 @@ enum
 	KERN_OVERFLOWUID=46,	/* int: overflow UID */
 	KERN_OVERFLOWGID=47,	/* int: overflow GID */
 	KERN_SHMPATH=48,	/* string: path to shm fs */
-	KERN_HOTPLUG=49,	/* string: path to hotplug policy agent */
+	KERN_HOTPLUG=49,	/* string: path to uevent helper (deprecated) */
 	KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
 	KERN_S390_USER_DEBUG_LOGGING=51,  /* int: dumps of user faults */
 	KERN_CORE_USES_PID=52,		/* int: use core or core.%pid */
include/linux/usb.h +1 -1
index d81b050..7a20997 100644
@@ -225,7 +225,7 @@ struct usb_interface_cache {
  * Device drivers should not attempt to activate configurations.  The choice
  * of which configuration to install is a policy decision based on such
  * considerations as available power, functionality provided, and the user's
- * desires (expressed through hotplug scripts).  However, drivers can call
+ * desires (expressed through userspace tools).  However, drivers can call
  * usb_reset_configuration() to reinitialize the current configuration and
  * all its interfaces.
  */
kernel/ksysfs.c +7 -7
index e975a76..bfb4a7a 100644
@@ -26,23 +26,23 @@ static struct subsys_attribute _name##_a
 /* current uevent sequence number */
 static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page)
 {
-	return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum);
+	return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum);
 }
 KERNEL_ATTR_RO(uevent_seqnum);
 
 /* uevent helper program, used during early boo */
 static ssize_t uevent_helper_show(struct subsystem *subsys, char *page)
 {
-	return sprintf(page, "%s\n", hotplug_path);
+	return sprintf(page, "%s\n", uevent_helper);
 }
 static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count)
 {
-	if (count+1 > HOTPLUG_PATH_LEN)
+	if (count+1 > UEVENT_HELPER_PATH_LEN)
 		return -ENOENT;
-	memcpy(hotplug_path, page, count);
-	hotplug_path[count] = '\0';
-	if (count && hotplug_path[count-1] == '\n')
-		hotplug_path[count-1] = '\0';
+	memcpy(uevent_helper, page, count);
+	uevent_helper[count] = '\0';
+	if (count && uevent_helper[count-1] == '\n')
+		uevent_helper[count-1] = '\0';
 	return count;
 }
 KERNEL_ATTR_RW(uevent_helper);
kernel/sysctl.c +2 -2
index 6a51e25..345f4a1 100644
@@ -395,8 +395,8 @@ static ctl_table kern_table[] = {
 	{
 		.ctl_name	= KERN_HOTPLUG,
 		.procname	= "hotplug",
-		.data		= &hotplug_path,
-		.maxlen		= HOTPLUG_PATH_LEN,
+		.data		= &uevent_helper,
+		.maxlen		= UEVENT_HELPER_PATH_LEN,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,
lib/kobject.c +2 -2
index a181abe..7a0e680 100644
@@ -207,7 +207,7 @@ int kobject_register(struct kobject * ko
 			       kobject_name(kobj),error);
 			dump_stack();
 		} else
-			kobject_hotplug(kobj, KOBJ_ADD);
+			kobject_uevent(kobj, KOBJ_ADD);
 	} else
 		error = -EINVAL;
 	return error;
@@ -312,7 +312,7 @@ void kobject_del(struct kobject * kobj)
 void kobject_unregister(struct kobject * kobj)
 {
 	pr_debug("kobject %s: unregistering\n",kobject_name(kobj));
-	kobject_hotplug(kobj, KOBJ_REMOVE);
+	kobject_uevent(kobj, KOBJ_REMOVE);
 	kobject_del(kobj);
 	kobject_put(kobj);
 }
lib/kobject_uevent.c +32 -32

157 lines not on this page · raw message

net/bluetooth/hci_sysfs.c +2 -2
index bd7568a..0ed3874 100644
@@ -78,7 +78,7 @@ static struct class_device_attribute *bt
 };
 
 #ifdef CONFIG_HOTPLUG
-static int bt_hotplug(struct class_device *cdev, char **envp, int num_envp, char *buf, int size)
+static int bt_uevent(struct class_device *cdev, char **envp, int num_envp, char *buf, int size)
 {
 	struct hci_dev *hdev = class_get_devdata(cdev);
 	int n, i = 0;
@@ -107,7 +107,7 @@ struct class bt_class = {
 	.name		= "bluetooth",
 	.release	= bt_release,
 #ifdef CONFIG_HOTPLUG
-	.hotplug	= bt_hotplug,
+	.uevent		= bt_uevent,
 #endif
 };
 
net/bridge/br_sysfs_if.c +2 -2
index f6a19d5..2ebdc23 100644
@@ -248,7 +248,7 @@ int br_sysfs_addif(struct net_bridge_por
 	if (err)
 		goto out2;
 
-	kobject_hotplug(&p->kobj, KOBJ_ADD);
+	kobject_uevent(&p->kobj, KOBJ_ADD);
 	return 0;
  out2:
 	kobject_del(&p->kobj);
@@ -260,7 +260,7 @@ void br_sysfs_removeif(struct net_bridge
 {
 	pr_debug("br_sysfs_removeif\n");
 	sysfs_remove_link(&p->br->ifobj, p->dev->name);
-	kobject_hotplug(&p->kobj, KOBJ_REMOVE);
+	kobject_uevent(&p->kobj, KOBJ_REMOVE);
 	kobject_del(&p->kobj);
 }
 
net/core/net-sysfs.c +4 -4
index e2137f3..198655d 100644
@@ -369,14 +369,14 @@ static struct attribute_group wireless_g
 #endif
 
 #ifdef CONFIG_HOTPLUG
-static int netdev_hotplug(struct class_device *cd, char **envp,
-			  int num_envp, char *buf, int size)
+static int netdev_uevent(struct class_device *cd, char **envp,
+			 int num_envp, char *buf, int size)
 {
 	struct net_device *dev = to_net_dev(cd);
 	int i = 0;
 	int n;
 
-	/* pass interface in env to hotplug. */
+	/* pass interface to uevent. */
 	envp[i++] = buf;
 	n = snprintf(buf, size, "INTERFACE=%s", dev->name) + 1;
 	buf += n;
@@ -408,7 +408,7 @@ static struct class net_class = {
 	.name = "net",
 	.release = netdev_release,
 #ifdef CONFIG_HOTPLUG
-	.hotplug = netdev_hotplug,
+	.uevent = netdev_uevent,
 #endif
 };
 
author
#7 lore raw

PATCH 1/1 driver kill hotplug word from sn and others fix

[PATCH] driver kill hotplug word from sn and others fix

The first of these changes s/hotplug/uevent/ was needed to compile sn2_defconfig (ia64/sn). The other three files changed are blind changes of all remaining bus_type.hotplug references I could find to bus_type.uevent.

This patch attempts to finish similar changes made in the gregkh-driver-kill-hotplug-word-from-driver-core Nov 22 patch.

---
commit 6d20b035dee4300e9786c6e1cb77a765c7f9460a
tree 104596b8fca1f4946da8d499a8429e5decf7e2d9
parent 712f47cea7703a340406fde61e84eb86ce781988
author Paul Jackson <[email protected]> Fri, 25 Nov 2005 20:04:26 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 arch/arm/common/amba.c      |    6 +++---
 arch/ia64/sn/kernel/tiocx.c |    4 ++--
 drivers/s390/cio/ccwgroup.c |    4 ++--
 drivers/s390/cio/device.c   |    4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/common/amba.c +3 -3
index e101311..c95ec9e 100644
@@ -45,7 +45,7 @@ static int amba_match(struct device *dev
 }
 
 #ifdef CONFIG_HOTPLUG
-static int amba_hotplug(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)
+static int amba_uevent(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)
 {
 	struct amba_device *pcdev = to_amba_device(dev);
 
@@ -58,7 +58,7 @@ static int amba_hotplug(struct device *d
 	return 0;
 }
 #else
-#define amba_hotplug NULL
+#define amba_uevent NULL
 #endif
 
 static int amba_suspend(struct device *dev, pm_message_t state)
@@ -88,7 +88,7 @@ static int amba_resume(struct device *de
 static struct bus_type amba_bustype = {
 	.name		= "amba",
 	.match		= amba_match,
-	.hotplug	= amba_hotplug,
+	.uevent		= amba_uevent,
 	.suspend	= amba_suspend,
 	.resume		= amba_resume,
 };
arch/ia64/sn/kernel/tiocx.c +2 -2
index 0d8592a..768c21d 100644
@@ -65,7 +65,7 @@ static int tiocx_match(struct device *de
 
 }
 
-static int tiocx_hotplug(struct device *dev, char **envp, int num_envp,
+static int tiocx_uevent(struct device *dev, char **envp, int num_envp,
 			 char *buffer, int buffer_size)
 {
 	return -ENODEV;
@@ -79,7 +79,7 @@ static void tiocx_bus_release(struct dev
 struct bus_type tiocx_bus_type = {
 	.name = "tiocx",
 	.match = tiocx_match,
-	.hotplug = tiocx_hotplug,
+	.uevent = tiocx_uevent,
 };
 
 /**
drivers/s390/cio/ccwgroup.c +2 -2
index e7bd7f3..be9d2d6 100644
@@ -45,7 +45,7 @@ ccwgroup_bus_match (struct device * dev,
 	return 0;
 }
 static int
-ccwgroup_hotplug (struct device *dev, char **envp, int num_envp, char *buffer,
+ccwgroup_uevent (struct device *dev, char **envp, int num_envp, char *buffer,
 		  int buffer_size)
 {
 	/* TODO */
@@ -55,7 +55,7 @@ ccwgroup_hotplug (struct device *dev, ch
 static struct bus_type ccwgroup_bus_type = {
 	.name    = "ccwgroup",
 	.match   = ccwgroup_bus_match,
-	.hotplug = ccwgroup_hotplug,
+	.uevent = ccwgroup_uevent,
 };
 
 static inline void
drivers/s390/cio/device.c +2 -2
index 811c9d1..85908ca 100644
@@ -59,7 +59,7 @@ ccw_bus_match (struct device * dev, stru
  * Heavily modeled on pci and usb hotplug.
  */
 static int
-ccw_hotplug (struct device *dev, char **envp, int num_envp,
+ccw_uevent (struct device *dev, char **envp, int num_envp,
 	     char *buffer, int buffer_size)
 {
 	struct ccw_device *cdev = to_ccwdev(dev);
@@ -110,7 +110,7 @@ ccw_hotplug (struct device *dev, char **
 struct bus_type ccw_bus_type = {
 	.name  = "ccw",
 	.match = &ccw_bus_match,
-	.hotplug = &ccw_hotplug,
+	.uevent = &ccw_uevent,
 };
 
 static int io_subchannel_probe (struct device *);
author
#8 lore raw

PATCH 1/1 HOTPLUG: always enable the .config option, unless EMBEDDED

[PATCH] HOTPLUG: always enable the .config option, unless EMBEDDED

With modules, dynamic /dev, and uevents, people really want CONFIG_HOTPLUG to be enabled in their kernels. If not, they can still disable it, but it is discouraged.

---
commit 712f47cea7703a340406fde61e84eb86ce781988
tree cf8a4ae14b1503446000454151ef5c8cef507336
parent 312c004d36ce6c739512bac83b452f4c20ab1f62
author Greg Kroah-Hartman <[email protected]> Wed, 16 Nov 2005 11:27:07 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 init/Kconfig |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
init/Kconfig +9 -8
index 0de8b77..d2b4e33 100644
@@ -197,14 +197,6 @@ config AUDITSYSCALL
 	  can be used independently or with another kernel subsystem,
 	  such as SELinux.
 
-config HOTPLUG
-	bool "Support for hot-pluggable devices" if !ARCH_S390
-	default ARCH_S390
-	help
-	  This option is provided for the case where no in-kernel-tree
-	  modules require HOTPLUG functionality, but a module built
-	  outside the kernel tree does. Such modules require Y here.
-
 config IKCONFIG
 	bool "Kernel .config support"
 	---help---
@@ -289,6 +281,15 @@ config KALLSYMS_EXTRA_PASS
 	   you wait for kallsyms to be fixed.
 
 
+config HOTPLUG
+	bool "Support for hot-pluggable devices" if EMBEDDED
+	default y
+	help
+	  This option is provided for the case where no hotplug or uevent
+	  capabilities is wanted by the kernel.  You should only consider
+	  disabling this option for embedded systems that do not use modules, a
+	  dynamic /dev tree, or dynamic device discovery.  Just say Y.
+
 config PRINTK
 	default y
 	bool "Enable support for printk" if EMBEDDED
author
#9 lore raw

PATCH 1/1 Hold the device's parent's lock during probe and remove

[PATCH] Hold the device's parent's lock during probe and remove

This patch (as604) makes the driver core hold a device's parent's lock as well as the device's lock during calls to the probe and remove methods in a driver. This facility is needed by USB device drivers, owing to the peculiar way USB devices work:

A device provides multiple interfaces, and drivers are bound to interfaces rather than to devices;

Nevertheless a reset, reset-configuration, suspend, or resume affects the entire device and requires the caller to hold the lock for the device, not just a lock for one of the interfaces.

Since a USB driver's probe method is always called with the interface lock held, the locking order rules (always lock parent before child) prevent these methods from acquiring the device lock. The solution provided here is to call all probe and remove methods, for all devices (not just USB), with the parent lock already acquired.

Although currently only the USB subsystem requires these changes, people have mentioned in prior discussion that the overhead of acquiring an extra semaphore in all the prove/remove sequences is not overly large.

Up to now, the USB core has been using its own set of private semaphores. A followup patch will remove them, relying entirely on the device semaphores provided by the driver core.

The code paths affected by this patch are:

device_add and device_del: The USB core already holds the parent lock, so no actual change is needed.

driver_register and driver_unregister: The driver core will now lock both the parent and the device before probing or removing.

driver_bind and driver_unbind (in sysfs): These routines will now lock both the parent and the device before binding or unbinding.

bus_rescan_devices: The helper routine will lock the parent before probing a device.

I have not tested this patch for conflicts with other subsystems. As far as I can see, the only possibility of conflict would lie in the bus_rescan_devices pathway, and it seems pretty remote. Nevertheless, it would be good for this to get a lot of testing in -mm.

---
commit bf74ad5bc41727d5f2f1c6bedb2c1fac394de731
tree 1e46f41550a9fe6df40fedeace23f5aff656b478
parent 6d20b035dee4300e9786c6e1cb77a765c7f9460a
author Alan Stern <[email protected]> Thu, 17 Nov 2005 16:54:12 -0500 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 drivers/base/bus.c |   15 ++++++++++++++-
 drivers/base/dd.c  |   15 ++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)
drivers/base/bus.c +14 -1
index fa601b0..e3f915a 100644
@@ -152,7 +152,11 @@ static ssize_t driver_unbind(struct devi
 
 	dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
 	if (dev && dev->driver == drv) {
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		device_release_driver(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
 		err = count;
 	}
 	put_device(dev);
@@ -175,9 +179,13 @@ static ssize_t driver_bind(struct device
 
 	dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
 	if (dev && dev->driver == NULL) {
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		down(&dev->sem);
 		err = driver_probe_device(drv, dev);
 		up(&dev->sem);
+		if (dev->parent)
+			up(&dev->parent->sem);
 	}
 	put_device(dev);
 	put_bus(bus);
@@ -484,8 +492,13 @@ void bus_remove_driver(struct device_dri
 /* Helper for bus_rescan_devices's iter */
 static int bus_rescan_devices_helper(struct device *dev, void *data)
 {
-	if (!dev->driver)
+	if (!dev->driver) {
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		device_attach(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
+	}
 	return 0;
 }
 
drivers/base/dd.c +14 -1
index 3b419c9..2b90501 100644
@@ -65,7 +65,8 @@ void device_bind_driver(struct device * 
  *	This function returns 1 if a match is found, an error if one
  *	occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.
  *
- *	This function must be called with @dev->sem held.
+ *	This function must be called with @dev->sem held.  When called
+ *	for a USB interface, @dev->parent->sem must be held as well.
  */
 int driver_probe_device(struct device_driver * drv, struct device * dev)
 {
@@ -123,6 +124,8 @@ static int __device_attach(struct device
  *
  *	Returns 1 if the device was bound to a driver;
  *	0 if no matching device was found; error code otherwise.
+ *
+ *	When called for a USB interface, @dev->parent->sem must be held.
  */
 int device_attach(struct device * dev)
 {
@@ -152,10 +155,14 @@ static int __driver_attach(struct device
 	 * is an error.
 	 */
 
+	if (dev->parent)	/* Needed for USB */
+		down(&dev->parent->sem);
 	down(&dev->sem);
 	if (!dev->driver)
 		driver_probe_device(drv, dev);
 	up(&dev->sem);
+	if (dev->parent)
+		up(&dev->parent->sem);
 
 	return 0;
 }
@@ -181,6 +188,8 @@ void driver_attach(struct device_driver 
  *	Manually detach device from driver.
  *
  *	__device_release_driver() must be called with @dev->sem held.
+ *	When called for a USB interface, @dev->parent->sem must be held
+ *	as well.
  */
 
 static void __device_release_driver(struct device * dev)
@@ -233,10 +242,14 @@ void driver_detach(struct device_driver 
 		get_device(dev);
 		spin_unlock(&drv->klist_devices.k_lock);
 
+		if (dev->parent)	/* Needed for USB */
+			down(&dev->parent->sem);
 		down(&dev->sem);
 		if (dev->driver == drv)
 			__device_release_driver(dev);
 		up(&dev->sem);
+		if (dev->parent)
+			up(&dev->parent->sem);
 		put_device(dev);
 	}
 }
author
#10 lore raw

PATCH 1/1 Allow overlapping resources for platform devices

[PATCH] Allow overlapping resources for platform devices

There are cases in which a device's memory mapped registers overlap with another device's memory mapped registers. On several PowerPC devices this occurs for the MDIO bus, whose registers tended to overlap with one of the ethernet controllers.

By switching from request_resource to insert_resource we can register the MDIO bus as a proper platform device and not hack around how we handle its memory mapped registers.

---
commit d960bb4db9f422b5c3c82e0dfd6c8213a4fc430d
tree a5d79803da3f7e20fa55f6fd1b8ec9c74ef0c322
parent e22dafbcd7a579c29a424d5203b5b33b131948a7
author Kumar Gala <[email protected]> Mon, 28 Nov 2005 10:15:39 -0600 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 drivers/base/platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/platform.c +1 -1
index 8827daf..1091af1 100644
@@ -257,7 +257,7 @@ int platform_device_add(struct platform_
 				p = &ioport_resource;
 		}
 
-		if (p && request_resource(p, r)) {
+		if (p && insert_resource(p, r)) {
 			printk(KERN_ERR
 			       "%s: failed to claim resource %d\n",
 			       pdev->dev.bus_id, i);
author
#11 lore raw

PATCH 1/1 klist: Fix broken kref counting in find functions

[PATCH] klist: Fix broken kref counting in find functions

The klist reference counting in the find functions that use klist_iter_init_node is broken. If the function (for example driver_find_device) is called with a NULL start object then everything is fine, the first call to next_device()/klist_next increases the ref-count of the first node on the list and does nothing for the start object which is NULL.

If they are called with a valid start object then klist_next will decrement the ref-count for the start object but nobody has incremented it. Logical place to fix this would be klist_iter_init_node because the function puts a reference of the object into the klist_iter struct.

---
commit e22dafbcd7a579c29a424d5203b5b33b131948a7
tree 122969a87ba706be8374beb15bc03493e3601404
parent bf74ad5bc41727d5f2f1c6bedb2c1fac394de731
author Frank Pavlic <[email protected]> Sat, 26 Nov 2005 20:48:40 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 lib/klist.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
lib/klist.c +2 -0
index bb2f355..9c94f0b 100644
@@ -199,6 +199,8 @@ void klist_iter_init_node(struct klist *
 	i->i_klist = k;
 	i->i_head = &k->k_list;
 	i->i_cur = n;
+	if (n)
+		kref_get(&n->n_ref);
 }
 
 EXPORT_SYMBOL_GPL(klist_iter_init_node);
author
#12 lore raw

PATCH 1/1 kobject_uevent CONFIG_NET=n fix

[PATCH] kobject_uevent CONFIG_NET=n fix

lib/lib.a(kobject_uevent.o)(.text+0x25f): In function `kobject_uevent':
: undefined reference to __alloc_skb' lib/lib.a(kobject_uevent.o)(.text+0x2a1): In function kobject_uevent':
: undefined reference to skb_over_panic' lib/lib.a(kobject_uevent.o)(.text+0x31d): In function kobject_uevent':
: undefined reference to skb_over_panic' lib/lib.a(kobject_uevent.o)(.text+0x356): In function kobject_uevent':
: undefined reference to netlink_broadcast' lib/lib.a(kobject_uevent.o)(.init.text+0x9): In function kobject_uevent_init':
: undefined reference to `netlink_kernel_create'
make: *** [.tmp_vmlinux1] Error 1

Netlink is unconditionally enabled if CONFIG_NET, so that's OK.

kobject_uevent.o is compiled even if !CONFIG_HOTPLUG, which is lazy.

Let's compound the sin.

---
commit f743ca5e10f4145e0b3e6d11b9b46171e16af7ce
tree e21e900b2400d66a6da37492951e80c6f4cf4230
parent d960bb4db9f422b5c3c82e0dfd6c8213a4fc430d
author [email protected] <[email protected]> Tue, 22 Nov 2005 23:36:13 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:08 -0800

 include/linux/kobject.h |    2 +-
 kernel/ksysfs.c         |    3 +++
 lib/kobject_uevent.c    |    4 +---
 3 files changed, 5 insertions(+), 4 deletions(-)
include/linux/kobject.h +1 -1
index 8eb21f2..2a8d8da 100644
@@ -253,7 +253,7 @@ struct subsys_attribute {
 extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
 extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
 
-#ifdef CONFIG_HOTPLUG
+#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET)
 void kobject_uevent(struct kobject *kobj, enum kobject_action action);
 
 int add_uevent_var(char **envp, int num_envp, int *cur_index,
kernel/ksysfs.c +3 -0
index bfb4a7a..99af8b0 100644
@@ -15,6 +15,9 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
+u64 uevent_seqnum;
+char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
+
 #define KERNEL_ATTR_RO(_name) \
 static struct subsys_attribute _name##_attr = __ATTR_RO(_name)
 
lib/kobject_uevent.c +1 -3
index 01479e5..f56e27a 100644
@@ -25,9 +25,7 @@
 #define BUFFER_SIZE	1024	/* buffer for the variables */
 #define NUM_ENVP	32	/* number of env pointers */
 
-#if defined(CONFIG_HOTPLUG)
-char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
-u64 uevent_seqnum;
+#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
 static DEFINE_SPINLOCK(sequence_lock);
 static struct sock *uevent_sock;
 
author
#13 lore raw

PATCH 1/1 Input: add modalias support

[PATCH] Input: add modalias support

Here's the patch for modalias support for input classes. It uses comma-separated numbers, and doesn't describe all the potential keys (no module currently cares, and that would make the strings huge). The changes to input.h are to move the definitions needed by file2alias outside __KERNEL__. I chose not to move those definitions to mod_devicetable.h, because there are so many that it might break compile of something else in the kernel.

The rest is fairly straightforward.

---
commit 1d8f430c15b3a345db990e285742c67c2f52f9a6
tree 7bf8ae0929ebf581c4de68e7f4be9f6ea672d453
parent 263756ec228f1cdd49fc50b1f87001a4cebdfe12
author Rusty Russell <[email protected]> Wed, 07 Dec 2005 21:40:34 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 drivers/input/input.c    |   39 +++++++++++++++++++++++
 include/linux/input.h    |   79 ++++++++++++++++++++++++----------------------
 scripts/mod/file2alias.c |   62 ++++++++++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+), 39 deletions(-)
drivers/input/input.c +39 -0
index 2d37b39..ef5824c 100644
@@ -528,10 +528,49 @@ INPUT_DEV_STRING_ATTR_SHOW(name);
 INPUT_DEV_STRING_ATTR_SHOW(phys);
 INPUT_DEV_STRING_ATTR_SHOW(uniq);
 
+static int print_modalias_bits(char *buf, char prefix, unsigned long *arr,
+			       unsigned int min, unsigned int max)
+{
+	int len, i;
+
+	len = sprintf(buf, "%c", prefix);
+	for (i = min; i < max; i++)
+		if (arr[LONG(i)] & BIT(i))
+			len += sprintf(buf+len, "%X,", i);
+	return len;
+}
+
+static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)
+{
+	struct input_dev *id = to_input_dev(dev);
+	ssize_t len = 0;
+
+	len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-",
+		       id->id.bustype,
+		       id->id.vendor,
+		       id->id.product,
+		       id->id.version);
+
+	len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX);
+	len += print_modalias_bits(buf+len, 'k', id->keybit,
+				   KEY_MIN_INTERESTING, KEY_MAX);
+	len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX);
+	len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX);
+	len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX);
+	len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX);
+	len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX);
+	len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX);
+	len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX);
+	len += sprintf(buf+len, "\n");
+	return len;
+}
+static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);
+
 static struct attribute *input_dev_attrs[] = {
 	&class_device_attr_name.attr,
 	&class_device_attr_phys.attr,
 	&class_device_attr_uniq.attr,
+	&class_device_attr_modalias.attr,
 	NULL
 };
 
include/linux/input.h +41 -38

108 lines not on this page · raw message

scripts/mod/file2alias.c +61 -1

88 lines not on this page · raw message

author
#14 lore raw

PATCH 1/1 ide: MODALIAS support for autoloading of ide-cd, ide-disk, ...

[PATCH] ide: MODALIAS support for autoloading of ide-cd, ide-disk, ...

IDE: MODALIAS support for autoloading of ide-cd, ide-disk, ...

Add MODULE_ALIAS to IDE midlayer modules: ide-disk, ide-cd, ide-floppy and ide-tape, to autoload these modules depending on the probed media type of the IDE device.

It is used by udev and replaces the former agent shell script of the hotplug package, which was required to lookup the media type in the proc filesystem. Using proc was racy, cause the media file is created after the hotplug event is sent out.

The module autoloading does not take any effect, until something like the following udev rule is configured:
SUBSYSTEM=="ide", ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"

The module ide-scsi will not be autoloaded, cause it requires manual configuration. It can't be, and never was supported for automatic setup in the hotplug package. Adding a MODULE_ALIAS to ide-scsi for all supported media types, would just lead to a default blacklist entry anyway.

  $ modinfo ide-disk
  filename:       /lib/modules/2.6.15-rc4-g1b0997f5/kernel/drivers/ide/ide-disk.ko
  description:    ATA DISK Driver
  alias:          ide:*m-disk*
  license:        GPL
  ...
  $ modprobe -vn ide:m-disk
  insmod /lib/modules/2.6.15-rc4-g1b0997f5/kernel/drivers/ide/ide-disk.ko
  $ cat /sys/bus/ide/devices/0.0/modalias
  ide:m-disk

It also adds attributes to the IDE device:

  $ tree /sys/bus/ide/devices/0.0/
  /sys/bus/ide/devices/0.0/
  |-- bus -> ../../../../../../../bus/ide
  |-- drivename
  |-- media
  |-- modalias
  |-- power
  |   |-- state
  |   `-- wakeup
  `-- uevent
  $ cat /sys/bus/ide/devices/0.0/{modalias,drivename,media}
  ide:m-disk
  hda
  disk

---
commit 263756ec228f1cdd49fc50b1f87001a4cebdfe12
tree 502925a94655348a768f25180e49126688100a8d
parent f743ca5e10f4145e0b3e6d11b9b46171e16af7ce
author Kay Sievers <[email protected]> Mon, 12 Dec 2005 18:03:44 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 drivers/ide/ide-cd.c     |    1 +
 drivers/ide/ide-disk.c   |    1 +
 drivers/ide/ide-floppy.c |    1 +
 drivers/ide/ide-tape.c   |    1 +
 drivers/ide/ide.c        |   60 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 64 insertions(+), 0 deletions(-)
drivers/ide/ide-cd.c +1 -0
index b4d7a3e..70aeb3a 100644
@@ -3509,6 +3509,7 @@ static int __init ide_cdrom_init(void)
 	return driver_register(&ide_cdrom_driver.gen_driver);
 }
 
+MODULE_ALIAS("ide:*m-cdrom*");
 module_init(ide_cdrom_init);
 module_exit(ide_cdrom_exit);
 MODULE_LICENSE("GPL");
drivers/ide/ide-disk.c +1 -0
index 449522f..4e57679 100644
@@ -1271,6 +1271,7 @@ static int __init idedisk_init(void)
 	return driver_register(&idedisk_driver.gen_driver);
 }
 
+MODULE_ALIAS("ide:*m-disk*");
 module_init(idedisk_init);
 module_exit(idedisk_exit);
 MODULE_LICENSE("GPL");
drivers/ide/ide-floppy.c +1 -0
index 9e293c8..fba3fff 100644
@@ -2197,6 +2197,7 @@ static int __init idefloppy_init(void)
 	return driver_register(&idefloppy_driver.gen_driver);
 }
 
+MODULE_ALIAS("ide:*m-floppy*");
 module_init(idefloppy_init);
 module_exit(idefloppy_exit);
 MODULE_LICENSE("GPL");
drivers/ide/ide-tape.c +1 -0
index 7d7944e..fab9b2b 100644
@@ -4947,6 +4947,7 @@ out:
 	return error;
 }
 
+MODULE_ALIAS("ide:*m-tape*");
 module_init(idetape_init);
 module_exit(idetape_exit);
 MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR);
drivers/ide/ide.c +60 -0

69 lines not on this page · raw message

author
#15 lore raw

PATCH 1/1 Driver core: Make block devices create the proper symlink name

[PATCH] Driver core: Make block devices create the proper symlink name

Block devices need to add the block device name to the symlink they put in the device directory, otherwise multiple symlinks of the same name can be created. This matches the class system, which works the same way, we just forgot to convert block at the same time.

---
commit 8218ef80932aa7e5e3d20c929a640c8d82133a9a
tree 73f2e7a972563cf536a7dae0fa02d99c4041d893
parent 874c6241b2e49e52680d32a50d4909c7768d5cb9
author Greg Kroah-Hartman <[email protected]> Tue, 13 Dec 2005 15:17:34 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 fs/partitions/check.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)
fs/partitions/check.c +25 -2
index 7187a57..7881ce0 100644
@@ -336,12 +336,31 @@ void add_partition(struct gendisk *disk,
 	disk->part[part-1] = p;
 }
 
+static char *make_block_name(struct gendisk *disk)
+{
+	char *name;
+	static char *block_str = "block:";
+	int size;
+
+	size = strlen(block_str) + strlen(disk->disk_name) + 1;
+	name = kmalloc(size, GFP_KERNEL);
+	if (!name)
+		return NULL;
+	strcpy(name, block_str);
+	strcat(name, disk->disk_name);
+	return name;
+}
+
 static void disk_sysfs_symlinks(struct gendisk *disk)
 {
 	struct device *target = get_device(disk->driverfs_dev);
 	if (target) {
+		char *disk_name = make_block_name(disk);
 		sysfs_create_link(&disk->kobj,&target->kobj,"device");
-		sysfs_create_link(&target->kobj,&disk->kobj,"block");
+		if (disk_name) {
+			sysfs_create_link(&target->kobj,&disk->kobj,disk_name);
+			kfree(disk_name);
+		}
 	}
 }
 
@@ -461,8 +480,12 @@ void del_gendisk(struct gendisk *disk)
 	devfs_remove_disk(disk);
 
 	if (disk->driverfs_dev) {
+		char *disk_name = make_block_name(disk);
 		sysfs_remove_link(&disk->kobj, "device");
-		sysfs_remove_link(&disk->driverfs_dev->kobj, "block");
+		if (disk_name) {
+			sysfs_remove_link(&disk->driverfs_dev->kobj, disk_name);
+			kfree(disk_name);
+		}
 		put_device(disk->driverfs_dev);
 	}
 	kobject_uevent(&disk->kobj, KOBJ_REMOVE);
author
#16 lore raw

PATCH 1/1 Driver core: only all userspace bind/unbind if CONFIG_HOTPLUG is enabled

[PATCH] Driver core: only all userspace bind/unbind if CONFIG_HOTPLUG is enabled

Thanks to drivers making their id tables __devinit, we can't allow userspace to bind or unbind drivers from devices manually through sysfs. So we only allow this if CONFIG_HOTPLUG is enabled.

---
commit 874c6241b2e49e52680d32a50d4909c7768d5cb9
tree 815b08ab6793cd45346c3d5f6a3875f36c0bfc91
parent a96b204208443ab7e23c681f7ddabe807a741d0c
author Greg Kroah-Hartman <[email protected]> Tue, 13 Dec 2005 15:17:34 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 drivers/base/bus.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
drivers/base/bus.c +22 -4
index e3f915a..29f6af5 100644
@@ -428,6 +428,26 @@ static void driver_remove_attrs(struct b
 	}
 }
 
+#ifdef CONFIG_HOTPLUG
+/*
+ * Thanks to drivers making their tables __devinit, we can't allow manual
+ * bind and unbind from userspace unless CONFIG_HOTPLUG is enabled.
+ */
+static void add_bind_files(struct device_driver *drv)
+{
+	driver_create_file(drv, &driver_attr_unbind);
+	driver_create_file(drv, &driver_attr_bind);
+}
+
+static void remove_bind_files(struct device_driver *drv)
+{
+	driver_remove_file(drv, &driver_attr_bind);
+	driver_remove_file(drv, &driver_attr_unbind);
+}
+#else
+static inline void add_bind_files(struct device_driver *drv) {}
+static inline void remove_bind_files(struct device_driver *drv) {}
+#endif
 
 /**
  *	bus_add_driver - Add a driver to the bus.
@@ -457,8 +477,7 @@ int bus_add_driver(struct device_driver 
 		module_add_driver(drv->owner, drv);
 
 		driver_add_attrs(bus, drv);
-		driver_create_file(drv, &driver_attr_unbind);
-		driver_create_file(drv, &driver_attr_bind);
+		add_bind_files(drv);
 	}
 	return error;
 }
@@ -476,8 +495,7 @@ int bus_add_driver(struct device_driver 
 void bus_remove_driver(struct device_driver * drv)
 {
 	if (drv->bus) {
-		driver_remove_file(drv, &driver_attr_bind);
-		driver_remove_file(drv, &driver_attr_unbind);
+		remove_bind_files(drv);
 		driver_remove_attrs(drv->bus, drv);
 		klist_remove(&drv->knode_bus);
 		pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
author
#17 lore raw

PATCH 1/1 Driver Core: Add platform_device_del()

[PATCH] Driver Core: Add platform_device_del()

Driver core: add platform_device_del function

Having platform_device_del90 allows more straightforward error handling code in drivers registering platform devices.

---
commit 93ce3061be212f6280e7ccafa9a7f698a95c6d75
tree a451566360fea86ef597fcd2fe693dce65626f93
parent e39b84337b8aed3044683a57741a19e5002225b9
author Dmitry Torokhov <[email protected]> Sat, 10 Dec 2005 01:36:27 -0500 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 drivers/base/platform.c         |   45 ++++++++++++++++++++++++++-------------
 include/linux/platform_device.h |    1 +
 2 files changed, 31 insertions(+), 15 deletions(-)
drivers/base/platform.c +30 -15
index 1091af1..95ecfc4 100644
@@ -168,7 +168,7 @@ struct platform_device *platform_device_
 		pa->pdev.dev.release = platform_device_release;
 	}
 
-	return pa ? &pa->pdev : NULL;	
+	return pa ? &pa->pdev : NULL;
 }
 EXPORT_SYMBOL_GPL(platform_device_alloc);
 
@@ -282,24 +282,13 @@ int platform_device_add(struct platform_
 EXPORT_SYMBOL_GPL(platform_device_add);
 
 /**
- *	platform_device_register - add a platform-level device
- *	@pdev:	platform device we're adding
- *
- */
-int platform_device_register(struct platform_device * pdev)
-{
-	device_initialize(&pdev->dev);
-	return platform_device_add(pdev);
-}
-
-/**
- *	platform_device_unregister - remove a platform-level device
+ *	platform_device_del - remove a platform-level device
  *	@pdev:	platform device we're removing
  *
  *	Note that this function will also release all memory- and port-based
  *	resources owned by the device (@dev->resource).
  */
-void platform_device_unregister(struct platform_device * pdev)
+void platform_device_del(struct platform_device *pdev)
 {
 	int i;
 
@@ -310,9 +299,35 @@ void platform_device_unregister(struct p
 				release_resource(r);
 		}
 
-		device_unregister(&pdev->dev);
+		device_del(&pdev->dev);
 	}
 }
+EXPORT_SYMBOL_GPL(platform_device_del);
+
+/**
+ *	platform_device_register - add a platform-level device
+ *	@pdev:	platform device we're adding
+ *
+ */
+int platform_device_register(struct platform_device * pdev)
+{
+	device_initialize(&pdev->dev);
+	return platform_device_add(pdev);
+}
+
+/**
+ *	platform_device_unregister - unregister a platform-level device
+ *	@pdev:	platform device we're unregistering
+ *
+ *	Unregistration is done in 2 steps. Fisrt we release all resources
+ *	and remove it from the sybsystem, then we drop reference count by
+ *	calling platform_device_put().
+ */
+void platform_device_unregister(struct platform_device * pdev)
+{
+	platform_device_del(pdev);
+	platform_device_put(pdev);
+}
 
 /**
  *	platform_device_register_simple
include/linux/platform_device.h +1 -0
index 17e336f..782090c 100644
@@ -41,6 +41,7 @@ extern struct platform_device *platform_
 extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
 extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
 extern int platform_device_add(struct platform_device *pdev);
+extern void platform_device_del(struct platform_device *pdev);
 extern void platform_device_put(struct platform_device *pdev);
 
 struct platform_driver {
author
#18 lore raw

PATCH 1/1 Driver Core: Rearrange exports in platform.c

[PATCH] Driver Core: Rearrange exports in platform.c

Driver core: rearrange exports in platform.c

The new way is to specify export right after symbol definition. Rearrange exports to follow new style to avoid mixing two styles in one file.

---
commit a96b204208443ab7e23c681f7ddabe807a741d0c
tree 7dacd3fe2790e1c5a922ff30fdab00b689a83998
parent 93ce3061be212f6280e7ccafa9a7f698a95c6d75
author Dmitry Torokhov <[email protected]> Sat, 10 Dec 2005 01:36:28 -0500 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 drivers/base/platform.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
drivers/base/platform.c +10 -11
index 95ecfc4..0f81731 100644
@@ -25,6 +25,7 @@
 struct device platform_bus = {
 	.bus_id		= "platform",
 };
+EXPORT_SYMBOL_GPL(platform_bus);
 
 /**
  *	platform_get_resource - get a resource for a device
@@ -49,6 +50,7 @@ platform_get_resource(struct platform_de
 	}
 	return NULL;
 }
+EXPORT_SYMBOL_GPL(platform_get_resource);
 
 /**
  *	platform_get_irq - get an IRQ for a device
@@ -61,6 +63,7 @@ int platform_get_irq(struct platform_dev
 
 	return r ? r->start : 0;
 }
+EXPORT_SYMBOL_GPL(platform_get_irq);
 
 /**
  *	platform_get_resource_byname - get a resource for a device by name
@@ -84,6 +87,7 @@ platform_get_resource_byname(struct plat
 	}
 	return NULL;
 }
+EXPORT_SYMBOL_GPL(platform_get_resource_byname);
 
 /**
  *	platform_get_irq - get an IRQ for a device
@@ -96,6 +100,7 @@ int platform_get_irq_byname(struct platf
 
 	return r ? r->start : 0;
 }
+EXPORT_SYMBOL_GPL(platform_get_irq_byname);
 
 /**
  *	platform_add_devices - add a numbers of platform devices
@@ -117,6 +122,7 @@ int platform_add_devices(struct platform
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(platform_add_devices);
 
 struct platform_object {
 	struct platform_device pdev;
@@ -314,6 +320,7 @@ int platform_device_register(struct plat
 	device_initialize(&pdev->dev);
 	return platform_device_add(pdev);
 }
+EXPORT_SYMBOL_GPL(platform_device_register);
 
 /**
  *	platform_device_unregister - unregister a platform-level device
@@ -328,6 +335,7 @@ void platform_device_unregister(struct p
 	platform_device_del(pdev);
 	platform_device_put(pdev);
 }
+EXPORT_SYMBOL_GPL(platform_device_unregister);
 
 /**
  *	platform_device_register_simple
@@ -370,6 +378,7 @@ error:
 	platform_device_put(pdev);
 	return ERR_PTR(retval);
 }
+EXPORT_SYMBOL_GPL(platform_device_register_simple);
 
 static int platform_drv_probe(struct device *_dev)
 {
@@ -491,6 +500,7 @@ struct bus_type platform_bus_type = {
 	.suspend	= platform_suspend,
 	.resume		= platform_resume,
 };
+EXPORT_SYMBOL_GPL(platform_bus_type);
 
 int __init platform_bus_init(void)
 {
@@ -519,14 +529,3 @@ u64 dma_get_required_mask(struct device 
 }
 EXPORT_SYMBOL_GPL(dma_get_required_mask);
 #endif
-
-EXPORT_SYMBOL_GPL(platform_bus);
-EXPORT_SYMBOL_GPL(platform_bus_type);
-EXPORT_SYMBOL_GPL(platform_add_devices);
-EXPORT_SYMBOL_GPL(platform_device_register);
-EXPORT_SYMBOL_GPL(platform_device_register_simple);
-EXPORT_SYMBOL_GPL(platform_device_unregister);
-EXPORT_SYMBOL_GPL(platform_get_irq);
-EXPORT_SYMBOL_GPL(platform_get_resource);
-EXPORT_SYMBOL_GPL(platform_get_irq_byname);
-EXPORT_SYMBOL_GPL(platform_get_resource_byname);
author
#19 lore raw

PATCH 1/1 Input: fix add modalias support build error

[PATCH] Input: fix add modalias support build error

Fix build when scripts/mod/file2alias.c includes linux/input.h, which tries to include /usr/include/linux/mod_devicetable.h:

In file included from scripts/mod/file2alias.c:40:
include/linux/input.h:21:35: linux/mod_devicetable.h: No such file or directory make[2]: *** [scripts/mod/file2alias.o] Error 1

---
commit e39b84337b8aed3044683a57741a19e5002225b9
tree b0e6fdd68b9b7d24b984401795f4660cc9cf7d0b
parent 1d8f430c15b3a345db990e285742c67c2f52f9a6
author Rusty Russell <[email protected]> Sat, 10 Dec 2005 22:48:20 +1100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 include/linux/input.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/input.h +1 -1
index bef0855..6d4cc3c 100644
@@ -13,12 +13,12 @@
 #include <linux/time.h>
 #include <linux/list.h>
 #include <linux/device.h>
+#include <linux/mod_devicetable.h>
 #else
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <asm/types.h>
 #endif
-#include <linux/mod_devicetable.h>
 
 /*
  * The event structure itself
author
#20 lore raw

PATCH 1/1 sysfs: handle failures in sysfs_make_dirent

[PATCH] sysfs: handle failures in sysfs_make_dirent

I noticed that if sysfs_make_dirent fails to allocate the sd, then a null will be passed to sysfs_put.

---
commit e80a5dea8e056d8f398be1900d61c581d379f02f
tree 97d6e0d1c669987c54961bec49347b3717e55d52
parent 8218ef80932aa7e5e3d20c929a640c8d82133a9a
author Steven Rostedt <[email protected]> Wed, 23 Nov 2005 09:15:44 -0500 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:09 -0800

 fs/sysfs/dir.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
fs/sysfs/dir.c +5 -1
index 59734ba..d367803 100644
@@ -112,7 +112,11 @@ static int create_dir(struct kobject * k
 			}
 		}
 		if (error && (error != -EEXIST)) {
-			sysfs_put((*d)->d_fsdata);
+			struct sysfs_dirent *sd = (*d)->d_fsdata;
+			if (sd) {
+ 				list_del_init(&sd->s_sibling);
+				sysfs_put(sd);
+			}
 			d_drop(*d);
 		}
 		dput(*d);
author
#21 lore raw

PATCH 1/1 drivers/base/power/runtime.c: #if 0 dpm_set_power_state()

[PATCH] drivers/base/power/runtime.c: #if 0 dpm_set_power_state()

This patch #if 0's an unused global function.

---
commit 1f1bf132d81ed723bc5fefbcec7d0779ce683a4f
tree 59cfbf241906753770c6150ef76efd1816210b74
parent e80a5dea8e056d8f398be1900d61c581d379f02f
author Adrian Bunk <[email protected]> Mon, 12 Dec 2005 01:31:03 -0800 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:10 -0800

 drivers/base/power/runtime.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/base/power/runtime.c +2 -0
index adbc314..4bafef8 100644
@@ -64,6 +64,7 @@ int dpm_runtime_suspend(struct device * 
 }
 
 
+#if 0
 /**
  *	dpm_set_power_state - Update power_state field.
  *	@dev:	Device.
@@ -80,3 +81,4 @@ void dpm_set_power_state(struct device *
 	dev->power.power_state = state;
 	up(&dpm_sem);
 }
+#endif  /*  0  */
author
#22 lore raw

PATCH 1/1 net: swich device attribute creation to default attrs

[PATCH] net: swich device attribute creation to default attrs

Recent udev versions don't longer cover bad sysfs timing with built-in logic. Explicit rules are required to do that. For net devices, the following is needed:
ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"
to handle access to net device properties from an event handler without races.

This patch changes the main net attributes to be created by the driver core, which is done _before_ the event is sent out and will not require the stat() loop of the WAIT_FOR_SYSFS key.

---
commit fd586bacf439f36dea9b9bf6e6133ac87df2730c
tree 2d0ea08194e086851b4a35d1003aa8be376ab683
parent 1f1bf132d81ed723bc5fefbcec7d0779ce683a4f
author Kay Sievers <[email protected]> Mon, 19 Dec 2005 01:42:56 +0100 committer Greg Kroah-Hartman <[email protected]> Wed, 04 Jan 2006 16:18:10 -0800

 net/core/net-sysfs.c |   68 +++++++++++++++-----------------------------------
 1 files changed, 21 insertions(+), 47 deletions(-)
net/core/net-sysfs.c +21 -47
index 198655d..e1da81d 100644
@@ -84,16 +84,11 @@ static ssize_t netdev_store(struct class
 	return ret;
 }
 
-/* generate a read-only network device class attribute */
-#define NETDEVICE_ATTR(field, format_string)				\
-NETDEVICE_SHOW(field, format_string)					\
-static CLASS_DEVICE_ATTR(field, S_IRUGO, show_##field, NULL)		\
-
-NETDEVICE_ATTR(addr_len, fmt_dec);
-NETDEVICE_ATTR(iflink, fmt_dec);
-NETDEVICE_ATTR(ifindex, fmt_dec);
-NETDEVICE_ATTR(features, fmt_long_hex);
-NETDEVICE_ATTR(type, fmt_dec);
+NETDEVICE_SHOW(addr_len, fmt_dec);
+NETDEVICE_SHOW(iflink, fmt_dec);
+NETDEVICE_SHOW(ifindex, fmt_dec);
+NETDEVICE_SHOW(features, fmt_long_hex);
+NETDEVICE_SHOW(type, fmt_dec);
 
 /* use same locking rules as GIFHWADDR ioctl's */
 static ssize_t format_addr(char *buf, const unsigned char *addr, int len)
@@ -136,10 +131,6 @@ static ssize_t show_carrier(struct class
 	return -EINVAL;
 }
 
-static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
-static CLASS_DEVICE_ATTR(broadcast, S_IRUGO, show_broadcast, NULL);
-static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
-
 /* read-write attributes */
 NETDEVICE_SHOW(mtu, fmt_dec);
 
@@ -153,8 +144,6 @@ static ssize_t store_mtu(struct class_de
 	return netdev_store(dev, buf, len, change_mtu);
 }
 
-static CLASS_DEVICE_ATTR(mtu, S_IRUGO | S_IWUSR, show_mtu, store_mtu);
-
 NETDEVICE_SHOW(flags, fmt_hex);
 
 static int change_flags(struct net_device *net, unsigned long new_flags)
@@ -167,8 +156,6 @@ static ssize_t store_flags(struct class_
 	return netdev_store(dev, buf, len, change_flags);
 }
 
-static CLASS_DEVICE_ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags);
-
 NETDEVICE_SHOW(tx_queue_len, fmt_ulong);
 
 static int change_tx_queue_len(struct net_device *net, unsigned long new_len)
@@ -182,9 +169,6 @@ static ssize_t store_tx_queue_len(struct
 	return netdev_store(dev, buf, len, change_tx_queue_len);
 }
 
-static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, 
-			 store_tx_queue_len);
-
 NETDEVICE_SHOW(weight, fmt_dec);
 
 static int change_weight(struct net_device *net, unsigned long new_weight)
@@ -198,24 +182,21 @@ static ssize_t store_weight(struct class
 	return netdev_store(dev, buf, len, change_weight);
 }
 
-static CLASS_DEVICE_ATTR(weight, S_IRUGO | S_IWUSR, show_weight, 
-			 store_weight);
-
-
-static struct class_device_attribute *net_class_attributes[] = {
-	&class_device_attr_ifindex,
-	&class_device_attr_iflink,
-	&class_device_attr_addr_len,
-	&class_device_attr_tx_queue_len,
-	&class_device_attr_features,
-	&class_device_attr_mtu,
-	&class_device_attr_flags,
-	&class_device_attr_weight,
-	&class_device_attr_type,
-	&class_device_attr_address,
-	&class_device_attr_broadcast,
-	&class_device_attr_carrier,
-	NULL
+static struct class_device_attribute net_class_attributes[] = {
+	__ATTR(addr_len, S_IRUGO, show_addr_len, NULL),
+	__ATTR(iflink, S_IRUGO, show_iflink, NULL),
+	__ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
+	__ATTR(features, S_IRUGO, show_features, NULL),
+	__ATTR(type, S_IRUGO, show_type, NULL),
+	__ATTR(address, S_IRUGO, show_address, NULL),
+	__ATTR(broadcast, S_IRUGO, show_broadcast, NULL),
+	__ATTR(carrier, S_IRUGO, show_carrier, NULL),
+	__ATTR(mtu, S_IRUGO | S_IWUSR, show_mtu, store_mtu),
+	__ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags),
+	__ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len,
+	       store_tx_queue_len),
+	__ATTR(weight, S_IRUGO | S_IWUSR, show_weight, store_weight),
+	{}
 };
 
 /* Show a given an attribute in the statistics group */
@@ -407,6 +388,7 @@ static void netdev_release(struct class_
 static struct class net_class = {
 	.name = "net",
 	.release = netdev_release,
+	.class_dev_attrs = net_class_attributes,
 #ifdef CONFIG_HOTPLUG
 	.uevent = netdev_uevent,
 #endif
@@ -431,8 +413,6 @@ void netdev_unregister_sysfs(struct net_
 int netdev_register_sysfs(struct net_device *net)
 {
 	struct class_device *class_dev = &(net->class_dev);
-	int i;
-	struct class_device_attribute *attr;
 	int ret;
 
 	class_dev->class = &net_class;
@@ -442,12 +422,6 @@ int netdev_register_sysfs(struct net_dev
 	if ((ret = class_device_register(class_dev)))
 		goto out;
 
-	for (i = 0; (attr = net_class_attributes[i]) != NULL; i++) {
-		if ((ret = class_device_create_file(class_dev, attr)))
-		    goto out_unreg;
-	}
-
-
 	if (net->get_stats &&
 	    (ret = sysfs_create_group(&class_dev->kobj, &netstat_group)))
 		goto out_unreg; 
#23 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

Here are a lot of driver core patches for 2.6.15. They have all been in the past few -mm releases with no problems.

Strange, because it doesn't merge with your other own changes. It might be an ordering thing (ie they might have merged fine in another order). Or maybe it's just because the -mm scripts will force-apply patches (or drop them).

Anyway, there were clashes in drivers/usb/core/usb.c with the patch "USB:
fix usb_find_interface for ppc64" that came through your USB changes, and that gets a merge error with the uevent/hotplug thing.

I can do the trivial manual fixup, but when I do, I have two copies of "usb_match_id()": one in drivers/usb/core/driver.c and one in drivers/usb/core/usb.c.

I've pushed out my tree, so that you can see for yourself (it seems to have mirrored out too).

Linus

author
#24 lore raw
Quoted 16 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Here are a lot of driver core patches for 2.6.15. They have all been in the past few -mm releases with no problems.

Strange, because it doesn't merge with your other own changes. It might be an ordering thing (ie they might have merged fine in another order). Or maybe it's just because the -mm scripts will force-apply patches (or drop them).

Anyway, there were clashes in drivers/usb/core/usb.c with the patch "USB:
fix usb_find_interface for ppc64" that came through your USB changes, and that gets a merge error with the uevent/hotplug thing.

Quoted 6 lines

I can do the trivial manual fixup, but when I do, I have two copies of "usb_match_id()": one in drivers/usb/core/driver.c and one in drivers/usb/core/usb.c.

I've pushed out my tree, so that you can see for yourself (it seems to have mirrored out too).

Yeah, I was wondering how that would merge together, I'll take a look at the tree after dinner and fix up the problem (there should only be one copy of that function.)

thanks,

greg k-h

#25 lore raw
Quoted 11 lines · Greg KH
Quoted 7 lines

I can do the trivial manual fixup, but when I do, I have two copies of "usb_match_id()": one in drivers/usb/core/driver.c and one in drivers/usb/core/usb.c.

I've pushed out my tree, so that you can see for yourself (it seems to have mirrored out too).

Yeah, I was wondering how that would merge together, I'll take a look at the tree after dinner and fix up the problem (there should only be one copy of that function.)

Actually, looking closer, my first trivial merge was wrong (it took the code from both branches), and doing it right seems to get the proper results (with just one usb_match_id() function).

I'll push out my _proper_ trivial merge fixup, please just verify that the end result looks sane and matches what you have.

Linus

author
#26 lore raw
Quoted 15 lines · Linus Torvalds
Quoted 11 lines · Greg KH
Quoted 7 lines

I can do the trivial manual fixup, but when I do, I have two copies of "usb_match_id()": one in drivers/usb/core/driver.c and one in drivers/usb/core/usb.c.

I've pushed out my tree, so that you can see for yourself (it seems to have mirrored out too).

Yeah, I was wondering how that would merge together, I'll take a look at the tree after dinner and fix up the problem (there should only be one copy of that function.)

Quoted 6 lines

Actually, looking closer, my first trivial merge was wrong (it took the code from both branches), and doing it right seems to get the proper results (with just one usb_match_id() function).

I'll push out my _proper_ trivial merge fixup, please just verify that the end result looks sane and matches what you have.

The end result looks sane, thanks for fixing it up.

But it looks like you forgot to pull from my "remove devfs" git tree at:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/devfs-2.6.git/

so you still are missing some patches :)

thanks,

greg k-h

#27 lore raw
Quoted 2 lines · Greg KH

The end result looks sane, thanks for fixing it up.

Goodie.

Quoted 4 lines

But it looks like you forgot to pull from my "remove devfs" git tree at:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/devfs-2.6.git/

so you still are missing some patches :)

Yeah, I "forgot" to start that particular flame-war.

Ok, here's the last chance for people to complain. If I don't get any complaints, I'll "remember" to pull your tree.

Linus

author
#28 lore raw

devfs going away, last chance to complain (was Re: [GIT PATCH] Driver Core patches for 2.6.15)

Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Greg KH

But it looks like you forgot to pull from my "remove devfs" git tree at:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/devfs-2.6.git/

so you still are missing some patches :)

Yeah, I "forgot" to start that particular flame-war.

Heh.

Quoted 2 lines

Ok, here's the last chance for people to complain. If I don't get any complaints, I'll "remember" to pull your tree.

Fair enough, I've changed the topic so it will stand out a bit better...

thanks,

greg k-h

#29 lore raw

Re: devfs going away, last chance to complain (was Re: [GIT PATCH] Driver Core patches for 2.6.15)

Pardon my ignorance, but what precisely was/is the problem with devfs, anyway?

Regards,

Steven Noonan

#30 lore raw

Re: devfs going away, last chance to complain (was Re: [GIT PATCH] Driver Core patches for 2.6.15)

Quoted 2 lines · Steven Noonan

Pardon my ignorance, but what precisely was/is the problem with devfs, anyway?

This has been toasted to death many times. These guys won't waste time describing the issues again. Just search the ML archives for devfs, but make sure you have several hours to kill ;)

Andrew Walrond

#31 lore raw

Re: devfs going away, last chance to complain (was Re: [GIT PATCH] Driver Core patches for 2.6.15)

In reply to Steven Noonan
Quoted 1 line · Steven Noonan

Pardon my ignorance, but what precisely was/is the problem with devfs, anyway?

1) It had unfixable races (The device is created when the hardware is detected but the module isn't loaded yet so the device doesn't work?)
2) The maintainer stopped maintaining it
3) It put naming policy (and a bad one at that) in the kernel where it doesn't belong.

I'm sure there are more, but those are the basic ones.

Cheers,
Kyle Moffett

--
Somone asked me why I work on this free (http://www.fsf.org/philosophy/) software stuff and not get a real job. Charles Schulz had the best answer:

"Why do musicians compose symphonies and poets write poems? They do it because life wouldn't have any meaning for them if they didn't. That's why I draw cartoons. It's my life."
-- Charles Schulz

#32 lore raw
In reply to Linus Torvalds
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Linus" == Linus Torvalds <[email protected]> writes:

But it looks like you forgot to pull from my "remove devfs" git tree at:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/devfs-2.6.git/

so you still are missing some patches :)

Linus> Yeah, I "forgot" to start that particular flame-war.

*laugh*

Linus> Ok, here's the last chance for people to complain. If I don't Linus> get any complaints, I'll "remember" to pull your tree.

FWIW, kill it.