diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-18 14:45:02 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-20 00:14:20 -0400 |
commit | 3b72094409ab673d096b3852f4636be540780faf (patch) | |
tree | 4113e0da672247304045b64a956af5481f533cfa /drivers/input | |
parent | 25a70e38cd57952b09a013bf070e03705ee4f2ff (diff) |
Input: psmouse - allow defining read-only attributes
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/psmouse.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 54ed267894bd..e3562daeb2ed 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -116,9 +116,7 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *at | |||
116 | ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr, | 116 | ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr, |
117 | const char *buf, size_t count); | 117 | const char *buf, size_t count); |
118 | 118 | ||
119 | #define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \ | 119 | #define __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect) \ |
120 | static ssize_t _show(struct psmouse *, void *data, char *); \ | ||
121 | static ssize_t _set(struct psmouse *, void *data, const char *, size_t); \ | ||
122 | static struct psmouse_attribute psmouse_attr_##_name = { \ | 120 | static struct psmouse_attribute psmouse_attr_##_name = { \ |
123 | .dattr = { \ | 121 | .dattr = { \ |
124 | .attr = { \ | 122 | .attr = { \ |
@@ -134,7 +132,20 @@ static struct psmouse_attribute psmouse_attr_##_name = { \ | |||
134 | .protect = _protect, \ | 132 | .protect = _protect, \ |
135 | } | 133 | } |
136 | 134 | ||
137 | #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \ | 135 | #define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \ |
138 | __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1) | 136 | static ssize_t _show(struct psmouse *, void *, char *); \ |
137 | static ssize_t _set(struct psmouse *, void *, const char *, size_t); \ | ||
138 | __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect) | ||
139 | |||
140 | #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \ | ||
141 | __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1) | ||
142 | |||
143 | #define PSMOUSE_DEFINE_RO_ATTR(_name, _mode, _data, _show) \ | ||
144 | static ssize_t _show(struct psmouse *, void *, char *); \ | ||
145 | __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, NULL, 1) | ||
146 | |||
147 | #define PSMOUSE_DEFINE_WO_ATTR(_name, _mode, _data, _set) \ | ||
148 | static ssize_t _set(struct psmouse *, void *, const char *, size_t); \ | ||
149 | __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, 1) | ||
139 | 150 | ||
140 | #endif /* _PSMOUSE_H */ | 151 | #endif /* _PSMOUSE_H */ |