aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/class.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-09-13 09:34:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-26 00:08:38 -0400
commitc47ed219ba81632595e9f02e27318151fec16c9e (patch)
tree7c6d6c07122c26c12719c676b6a81f731122347d /drivers/base/class.c
parentc205ef4880273d2de4ee5388d4e52227ff688cc4 (diff)
Class: add support for class interfaces for devices
When moving class_device usage over to device, we need to handle class_interfaces properly with devices. This patch adds that support. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r--drivers/base/class.c10
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);