aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-04-26 03:12:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 13:57:32 -0400
commit523ded71de0c5e66973335bf99a80edfda9f401b (patch)
tree20f47e8ed91018977d9fb7f4169a6ef8db407b82 /include/linux/device.h
parentfa1a8c23eb7d3ded8a3c6d0e653339a2bc7fca9e (diff)
device_schedule_callback() needs a module reference
This patch (as896b) fixes an oversight in the design of device_schedule_callback(). It is necessary to acquire a reference to the module owning the callback routine, to prevent the module from being unloaded before the callback can run. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Satyam Sharma <satyam.sharma@gmail.com> Cc: Neil Brown <neilb@suse.de> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index af603a137690..8511d14071b3 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -367,8 +367,12 @@ extern int __must_check device_create_bin_file(struct device *dev,
367 struct bin_attribute *attr); 367 struct bin_attribute *attr);
368extern void device_remove_bin_file(struct device *dev, 368extern void device_remove_bin_file(struct device *dev,
369 struct bin_attribute *attr); 369 struct bin_attribute *attr);
370extern int device_schedule_callback(struct device *dev, 370extern int device_schedule_callback_owner(struct device *dev,
371 void (*func)(struct device *)); 371 void (*func)(struct device *), struct module *owner);
372
373/* This is a macro to avoid include problems with THIS_MODULE */
374#define device_schedule_callback(dev, func) \
375 device_schedule_callback_owner(dev, func, THIS_MODULE)
372 376
373/* device resource management */ 377/* device resource management */
374typedef void (*dr_release_t)(struct device *dev, void *res); 378typedef void (*dr_release_t)(struct device *dev, void *res);