diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:13:47 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:13:47 -0400 |
| commit | 53baaaa9682c230410a057263d1ce2922f43ddc4 (patch) | |
| tree | f5cced5622130f780d76953b284a631c3d226488 /include/linux/sysdev.h | |
| parent | f10140fbe5f97ecfeda986a12d0f1bad75642779 (diff) | |
| parent | 3f9787046ea37a26170dc4439efa21f8d23a9978 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (79 commits)
arm: bus_id -> dev_name() and dev_set_name() conversions
sparc64: fix up bus_id changes in sparc core code
3c59x: handle pci_name() being const
MTD: handle pci_name() being const
HP iLO driver
sysdev: Convert the x86 mce tolerant sysdev attribute to generic attribute
sysdev: Add utility functions for simple int/ulong variable sysdev attributes
sysdev: Pass the attribute to the low level sysdev show/store function
driver core: Suppress sysfs warnings for device_rename().
kobject: Transmit return value of call_usermodehelper() to caller
sysfs-rules.txt: reword API stability statement
debugfs: Implement debugfs_remove_recursive()
HOWTO: change email addresses of James in HOWTO
always enable FW_LOADER unless EMBEDDED=y
uio-howto.tmpl: use unique output names
uio-howto.tmpl: use standard copyright/legal markings
sysfs: don't call notify_change
sysdev: fix debugging statements in registration code.
kobject: should use kobject_put() in kset-example
kobject: reorder kobject to save space on 64 bit builds
...
Diffstat (limited to 'include/linux/sysdev.h')
| -rw-r--r-- | include/linux/sysdev.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index f2767bc6b735..f395bb3fa2f2 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
| @@ -99,8 +99,9 @@ extern void sysdev_unregister(struct sys_device *); | |||
| 99 | 99 | ||
| 100 | struct sysdev_attribute { | 100 | struct sysdev_attribute { |
| 101 | struct attribute attr; | 101 | struct attribute attr; |
| 102 | ssize_t (*show)(struct sys_device *, char *); | 102 | ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *); |
| 103 | ssize_t (*store)(struct sys_device *, const char *, size_t); | 103 | ssize_t (*store)(struct sys_device *, struct sysdev_attribute *, |
| 104 | const char *, size_t); | ||
| 104 | }; | 105 | }; |
| 105 | 106 | ||
| 106 | 107 | ||
| @@ -118,4 +119,38 @@ struct sysdev_attribute { | |||
| 118 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | 119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); |
| 119 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | 120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); |
| 120 | 121 | ||
| 122 | struct sysdev_ext_attribute { | ||
| 123 | struct sysdev_attribute attr; | ||
| 124 | void *var; | ||
| 125 | }; | ||
| 126 | |||
| 127 | /* | ||
| 128 | * Support for simple variable sysdev attributes. | ||
| 129 | * The pointer to the variable is stored in a sysdev_ext_attribute | ||
| 130 | */ | ||
| 131 | |||
| 132 | /* Add more types as needed */ | ||
| 133 | |||
| 134 | extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *, | ||
| 135 | char *); | ||
| 136 | extern ssize_t sysdev_store_ulong(struct sys_device *, | ||
| 137 | struct sysdev_attribute *, const char *, size_t); | ||
| 138 | extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *, | ||
| 139 | char *); | ||
| 140 | extern ssize_t sysdev_store_int(struct sys_device *, | ||
| 141 | struct sysdev_attribute *, const char *, size_t); | ||
| 142 | |||
| 143 | #define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
| 144 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \ | ||
| 145 | &(_var) } | ||
| 146 | #define SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
| 147 | struct sysdev_ext_attribute attr_##_name = \ | ||
| 148 | _SYSDEV_ULONG_ATTR(_name, _mode, _var); | ||
| 149 | #define _SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
| 150 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \ | ||
| 151 | &(_var) } | ||
| 152 | #define SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
| 153 | struct sysdev_ext_attribute attr_##_name = \ | ||
| 154 | _SYSDEV_INT_ATTR(_name, _mode, _var); | ||
| 155 | |||
| 121 | #endif /* _SYSDEV_H_ */ | 156 | #endif /* _SYSDEV_H_ */ |
