aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-13 16:51:36 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-13 16:51:36 -0500
commita30f82b7ebc87cdec3ef48303278f02970086118 (patch)
tree9ae4816d0499319aac3f8acbc262b17524c48eaa /drivers/base
parentce9b499c9f58d7f3f680413f3ab5407f4e647ba2 (diff)
Revert "sysfs, driver-core: remove unused {sysfs|device}_schedule_callback_owner()"
This reverts commit d1ba277e79889085a2faec3b68b91ce89c63f888. Tejun writes: I'm sorry but can you please revert the whole series? get_active() waiting while a node is deactivated has potential to lead to deadlock and that deactivate/reactivate interface is something fundamentally flawed and that cgroup will have to work with the remove_self() like everybody else. IOW, I think the first posting was correct. Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4195364f9fdd..9db57afcf81f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -615,6 +615,39 @@ void device_remove_bin_file(struct device *dev,
615} 615}
616EXPORT_SYMBOL_GPL(device_remove_bin_file); 616EXPORT_SYMBOL_GPL(device_remove_bin_file);
617 617
618/**
619 * device_schedule_callback_owner - helper to schedule a callback for a device
620 * @dev: device.
621 * @func: callback function to invoke later.
622 * @owner: module owning the callback routine
623 *
624 * Attribute methods must not unregister themselves or their parent device
625 * (which would amount to the same thing). Attempts to do so will deadlock,
626 * since unregistration is mutually exclusive with driver callbacks.
627 *
628 * Instead methods can call this routine, which will attempt to allocate
629 * and schedule a workqueue request to call back @func with @dev as its
630 * argument in the workqueue's process context. @dev will be pinned until
631 * @func returns.
632 *
633 * This routine is usually called via the inline device_schedule_callback(),
634 * which automatically sets @owner to THIS_MODULE.
635 *
636 * Returns 0 if the request was submitted, -ENOMEM if storage could not
637 * be allocated, -ENODEV if a reference to @owner isn't available.
638 *
639 * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an
640 * underlying sysfs routine (since it is intended for use by attribute
641 * methods), and if sysfs isn't available you'll get nothing but -ENOSYS.
642 */
643int device_schedule_callback_owner(struct device *dev,
644 void (*func)(struct device *), struct module *owner)
645{
646 return sysfs_schedule_callback(&dev->kobj,
647 (void (*)(void *)) func, dev, owner);
648}
649EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
650
618static void klist_children_get(struct klist_node *n) 651static void klist_children_get(struct klist_node *n)
619{ 652{
620 struct device_private *p = to_device_private_parent(n); 653 struct device_private *p = to_device_private_parent(n);