diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:49:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:49:58 -0400 |
commit | e80ab411e589e00550e2e6e5a6a02d59cc730357 (patch) | |
tree | 870225ff7b5b8d03e82a996963213a4bb9cce248 /drivers/base/core.c | |
parent | 529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff) | |
parent | ee959b00c335d7780136c5abda37809191fe52c3 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits)
SCSI: convert struct class_device to struct device
DRM: remove unused dev_class
IB: rename "dev" to "srp_dev" in srp_host structure
IB: convert struct class_device to struct device
memstick: convert struct class_device to struct device
driver core: replace remaining __FUNCTION__ occurrences
sysfs: refill attribute buffer when reading from offset 0
PM: Remove destroy_suspended_device()
Firmware: add iSCSI iBFT Support
PM: Remove legacy PM (fix)
Kobject: Replace list_for_each() with list_for_each_entry().
SYSFS: Explicitly include required header file slab.h.
Driver core: make device_is_registered() work for class devices
PM: Convert wakeup flag accessors to inline functions
PM: Make wakeup flags available whenever CONFIG_PM is set
PM: Fix misuse of wakeup flag accessors in serial core
Driver core: Call device_pm_add() after bus_add_device() in device_add()
PM: Handle device registrations during suspend/resume
block: send disk "change" event for rescan_partitions()
sysdev: detect multiple driver registrations
...
Fixed trivial conflict in include/linux/memory.h due to semaphore header
file change (made irrelevant by the change to mutex).
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 58 |
1 files changed, 14 insertions, 44 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 7c4b36ccb1a0..9248e0927d08 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -207,7 +207,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
207 | retval = dev->bus->uevent(dev, env); | 207 | retval = dev->bus->uevent(dev, env); |
208 | if (retval) | 208 | if (retval) |
209 | pr_debug("device: '%s': %s: bus uevent() returned %d\n", | 209 | pr_debug("device: '%s': %s: bus uevent() returned %d\n", |
210 | dev->bus_id, __FUNCTION__, retval); | 210 | dev->bus_id, __func__, retval); |
211 | } | 211 | } |
212 | 212 | ||
213 | /* have the class specific function add its stuff */ | 213 | /* have the class specific function add its stuff */ |
@@ -216,7 +216,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
216 | if (retval) | 216 | if (retval) |
217 | pr_debug("device: '%s': %s: class uevent() " | 217 | pr_debug("device: '%s': %s: class uevent() " |
218 | "returned %d\n", dev->bus_id, | 218 | "returned %d\n", dev->bus_id, |
219 | __FUNCTION__, retval); | 219 | __func__, retval); |
220 | } | 220 | } |
221 | 221 | ||
222 | /* have the device type specific fuction add its stuff */ | 222 | /* have the device type specific fuction add its stuff */ |
@@ -225,7 +225,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
225 | if (retval) | 225 | if (retval) |
226 | pr_debug("device: '%s': %s: dev_type uevent() " | 226 | pr_debug("device: '%s': %s: dev_type uevent() " |
227 | "returned %d\n", dev->bus_id, | 227 | "returned %d\n", dev->bus_id, |
228 | __FUNCTION__, retval); | 228 | __func__, retval); |
229 | } | 229 | } |
230 | 230 | ||
231 | return retval; | 231 | return retval; |
@@ -782,7 +782,7 @@ int device_add(struct device *dev) | |||
782 | goto Done; | 782 | goto Done; |
783 | } | 783 | } |
784 | 784 | ||
785 | pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); | 785 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); |
786 | 786 | ||
787 | parent = get_device(dev->parent); | 787 | parent = get_device(dev->parent); |
788 | setup_parent(dev, parent); | 788 | setup_parent(dev, parent); |
@@ -817,13 +817,12 @@ int device_add(struct device *dev) | |||
817 | error = device_add_attrs(dev); | 817 | error = device_add_attrs(dev); |
818 | if (error) | 818 | if (error) |
819 | goto AttrsError; | 819 | goto AttrsError; |
820 | error = dpm_sysfs_add(dev); | ||
821 | if (error) | ||
822 | goto PMError; | ||
823 | device_pm_add(dev); | ||
824 | error = bus_add_device(dev); | 820 | error = bus_add_device(dev); |
825 | if (error) | 821 | if (error) |
826 | goto BusError; | 822 | goto BusError; |
823 | error = device_pm_add(dev); | ||
824 | if (error) | ||
825 | goto PMError; | ||
827 | kobject_uevent(&dev->kobj, KOBJ_ADD); | 826 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
828 | bus_attach_device(dev); | 827 | bus_attach_device(dev); |
829 | if (parent) | 828 | if (parent) |
@@ -843,9 +842,9 @@ int device_add(struct device *dev) | |||
843 | Done: | 842 | Done: |
844 | put_device(dev); | 843 | put_device(dev); |
845 | return error; | 844 | return error; |
846 | BusError: | ||
847 | device_pm_remove(dev); | ||
848 | PMError: | 845 | PMError: |
846 | bus_remove_device(dev); | ||
847 | BusError: | ||
849 | if (dev->bus) | 848 | if (dev->bus) |
850 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | 849 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, |
851 | BUS_NOTIFY_DEL_DEVICE, dev); | 850 | BUS_NOTIFY_DEL_DEVICE, dev); |
@@ -981,7 +980,7 @@ void device_del(struct device *dev) | |||
981 | */ | 980 | */ |
982 | void device_unregister(struct device *dev) | 981 | void device_unregister(struct device *dev) |
983 | { | 982 | { |
984 | pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); | 983 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); |
985 | device_del(dev); | 984 | device_del(dev); |
986 | put_device(dev); | 985 | put_device(dev); |
987 | } | 986 | } |
@@ -1076,7 +1075,7 @@ EXPORT_SYMBOL_GPL(device_remove_file); | |||
1076 | 1075 | ||
1077 | static void device_create_release(struct device *dev) | 1076 | static void device_create_release(struct device *dev) |
1078 | { | 1077 | { |
1079 | pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); | 1078 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); |
1080 | kfree(dev); | 1079 | kfree(dev); |
1081 | } | 1080 | } |
1082 | 1081 | ||
@@ -1164,35 +1163,6 @@ void device_destroy(struct class *class, dev_t devt) | |||
1164 | } | 1163 | } |
1165 | EXPORT_SYMBOL_GPL(device_destroy); | 1164 | EXPORT_SYMBOL_GPL(device_destroy); |
1166 | 1165 | ||
1167 | #ifdef CONFIG_PM_SLEEP | ||
1168 | /** | ||
1169 | * destroy_suspended_device - asks the PM core to remove a suspended device | ||
1170 | * @class: pointer to the struct class that this device was registered with | ||
1171 | * @devt: the dev_t of the device that was previously registered | ||
1172 | * | ||
1173 | * This call notifies the PM core of the necessity to unregister a suspended | ||
1174 | * device created with a call to device_create() (devices cannot be | ||
1175 | * unregistered directly while suspended, since the PM core holds their | ||
1176 | * semaphores at that time). | ||
1177 | * | ||
1178 | * It can only be called within the scope of a system sleep transition. In | ||
1179 | * practice this means it has to be directly or indirectly invoked either by | ||
1180 | * a suspend or resume method, or by the PM core (e.g. via | ||
1181 | * disable_nonboot_cpus() or enable_nonboot_cpus()). | ||
1182 | */ | ||
1183 | void destroy_suspended_device(struct class *class, dev_t devt) | ||
1184 | { | ||
1185 | struct device *dev; | ||
1186 | |||
1187 | dev = class_find_device(class, &devt, __match_devt); | ||
1188 | if (dev) { | ||
1189 | device_pm_schedule_removal(dev); | ||
1190 | put_device(dev); | ||
1191 | } | ||
1192 | } | ||
1193 | EXPORT_SYMBOL_GPL(destroy_suspended_device); | ||
1194 | #endif /* CONFIG_PM_SLEEP */ | ||
1195 | |||
1196 | /** | 1166 | /** |
1197 | * device_rename - renames a device | 1167 | * device_rename - renames a device |
1198 | * @dev: the pointer to the struct device to be renamed | 1168 | * @dev: the pointer to the struct device to be renamed |
@@ -1210,7 +1180,7 @@ int device_rename(struct device *dev, char *new_name) | |||
1210 | return -EINVAL; | 1180 | return -EINVAL; |
1211 | 1181 | ||
1212 | pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id, | 1182 | pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id, |
1213 | __FUNCTION__, new_name); | 1183 | __func__, new_name); |
1214 | 1184 | ||
1215 | #ifdef CONFIG_SYSFS_DEPRECATED | 1185 | #ifdef CONFIG_SYSFS_DEPRECATED |
1216 | if ((dev->class) && (dev->parent)) | 1186 | if ((dev->class) && (dev->parent)) |
@@ -1249,7 +1219,7 @@ int device_rename(struct device *dev, char *new_name) | |||
1249 | dev->bus_id); | 1219 | dev->bus_id); |
1250 | if (error) { | 1220 | if (error) { |
1251 | dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", | 1221 | dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", |
1252 | __FUNCTION__, error); | 1222 | __func__, error); |
1253 | } | 1223 | } |
1254 | } | 1224 | } |
1255 | #endif | 1225 | #endif |
@@ -1325,7 +1295,7 @@ int device_move(struct device *dev, struct device *new_parent) | |||
1325 | new_parent_kobj = get_device_parent(dev, new_parent); | 1295 | new_parent_kobj = get_device_parent(dev, new_parent); |
1326 | 1296 | ||
1327 | pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id, | 1297 | pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id, |
1328 | __FUNCTION__, new_parent ? new_parent->bus_id : "<NULL>"); | 1298 | __func__, new_parent ? new_parent->bus_id : "<NULL>"); |
1329 | error = kobject_move(&dev->kobj, new_parent_kobj); | 1299 | error = kobject_move(&dev->kobj, new_parent_kobj); |
1330 | if (error) { | 1300 | if (error) { |
1331 | cleanup_glue_dir(dev, new_parent_kobj); | 1301 | cleanup_glue_dir(dev, new_parent_kobj); |