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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
14c05aa399
commit
6b6e39a6a8
@@ -610,7 +610,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
|
||||
dir->class = class;
|
||||
kobject_init(&dir->kobj, &class_dir_ktype);
|
||||
|
||||
dir->kobj.kset = &class->p->class_dirs;
|
||||
dir->kobj.kset = &class->p->glue_dirs;
|
||||
|
||||
retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name);
|
||||
if (retval < 0) {
|
||||
@@ -635,7 +635,7 @@ static struct kobject *get_device_parent(struct device *dev,
|
||||
if (sysfs_deprecated && dev->class == &block_class) {
|
||||
if (parent && parent->class == &block_class)
|
||||
return &parent->kobj;
|
||||
return &block_class.p->class_subsys.kobj;
|
||||
return &block_class.p->subsys.kobj;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -654,13 +654,13 @@ static struct kobject *get_device_parent(struct device *dev,
|
||||
mutex_lock(&gdp_mutex);
|
||||
|
||||
/* find our class-directory at the parent and reference it */
|
||||
spin_lock(&dev->class->p->class_dirs.list_lock);
|
||||
list_for_each_entry(k, &dev->class->p->class_dirs.list, entry)
|
||||
spin_lock(&dev->class->p->glue_dirs.list_lock);
|
||||
list_for_each_entry(k, &dev->class->p->glue_dirs.list, entry)
|
||||
if (k->parent == parent_kobj) {
|
||||
kobj = kobject_get(k);
|
||||
break;
|
||||
}
|
||||
spin_unlock(&dev->class->p->class_dirs.list_lock);
|
||||
spin_unlock(&dev->class->p->glue_dirs.list_lock);
|
||||
if (kobj) {
|
||||
mutex_unlock(&gdp_mutex);
|
||||
return kobj;
|
||||
@@ -682,7 +682,7 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
|
||||
{
|
||||
/* see if we live in a "glue" directory */
|
||||
if (!glue_dir || !dev->class ||
|
||||
glue_dir->kset != &dev->class->p->class_dirs)
|
||||
glue_dir->kset != &dev->class->p->glue_dirs)
|
||||
return;
|
||||
|
||||
kobject_put(glue_dir);
|
||||
@@ -709,7 +709,7 @@ static int device_add_class_symlinks(struct device *dev)
|
||||
return 0;
|
||||
|
||||
error = sysfs_create_link(&dev->kobj,
|
||||
&dev->class->p->class_subsys.kobj,
|
||||
&dev->class->p->subsys.kobj,
|
||||
"subsystem");
|
||||
if (error)
|
||||
goto out;
|
||||
@@ -728,7 +728,7 @@ static int device_add_class_symlinks(struct device *dev)
|
||||
#endif
|
||||
|
||||
/* link in the class directory pointing to the device */
|
||||
error = sysfs_create_link(&dev->class->p->class_subsys.kobj,
|
||||
error = sysfs_create_link(&dev->class->p->subsys.kobj,
|
||||
&dev->kobj, dev_name(dev));
|
||||
if (error)
|
||||
goto out_device;
|
||||
@@ -756,7 +756,7 @@ static void device_remove_class_symlinks(struct device *dev)
|
||||
if (sysfs_deprecated && dev->class == &block_class)
|
||||
return;
|
||||
#endif
|
||||
sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
|
||||
sysfs_delete_link(&dev->class->p->subsys.kobj, &dev->kobj, dev_name(dev));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -947,7 +947,7 @@ int device_add(struct device *dev)
|
||||
mutex_lock(&dev->class->p->class_mutex);
|
||||
/* tie the class to the device */
|
||||
klist_add_tail(&dev->knode_class,
|
||||
&dev->class->p->class_devices);
|
||||
&dev->class->p->klist_devices);
|
||||
|
||||
/* notify any interfaces that the device is here */
|
||||
list_for_each_entry(class_intf,
|
||||
@@ -1535,7 +1535,7 @@ int device_rename(struct device *dev, const char *new_name)
|
||||
}
|
||||
|
||||
if (dev->class) {
|
||||
error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
|
||||
error = sysfs_rename_link(&dev->class->p->subsys.kobj,
|
||||
&dev->kobj, old_device_name, new_name);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user