diff options
26 files changed, 1214 insertions, 417 deletions
diff --git a/driver/block-device.patch b/driver/block-device.patch index 15d5a1e8bdac26..e728dfb9ae6118 100644 --- a/driver/block-device.patch +++ b/driver/block-device.patch @@ -781,7 +781,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> error = kset_register(&cls->subsys); --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -672,14 +672,15 @@ static int device_add_class_symlinks(str +@@ -671,14 +671,15 @@ static int device_add_class_symlinks(str #ifdef CONFIG_SYSFS_DEPRECATED /* stacked class devices need a symlink in the class directory */ @@ -799,7 +799,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> struct device *parent = dev->parent; char *class_name; -@@ -708,10 +709,11 @@ static int device_add_class_symlinks(str +@@ -707,10 +708,11 @@ static int device_add_class_symlinks(str return 0; out_device: @@ -813,7 +813,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); #else /* link in the class directory pointing to the device */ -@@ -720,7 +722,7 @@ out_busid: +@@ -719,7 +721,7 @@ out_busid: if (error) goto out_subsys; @@ -822,7 +822,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> error = sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); if (error) -@@ -744,7 +746,7 @@ static void device_remove_class_symlinks +@@ -743,7 +745,7 @@ static void device_remove_class_symlinks return; #ifdef CONFIG_SYSFS_DEPRECATED @@ -831,7 +831,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> char *class_name; class_name = make_class_name(dev->class->name, &dev->kobj); -@@ -755,10 +757,11 @@ static void device_remove_class_symlinks +@@ -754,10 +756,11 @@ static void device_remove_class_symlinks sysfs_remove_link(&dev->kobj, "device"); } @@ -845,7 +845,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> sysfs_remove_link(&dev->kobj, "device"); sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); -@@ -924,6 +927,7 @@ struct device * get_device(struct device +@@ -922,6 +925,7 @@ struct device * get_device(struct device */ void put_device(struct device * dev) { diff --git a/driver/driver-core-clean-up-debugging-messages.patch b/driver/driver-core-clean-up-debugging-messages.patch index fe7b126d7fba1f..3497dd702974b5 100644 --- a/driver/driver-core-clean-up-debugging-messages.patch +++ b/driver/driver-core-clean-up-debugging-messages.patch @@ -120,7 +120,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> __FUNCTION__, retval); } -@@ -749,7 +751,7 @@ int device_add(struct device *dev) +@@ -748,7 +750,7 @@ int device_add(struct device *dev) goto Done; } @@ -129,7 +129,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> parent = get_device(dev->parent); error = setup_parent(dev, parent); -@@ -1019,7 +1021,7 @@ void device_del(struct device * dev) +@@ -1017,7 +1019,7 @@ void device_del(struct device * dev) */ void device_unregister(struct device * dev) { @@ -138,7 +138,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> device_del(dev); put_device(dev); } -@@ -1115,7 +1117,7 @@ EXPORT_SYMBOL_GPL(device_remove_file); +@@ -1113,7 +1115,7 @@ EXPORT_SYMBOL_GPL(device_remove_file); static void device_create_release(struct device *dev) { @@ -147,7 +147,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> kfree(dev); } -@@ -1219,7 +1221,8 @@ int device_rename(struct device *dev, ch +@@ -1217,7 +1219,8 @@ int device_rename(struct device *dev, ch if (!dev) return -EINVAL; @@ -157,7 +157,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #ifdef CONFIG_SYSFS_DEPRECATED if ((dev->class) && (dev->parent)) -@@ -1338,8 +1341,8 @@ int device_move(struct device *dev, stru +@@ -1336,8 +1339,8 @@ int device_move(struct device *dev, stru put_device(new_parent); goto out; } diff --git a/driver/driver-core-fix-class-glue-dir-cleanup-logic.patch b/driver/driver-core-fix-class-glue-dir-cleanup-logic.patch index 02c181dc95a6a3..bedf6cdbea5c17 100644 --- a/driver/driver-core-fix-class-glue-dir-cleanup-logic.patch +++ b/driver/driver-core-fix-class-glue-dir-cleanup-logic.patch @@ -29,7 +29,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #include <asm/semaphore.h> #include "base.h" -@@ -539,22 +539,20 @@ void device_initialize(struct device *de +@@ -538,22 +538,20 @@ void device_initialize(struct device *de } #ifdef CONFIG_SYSFS_DEPRECATED @@ -58,7 +58,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #else static struct kobject *virtual_device_parent(struct device *dev) { -@@ -567,8 +565,8 @@ static struct kobject *virtual_device_pa +@@ -566,8 +564,8 @@ static struct kobject *virtual_device_pa return virtual_dir; } @@ -69,7 +69,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> { int retval; -@@ -619,6 +617,34 @@ static struct kobject * get_device_paren +@@ -618,6 +616,34 @@ static struct kobject * get_device_paren return &parent->kobj; return NULL; } @@ -104,7 +104,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #endif static int setup_parent(struct device *dev, struct device *parent) -@@ -638,65 +664,74 @@ static int device_add_class_symlinks(str +@@ -637,65 +663,74 @@ static int device_add_class_symlinks(str if (!dev->class) return 0; @@ -214,7 +214,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> out_subsys: sysfs_remove_link(&dev->kobj, "subsystem"); out: -@@ -707,8 +742,9 @@ static void device_remove_class_symlinks +@@ -706,8 +741,9 @@ static void device_remove_class_symlinks { if (!dev->class) return; @@ -225,7 +225,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> char *class_name; class_name = make_class_name(dev->class->name, &dev->kobj); -@@ -716,11 +752,18 @@ static void device_remove_class_symlinks +@@ -715,11 +751,18 @@ static void device_remove_class_symlinks sysfs_remove_link(&dev->parent->kobj, class_name); kfree(class_name); } @@ -245,7 +245,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> sysfs_remove_link(&dev->kobj, "subsystem"); } -@@ -829,26 +872,6 @@ int device_add(struct device *dev) +@@ -827,26 +870,6 @@ int device_add(struct device *dev) SymlinkError: if (MAJOR(dev->devt)) device_remove_file(dev, &devt_attr); @@ -272,7 +272,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ueventattrError: device_remove_file(dev, &uevent_attr); attrError: -@@ -930,23 +953,7 @@ void device_del(struct device * dev) +@@ -928,23 +951,7 @@ void device_del(struct device * dev) if (MAJOR(dev->devt)) device_remove_file(dev, &devt_attr); if (dev->class) { @@ -297,7 +297,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> down(&dev->class->sem); /* notify any interfaces that the device is now gone */ -@@ -956,31 +963,6 @@ void device_del(struct device * dev) +@@ -954,31 +961,6 @@ void device_del(struct device * dev) /* remove the device from the class list */ list_del_init(&dev->node); up(&dev->class->sem); @@ -329,7 +329,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } device_remove_file(dev, &uevent_attr); device_remove_attrs(dev); -@@ -1003,9 +985,9 @@ void device_del(struct device * dev) +@@ -1001,9 +983,9 @@ void device_del(struct device * dev) BUS_NOTIFY_DEL_DEVICE, dev); device_pm_remove(dev); kobject_uevent(&dev->kobj, KOBJ_REMOVE); diff --git a/driver/driver-core-remove-fields-from-struct-bus_type.patch b/driver/driver-core-remove-fields-from-struct-bus_type.patch index 285c3ec401dc29..4fda6d04c8ce56 100644 --- a/driver/driver-core-remove-fields-from-struct-bus_type.patch +++ b/driver/driver-core-remove-fields-from-struct-bus_type.patch @@ -403,7 +403,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -768,7 +768,7 @@ int device_add(struct device *dev) +@@ -766,7 +766,7 @@ int device_add(struct device *dev) /* notify clients of device entry (new way) */ if (dev->bus) @@ -412,7 +412,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> BUS_NOTIFY_ADD_DEVICE, dev); error = device_create_file(dev, &uevent_attr); -@@ -819,7 +819,7 @@ int device_add(struct device *dev) +@@ -817,7 +817,7 @@ int device_add(struct device *dev) dpm_sysfs_remove(dev); PMError: if (dev->bus) @@ -421,7 +421,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> BUS_NOTIFY_DEL_DEVICE, dev); device_remove_attrs(dev); AttrsError: -@@ -997,7 +997,7 @@ void device_del(struct device * dev) +@@ -995,7 +995,7 @@ void device_del(struct device * dev) if (platform_notify_remove) platform_notify_remove(dev); if (dev->bus) diff --git a/driver/kobject-convert-block-elevator.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-block-elevator.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..6bf42d87ddc99c --- /dev/null +++ b/driver/kobject-convert-block-elevator.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,41 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert block/elevator.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Jens Axboe <axboe@kernel.dk> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + block/elevator.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- a/block/elevator.c ++++ b/block/elevator.c +@@ -185,9 +185,7 @@ static elevator_t *elevator_alloc(struct + + eq->ops = &e->ops; + eq->elevator_type = e; +- kobject_init(&eq->kobj); +- kobject_set_name(&eq->kobj, "%s", "iosched"); +- eq->kobj.ktype = &elv_ktype; ++ kobject_init_ng(&eq->kobj, &elv_ktype); + mutex_init(&eq->sysfs_lock); + + eq->hash = kmalloc_node(sizeof(struct hlist_head) * ELV_HASH_ENTRIES, +@@ -931,9 +929,7 @@ int elv_register_queue(struct request_qu + elevator_t *e = q->elevator; + int error; + +- e->kobj.parent = &q->kobj; +- +- error = kobject_add(&e->kobj); ++ error = kobject_add_ng(&e->kobj, &q->kobj, "%s", "iosched"); + if (!error) { + struct elv_fs_entry *attr = e->elevator_type->elevator_attrs; + if (attr) { diff --git a/driver/kobject-convert-block-ll_rw_blk.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-block-ll_rw_blk.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..63af40cf5e4140 --- /dev/null +++ b/driver/kobject-convert-block-ll_rw_blk.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,41 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert block/ll_rw_blk.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Jens Axboe <axboe@kernel.dk> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + block/ll_rw_blk.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/block/ll_rw_blk.c ++++ b/block/ll_rw_blk.c +@@ -1862,9 +1862,7 @@ struct request_queue *blk_alloc_queue_no + + init_timer(&q->unplug_timer); + +- kobject_set_name(&q->kobj, "%s", "queue"); +- q->kobj.ktype = &queue_ktype; +- kobject_init(&q->kobj); ++ kobject_init_ng(&q->kobj, &queue_ktype); + + mutex_init(&q->sysfs_lock); + +@@ -4182,9 +4180,8 @@ int blk_register_queue(struct gendisk *d + if (!q || !q->request_fn) + return -ENXIO; + +- q->kobj.parent = kobject_get(&disk->dev.kobj); +- +- ret = kobject_add(&q->kobj); ++ ret = kobject_add_ng(&q->kobj, kobject_get(&disk->dev.kobj), ++ "%s", "queue"); + if (ret < 0) + return ret; + diff --git a/driver/kobject-convert-drivers-base-class.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-drivers-base-class.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..9640f9aab5c469 --- /dev/null +++ b/driver/kobject-convert-drivers-base-class.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,46 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert drivers/base/class.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/base/class.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/drivers/base/class.c ++++ b/drivers/base/class.c +@@ -546,8 +546,7 @@ static struct class_device_attribute cla + void class_device_initialize(struct class_device *class_dev) + { + class_dev->kobj.kset = &class_obj_subsys; +- class_dev->kobj.ktype = &class_device_ktype; +- kobject_init(&class_dev->kobj); ++ kobject_init_ng(&class_dev->kobj, &class_device_ktype); + INIT_LIST_HEAD(&class_dev->node); + } + +@@ -575,16 +574,13 @@ int class_device_add(struct class_device + class_dev->class_id); + + /* first, register with generic layer. */ +- error = kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id); +- if (error) +- goto out2; +- + if (parent_class_dev) + class_dev->kobj.parent = &parent_class_dev->kobj; + else + class_dev->kobj.parent = &parent_class->subsys.kobj; + +- error = kobject_add(&class_dev->kobj); ++ error = kobject_add_ng(&class_dev->kobj, class_dev->kobj.parent, ++ "%s", class_dev->class_id); + if (error) + goto out2; + diff --git a/driver/kobject-convert-drivers-base-core.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-drivers-base-core.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..026c5fb92ca496 --- /dev/null +++ b/driver/kobject-convert-drivers-base-core.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,46 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert drivers/base/core.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/base/core.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -523,8 +523,7 @@ static void klist_children_put(struct kl + void device_initialize(struct device *dev) + { + dev->kobj.kset = devices_kset; +- dev->kobj.ktype = &device_ktype; +- kobject_init(&dev->kobj); ++ kobject_init_ng(&dev->kobj, &device_ktype); + klist_init(&dev->klist_children, klist_children_get, + klist_children_put); + INIT_LIST_HEAD(&dev->dma_pools); +@@ -729,7 +728,7 @@ static void device_remove_class_symlinks + * This is part 2 of device_register(), though may be called + * separately _iff_ device_initialize() has been called separately. + * +- * This adds it to the kobject hierarchy via kobject_add(), adds it ++ * This adds it to the kobject hierarchy via kobject_add_ng(), adds it + * to the global and sibling lists for the device, then + * adds it to the other relevant subsystems of the driver model. + */ +@@ -757,8 +756,7 @@ int device_add(struct device *dev) + goto Error; + + /* first, register with generic layer. */ +- kobject_set_name(&dev->kobj, "%s", dev->bus_id); +- error = kobject_add(&dev->kobj); ++ error = kobject_add_ng(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); + if (error) + goto Error; + diff --git a/driver/kobject-convert-drivers-md-md.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-drivers-md-md.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..98e1992d1e94d3 --- /dev/null +++ b/driver/kobject-convert-drivers-md-md.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,49 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert drivers/md/md.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Neil Brown <neilb@suse.de> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/md/md.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -1383,16 +1383,13 @@ static int bind_rdev_to_array(mdk_rdev_t + return -EBUSY; + } + bdevname(rdev->bdev,b); +- if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0) +- return -ENOMEM; +- while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) ++ while ( (s=strchr(b, '/')) != NULL) + *s = '!'; +- ++ + rdev->mddev = mddev; + printk(KERN_INFO "md: bind<%s>\n", b); + +- rdev->kobj.parent = &mddev->kobj; +- if ((err = kobject_add(&rdev->kobj))) ++ if ((err = kobject_add_ng(&rdev->kobj, &mddev->kobj, "dev-%s", b))) + goto fail; + + if (rdev->bdev->bd_part) +@@ -2036,9 +2033,7 @@ static mdk_rdev_t *md_import_device(dev_ + if (err) + goto abort_free; + +- rdev->kobj.parent = NULL; +- rdev->kobj.ktype = &rdev_ktype; +- kobject_init(&rdev->kobj); ++ kobject_init_ng(&rdev->kobj, &rdev_ktype); + + rdev->desc_nr = -1; + rdev->saved_raid_disk = -1; diff --git a/driver/kobject-convert-drivers-net-iseries_veth.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-drivers-net-iseries_veth.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..0d73268b6629c8 --- /dev/null +++ b/driver/kobject-convert-drivers-net-iseries_veth.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,58 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert drivers/net/iseries_veth.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kyle A. Lucke <klucke@us.ibm.com> +Cc: David Gibson <dwg@au1.ibm.com> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/net/iseries_veth.c | 17 +++++------------ + 1 file changed, 5 insertions(+), 12 deletions(-) + +--- a/drivers/net/iseries_veth.c ++++ b/drivers/net/iseries_veth.c +@@ -844,11 +844,7 @@ static int veth_init_connection(u8 rlp) + + /* This gets us 1 reference, which is held on behalf of the driver + * infrastructure. It's released at module unload. */ +- kobject_init(&cnx->kobject); +- cnx->kobject.ktype = &veth_lpar_connection_ktype; +- rc = kobject_set_name(&cnx->kobject, "cnx%.2d", rlp); +- if (rc != 0) +- return rc; ++ kobject_init_ng(&cnx->kobject, &veth_lpar_connection_ktype); + + msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); + if (! msgs) { +@@ -1087,11 +1083,8 @@ static struct net_device * __init veth_p + return NULL; + } + +- kobject_init(&port->kobject); +- port->kobject.parent = &dev->dev.kobj; +- port->kobject.ktype = &veth_port_ktype; +- kobject_set_name(&port->kobject, "veth_port"); +- if (0 != kobject_add(&port->kobject)) ++ kobject_init_ng(&port->kobject, &veth_port_ktypeq); ++ if (0 != kobject_add_ng(&port->kobject, &dev->dev.kobj, "veth_port")) + veth_error("Failed adding port for %s to sysfs.\n", dev->name); + + veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", +@@ -1711,9 +1704,9 @@ static int __init veth_module_init(void) + continue; + + kobj = &veth_cnx[i]->kobject; +- kobj->parent = &veth_driver.driver.kobj; + /* If the add failes, complain but otherwise continue */ +- if (0 != kobject_add(kobj)) ++ if (0 != kobject_add_ng(kobj, &veth_driver.driver.kobj, ++ "cnx%.2d", veth_cnx[i]->remote_lp)) + veth_error("cnx %d: Failed adding to sysfs.\n", i); + } + diff --git a/driver/kobject-convert-fs-char_dev.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-fs-char_dev.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..ba55ccbe0f0c85 --- /dev/null +++ b/driver/kobject-convert-fs-char_dev.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,38 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert fs/char_dev.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + fs/char_dev.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/fs/char_dev.c ++++ b/fs/char_dev.c +@@ -510,9 +510,8 @@ struct cdev *cdev_alloc(void) + { + struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); + if (p) { +- p->kobj.ktype = &ktype_cdev_dynamic; + INIT_LIST_HEAD(&p->list); +- kobject_init(&p->kobj); ++ kobject_init_ng(&p->kobj, &ktype_cdev_dynamic); + } + return p; + } +@@ -529,8 +528,7 @@ void cdev_init(struct cdev *cdev, const + { + memset(cdev, 0, sizeof *cdev); + INIT_LIST_HEAD(&cdev->list); +- cdev->kobj.ktype = &ktype_cdev_default; +- kobject_init(&cdev->kobj); ++ kobject_init_ng(&cdev->kobj, &ktype_cdev_default); + cdev->ops = fops; + } + diff --git a/driver/kobject-convert-kernel-module.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-kernel-module.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..69caafff33fdc8 --- /dev/null +++ b/driver/kobject-convert-kernel-module.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,42 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert kernel/module.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + kernel/module.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -1217,18 +1217,16 @@ int mod_sysfs_init(struct module *mod) + err = -EINVAL; + goto out; + } +- memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); +- err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name); +- if (err) +- goto out; +- mod->mkobj.kobj.kset = module_kset; +- mod->mkobj.kobj.ktype = &module_ktype; + mod->mkobj.mod = mod; + +- kobject_init(&mod->mkobj.kobj); ++ memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); ++ mod->mkobj.kobj.kset = module_kset; ++ err = kobject_init_and_add(&mod->mkobj.kobj, &module_ktype, NULL, ++ "%s", mod->name); ++ if (err) ++ kobject_put(&mod->mkobj.kobj); + + /* delay uevent until full sysfs population */ +- err = kobject_add(&mod->mkobj.kobj); + out: + return err; + } diff --git a/driver/kobject-convert-kernel-params.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-kernel-params.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..9a3a224ca5bc30 --- /dev/null +++ b/driver/kobject-convert-kernel-params.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,31 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert kernel/params.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + kernel/params.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/kernel/params.c ++++ b/kernel/params.c +@@ -561,11 +561,9 @@ static void __init kernel_param_sysfs_se + + mk->mod = THIS_MODULE; + mk->kobj.kset = module_kset; +- mk->kobj.ktype = &module_ktype; +- kobject_set_name(&mk->kobj, name); +- kobject_init(&mk->kobj); +- ret = kobject_add(&mk->kobj); ++ ret = kobject_init_and_add(&mk->kobj, &module_ktype, NULL, "%s", name); + if (ret) { ++ kobject_put(&mk->kobj); + printk(KERN_ERR "Module '%s' failed to be added to sysfs, " + "error number %d\n", name, ret); + printk(KERN_ERR "The system will be unstable now.\n"); diff --git a/driver/kobject-convert-kernel-user.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-kernel-user.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..27395574ff3d97 --- /dev/null +++ b/driver/kobject-convert-kernel-user.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,35 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert kernel/user.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + kernel/user.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/kernel/user.c ++++ b/kernel/user.c +@@ -181,13 +181,12 @@ static int uids_user_create(struct user_ + int error; + + memset(kobj, 0, sizeof(struct kobject)); +- kobj->ktype = &uids_ktype; + kobj->kset = uids_kset; +- kobject_init(kobj); +- kobject_set_name(&up->kobj, "%d", up->uid); +- error = kobject_add(kobj); +- if (error) ++ error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid); ++ if (error) { ++ kobject_put(kobj); + goto done; ++ } + + kobject_uevent(kobj, KOBJ_ADD); + done: diff --git a/driver/kobject-convert-mm-slub.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-mm-slub.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..72a46053429f0d --- /dev/null +++ b/driver/kobject-convert-mm-slub.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,36 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert mm/slub.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Christoph Lameter <clameter@sgi.com> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + mm/slub.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -4028,13 +4028,12 @@ static int sysfs_slab_add(struct kmem_ca + name = create_unique_id(s); + } + +- kobject_set_name(&s->kobj, name); + s->kobj.kset = slab_kset; +- s->kobj.ktype = &slab_ktype; +- kobject_init(&s->kobj); +- err = kobject_add(&s->kobj); +- if (err) ++ err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, name); ++ if (err) { ++ kobject_put(&s->kobj); + return err; ++ } + + err = sysfs_create_group(&s->kobj, &slab_attr_group); + if (err) diff --git a/driver/kobject-convert-net-bridge-br_if.c-to-use-kobject_init-add_ng.patch b/driver/kobject-convert-net-bridge-br_if.c-to-use-kobject_init-add_ng.patch new file mode 100644 index 00000000000000..29e90d442607d6 --- /dev/null +++ b/driver/kobject-convert-net-bridge-br_if.c-to-use-kobject_init-add_ng.patch @@ -0,0 +1,49 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: convert net/bridge/br_if.c to use kobject_init/add_ng() + +This converts the code to use the new kobject functions, cleaning up the +logic in doing so. + +Cc: Stephen Hemminger <shemminger@linux-foundation.org> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + net/bridge/br_if.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +--- a/net/bridge/br_if.c ++++ b/net/bridge/br_if.c +@@ -258,12 +258,6 @@ static struct net_bridge_port *new_nbp(s + p->state = BR_STATE_DISABLED; + br_stp_port_timer_init(p); + +- kobject_init(&p->kobj); +- kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); +- p->kobj.ktype = &brport_ktype; +- p->kobj.parent = &(dev->dev.kobj); +- p->kobj.kset = NULL; +- + return p; + } + +@@ -379,7 +373,8 @@ int br_add_if(struct net_bridge *br, str + if (IS_ERR(p)) + return PTR_ERR(p); + +- err = kobject_add(&p->kobj); ++ err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), ++ SYSFS_BRIDGE_PORT_ATTR); + if (err) + goto err0; + +@@ -416,6 +411,7 @@ err2: + br_fdb_delete_by_port(br, p, 1); + err1: + kobject_del(&p->kobj); ++ return err; + err0: + kobject_put(&p->kobj); + return err; diff --git a/driver/kobject-remove-kobject_add-as-no-one-uses-it-anymore.patch b/driver/kobject-remove-kobject_add-as-no-one-uses-it-anymore.patch new file mode 100644 index 00000000000000..3a4d0bcc63e308 --- /dev/null +++ b/driver/kobject-remove-kobject_add-as-no-one-uses-it-anymore.patch @@ -0,0 +1,97 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: remove kobject_add() as no one uses it anymore + +The old kobject_add() function is on longer in use, so let us remove it +from the public scope (kset mess in the kobject.c file still uses it, +but that can be cleaned up later very simply.) + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + include/linux/kobject.h | 1 - + lib/kobject.c | 22 ++++++++-------------- + 2 files changed, 8 insertions(+), 15 deletions(-) + +--- a/include/linux/kobject.h ++++ b/include/linux/kobject.h +@@ -80,7 +80,6 @@ static inline const char * kobject_name( + + extern void kobject_init(struct kobject *); + extern void kobject_init_ng(struct kobject *kobj, struct kobj_type *ktype); +-extern int __must_check kobject_add(struct kobject *); + extern int __must_check kobject_add_ng(struct kobject *kobj, + struct kobject *parent, + const char *fmt, ...); +--- a/lib/kobject.c ++++ b/lib/kobject.c +@@ -144,7 +144,7 @@ void kobject_init(struct kobject * kobj) + * Remove the kobject from the kset list and decrement + * its parent's refcount. + * This is separated out, so we can use it in both +- * kobject_del() and kobject_add() on error. ++ * kobject_del() and kobject_add_internal() on error. + */ + + static void unlink(struct kobject * kobj) +@@ -161,12 +161,7 @@ static void unlink(struct kobject * kobj + kobject_put(parent); + } + +-/** +- * kobject_add - add an object to the hierarchy. +- * @kobj: object. +- */ +- +-int kobject_add(struct kobject * kobj) ++static int kobject_add_internal(struct kobject *kobj) + { + int error = 0; + struct kobject * parent; +@@ -215,13 +210,13 @@ int kobject_add(struct kobject * kobj) + + /* be noisy on error issues */ + if (error == -EEXIST) +- printk(KERN_ERR "kobject_add failed for %s with " ++ printk(KERN_ERR "%s failed for %s with " + "-EEXIST, don't try to register things with " + "the same name in the same directory.\n", +- kobject_name(kobj)); ++ __FUNCTION__, kobject_name(kobj)); + else +- printk(KERN_ERR "kobject_add failed for %s (%d)\n", +- kobject_name(kobj), error); ++ printk(KERN_ERR "%s failed for %s (%d)\n", ++ __FUNCTION__, kobject_name(kobj), error); + dump_stack(); + } + +@@ -351,7 +346,7 @@ static int kobject_add_varg(struct kobje + return retval; + } + kobj->parent = parent; +- return kobject_add(kobj); ++ return kobject_add_internal(kobj); + } + + /** +@@ -742,7 +737,7 @@ struct sysfs_ops kobj_sysfs_ops = { + + int kset_add(struct kset * k) + { +- return kobject_add(&k->kobj); ++ return kobject_add_internal(&k->kobj); + } + + +@@ -897,7 +892,6 @@ EXPORT_SYMBOL(kobject_register); + EXPORT_SYMBOL(kobject_unregister); + EXPORT_SYMBOL(kobject_get); + EXPORT_SYMBOL(kobject_put); +-EXPORT_SYMBOL(kobject_add); + EXPORT_SYMBOL(kobject_del); + + EXPORT_SYMBOL(kset_register); diff --git a/driver/kobject-remove-kobject_init-as-no-one-uses-it-anymore.patch b/driver/kobject-remove-kobject_init-as-no-one-uses-it-anymore.patch new file mode 100644 index 00000000000000..2870f8e497a1e3 --- /dev/null +++ b/driver/kobject-remove-kobject_init-as-no-one-uses-it-anymore.patch @@ -0,0 +1,69 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: remove kobject_init() as no one uses it anymore + +The old kobject_init() function is on longer in use, so let us remove it +from the public scope (kset mess in the kobject.c file still uses it, +but that can be cleaned up later very simply.) + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + include/linux/kobject.h | 1 - + lib/kobject.c | 11 +++-------- + 2 files changed, 3 insertions(+), 9 deletions(-) + +--- a/include/linux/kobject.h ++++ b/include/linux/kobject.h +@@ -78,7 +78,6 @@ static inline const char * kobject_name( + return kobj->k_name; + } + +-extern void kobject_init(struct kobject *); + extern void kobject_init_ng(struct kobject *kobj, struct kobj_type *ktype); + extern int __must_check kobject_add(struct kobject *kobj, + struct kobject *parent, +--- a/lib/kobject.c ++++ b/lib/kobject.c +@@ -124,11 +124,7 @@ char *kobject_get_path(struct kobject *k + } + EXPORT_SYMBOL_GPL(kobject_get_path); + +-/** +- * kobject_init - initialize object. +- * @kobj: object in question. +- */ +-void kobject_init(struct kobject * kobj) ++static void kobject_init_internal(struct kobject * kobj) + { + if (!kobj) + return; +@@ -232,7 +228,7 @@ int kobject_register(struct kobject * ko + { + int error = -EINVAL; + if (kobj) { +- kobject_init(kobj); ++ kobject_init_internal(kobj); + error = kobject_add(kobj); + if (!error) + kobject_uevent(kobj, KOBJ_ADD); +@@ -695,7 +691,7 @@ EXPORT_SYMBOL_GPL(kobject_create_and_add + + void kset_init(struct kset * k) + { +- kobject_init(&k->kobj); ++ kobject_init_internal(&k->kobj); + INIT_LIST_HEAD(&k->list); + spin_lock_init(&k->list_lock); + } +@@ -887,7 +883,6 @@ struct kset *kset_create_and_add(const c + } + EXPORT_SYMBOL_GPL(kset_create_and_add); + +-EXPORT_SYMBOL(kobject_init); + EXPORT_SYMBOL(kobject_register); + EXPORT_SYMBOL(kobject_unregister); + EXPORT_SYMBOL(kobject_get); diff --git a/driver/kobject-rename-kobject_add_ng-to-kobject_add.patch b/driver/kobject-rename-kobject_add_ng-to-kobject_add.patch new file mode 100644 index 00000000000000..28310d25978f51 --- /dev/null +++ b/driver/kobject-rename-kobject_add_ng-to-kobject_add.patch @@ -0,0 +1,200 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: rename kobject_add_ng() to kobject_add() + +Now that the old kobject_add() function is gone, rename kobject_add_ng() +to kobject_add() to clean up the namespace. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + block/elevator.c | 2 +- + block/ll_rw_blk.c | 4 ++-- + drivers/base/class.c | 4 ++-- + drivers/base/core.c | 6 +++--- + drivers/md/md.c | 2 +- + drivers/net/iseries_veth.c | 6 +++--- + drivers/uio/uio.c | 2 +- + include/linux/kobject.h | 6 +++--- + lib/kobject.c | 14 +++++++------- + 9 files changed, 23 insertions(+), 23 deletions(-) + +--- a/block/elevator.c ++++ b/block/elevator.c +@@ -929,7 +929,7 @@ int elv_register_queue(struct request_qu + elevator_t *e = q->elevator; + int error; + +- error = kobject_add_ng(&e->kobj, &q->kobj, "%s", "iosched"); ++ error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched"); + if (!error) { + struct elv_fs_entry *attr = e->elevator_type->elevator_attrs; + if (attr) { +--- a/block/ll_rw_blk.c ++++ b/block/ll_rw_blk.c +@@ -4180,8 +4180,8 @@ int blk_register_queue(struct gendisk *d + if (!q || !q->request_fn) + return -ENXIO; + +- ret = kobject_add_ng(&q->kobj, kobject_get(&disk->dev.kobj), +- "%s", "queue"); ++ ret = kobject_add(&q->kobj, kobject_get(&disk->dev.kobj), ++ "%s", "queue"); + if (ret < 0) + return ret; + +--- a/drivers/base/class.c ++++ b/drivers/base/class.c +@@ -586,8 +586,8 @@ int class_device_add(struct class_device + else + class_dev->kobj.parent = &parent_class->subsys.kobj; + +- error = kobject_add_ng(&class_dev->kobj, class_dev->kobj.parent, +- "%s", class_dev->class_id); ++ error = kobject_add(&class_dev->kobj, class_dev->kobj.parent, ++ "%s", class_dev->class_id); + if (error) + goto out2; + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -602,7 +602,7 @@ static struct kobject *get_device_parent + if (!k) + return NULL; + k->kset = &dev->class->class_dirs; +- retval = kobject_add_ng(k, parent_kobj, "%s", dev->class->name); ++ retval = kobject_add(k, parent_kobj, "%s", dev->class->name); + if (retval < 0) { + kobject_put(k); + return NULL; +@@ -776,7 +776,7 @@ static void device_remove_class_symlinks + * This is part 2 of device_register(), though may be called + * separately _iff_ device_initialize() has been called separately. + * +- * This adds it to the kobject hierarchy via kobject_add_ng(), adds it ++ * This adds it to the kobject hierarchy via kobject_add(), adds it + * to the global and sibling lists for the device, then + * adds it to the other relevant subsystems of the driver model. + */ +@@ -804,7 +804,7 @@ int device_add(struct device *dev) + goto Error; + + /* first, register with generic layer. */ +- error = kobject_add_ng(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); ++ error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); + if (error) + goto Error; + +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -1389,7 +1389,7 @@ static int bind_rdev_to_array(mdk_rdev_t + rdev->mddev = mddev; + printk(KERN_INFO "md: bind<%s>\n", b); + +- if ((err = kobject_add_ng(&rdev->kobj, &mddev->kobj, "dev-%s", b))) ++ if ((err = kobject_add(&rdev->kobj, &mddev->kobj, "dev-%s", b))) + goto fail; + + if (rdev->bdev->bd_part) +--- a/drivers/net/iseries_veth.c ++++ b/drivers/net/iseries_veth.c +@@ -1084,7 +1084,7 @@ static struct net_device * __init veth_p + } + + kobject_init_ng(&port->kobject, &veth_port_ktypeq); +- if (0 != kobject_add_ng(&port->kobject, &dev->dev.kobj, "veth_port")) ++ if (0 != kobject_add(&port->kobject, &dev->dev.kobj, "veth_port")) + veth_error("Failed adding port for %s to sysfs.\n", dev->name); + + veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", +@@ -1705,8 +1705,8 @@ static int __init veth_module_init(void) + + kobj = &veth_cnx[i]->kobject; + /* If the add failes, complain but otherwise continue */ +- if (0 != kobject_add_ng(kobj, &veth_driver.driver.kobj, +- "cnx%.2d", veth_cnx[i]->remote_lp)) ++ if (0 != kobject_add(kobj, &veth_driver.driver.kobj, ++ "cnx%.2d", veth_cnx[i]->remote_lp)) + veth_error("cnx %d: Failed adding to sysfs.\n", i); + } + +--- a/drivers/uio/uio.c ++++ b/drivers/uio/uio.c +@@ -172,7 +172,7 @@ static int uio_dev_add_attributes(struct + kobject_init_ng(&map->kobj, &map_attr_type); + map->mem = mem; + mem->map = map; +- ret = kobject_add_ng(&map->kobj, idev->map_dir, "map%d", mi); ++ ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi); + if (ret) + goto err; + ret = kobject_uevent(&map->kobj, KOBJ_ADD); +--- a/include/linux/kobject.h ++++ b/include/linux/kobject.h +@@ -80,9 +80,9 @@ static inline const char * kobject_name( + + extern void kobject_init(struct kobject *); + extern void kobject_init_ng(struct kobject *kobj, struct kobj_type *ktype); +-extern int __must_check kobject_add_ng(struct kobject *kobj, +- struct kobject *parent, +- const char *fmt, ...); ++extern int __must_check kobject_add(struct kobject *kobj, ++ struct kobject *parent, ++ const char *fmt, ...); + extern int __must_check kobject_init_and_add(struct kobject *kobj, + struct kobj_type *ktype, + struct kobject *parent, +--- a/lib/kobject.c ++++ b/lib/kobject.c +@@ -350,7 +350,7 @@ static int kobject_add_varg(struct kobje + } + + /** +- * kobject_add_ng - the main kobject add function ++ * kobject_add - the main kobject add function + * @kobj: the kobject to add + * @parent: pointer to the parent of the kobject. + * @fmt: format to name the kobject with. +@@ -381,8 +381,8 @@ static int kobject_add_varg(struct kobje + * kobject_uevent() with the UEVENT_ADD parameter to ensure that + * userspace is properly notified of this kobject's creation. + */ +-int kobject_add_ng(struct kobject *kobj, struct kobject *parent, +- const char *fmt, ...) ++int kobject_add(struct kobject *kobj, struct kobject *parent, ++ const char *fmt, ...) + { + va_list args; + int retval; +@@ -396,7 +396,7 @@ int kobject_add_ng(struct kobject *kobj, + + return retval; + } +-EXPORT_SYMBOL(kobject_add_ng); ++EXPORT_SYMBOL(kobject_add); + + /** + * kobject_init_and_add - initialize a kobject structure and add it to the kobject hierarchy +@@ -406,8 +406,8 @@ EXPORT_SYMBOL(kobject_add_ng); + * @fmt: the name of the kobject. + * + * This function combines the call to kobject_init_ng() and +- * kobject_add_ng(). The same type of error handling after a call to +- * kobject_add_ng() and kobject lifetime rules are the same here. ++ * kobject_add(). The same type of error handling after a call to ++ * kobject_add() and kobject lifetime rules are the same here. + */ + int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, + struct kobject *parent, const char *fmt, ...) +@@ -677,7 +677,7 @@ struct kobject *kobject_create_and_add(c + if (!kobj) + return NULL; + +- retval = kobject_add_ng(kobj, parent, "%s", name); ++ retval = kobject_add(kobj, parent, "%s", name); + if (retval) { + printk(KERN_WARNING "%s: kobject_add error: %d\n", + __FUNCTION__, retval); diff --git a/driver/kobject-rename-kobject_init_ng-to-kobject_init.patch b/driver/kobject-rename-kobject_init_ng-to-kobject_init.patch new file mode 100644 index 00000000000000..088f9633fd448e --- /dev/null +++ b/driver/kobject-rename-kobject_init_ng-to-kobject_init.patch @@ -0,0 +1,207 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: rename kobject_init_ng() to kobject_init() + +Now that the old kobject_init() function is gone, rename +kobject_init_ng() to kobject_init() to clean up the namespace. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + block/elevator.c | 2 +- + block/ll_rw_blk.c | 2 +- + drivers/base/class.c | 2 +- + drivers/base/core.c | 2 +- + drivers/md/md.c | 2 +- + drivers/net/iseries_veth.c | 4 ++-- + drivers/uio/uio.c | 2 +- + fs/char_dev.c | 4 ++-- + include/linux/kobject.h | 2 +- + lib/kobject.c | 14 +++++++------- + 10 files changed, 18 insertions(+), 18 deletions(-) + +--- a/block/elevator.c ++++ b/block/elevator.c +@@ -185,7 +185,7 @@ static elevator_t *elevator_alloc(struct + + eq->ops = &e->ops; + eq->elevator_type = e; +- kobject_init_ng(&eq->kobj, &elv_ktype); ++ kobject_init(&eq->kobj, &elv_ktype); + mutex_init(&eq->sysfs_lock); + + eq->hash = kmalloc_node(sizeof(struct hlist_head) * ELV_HASH_ENTRIES, +--- a/block/ll_rw_blk.c ++++ b/block/ll_rw_blk.c +@@ -1862,7 +1862,7 @@ struct request_queue *blk_alloc_queue_no + + init_timer(&q->unplug_timer); + +- kobject_init_ng(&q->kobj, &queue_ktype); ++ kobject_init(&q->kobj, &queue_ktype); + + mutex_init(&q->sysfs_lock); + +--- a/drivers/base/class.c ++++ b/drivers/base/class.c +@@ -553,7 +553,7 @@ static struct class_device_attribute cla + void class_device_initialize(struct class_device *class_dev) + { + class_dev->kobj.kset = &class_obj_subsys; +- kobject_init_ng(&class_dev->kobj, &class_device_ktype); ++ kobject_init(&class_dev->kobj, &class_device_ktype); + INIT_LIST_HEAD(&class_dev->node); + } + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -525,7 +525,7 @@ static void klist_children_put(struct kl + void device_initialize(struct device *dev) + { + dev->kobj.kset = devices_kset; +- kobject_init_ng(&dev->kobj, &device_ktype); ++ kobject_init(&dev->kobj, &device_ktype); + klist_init(&dev->klist_children, klist_children_get, + klist_children_put); + INIT_LIST_HEAD(&dev->dma_pools); +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -2033,7 +2033,7 @@ static mdk_rdev_t *md_import_device(dev_ + if (err) + goto abort_free; + +- kobject_init_ng(&rdev->kobj, &rdev_ktype); ++ kobject_init(&rdev->kobj, &rdev_ktype); + + rdev->desc_nr = -1; + rdev->saved_raid_disk = -1; +--- a/drivers/net/iseries_veth.c ++++ b/drivers/net/iseries_veth.c +@@ -844,7 +844,7 @@ static int veth_init_connection(u8 rlp) + + /* This gets us 1 reference, which is held on behalf of the driver + * infrastructure. It's released at module unload. */ +- kobject_init_ng(&cnx->kobject, &veth_lpar_connection_ktype); ++ kobject_init(&cnx->kobject, &veth_lpar_connection_ktype); + + msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); + if (! msgs) { +@@ -1083,7 +1083,7 @@ static struct net_device * __init veth_p + return NULL; + } + +- kobject_init_ng(&port->kobject, &veth_port_ktypeq); ++ kobject_init(&port->kobject, &veth_port_ktypeq); + if (0 != kobject_add(&port->kobject, &dev->dev.kobj, "veth_port")) + veth_error("Failed adding port for %s to sysfs.\n", dev->name); + +--- a/drivers/uio/uio.c ++++ b/drivers/uio/uio.c +@@ -169,7 +169,7 @@ static int uio_dev_add_attributes(struct + map = kzalloc(sizeof(*map), GFP_KERNEL); + if (!map) + goto err; +- kobject_init_ng(&map->kobj, &map_attr_type); ++ kobject_init(&map->kobj, &map_attr_type); + map->mem = mem; + mem->map = map; + ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi); +--- a/fs/char_dev.c ++++ b/fs/char_dev.c +@@ -511,7 +511,7 @@ struct cdev *cdev_alloc(void) + struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); + if (p) { + INIT_LIST_HEAD(&p->list); +- kobject_init_ng(&p->kobj, &ktype_cdev_dynamic); ++ kobject_init(&p->kobj, &ktype_cdev_dynamic); + } + return p; + } +@@ -528,7 +528,7 @@ void cdev_init(struct cdev *cdev, const + { + memset(cdev, 0, sizeof *cdev); + INIT_LIST_HEAD(&cdev->list); +- kobject_init_ng(&cdev->kobj, &ktype_cdev_default); ++ kobject_init(&cdev->kobj, &ktype_cdev_default); + cdev->ops = fops; + } + +--- a/include/linux/kobject.h ++++ b/include/linux/kobject.h +@@ -78,7 +78,7 @@ static inline const char * kobject_name( + return kobj->k_name; + } + +-extern void kobject_init_ng(struct kobject *kobj, struct kobj_type *ktype); ++extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); + extern int __must_check kobject_add(struct kobject *kobj, + struct kobject *parent, + const char *fmt, ...); +--- a/lib/kobject.c ++++ b/lib/kobject.c +@@ -287,7 +287,7 @@ int kobject_set_name(struct kobject *kob + EXPORT_SYMBOL(kobject_set_name); + + /** +- * kobject_init_ng - initialize a kobject structure ++ * kobject_init - initialize a kobject structure + * @kobj: pointer to the kobject to initialize + * @ktype: pointer to the ktype for this kobject. + * +@@ -298,7 +298,7 @@ EXPORT_SYMBOL(kobject_set_name); + * to kobject_put(), not by a call to kfree directly to ensure that all of + * the memory is cleaned up properly. + */ +-void kobject_init_ng(struct kobject *kobj, struct kobj_type *ktype) ++void kobject_init(struct kobject *kobj, struct kobj_type *ktype) + { + char *err_str; + +@@ -326,7 +326,7 @@ error: + printk(KERN_ERR "kobject: %s\n", err_str); + dump_stack(); + } +-EXPORT_SYMBOL(kobject_init_ng); ++EXPORT_SYMBOL(kobject_init); + + static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, + const char *fmt, va_list vargs) +@@ -401,7 +401,7 @@ EXPORT_SYMBOL(kobject_add); + * @parent: pointer to the parent of this kobject. + * @fmt: the name of the kobject. + * +- * This function combines the call to kobject_init_ng() and ++ * This function combines the call to kobject_init() and + * kobject_add(). The same type of error handling after a call to + * kobject_add() and kobject lifetime rules are the same here. + */ +@@ -411,7 +411,7 @@ int kobject_init_and_add(struct kobject + va_list args; + int retval; + +- kobject_init_ng(kobj, ktype); ++ kobject_init(kobj, ktype); + + va_start(args, fmt); + retval = kobject_add_varg(kobj, parent, fmt, args); +@@ -636,7 +636,7 @@ static struct kobj_type dynamic_kobj_kty + * + * If the kobject was not able to be created, NULL will be returned. + * The kobject structure returned from here must be cleaned up with a +- * call to kobject_put() and not kfree(), as kobject_init_ng() has ++ * call to kobject_put() and not kfree(), as kobject_init() has + * already been called on this structure. + */ + struct kobject *kobject_create(void) +@@ -647,7 +647,7 @@ struct kobject *kobject_create(void) + if (!kobj) + return NULL; + +- kobject_init_ng(kobj, &dynamic_kobj_ktype); ++ kobject_init(kobj, &dynamic_kobj_ktype); + return kobj; + } + diff --git a/driver/kobject-the-cris-iop_fw_load.c-code-is-broken.patch b/driver/kobject-the-cris-iop_fw_load.c-code-is-broken.patch new file mode 100644 index 00000000000000..f50a3ae1543a49 --- /dev/null +++ b/driver/kobject-the-cris-iop_fw_load.c-code-is-broken.patch @@ -0,0 +1,59 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Mon, 17 Dec 2007 23:05:35 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Kobject: the cris iop_fw_load.c code is broken + +This code is really really really broken. So much so that it's almost +impossible to fix with a simple patch, so just comment out the offending +registration with the kobject core, and mark the driver as broken. + +The problem is that the code is trying to register a "raw" struct +device, which is not allowed. struct device is only for use within the +driver model. This is being done to try to use the firmware layer which +wants a struct device. To properly fix this, use something easy, like a +platform device, which is a struct device and can be used for this kind +of thing. + +Cc: Mikael Starvik <starvik@axis.com> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + arch/cris/arch-v32/drivers/iop_fw_load.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/arch/cris/arch-v32/drivers/iop_fw_load.c ++++ b/arch/cris/arch-v32/drivers/iop_fw_load.c +@@ -20,6 +20,9 @@ + + #define IOP_TIMEOUT 100 + ++#error "This driver is broken with regard to its driver core usage." ++#error "Please contact <greg@kroah.com> for details on how to fix it properly." ++ + static struct device iop_spu_device[2] = { + { .bus_id = "iop-spu0", }, + { .bus_id = "iop-spu1", }, +@@ -192,6 +195,13 @@ int iop_start_mpu(unsigned int start_add + + static int __init iop_fw_load_init(void) + { ++#if 0 ++ /* ++ * static struct devices can not be added directly to sysfs by ignoring ++ * the driver model infrastructure. To fix this properly, please use ++ * the platform_bus to register these devices to be able to properly ++ * use the firmware infrastructure. ++ */ + device_initialize(&iop_spu_device[0]); + kobject_set_name(&iop_spu_device[0].kobj, "iop-spu0"); + kobject_add(&iop_spu_device[0].kobj); +@@ -201,6 +211,7 @@ static int __init iop_fw_load_init(void) + device_initialize(&iop_mpu_device); + kobject_set_name(&iop_mpu_device.kobj, "iop-mpu"); + kobject_add(&iop_mpu_device.kobj); ++#endif + return 0; + } + diff --git a/driver/kobject-warn.patch b/driver/kobject-warn.patch index c85932d876e9fc..638e437cb885be 100644 --- a/driver/kobject-warn.patch +++ b/driver/kobject-warn.patch @@ -25,7 +25,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/lib/kobject.c +++ b/lib/kobject.c -@@ -132,6 +132,7 @@ void kobject_init(struct kobject * kobj) +@@ -128,6 +128,7 @@ static void kobject_init_internal(struct { if (!kobj) return; @@ -33,7 +33,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> kref_init(&kobj->kref); INIT_LIST_HEAD(&kobj->entry); } -@@ -603,6 +604,10 @@ static void kobject_cleanup(struct kobje +@@ -594,6 +595,10 @@ static void kobject_cleanup(struct kobje * not a statically allocated kobject, so we should be safe to * free the name */ kfree(name); diff --git a/driver/warn-when-statically-allocated-kobjects-are-used.patch b/driver/warn-when-statically-allocated-kobjects-are-used.patch index 5e3c89e8c1257a..8a355f25a04893 100644 --- a/driver/warn-when-statically-allocated-kobjects-are-used.patch +++ b/driver/warn-when-statically-allocated-kobjects-are-used.patch @@ -32,8 +32,8 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- include/linux/init.h | 1 init/main.c | 9 ++++++++ - lib/kobject.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 64 insertions(+) + lib/kobject.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++- + 3 files changed, 65 insertions(+), 1 deletion(-) --- a/include/linux/init.h +++ b/include/linux/init.h @@ -80,7 +80,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /** * populate_dir - populate directory with attributes. -@@ -124,6 +126,57 @@ char *kobject_get_path(struct kobject *k +@@ -124,16 +126,67 @@ char *kobject_get_path(struct kobject *k } EXPORT_SYMBOL_GPL(kobject_get_path); @@ -135,14 +135,25 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +} +#endif + - /** - * kobject_init - initialize object. - * @kobj: object in question. -@@ -133,6 +186,7 @@ void kobject_init(struct kobject * kobj) + static void kobject_init_internal(struct kobject * kobj) + { if (!kobj) return; WARN_ON(atomic_read(&kobj->kref.refcount)); -+ verify_dynamic_kobject_allocation(kobj); kref_init(&kobj->kref); ++ verify_dynamic_kobject_allocation(kobj); INIT_LIST_HEAD(&kobj->entry); } + +- + /** + * unlink - remove kobject from kset list. + * @kobj: kobject. +@@ -317,6 +370,7 @@ void kobject_init(struct kobject *kobj, + "something is seriously wrong.\n"); + dump_stack(); + } ++ verify_dynamic_kobject_allocation(kobj); + + kref_init(&kobj->kref); + INIT_LIST_HEAD(&kobj->entry); diff --git a/f2.patch b/f2.patch deleted file mode 100644 index bf439988927737..00000000000000 --- a/f2.patch +++ /dev/null @@ -1,374 +0,0 @@ ---- - arch/cris/arch-v32/drivers/iop_fw_load.c | 11 +++++++++++ - block/elevator.c | 8 ++------ - block/ll_rw_blk.c | 9 +++------ - drivers/base/class.c | 10 +++------- - drivers/base/core.c | 8 +++----- - drivers/md/md.c | 13 ++++--------- - drivers/net/iseries_veth.c | 17 +++++------------ - fs/char_dev.c | 6 ++---- - kernel/module.c | 14 ++++++-------- - kernel/params.c | 6 ++---- - kernel/user.c | 9 ++++----- - mm/slub.c | 9 ++++----- - net/bridge/br_if.c | 10 +++------- - 13 files changed, 52 insertions(+), 78 deletions(-) - ---- a/arch/cris/arch-v32/drivers/iop_fw_load.c -+++ b/arch/cris/arch-v32/drivers/iop_fw_load.c -@@ -20,6 +20,9 @@ - - #define IOP_TIMEOUT 100 - -+#error "This driver is broken with regard to its driver core usage." -+#error "Please contact <greg@kroah.com> for details on how to fix it properly." -+ - static struct device iop_spu_device[2] = { - { .bus_id = "iop-spu0", }, - { .bus_id = "iop-spu1", }, -@@ -192,6 +195,13 @@ int iop_start_mpu(unsigned int start_add - - static int __init iop_fw_load_init(void) - { -+#if 0 -+ /* -+ * static struct devices can not be added directly to sysfs by ignoring -+ * the driver model infrastructure. To fix this properly, please use -+ * the platform_bus to register these devices to be able to properly -+ * use the firmware infrastructure. -+ */ - device_initialize(&iop_spu_device[0]); - kobject_set_name(&iop_spu_device[0].kobj, "iop-spu0"); - kobject_add(&iop_spu_device[0].kobj); -@@ -201,6 +211,7 @@ static int __init iop_fw_load_init(void) - device_initialize(&iop_mpu_device); - kobject_set_name(&iop_mpu_device.kobj, "iop-mpu"); - kobject_add(&iop_mpu_device.kobj); -+#endif - return 0; - } - ---- a/block/elevator.c -+++ b/block/elevator.c -@@ -185,9 +185,7 @@ static elevator_t *elevator_alloc(struct - - eq->ops = &e->ops; - eq->elevator_type = e; -- kobject_init(&eq->kobj); -- kobject_set_name(&eq->kobj, "%s", "iosched"); -- eq->kobj.ktype = &elv_ktype; -+ kobject_init_ng(&eq->kobj, &elv_ktype); - mutex_init(&eq->sysfs_lock); - - eq->hash = kmalloc_node(sizeof(struct hlist_head) * ELV_HASH_ENTRIES, -@@ -931,9 +929,7 @@ int elv_register_queue(struct request_qu - elevator_t *e = q->elevator; - int error; - -- e->kobj.parent = &q->kobj; -- -- error = kobject_add(&e->kobj); -+ error = kobject_add_ng(&e->kobj, &q->kobj, "%s", "iosched"); - if (!error) { - struct elv_fs_entry *attr = e->elevator_type->elevator_attrs; - if (attr) { ---- a/block/ll_rw_blk.c -+++ b/block/ll_rw_blk.c -@@ -1862,9 +1862,7 @@ struct request_queue *blk_alloc_queue_no - - init_timer(&q->unplug_timer); - -- kobject_set_name(&q->kobj, "%s", "queue"); -- q->kobj.ktype = &queue_ktype; -- kobject_init(&q->kobj); -+ kobject_init_ng(&q->kobj, &queue_ktype); - - mutex_init(&q->sysfs_lock); - -@@ -4182,9 +4180,8 @@ int blk_register_queue(struct gendisk *d - if (!q || !q->request_fn) - return -ENXIO; - -- q->kobj.parent = kobject_get(&disk->dev.kobj); -- -- ret = kobject_add(&q->kobj); -+ ret = kobject_add_ng(&q->kobj, kobject_get(&disk->dev.kobj), -+ "%s", "queue"); - if (ret < 0) - return ret; - ---- a/drivers/base/class.c -+++ b/drivers/base/class.c -@@ -553,8 +553,7 @@ static struct class_device_attribute cla - void class_device_initialize(struct class_device *class_dev) - { - class_dev->kobj.kset = &class_obj_subsys; -- class_dev->kobj.ktype = &class_device_ktype; -- kobject_init(&class_dev->kobj); -+ kobject_init_ng(&class_dev->kobj, &class_device_ktype); - INIT_LIST_HEAD(&class_dev->node); - } - -@@ -582,16 +581,13 @@ int class_device_add(struct class_device - class_dev->class_id); - - /* first, register with generic layer. */ -- error = kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id); -- if (error) -- goto out2; -- - if (parent_class_dev) - class_dev->kobj.parent = &parent_class_dev->kobj; - else - class_dev->kobj.parent = &parent_class->subsys.kobj; - -- error = kobject_add(&class_dev->kobj); -+ error = kobject_add_ng(&class_dev->kobj, class_dev->kobj.parent, -+ "%s", class_dev->class_id); - if (error) - goto out2; - ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -526,8 +526,7 @@ static void klist_children_put(struct kl - void device_initialize(struct device *dev) - { - dev->kobj.kset = devices_kset; -- dev->kobj.ktype = &device_ktype; -- kobject_init(&dev->kobj); -+ kobject_init_ng(&dev->kobj, &device_ktype); - klist_init(&dev->klist_children, klist_children_get, - klist_children_put); - INIT_LIST_HEAD(&dev->dma_pools); -@@ -778,7 +777,7 @@ static void device_remove_class_symlinks - * This is part 2 of device_register(), though may be called - * separately _iff_ device_initialize() has been called separately. - * -- * This adds it to the kobject hierarchy via kobject_add(), adds it -+ * This adds it to the kobject hierarchy via kobject_add_ng(), adds it - * to the global and sibling lists for the device, then - * adds it to the other relevant subsystems of the driver model. - */ -@@ -806,8 +805,7 @@ int device_add(struct device *dev) - goto Error; - - /* first, register with generic layer. */ -- kobject_set_name(&dev->kobj, "%s", dev->bus_id); -- error = kobject_add(&dev->kobj); -+ error = kobject_add_ng(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); - if (error) - goto Error; - ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -1383,16 +1383,13 @@ static int bind_rdev_to_array(mdk_rdev_t - return -EBUSY; - } - bdevname(rdev->bdev,b); -- if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0) -- return -ENOMEM; -- while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) -+ while ( (s=strchr(b, '/')) != NULL) - *s = '!'; -- -+ - rdev->mddev = mddev; - printk(KERN_INFO "md: bind<%s>\n", b); - -- rdev->kobj.parent = &mddev->kobj; -- if ((err = kobject_add(&rdev->kobj))) -+ if ((err = kobject_add_ng(&rdev->kobj, &mddev->kobj, "dev-%s", b))) - goto fail; - - if (rdev->bdev->bd_part) -@@ -2036,9 +2033,7 @@ static mdk_rdev_t *md_import_device(dev_ - if (err) - goto abort_free; - -- rdev->kobj.parent = NULL; -- rdev->kobj.ktype = &rdev_ktype; -- kobject_init(&rdev->kobj); -+ kobject_init_ng(&rdev->kobj, &rdev_ktype); - - rdev->desc_nr = -1; - rdev->saved_raid_disk = -1; ---- a/drivers/net/iseries_veth.c -+++ b/drivers/net/iseries_veth.c -@@ -844,11 +844,7 @@ static int veth_init_connection(u8 rlp) - - /* This gets us 1 reference, which is held on behalf of the driver - * infrastructure. It's released at module unload. */ -- kobject_init(&cnx->kobject); -- cnx->kobject.ktype = &veth_lpar_connection_ktype; -- rc = kobject_set_name(&cnx->kobject, "cnx%.2d", rlp); -- if (rc != 0) -- return rc; -+ kobject_init_ng(&cnx->kobject, &veth_lpar_connection_ktype); - - msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); - if (! msgs) { -@@ -1087,11 +1083,8 @@ static struct net_device * __init veth_p - return NULL; - } - -- kobject_init(&port->kobject); -- port->kobject.parent = &dev->dev.kobj; -- port->kobject.ktype = &veth_port_ktype; -- kobject_set_name(&port->kobject, "veth_port"); -- if (0 != kobject_add(&port->kobject)) -+ kobject_init_ng(&port->kobject, &veth_port_ktypeq); -+ if (0 != kobject_add_ng(&port->kobject, &dev->dev.kobj, "veth_port")) - veth_error("Failed adding port for %s to sysfs.\n", dev->name); - - veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", -@@ -1711,9 +1704,9 @@ static int __init veth_module_init(void) - continue; - - kobj = &veth_cnx[i]->kobject; -- kobj->parent = &veth_driver.driver.kobj; - /* If the add failes, complain but otherwise continue */ -- if (0 != kobject_add(kobj)) -+ if (0 != kobject_add_ng(kobj, &veth_driver.driver.kobj, -+ "cnx%.2d", veth_cnx[i]->remote_lp)) - veth_error("cnx %d: Failed adding to sysfs.\n", i); - } - ---- a/fs/char_dev.c -+++ b/fs/char_dev.c -@@ -510,9 +510,8 @@ struct cdev *cdev_alloc(void) - { - struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); - if (p) { -- p->kobj.ktype = &ktype_cdev_dynamic; - INIT_LIST_HEAD(&p->list); -- kobject_init(&p->kobj); -+ kobject_init_ng(&p->kobj, &ktype_cdev_dynamic); - } - return p; - } -@@ -529,8 +528,7 @@ void cdev_init(struct cdev *cdev, const - { - memset(cdev, 0, sizeof *cdev); - INIT_LIST_HEAD(&cdev->list); -- cdev->kobj.ktype = &ktype_cdev_default; -- kobject_init(&cdev->kobj); -+ kobject_init_ng(&cdev->kobj, &ktype_cdev_default); - cdev->ops = fops; - } - ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -1217,18 +1217,16 @@ int mod_sysfs_init(struct module *mod) - err = -EINVAL; - goto out; - } -- memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); -- err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name); -- if (err) -- goto out; -- mod->mkobj.kobj.kset = module_kset; -- mod->mkobj.kobj.ktype = &module_ktype; - mod->mkobj.mod = mod; - -- kobject_init(&mod->mkobj.kobj); -+ memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); -+ mod->mkobj.kobj.kset = module_kset; -+ err = kobject_init_and_add(&mod->mkobj.kobj, &module_ktype, NULL, -+ "%s", mod->name); -+ if (err) -+ kobject_put(&mod->mkobj.kobj); - - /* delay uevent until full sysfs population */ -- err = kobject_add(&mod->mkobj.kobj); - out: - return err; - } ---- a/kernel/params.c -+++ b/kernel/params.c -@@ -561,11 +561,9 @@ static void __init kernel_param_sysfs_se - - mk->mod = THIS_MODULE; - mk->kobj.kset = module_kset; -- mk->kobj.ktype = &module_ktype; -- kobject_set_name(&mk->kobj, name); -- kobject_init(&mk->kobj); -- ret = kobject_add(&mk->kobj); -+ ret = kobject_init_and_add(&mk->kobj, &module_ktype, NULL, "%s", name); - if (ret) { -+ kobject_put(&mk->kobj); - printk(KERN_ERR "Module '%s' failed to be added to sysfs, " - "error number %d\n", name, ret); - printk(KERN_ERR "The system will be unstable now.\n"); ---- a/kernel/user.c -+++ b/kernel/user.c -@@ -181,13 +181,12 @@ static int uids_user_create(struct user_ - int error; - - memset(kobj, 0, sizeof(struct kobject)); -- kobj->ktype = &uids_ktype; - kobj->kset = uids_kset; -- kobject_init(kobj); -- kobject_set_name(&up->kobj, "%d", up->uid); -- error = kobject_add(kobj); -- if (error) -+ error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid); -+ if (error) { -+ kobject_put(kobj); - goto done; -+ } - - kobject_uevent(kobj, KOBJ_ADD); - done: ---- a/mm/slub.c -+++ b/mm/slub.c -@@ -4028,13 +4028,12 @@ static int sysfs_slab_add(struct kmem_ca - name = create_unique_id(s); - } - -- kobject_set_name(&s->kobj, name); - s->kobj.kset = slab_kset; -- s->kobj.ktype = &slab_ktype; -- kobject_init(&s->kobj); -- err = kobject_add(&s->kobj); -- if (err) -+ err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, name); -+ if (err) { -+ kobject_put(&s->kobj); - return err; -+ } - - err = sysfs_create_group(&s->kobj, &slab_attr_group); - if (err) ---- a/net/bridge/br_if.c -+++ b/net/bridge/br_if.c -@@ -258,12 +258,6 @@ static struct net_bridge_port *new_nbp(s - p->state = BR_STATE_DISABLED; - br_stp_port_timer_init(p); - -- kobject_init(&p->kobj); -- kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); -- p->kobj.ktype = &brport_ktype; -- p->kobj.parent = &(dev->dev.kobj); -- p->kobj.kset = NULL; -- - return p; - } - -@@ -379,7 +373,8 @@ int br_add_if(struct net_bridge *br, str - if (IS_ERR(p)) - return PTR_ERR(p); - -- err = kobject_add(&p->kobj); -+ err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), -+ SYSFS_BRIDGE_PORT_ATTR); - if (err) - goto err0; - -@@ -416,6 +411,7 @@ err2: - br_fdb_delete_by_port(br, p, 1); - err1: - kobject_del(&p->kobj); -+ return err; - err0: - kobject_put(&p->kobj); - return err; diff --git a/kobject-remove-kobject_register.patch b/kobject-remove-kobject_register.patch index 2870eebad5be48..9f4e69b1cd9b39 100644 --- a/kobject-remove-kobject_register.patch +++ b/kobject-remove-kobject_register.patch @@ -14,7 +14,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/include/linux/kobject.h +++ b/include/linux/kobject.h -@@ -98,7 +98,6 @@ extern struct kobject * __must_check kob +@@ -96,7 +96,6 @@ extern struct kobject * __must_check kob extern int __must_check kobject_rename(struct kobject *, const char *new_name); extern int __must_check kobject_move(struct kobject *, struct kobject *); @@ -24,7 +24,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> extern struct kobject * kobject_get(struct kobject *); --- a/lib/kobject.c +++ b/lib/kobject.c -@@ -284,23 +284,6 @@ int kobject_add(struct kobject * kobj) +@@ -274,23 +274,6 @@ static int kobject_add_internal(struct k } /** @@ -36,7 +36,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> -{ - int error = -EINVAL; - if (kobj) { -- kobject_init(kobj); +- kobject_init_internal(kobj); - error = kobject_add(kobj); - if (!error) - kobject_uevent(kobj, KOBJ_ADD); @@ -48,10 +48,10 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> * kobject_set_name_vargs - Set the name of an kobject * @kobj: struct kobject to set the name of * @fmt: format string used to build the name -@@ -952,7 +935,6 @@ struct kset *kset_create_and_add(const c +@@ -942,7 +925,6 @@ struct kset *kset_create_and_add(const c + } EXPORT_SYMBOL_GPL(kset_create_and_add); - EXPORT_SYMBOL(kobject_init); -EXPORT_SYMBOL(kobject_register); EXPORT_SYMBOL(kobject_unregister); EXPORT_SYMBOL(kobject_get); @@ -131,7 +131,6 @@ driver/kobject-change-drivers-cpufreq-cpufreq.c-to-use-kobject_init_and_add.patc driver/kobject-change-drivers-edac-to-use-kobject_init_and_add.patch driver/kobject-change-drivers-cpuidle-sysfs.c-to-use-kobject_init_and_add.patch driver/kobject-change-drivers-pci-hotplug-pci_hotplug_core.c-to-use-kobject_init_and_add.patch -driver/kobject-change-drivers-md-md.c-to-use-kobject_init_and_add.patch driver/kobject-change-drivers-base-sys.c-to-use-kobject_init_and_add.patch driver/kobject-change-arch-x86-kernel-cpu-intel_cacheinfo.c-to-use-kobject_init_and_add.patch driver/kobject-change-drivers-acpi-system.c-to-use-kobject_create_and_add.patch @@ -140,6 +139,16 @@ driver/kobject-change-arch-sh-kernel-cpu-sh4-sq.c-to-use-kobject_init_and_add.pa driver/kobject-change-drivers-net-ibmveth.c-to-use-kobject_init_and_add.patch driver/kobject-change-drivers-parisc-pdc_stable.c-to-use-kobject_init_and_add.patch driver/kobject-change-arch-ia64-kernel-topology.c-to-use-kobject_init_and_add.patch +driver/kobject-change-drivers-md-md.c-to-use-kobject_init_and_add.patch +driver/kobject-the-cris-iop_fw_load.c-code-is-broken.patch +driver/kobject-convert-drivers-base-class.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-drivers-base-core.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-drivers-net-iseries_veth.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-fs-char_dev.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-kernel-params.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-kernel-user.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-mm-slub.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-net-bridge-br_if.c-to-use-kobject_init-add_ng.patch driver/driver-core-remove-owner-field-from-struct-bus_type.patch driver/driver-core-add-way-to-get-to-bus-kset.patch @@ -173,9 +182,18 @@ driver/sysfs-fix-sys-module-holders-after-sysfs-logic-change.patch # please work this time... driver/kobject-drop-child-parent-ref-at-unregistration.patch driver/block-device.patch +driver/kobject-convert-block-elevator.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-block-ll_rw_blk.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-drivers-md-md.c-to-use-kobject_init-add_ng.patch +driver/kobject-convert-kernel-module.c-to-use-kobject_init-add_ng.patch -# helper tools, not for mainline. +# remove the no-more needed functions and rename them ! +driver/kobject-remove-kobject_add-as-no-one-uses-it-anymore.patch +driver/kobject-rename-kobject_add_ng-to-kobject_add.patch +driver/kobject-remove-kobject_init-as-no-one-uses-it-anymore.patch +driver/kobject-rename-kobject_init_ng-to-kobject_init.patch +# helper tools, not for mainline. driver/put_device-might_sleep.patch driver/kobject-warn.patch driver/warn-when-statically-allocated-kobjects-are-used.patch @@ -280,7 +298,5 @@ usb/usb-gotemp.patch # kobject-remove-kobject_register.patch -f2.patch - |
