aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-12-05 14:10:31 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 13:44:33 -0500
commitec0676ee28528dc8dda13a93ee4b1f215a0c2f9d (patch)
treec647b85236a717e83014d74a1890b4f4c76de0c8 /drivers/base
parentd0d85ff989222f08dd1fa66321fef5567bbc4a7b (diff)
Driver core: move the bus notifier call points
This patch (as1184) changes the location of the notifications in device_add() and device_del(). Now the BUS_NOTIFY_ADD_DEVICE message is sent after dpm_sysfs_add(), which is necessary for clients that want to add attributes to the power/ subdirectory. The BUS_NOTIFY_DEL_DEVICE message is correspondingly moved before dpm_sysfs_remove(). Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 180ff84ea26c..ee555d7d5c3f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -894,11 +894,6 @@ int device_add(struct device *dev)
894 if (platform_notify) 894 if (platform_notify)
895 platform_notify(dev); 895 platform_notify(dev);
896 896
897 /* notify clients of device entry (new way) */
898 if (dev->bus)
899 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
900 BUS_NOTIFY_ADD_DEVICE, dev);
901
902 error = device_create_file(dev, &uevent_attr); 897 error = device_create_file(dev, &uevent_attr);
903 if (error) 898 if (error)
904 goto attrError; 899 goto attrError;
@@ -926,6 +921,14 @@ int device_add(struct device *dev)
926 if (error) 921 if (error)
927 goto DPMError; 922 goto DPMError;
928 device_pm_add(dev); 923 device_pm_add(dev);
924
925 /* Notify clients of device addition. This call must come
926 * after dpm_sysf_add() and before kobject_uevent().
927 */
928 if (dev->bus)
929 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
930 BUS_NOTIFY_ADD_DEVICE, dev);
931
929 kobject_uevent(&dev->kobj, KOBJ_ADD); 932 kobject_uevent(&dev->kobj, KOBJ_ADD);
930 bus_attach_device(dev); 933 bus_attach_device(dev);
931 if (parent) 934 if (parent)
@@ -951,9 +954,6 @@ done:
951 DPMError: 954 DPMError:
952 bus_remove_device(dev); 955 bus_remove_device(dev);
953 BusError: 956 BusError:
954 if (dev->bus)
955 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
956 BUS_NOTIFY_DEL_DEVICE, dev);
957 device_remove_attrs(dev); 957 device_remove_attrs(dev);
958 AttrsError: 958 AttrsError:
959 device_remove_class_symlinks(dev); 959 device_remove_class_symlinks(dev);
@@ -1038,6 +1038,12 @@ void device_del(struct device *dev)
1038 struct device *parent = dev->parent; 1038 struct device *parent = dev->parent;
1039 struct class_interface *class_intf; 1039 struct class_interface *class_intf;
1040 1040
1041 /* Notify clients of device removal. This call must come
1042 * before dpm_sysfs_remove().
1043 */
1044 if (dev->bus)
1045 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
1046 BUS_NOTIFY_DEL_DEVICE, dev);
1041 device_pm_remove(dev); 1047 device_pm_remove(dev);
1042 dpm_sysfs_remove(dev); 1048 dpm_sysfs_remove(dev);
1043 if (parent) 1049 if (parent)
@@ -1075,9 +1081,6 @@ void device_del(struct device *dev)
1075 */ 1081 */
1076 if (platform_notify_remove) 1082 if (platform_notify_remove)
1077 platform_notify_remove(dev); 1083 platform_notify_remove(dev);
1078 if (dev->bus)
1079 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
1080 BUS_NOTIFY_DEL_DEVICE, dev);
1081 kobject_uevent(&dev->kobj, KOBJ_REMOVE); 1084 kobject_uevent(&dev->kobj, KOBJ_REMOVE);
1082 cleanup_device_parent(dev); 1085 cleanup_device_parent(dev);
1083 kobject_del(&dev->kobj); 1086 kobject_del(&dev->kobj);