diff options
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r-- | drivers/base/class.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index cbdf47c0c60d..b06b0e2b9c62 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -842,6 +842,7 @@ int class_interface_register(struct class_interface *class_intf) | |||
842 | { | 842 | { |
843 | struct class *parent; | 843 | struct class *parent; |
844 | struct class_device *class_dev; | 844 | struct class_device *class_dev; |
845 | struct device *dev; | ||
845 | 846 | ||
846 | if (!class_intf || !class_intf->class) | 847 | if (!class_intf || !class_intf->class) |
847 | return -ENODEV; | 848 | return -ENODEV; |
@@ -856,6 +857,10 @@ int class_interface_register(struct class_interface *class_intf) | |||
856 | list_for_each_entry(class_dev, &parent->children, node) | 857 | list_for_each_entry(class_dev, &parent->children, node) |
857 | class_intf->add(class_dev, class_intf); | 858 | class_intf->add(class_dev, class_intf); |
858 | } | 859 | } |
860 | if (class_intf->add_dev) { | ||
861 | list_for_each_entry(dev, &parent->devices, node) | ||
862 | class_intf->add_dev(dev, class_intf); | ||
863 | } | ||
859 | up(&parent->sem); | 864 | up(&parent->sem); |
860 | 865 | ||
861 | return 0; | 866 | return 0; |
@@ -865,6 +870,7 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
865 | { | 870 | { |
866 | struct class * parent = class_intf->class; | 871 | struct class * parent = class_intf->class; |
867 | struct class_device *class_dev; | 872 | struct class_device *class_dev; |
873 | struct device *dev; | ||
868 | 874 | ||
869 | if (!parent) | 875 | if (!parent) |
870 | return; | 876 | return; |
@@ -875,6 +881,10 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
875 | list_for_each_entry(class_dev, &parent->children, node) | 881 | list_for_each_entry(class_dev, &parent->children, node) |
876 | class_intf->remove(class_dev, class_intf); | 882 | class_intf->remove(class_dev, class_intf); |
877 | } | 883 | } |
884 | if (class_intf->remove_dev) { | ||
885 | list_for_each_entry(dev, &parent->devices, node) | ||
886 | class_intf->remove_dev(dev, class_intf); | ||
887 | } | ||
878 | up(&parent->sem); | 888 | up(&parent->sem); |
879 | 889 | ||
880 | class_put(parent); | 890 | class_put(parent); |