|
@@ -480,9 +480,10 @@ void device_remove_bin_file(struct device *dev, struct bin_attribute *attr)
|
|
|
EXPORT_SYMBOL_GPL(device_remove_bin_file);
|
|
|
|
|
|
/**
|
|
|
- * device_schedule_callback - helper to schedule a callback for a device
|
|
|
+ * 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,
|
|
@@ -493,20 +494,23 @@ EXPORT_SYMBOL_GPL(device_remove_bin_file);
|
|
|
* 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.
|
|
|
+ * 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(struct device *dev,
|
|
|
- void (*func)(struct device *))
|
|
|
+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);
|
|
|
+ (void (*)(void *)) func, dev, owner);
|
|
|
}
|
|
|
-EXPORT_SYMBOL_GPL(device_schedule_callback);
|
|
|
+EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
|
|
|
|
|
|
static void klist_children_get(struct klist_node *n)
|
|
|
{
|