summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-13 13:51:36 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-13 13:51:36 -0800
commita30f82b7ebc87cdec3ef48303278f02970086118 (patch)
tree9ae4816d0499319aac3f8acbc262b17524c48eaa /drivers/base
parentce9b499c9f58d7f3f680413f3ab5407f4e647ba2 (diff)
downloadop-kernel-dev-a30f82b7ebc87cdec3ef48303278f02970086118.zip
op-kernel-dev-a30f82b7ebc87cdec3ef48303278f02970086118.tar.gz
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 4195364..9db57af 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -615,6 +615,39 @@ void device_remove_bin_file(struct device *dev,
}
EXPORT_SYMBOL_GPL(device_remove_bin_file);
+/**
+ * device_schedule_callback_owner - helper to schedule a callback for a device
+ * @dev: device.
+ * @func: callback function to invoke later.
+ * @owner: module owning the callback routine
+ *
+ * Attribute methods must not unregister themselves or their parent device
+ * (which would amount to the same thing). Attempts to do so will deadlock,
+ * since unregistration is mutually exclusive with driver callbacks.
+ *
+ * Instead methods can call this routine, which will attempt to allocate
+ * and schedule a workqueue request to call back @func with @dev as its
+ * argument in the workqueue's process context. @dev will be pinned until
+ * @func returns.
+ *
+ * This routine is usually called via the inline device_schedule_callback(),
+ * which automatically sets @owner to THIS_MODULE.
+ *
+ * Returns 0 if the request was submitted, -ENOMEM if storage could not
+ * be allocated, -ENODEV if a reference to @owner isn't available.
+ *
+ * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an
+ * underlying sysfs routine (since it is intended for use by attribute
+ * methods), and if sysfs isn't available you'll get nothing but -ENOSYS.
+ */
+int device_schedule_callback_owner(struct device *dev,
+ void (*func)(struct device *), struct module *owner)
+{
+ return sysfs_schedule_callback(&dev->kobj,
+ (void (*)(void *)) func, dev, owner);
+}
+EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
+
static void klist_children_get(struct klist_node *n)
{
struct device_private *p = to_device_private_parent(n);
OpenPOWER on IntegriCloud