diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-20 15:03:40 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-20 15:03:40 -0700 |
commit | f3fac81def54871901b5760452e2e08b39139d16 (patch) | |
tree | 0b991d8b0687a5c395d7aeac2ae3b7770af0084f /driver | |
parent | 4ae8d6206367af5f28595763af3c54eb711d5782 (diff) | |
download | patches-f3fac81def54871901b5760452e2e08b39139d16.tar.gz |
fix up the symlinks for devices moving from classes
Diffstat (limited to 'driver')
-rw-r--r-- | driver/device-symlinks-for-classes.patch | 68 | ||||
-rw-r--r-- | driver/driver-core-add-generic-subsystem-link-to-all-devices.patch | 8 | ||||
-rw-r--r-- | driver/make_class_name-kobj.patch | 98 | ||||
-rw-r--r-- | driver/put_device-might_sleep.patch | 2 |
4 files changed, 171 insertions, 5 deletions
diff --git a/driver/device-symlinks-for-classes.patch b/driver/device-symlinks-for-classes.patch new file mode 100644 index 0000000000000..0f64f718de4de --- /dev/null +++ b/driver/device-symlinks-for-classes.patch @@ -0,0 +1,68 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Tue, 20 Jun 2006 13:59:20 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Driver core: add proper symlinks for devices + +We need to create the "compatible" symlinks that class_devices used to +create when they were in the class directories so that userspace does +not know anything changed at all. + +Yeah, we have a lot of symlinks now, but we should be able to get rid of +them in a year or two... (wishful thinking...) + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/base/core.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- gregkh-2.6.orig/drivers/base/core.c ++++ gregkh-2.6/drivers/base/core.c +@@ -273,6 +273,7 @@ void device_initialize(struct device *de + int device_add(struct device *dev) + { + struct device *parent = NULL; ++ char *class_name = NULL; + int error = -EINVAL; + + dev = get_device(dev); +@@ -324,6 +325,10 @@ int device_add(struct device *dev) + "subsystem"); + sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, + dev->bus_id); ++ ++ sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); ++ class_name = make_class_name(dev->class->name, &dev->kobj); ++ sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name); + } + + if ((error = device_pm_add(dev))) +@@ -339,6 +344,7 @@ int device_add(struct device *dev) + if (platform_notify) + platform_notify(dev); + Done: ++ kfree(class_name); + put_device(dev); + return error; + BusError: +@@ -420,6 +426,7 @@ void put_device(struct device * dev) + void device_del(struct device * dev) + { + struct device * parent = dev->parent; ++ char *class_name = NULL; + + if (parent) + klist_del(&dev->knode_parent); +@@ -428,6 +435,10 @@ void device_del(struct device * dev) + if (dev->class) { + sysfs_remove_link(&dev->kobj, "subsystem"); + sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); ++ class_name = make_class_name(dev->class->name, &dev->kobj); ++ sysfs_remove_link(&dev->kobj, "device"); ++ sysfs_remove_link(&dev->parent->kobj, class_name); ++ kfree(class_name); + } + device_remove_file(dev, &dev->uevent_attr); + diff --git a/driver/driver-core-add-generic-subsystem-link-to-all-devices.patch b/driver/driver-core-add-generic-subsystem-link-to-all-devices.patch index 58f8454c4326d..56615808d878d 100644 --- a/driver/driver-core-add-generic-subsystem-link-to-all-devices.patch +++ b/driver/driver-core-add-generic-subsystem-link-to-all-devices.patch @@ -65,7 +65,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> device_remove_attrs(dev->bus, dev); --- gregkh-2.6.orig/drivers/base/class.c +++ gregkh-2.6/drivers/base/class.c -@@ -562,6 +562,7 @@ int class_device_add(struct class_device +@@ -561,6 +561,7 @@ int class_device_add(struct class_device goto out2; /* add the needed attributes to this device */ @@ -73,7 +73,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> class_dev->uevent_attr.attr.name = "uevent"; class_dev->uevent_attr.attr.mode = S_IWUSR; class_dev->uevent_attr.attr.owner = parent_class->owner; -@@ -736,6 +737,7 @@ void class_device_del(struct class_devic +@@ -737,6 +738,7 @@ void class_device_del(struct class_devic sysfs_remove_link(&class_dev->kobj, "device"); sysfs_remove_link(&class_dev->dev->kobj, class_name); } @@ -83,7 +83,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> class_device_remove_file(class_dev, class_dev->devt_attr); --- gregkh-2.6.orig/drivers/base/core.c +++ gregkh-2.6/drivers/base/core.c -@@ -335,9 +335,12 @@ int device_add(struct device *dev) +@@ -319,9 +319,12 @@ int device_add(struct device *dev) dev->devt_attr = attr; } @@ -97,7 +97,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> if ((error = device_pm_add(dev))) goto PMError; -@@ -438,8 +441,10 @@ void device_del(struct device * dev) +@@ -422,8 +425,10 @@ void device_del(struct device * dev) klist_del(&dev->knode_parent); if (dev->devt_attr) device_remove_file(dev, dev->devt_attr); diff --git a/driver/make_class_name-kobj.patch b/driver/make_class_name-kobj.patch new file mode 100644 index 0000000000000..898dc68a1b3c3 --- /dev/null +++ b/driver/make_class_name-kobj.patch @@ -0,0 +1,98 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Tue, 20 Jun 2006 13:59:20 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Driver core: change make_class_name() to take kobjects + +This is needed for a future patch for the device code to create the +proper symlinks for devices that are "class devices". + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/base/base.h | 1 + + drivers/base/class.c | 31 +++++++++++++++++-------------- + 2 files changed, 18 insertions(+), 14 deletions(-) + +--- gregkh-2.6.orig/drivers/base/base.h ++++ gregkh-2.6/drivers/base/base.h +@@ -42,4 +42,5 @@ struct class_device_attribute *to_class_ + return container_of(_attr, struct class_device_attribute, attr); + } + ++extern char *make_class_name(const char *name, struct kobject *kobj); + +--- gregkh-2.6.orig/drivers/base/class.c ++++ gregkh-2.6/drivers/base/class.c +@@ -504,22 +504,21 @@ void class_device_initialize(struct clas + INIT_LIST_HEAD(&class_dev->node); + } + +-static char *make_class_name(struct class_device *class_dev) ++char *make_class_name(const char *name, struct kobject *kobj) + { +- char *name; ++ char *class_name; + int size; + +- size = strlen(class_dev->class->name) + +- strlen(kobject_name(&class_dev->kobj)) + 2; ++ size = strlen(name) + strlen(kobject_name(kobj)) + 2; + +- name = kmalloc(size, GFP_KERNEL); +- if (!name) ++ class_name = kmalloc(size, GFP_KERNEL); ++ if (!class_name) + return ERR_PTR(-ENOMEM); + +- strcpy(name, class_dev->class->name); +- strcat(name, ":"); +- strcat(name, kobject_name(&class_dev->kobj)); +- return name; ++ strcpy(class_name, name); ++ strcat(class_name, ":"); ++ strcat(class_name, kobject_name(kobj)); ++ return class_name; + } + + int class_device_add(struct class_device *class_dev) +@@ -594,7 +593,8 @@ int class_device_add(struct class_device + goto out5; + + if (class_dev->dev) { +- class_name = make_class_name(class_dev); ++ class_name = make_class_name(class_dev->class->name, ++ &class_dev->kobj); + error = sysfs_create_link(&class_dev->kobj, + &class_dev->dev->kobj, "device"); + if (error) +@@ -731,7 +731,8 @@ void class_device_del(struct class_devic + } + + if (class_dev->dev) { +- class_name = make_class_name(class_dev); ++ class_name = make_class_name(class_dev->class->name, ++ &class_dev->kobj); + sysfs_remove_link(&class_dev->kobj, "device"); + sysfs_remove_link(&class_dev->dev->kobj, class_name); + } +@@ -796,14 +797,16 @@ int class_device_rename(struct class_dev + new_name); + + if (class_dev->dev) +- old_class_name = make_class_name(class_dev); ++ old_class_name = make_class_name(class_dev->class->name, ++ &class_dev->kobj); + + strlcpy(class_dev->class_id, new_name, KOBJ_NAME_LEN); + + error = kobject_rename(&class_dev->kobj, new_name); + + if (class_dev->dev) { +- new_class_name = make_class_name(class_dev); ++ new_class_name = make_class_name(class_dev->class->name, ++ &class_dev->kobj); + sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj, + new_class_name); + sysfs_remove_link(&class_dev->dev->kobj, old_class_name); diff --git a/driver/put_device-might_sleep.patch b/driver/put_device-might_sleep.patch index 2c7eb2281b1c7..695f2c1c9a496 100644 --- a/driver/put_device-might_sleep.patch +++ b/driver/put_device-might_sleep.patch @@ -12,7 +12,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/drivers/base/core.c +++ gregkh-2.6/drivers/base/core.c -@@ -414,6 +414,7 @@ struct device * get_device(struct device +@@ -420,6 +420,7 @@ struct device * get_device(struct device */ void put_device(struct device * dev) { |