aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-02 14:02:55 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 14:03:08 -0400
commitc9494727cf293ae2ec66af57547a3e79c724fec2 (patch)
tree44ae197b64fa7530ee695a90ad31326dda06f1e1 /include/linux/device.h
parent6427462bfa50f50dc6c088c07037264fcc73eca1 (diff)
parent42be79e37e264557f12860fa4cc84b4de3685954 (diff)
Merge branch 'linus' into sched/core
Merge reason: update to latest upstream Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index b30527db3ac..182192892d4 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -106,7 +106,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,
106 106
107/* All 4 notifers below get called with the target struct device * 107/* All 4 notifers below get called with the target struct device *
108 * as an argument. Note that those functions are likely to be called 108 * as an argument. Note that those functions are likely to be called
109 * with the device semaphore held in the core, so be careful. 109 * with the device lock held in the core, so be careful.
110 */ 110 */
111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
@@ -251,8 +251,10 @@ extern struct device *class_find_device(struct class *class,
251 251
252struct class_attribute { 252struct class_attribute {
253 struct attribute attr; 253 struct attribute attr;
254 ssize_t (*show)(struct class *class, char *buf); 254 ssize_t (*show)(struct class *class, struct class_attribute *attr,
255 ssize_t (*store)(struct class *class, const char *buf, size_t count); 255 char *buf);
256 ssize_t (*store)(struct class *class, struct class_attribute *attr,
257 const char *buf, size_t count);
256}; 258};
257 259
258#define CLASS_ATTR(_name, _mode, _show, _store) \ 260#define CLASS_ATTR(_name, _mode, _show, _store) \
@@ -263,6 +265,23 @@ extern int __must_check class_create_file(struct class *class,
263extern void class_remove_file(struct class *class, 265extern void class_remove_file(struct class *class,
264 const struct class_attribute *attr); 266 const struct class_attribute *attr);
265 267
268/* Simple class attribute that is just a static string */
269
270struct class_attribute_string {
271 struct class_attribute attr;
272 char *str;
273};
274
275/* Currently read-only only */
276#define _CLASS_ATTR_STRING(_name, _mode, _str) \
277 { __ATTR(_name, _mode, show_class_attr_string, NULL), _str }
278#define CLASS_ATTR_STRING(_name, _mode, _str) \
279 struct class_attribute_string class_attr_##_name = \
280 _CLASS_ATTR_STRING(_name, _mode, _str)
281
282extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr,
283 char *buf);
284
266struct class_interface { 285struct class_interface {
267 struct list_head node; 286 struct list_head node;
268 struct class *class; 287 struct class *class;
@@ -489,6 +508,21 @@ static inline bool device_async_suspend_enabled(struct device *dev)
489 return !!dev->power.async_suspend; 508 return !!dev->power.async_suspend;
490} 509}
491 510
511static inline void device_lock(struct device *dev)
512{
513 down(&dev->sem);
514}
515
516static inline int device_trylock(struct device *dev)
517{
518 return down_trylock(&dev->sem);
519}
520
521static inline void device_unlock(struct device *dev)
522{
523 up(&dev->sem);
524}
525
492void driver_init(void); 526void driver_init(void);
493 527
494/* 528/*