diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-27 15:58:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-27 15:58:54 -0400 |
commit | d868772fff6c4b881d66af8640251714e1aefa98 (patch) | |
tree | c95a68d358d5c875d25763ffe9a44fe9f2081f34 /include | |
parent | a205752d1ad2d37d6597aaae5a56fc396a770868 (diff) | |
parent | 404d5b185b4eb56d6fa2f7bd27833f8df1c38ce4 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (46 commits)
dev_dbg: check dev_dbg() arguments
drivers/base/attribute_container.c: use mutex instead of binary semaphore
mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
s2ram: add arch irq disable/enable hooks
define platform wakeup hook, use in pci_enable_wake()
security: prevent permission checking of file removal via sysfs_remove_group()
device_schedule_callback() needs a module reference
s390: cio: Delay uevents for subchannels
sysfs: bin.c printk fix
Driver core: use mutex instead of semaphore in DMA pool handler
driver core: bus_add_driver should return an error if no bus
debugfs: Add debugfs_create_u64()
the overdue removal of the mount/umount uevents
kobject: Comment and warning fixes to kobject.c
Driver core: warn when userspace writes to the uevent file in a non-supported way
Driver core: make uevent-environment available in uevent-file
kobject core: remove rwsem from struct subsystem
qeth: Remove usage of subsys.rwsem
PHY: remove rwsem use from phy core
IEEE1394: remove rwsem use from ieee1394 core
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/debugfs.h | 9 | ||||
-rw-r--r-- | include/linux/device.h | 69 | ||||
-rw-r--r-- | include/linux/kobject.h | 12 | ||||
-rw-r--r-- | include/linux/namei.h | 1 | ||||
-rw-r--r-- | include/linux/pci.h | 2 | ||||
-rw-r--r-- | include/linux/pm.h | 37 | ||||
-rw-r--r-- | include/linux/sysfs.h | 4 |
7 files changed, 99 insertions, 35 deletions
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 9fa0983d1aa8..5a9c49534d08 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -44,6 +44,8 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode, | |||
44 | struct dentry *parent, u16 *value); | 44 | struct dentry *parent, u16 *value); |
45 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, | 45 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, |
46 | struct dentry *parent, u32 *value); | 46 | struct dentry *parent, u32 *value); |
47 | struct dentry *debugfs_create_u64(const char *name, mode_t mode, | ||
48 | struct dentry *parent, u64 *value); | ||
47 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, | 49 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, |
48 | struct dentry *parent, u32 *value); | 50 | struct dentry *parent, u32 *value); |
49 | 51 | ||
@@ -104,6 +106,13 @@ static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, | |||
104 | return ERR_PTR(-ENODEV); | 106 | return ERR_PTR(-ENODEV); |
105 | } | 107 | } |
106 | 108 | ||
109 | static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, | ||
110 | struct dentry *parent, | ||
111 | u64 *value) | ||
112 | { | ||
113 | return ERR_PTR(-ENODEV); | ||
114 | } | ||
115 | |||
107 | static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, | 116 | static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, |
108 | struct dentry *parent, | 117 | struct dentry *parent, |
109 | u32 *value) | 118 | u32 *value) |
diff --git a/include/linux/device.h b/include/linux/device.h index 5cf30e95c8b6..a0cd2ced31a9 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -34,9 +34,24 @@ struct device; | |||
34 | struct device_driver; | 34 | struct device_driver; |
35 | struct class; | 35 | struct class; |
36 | struct class_device; | 36 | struct class_device; |
37 | struct bus_type; | ||
38 | |||
39 | struct bus_attribute { | ||
40 | struct attribute attr; | ||
41 | ssize_t (*show)(struct bus_type *, char * buf); | ||
42 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | ||
43 | }; | ||
44 | |||
45 | #define BUS_ATTR(_name,_mode,_show,_store) \ | ||
46 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
47 | |||
48 | extern int __must_check bus_create_file(struct bus_type *, | ||
49 | struct bus_attribute *); | ||
50 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
37 | 51 | ||
38 | struct bus_type { | 52 | struct bus_type { |
39 | const char * name; | 53 | const char * name; |
54 | struct module * owner; | ||
40 | 55 | ||
41 | struct subsystem subsys; | 56 | struct subsystem subsys; |
42 | struct kset drivers; | 57 | struct kset drivers; |
@@ -49,6 +64,8 @@ struct bus_type { | |||
49 | struct bus_attribute * bus_attrs; | 64 | struct bus_attribute * bus_attrs; |
50 | struct device_attribute * dev_attrs; | 65 | struct device_attribute * dev_attrs; |
51 | struct driver_attribute * drv_attrs; | 66 | struct driver_attribute * drv_attrs; |
67 | struct bus_attribute drivers_autoprobe_attr; | ||
68 | struct bus_attribute drivers_probe_attr; | ||
52 | 69 | ||
53 | int (*match)(struct device * dev, struct device_driver * drv); | 70 | int (*match)(struct device * dev, struct device_driver * drv); |
54 | int (*uevent)(struct device *dev, char **envp, | 71 | int (*uevent)(struct device *dev, char **envp, |
@@ -61,6 +78,9 @@ struct bus_type { | |||
61 | int (*suspend_late)(struct device * dev, pm_message_t state); | 78 | int (*suspend_late)(struct device * dev, pm_message_t state); |
62 | int (*resume_early)(struct device * dev); | 79 | int (*resume_early)(struct device * dev); |
63 | int (*resume)(struct device * dev); | 80 | int (*resume)(struct device * dev); |
81 | |||
82 | unsigned int drivers_autoprobe:1; | ||
83 | unsigned int multithread_probe:1; | ||
64 | }; | 84 | }; |
65 | 85 | ||
66 | extern int __must_check bus_register(struct bus_type * bus); | 86 | extern int __must_check bus_register(struct bus_type * bus); |
@@ -102,26 +122,10 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
102 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be | 122 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be |
103 | unbound */ | 123 | unbound */ |
104 | 124 | ||
105 | /* sysfs interface for exporting bus attributes */ | ||
106 | |||
107 | struct bus_attribute { | ||
108 | struct attribute attr; | ||
109 | ssize_t (*show)(struct bus_type *, char * buf); | ||
110 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | ||
111 | }; | ||
112 | |||
113 | #define BUS_ATTR(_name,_mode,_show,_store) \ | ||
114 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
115 | |||
116 | extern int __must_check bus_create_file(struct bus_type *, | ||
117 | struct bus_attribute *); | ||
118 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
119 | |||
120 | struct device_driver { | 125 | struct device_driver { |
121 | const char * name; | 126 | const char * name; |
122 | struct bus_type * bus; | 127 | struct bus_type * bus; |
123 | 128 | ||
124 | struct completion unloaded; | ||
125 | struct kobject kobj; | 129 | struct kobject kobj; |
126 | struct klist klist_devices; | 130 | struct klist klist_devices; |
127 | struct klist_node knode_bus; | 131 | struct klist_node knode_bus; |
@@ -135,8 +139,6 @@ struct device_driver { | |||
135 | void (*shutdown) (struct device * dev); | 139 | void (*shutdown) (struct device * dev); |
136 | int (*suspend) (struct device * dev, pm_message_t state); | 140 | int (*suspend) (struct device * dev, pm_message_t state); |
137 | int (*resume) (struct device * dev); | 141 | int (*resume) (struct device * dev); |
138 | |||
139 | unsigned int multithread_probe:1; | ||
140 | }; | 142 | }; |
141 | 143 | ||
142 | 144 | ||
@@ -181,10 +183,9 @@ struct class { | |||
181 | struct list_head children; | 183 | struct list_head children; |
182 | struct list_head devices; | 184 | struct list_head devices; |
183 | struct list_head interfaces; | 185 | struct list_head interfaces; |
186 | struct kset class_dirs; | ||
184 | struct semaphore sem; /* locks both the children and interfaces lists */ | 187 | struct semaphore sem; /* locks both the children and interfaces lists */ |
185 | 188 | ||
186 | struct kobject *virtual_dir; | ||
187 | |||
188 | struct class_attribute * class_attrs; | 189 | struct class_attribute * class_attrs; |
189 | struct class_device_attribute * class_dev_attrs; | 190 | struct class_device_attribute * class_dev_attrs; |
190 | struct device_attribute * dev_attrs; | 191 | struct device_attribute * dev_attrs; |
@@ -328,11 +329,23 @@ extern struct class_device *class_device_create(struct class *cls, | |||
328 | __attribute__((format(printf,5,6))); | 329 | __attribute__((format(printf,5,6))); |
329 | extern void class_device_destroy(struct class *cls, dev_t devt); | 330 | extern void class_device_destroy(struct class *cls, dev_t devt); |
330 | 331 | ||
332 | /* | ||
333 | * The type of device, "struct device" is embedded in. A class | ||
334 | * or bus can contain devices of different types | ||
335 | * like "partitions" and "disks", "mouse" and "event". | ||
336 | * This identifies the device type and carries type-specific | ||
337 | * information, equivalent to the kobj_type of a kobject. | ||
338 | * If "name" is specified, the uevent will contain it in | ||
339 | * the DEVTYPE variable. | ||
340 | */ | ||
331 | struct device_type { | 341 | struct device_type { |
332 | struct device_attribute *attrs; | 342 | const char *name; |
343 | struct attribute_group **groups; | ||
333 | int (*uevent)(struct device *dev, char **envp, int num_envp, | 344 | int (*uevent)(struct device *dev, char **envp, int num_envp, |
334 | char *buffer, int buffer_size); | 345 | char *buffer, int buffer_size); |
335 | void (*release)(struct device *dev); | 346 | void (*release)(struct device *dev); |
347 | int (*suspend)(struct device * dev, pm_message_t state); | ||
348 | int (*resume)(struct device * dev); | ||
336 | }; | 349 | }; |
337 | 350 | ||
338 | /* interface for exporting device attributes */ | 351 | /* interface for exporting device attributes */ |
@@ -354,8 +367,12 @@ extern int __must_check device_create_bin_file(struct device *dev, | |||
354 | struct bin_attribute *attr); | 367 | struct bin_attribute *attr); |
355 | extern void device_remove_bin_file(struct device *dev, | 368 | extern void device_remove_bin_file(struct device *dev, |
356 | struct bin_attribute *attr); | 369 | struct bin_attribute *attr); |
357 | extern int device_schedule_callback(struct device *dev, | 370 | extern int device_schedule_callback_owner(struct device *dev, |
358 | 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) | ||
359 | 376 | ||
360 | /* device resource management */ | 377 | /* device resource management */ |
361 | typedef void (*dr_release_t)(struct device *dev, void *res); | 378 | typedef void (*dr_release_t)(struct device *dev, void *res); |
@@ -554,7 +571,11 @@ extern const char *dev_driver_string(struct device *dev); | |||
554 | #define dev_dbg(dev, format, arg...) \ | 571 | #define dev_dbg(dev, format, arg...) \ |
555 | dev_printk(KERN_DEBUG , dev , format , ## arg) | 572 | dev_printk(KERN_DEBUG , dev , format , ## arg) |
556 | #else | 573 | #else |
557 | #define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0) | 574 | static inline int __attribute__ ((format (printf, 2, 3))) |
575 | dev_dbg(struct device * dev, const char * fmt, ...) | ||
576 | { | ||
577 | return 0; | ||
578 | } | ||
558 | #endif | 579 | #endif |
559 | 580 | ||
560 | #define dev_err(dev, format, arg...) \ | 581 | #define dev_err(dev, format, arg...) \ |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index b850e0310538..eb0e63ef297f 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/sysfs.h> | 22 | #include <linux/sysfs.h> |
23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/rwsem.h> | ||
26 | #include <linux/kref.h> | 25 | #include <linux/kref.h> |
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
@@ -43,11 +42,9 @@ enum kobject_action { | |||
43 | KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ | 42 | KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ |
44 | KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ | 43 | KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ |
45 | KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ | 44 | KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ |
46 | KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices (broken) */ | 45 | KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */ |
47 | KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ | 46 | KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */ |
48 | KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ | 47 | KOBJ_MOVE = (__force kobject_action_t) 0x06, /* device move */ |
49 | KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */ | ||
50 | KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */ | ||
51 | }; | 48 | }; |
52 | 49 | ||
53 | struct kobject { | 50 | struct kobject { |
@@ -89,6 +86,8 @@ extern void kobject_unregister(struct kobject *); | |||
89 | extern struct kobject * kobject_get(struct kobject *); | 86 | extern struct kobject * kobject_get(struct kobject *); |
90 | extern void kobject_put(struct kobject *); | 87 | extern void kobject_put(struct kobject *); |
91 | 88 | ||
89 | extern struct kobject *kobject_kset_add_dir(struct kset *kset, | ||
90 | struct kobject *, const char *); | ||
92 | extern struct kobject *kobject_add_dir(struct kobject *, const char *); | 91 | extern struct kobject *kobject_add_dir(struct kobject *, const char *); |
93 | 92 | ||
94 | extern char * kobject_get_path(struct kobject *, gfp_t); | 93 | extern char * kobject_get_path(struct kobject *, gfp_t); |
@@ -175,7 +174,6 @@ extern struct kobject * kset_find_obj(struct kset *, const char *); | |||
175 | 174 | ||
176 | struct subsystem { | 175 | struct subsystem { |
177 | struct kset kset; | 176 | struct kset kset; |
178 | struct rw_semaphore rwsem; | ||
179 | }; | 177 | }; |
180 | 178 | ||
181 | #define decl_subsys(_name,_type,_uevent_ops) \ | 179 | #define decl_subsys(_name,_type,_uevent_ops) \ |
diff --git a/include/linux/namei.h b/include/linux/namei.h index d39a5a67e979..b7dd24917f0d 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -82,6 +82,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | |||
82 | extern void release_open_intent(struct nameidata *); | 82 | extern void release_open_intent(struct nameidata *); |
83 | 83 | ||
84 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); | 84 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); |
85 | extern struct dentry *lookup_one_len_kern(const char *, struct dentry *, int); | ||
85 | 86 | ||
86 | extern int follow_down(struct vfsmount **, struct dentry **); | 87 | extern int follow_down(struct vfsmount **, struct dentry **); |
87 | extern int follow_up(struct vfsmount **, struct dentry **); | 88 | extern int follow_up(struct vfsmount **, struct dentry **); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 481ea0663f19..a3ad76221c6f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -361,8 +361,6 @@ struct pci_driver { | |||
361 | struct pci_error_handlers *err_handler; | 361 | struct pci_error_handlers *err_handler; |
362 | struct device_driver driver; | 362 | struct device_driver driver; |
363 | struct pci_dynids dynids; | 363 | struct pci_dynids dynids; |
364 | |||
365 | int multithread_probe; | ||
366 | }; | 364 | }; |
367 | 365 | ||
368 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) | 366 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 21db05ac7c0b..9bd86db4d395 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -166,6 +166,24 @@ extern struct pm_ops *pm_ops; | |||
166 | extern int pm_suspend(suspend_state_t state); | 166 | extern int pm_suspend(suspend_state_t state); |
167 | 167 | ||
168 | 168 | ||
169 | /** | ||
170 | * arch_suspend_disable_irqs - disable IRQs for suspend | ||
171 | * | ||
172 | * Disables IRQs (in the default case). This is a weak symbol in the common | ||
173 | * code and thus allows architectures to override it if more needs to be | ||
174 | * done. Not called for suspend to disk. | ||
175 | */ | ||
176 | extern void arch_suspend_disable_irqs(void); | ||
177 | |||
178 | /** | ||
179 | * arch_suspend_enable_irqs - enable IRQs after suspend | ||
180 | * | ||
181 | * Enables IRQs (in the default case). This is a weak symbol in the common | ||
182 | * code and thus allows architectures to override it if more needs to be | ||
183 | * done. Not called for suspend to disk. | ||
184 | */ | ||
185 | extern void arch_suspend_enable_irqs(void); | ||
186 | |||
169 | /* | 187 | /* |
170 | * Device power management | 188 | * Device power management |
171 | */ | 189 | */ |
@@ -273,6 +291,20 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
273 | __suspend_report_result(__FUNCTION__, fn, ret); \ | 291 | __suspend_report_result(__FUNCTION__, fn, ret); \ |
274 | } while (0) | 292 | } while (0) |
275 | 293 | ||
294 | /* | ||
295 | * Platform hook to activate device wakeup capability, if that's not already | ||
296 | * handled by enable_irq_wake() etc. | ||
297 | * Returns zero on success, else negative errno | ||
298 | */ | ||
299 | extern int (*platform_enable_wakeup)(struct device *dev, int is_on); | ||
300 | |||
301 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | ||
302 | { | ||
303 | if (platform_enable_wakeup) | ||
304 | return (*platform_enable_wakeup)(dev, is_on); | ||
305 | return 0; | ||
306 | } | ||
307 | |||
276 | #else /* !CONFIG_PM */ | 308 | #else /* !CONFIG_PM */ |
277 | 309 | ||
278 | static inline int device_suspend(pm_message_t state) | 310 | static inline int device_suspend(pm_message_t state) |
@@ -294,6 +326,11 @@ static inline void dpm_runtime_resume(struct device * dev) | |||
294 | 326 | ||
295 | #define suspend_report_result(fn, ret) do { } while (0) | 327 | #define suspend_report_result(fn, ret) do { } while (0) |
296 | 328 | ||
329 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | ||
330 | { | ||
331 | return -EIO; | ||
332 | } | ||
333 | |||
297 | #endif | 334 | #endif |
298 | 335 | ||
299 | /* changes to device_may_wakeup take effect on the next pm state change. | 336 | /* changes to device_may_wakeup take effect on the next pm state change. |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index fea9a6b3fb7b..7d5d1ec95c2e 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -80,7 +80,7 @@ struct sysfs_ops { | |||
80 | #ifdef CONFIG_SYSFS | 80 | #ifdef CONFIG_SYSFS |
81 | 81 | ||
82 | extern int sysfs_schedule_callback(struct kobject *kobj, | 82 | extern int sysfs_schedule_callback(struct kobject *kobj, |
83 | void (*func)(void *), void *data); | 83 | void (*func)(void *), void *data, struct module *owner); |
84 | 84 | ||
85 | extern int __must_check | 85 | extern int __must_check |
86 | sysfs_create_dir(struct kobject *, struct dentry *); | 86 | sysfs_create_dir(struct kobject *, struct dentry *); |
@@ -137,7 +137,7 @@ extern int __must_check sysfs_init(void); | |||
137 | #else /* CONFIG_SYSFS */ | 137 | #else /* CONFIG_SYSFS */ |
138 | 138 | ||
139 | static inline int sysfs_schedule_callback(struct kobject *kobj, | 139 | static inline int sysfs_schedule_callback(struct kobject *kobj, |
140 | void (*func)(void *), void *data) | 140 | void (*func)(void *), void *data, struct module *owner) |
141 | { | 141 | { |
142 | return -ENOSYS; | 142 | return -ENOSYS; |
143 | } | 143 | } |