aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-11-15 17:13:18 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-17 17:21:08 -0500
commit6b6e39a6a8da7234c538d14c43d3583da8875f9c (patch)
treecef5d25998665559ecc0cad2bcdb947cfa401b67 /drivers/base/core.c
parent14c05aa399e30f343f25158c9adfc44631378a96 (diff)
driver-core: merge private parts of class and bus
As classes and busses are pretty much the same thing, and we want to merge them together into a 'subsystem' in the future, let us share the same private data parts to make that merge easier. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 6ed645411c40..46ff6c251932 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -610,7 +610,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
610 dir->class = class; 610 dir->class = class;
611 kobject_init(&dir->kobj, &class_dir_ktype); 611 kobject_init(&dir->kobj, &class_dir_ktype);
612 612
613 dir->kobj.kset = &class->p->class_dirs; 613 dir->kobj.kset = &class->p->glue_dirs;
614 614
615 retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name); 615 retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name);
616 if (retval < 0) { 616 if (retval < 0) {
@@ -635,7 +635,7 @@ static struct kobject *get_device_parent(struct device *dev,
635 if (sysfs_deprecated && dev->class == &block_class) { 635 if (sysfs_deprecated && dev->class == &block_class) {
636 if (parent && parent->class == &block_class) 636 if (parent && parent->class == &block_class)
637 return &parent->kobj; 637 return &parent->kobj;
638 return &block_class.p->class_subsys.kobj; 638 return &block_class.p->subsys.kobj;
639 } 639 }
640#endif 640#endif
641 641
@@ -654,13 +654,13 @@ static struct kobject *get_device_parent(struct device *dev,
654 mutex_lock(&gdp_mutex); 654 mutex_lock(&gdp_mutex);
655 655
656 /* find our class-directory at the parent and reference it */ 656 /* find our class-directory at the parent and reference it */
657 spin_lock(&dev->class->p->class_dirs.list_lock); 657 spin_lock(&dev->class->p->glue_dirs.list_lock);
658 list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) 658 list_for_each_entry(k, &dev->class->p->glue_dirs.list, entry)
659 if (k->parent == parent_kobj) { 659 if (k->parent == parent_kobj) {
660 kobj = kobject_get(k); 660 kobj = kobject_get(k);
661 break; 661 break;
662 } 662 }
663 spin_unlock(&dev->class->p->class_dirs.list_lock); 663 spin_unlock(&dev->class->p->glue_dirs.list_lock);
664 if (kobj) { 664 if (kobj) {
665 mutex_unlock(&gdp_mutex); 665 mutex_unlock(&gdp_mutex);
666 return kobj; 666 return kobj;
@@ -682,7 +682,7 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
682{ 682{
683 /* see if we live in a "glue" directory */ 683 /* see if we live in a "glue" directory */
684 if (!glue_dir || !dev->class || 684 if (!glue_dir || !dev->class ||
685 glue_dir->kset != &dev->class->p->class_dirs) 685 glue_dir->kset != &dev->class->p->glue_dirs)
686 return; 686 return;
687 687
688 kobject_put(glue_dir); 688 kobject_put(glue_dir);
@@ -709,7 +709,7 @@ static int device_add_class_symlinks(struct device *dev)
709 return 0; 709 return 0;
710 710
711 error = sysfs_create_link(&dev->kobj, 711 error = sysfs_create_link(&dev->kobj,
712 &dev->class->p->class_subsys.kobj, 712 &dev->class->p->subsys.kobj,
713 "subsystem"); 713 "subsystem");
714 if (error) 714 if (error)
715 goto out; 715 goto out;
@@ -728,7 +728,7 @@ static int device_add_class_symlinks(struct device *dev)
728#endif 728#endif
729 729
730 /* link in the class directory pointing to the device */ 730 /* link in the class directory pointing to the device */
731 error = sysfs_create_link(&dev->class->p->class_subsys.kobj, 731 error = sysfs_create_link(&dev->class->p->subsys.kobj,
732 &dev->kobj, dev_name(dev)); 732 &dev->kobj, dev_name(dev));
733 if (error) 733 if (error)
734 goto out_device; 734 goto out_device;
@@ -756,7 +756,7 @@ static void device_remove_class_symlinks(struct device *dev)
756 if (sysfs_deprecated && dev->class == &block_class) 756 if (sysfs_deprecated && dev->class == &block_class)
757 return; 757 return;
758#endif 758#endif
759 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev)); 759 sysfs_delete_link(&dev->class->p->subsys.kobj, &dev->kobj, dev_name(dev));
760} 760}
761 761
762/** 762/**
@@ -947,7 +947,7 @@ int device_add(struct device *dev)
947 mutex_lock(&dev->class->p->class_mutex); 947 mutex_lock(&dev->class->p->class_mutex);
948 /* tie the class to the device */ 948 /* tie the class to the device */
949 klist_add_tail(&dev->knode_class, 949 klist_add_tail(&dev->knode_class,
950 &dev->class->p->class_devices); 950 &dev->class->p->klist_devices);
951 951
952 /* notify any interfaces that the device is here */ 952 /* notify any interfaces that the device is here */
953 list_for_each_entry(class_intf, 953 list_for_each_entry(class_intf,
@@ -1535,7 +1535,7 @@ int device_rename(struct device *dev, const char *new_name)
1535 } 1535 }
1536 1536
1537 if (dev->class) { 1537 if (dev->class) {
1538 error = sysfs_rename_link(&dev->class->p->class_subsys.kobj, 1538 error = sysfs_rename_link(&dev->class->p->subsys.kobj,
1539 &dev->kobj, old_device_name, new_name); 1539 &dev->kobj, old_device_name, new_name);
1540 if (error) 1540 if (error)
1541 goto out; 1541 goto out;