Commit 8f9dfd2c authored by Patrick Mochel's avatar Patrick Mochel

[driver model] Clean up class release handling.

Based on a patch by Stephen Hemminger.
parent 5df31005
...@@ -181,14 +181,18 @@ static struct sysfs_ops class_dev_sysfs_ops = { ...@@ -181,14 +181,18 @@ static struct sysfs_ops class_dev_sysfs_ops = {
static void class_dev_release(struct kobject * kobj) static void class_dev_release(struct kobject * kobj)
{ {
struct class_device *class_dev = to_class_dev(kobj); struct class_device *cd = to_class_dev(kobj);
if (class_dev->release) struct class * cls = cd->class;
class_dev->release(class_dev);
pr_debug("device class '%s': release.\n",cd->class_id);
if (cls->release)
cd->release(cd);
} }
static struct kobj_type ktype_class_device = { static struct kobj_type ktype_class_device = {
.release = &class_dev_release,
.sysfs_ops = &class_dev_sysfs_ops, .sysfs_ops = &class_dev_sysfs_ops,
.release = class_dev_release,
}; };
static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) static int class_hotplug_filter(struct kset *kset, struct kobject *kobj)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment