aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 15:49:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 15:49:58 -0700
commite80ab411e589e00550e2e6e5a6a02d59cc730357 (patch)
tree870225ff7b5b8d03e82a996963213a4bb9cce248 /drivers/base/core.c
parent529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff)
parentee959b00c335d7780136c5abda37809191fe52c3 (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.c58
1 files changed, 14 insertions, 44 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 7c4b36ccb1a..9248e0927d0 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,
retval = dev->bus->uevent(dev, env);
if (retval)
pr_debug("device: '%s': %s: bus uevent() returned %d\n",
- dev->bus_id, __FUNCTION__, retval);
+ dev->bus_id, __func__, retval);
}
/* have the class specific function add its stuff */
@@ -216,7 +216,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
if (retval)
pr_debug("device: '%s': %s: class uevent() "
"returned %d\n", dev->bus_id,
- __FUNCTION__, retval);
+ __func__, retval);
}
/* have the device type specific fuction add its stuff */
@@ -225,7 +225,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
if (retval)
pr_debug("device: '%s': %s: dev_type uevent() "
"returned %d\n", dev->bus_id,
- __FUNCTION__, retval);
+ __func__, retval);
}
return retval;
@@ -782,7 +782,7 @@ int device_add(struct device *dev)
goto Done;
}
- pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
+ pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
parent = get_device(dev->parent);
setup_parent(dev, parent);
@@ -817,13 +817,12 @@ int device_add(struct device *dev)
error = device_add_attrs(dev);
if (error)
goto AttrsError;
- error = dpm_sysfs_add(dev);
- if (error)
- goto PMError;
- device_pm_add(dev);
error = bus_add_device(dev);
if (error)
goto BusError;
+ error = device_pm_add(dev);
+ if (error)
+ goto PMError;
kobject_uevent(&dev->kobj, KOBJ_ADD);
bus_attach_device(dev);
if (parent)
@@ -843,9 +842,9 @@ int device_add(struct device *dev)
Done:
put_device(dev);
return error;
- BusError:
- device_pm_remove(dev);
PMError:
+ bus_remove_device(dev);
+ BusError:
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_DEL_DEVICE, dev);
@@ -981,7 +980,7 @@ void device_del(struct device *dev)
*/
void device_unregister(struct device *dev)
{
- pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
+ pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
device_del(dev);
put_device(dev);
}
@@ -1076,7 +1075,7 @@ EXPORT_SYMBOL_GPL(device_remove_file);
static void device_create_release(struct device *dev)
{
- pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
+ pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
kfree(dev);
}
@@ -1164,35 +1163,6 @@ void device_destroy(struct class *class, dev_t devt)
}
EXPORT_SYMBOL_GPL(device_destroy);
-#ifdef CONFIG_PM_SLEEP
-/**
- * destroy_suspended_device - asks the PM core to remove a suspended device
- * @class: pointer to the struct class that this device was registered with
- * @devt: the dev_t of the device that was previously registered
- *
- * This call notifies the PM core of the necessity to unregister a suspended
- * device created with a call to device_create() (devices cannot be
- * unregistered directly while suspended, since the PM core holds their
- * semaphores at that time).
- *
- * It can only be called within the scope of a system sleep transition. In
- * practice this means it has to be directly or indirectly invoked either by
- * a suspend or resume method, or by the PM core (e.g. via
- * disable_nonboot_cpus() or enable_nonboot_cpus()).
- */
-void destroy_suspended_device(struct class *class, dev_t devt)
-{
- struct device *dev;
-
- dev = class_find_device(class, &devt, __match_devt);
- if (dev) {
- device_pm_schedule_removal(dev);
- put_device(dev);
- }
-}
-EXPORT_SYMBOL_GPL(destroy_suspended_device);
-#endif /* CONFIG_PM_SLEEP */
-
/**
* device_rename - renames a device
* @dev: the pointer to the struct device to be renamed
@@ -1210,7 +1180,7 @@ int device_rename(struct device *dev, char *new_name)
return -EINVAL;
pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id,
- __FUNCTION__, new_name);
+ __func__, new_name);
#ifdef CONFIG_SYSFS_DEPRECATED
if ((dev->class) && (dev->parent))
@@ -1249,7 +1219,7 @@ int device_rename(struct device *dev, char *new_name)
dev->bus_id);
if (error) {
dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n",
- __FUNCTION__, error);
+ __func__, error);
}
}
#endif
@@ -1325,7 +1295,7 @@ int device_move(struct device *dev, struct device *new_parent)
new_parent_kobj = get_device_parent(dev, new_parent);
pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id,
- __FUNCTION__, new_parent ? new_parent->bus_id : "<NULL>");
+ __func__, new_parent ? new_parent->bus_id : "<NULL>");
error = kobject_move(&dev->kobj, new_parent_kobj);
if (error) {
cleanup_glue_dir(dev, new_parent_kobj);