diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-18 20:45:02 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-20 06:14:20 +0200 |
commit | 3b72094409ab673d096b3852f4636be540780faf (patch) | |
tree | 4113e0da672247304045b64a956af5481f533cfa /drivers/input | |
parent | Input: eeti_ts - allow active high irq lines (diff) | |
download | linux-3b72094409ab673d096b3852f4636be540780faf.tar.xz linux-3b72094409ab673d096b3852f4636be540780faf.zip |
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 ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); -#define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \ -static ssize_t _show(struct psmouse *, void *data, char *); \ -static ssize_t _set(struct psmouse *, void *data, const char *, size_t); \ +#define __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect) \ static struct psmouse_attribute psmouse_attr_##_name = { \ .dattr = { \ .attr = { \ @@ -134,7 +132,20 @@ static struct psmouse_attribute psmouse_attr_##_name = { \ .protect = _protect, \ } -#define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \ - __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1) +#define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \ + static ssize_t _show(struct psmouse *, void *, char *); \ + static ssize_t _set(struct psmouse *, void *, const char *, size_t); \ + __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect) + +#define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \ + __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1) + +#define PSMOUSE_DEFINE_RO_ATTR(_name, _mode, _data, _show) \ + static ssize_t _show(struct psmouse *, void *, char *); \ + __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, NULL, 1) + +#define PSMOUSE_DEFINE_WO_ATTR(_name, _mode, _data, _set) \ + static ssize_t _set(struct psmouse *, void *, const char *, size_t); \ + __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, 1) #endif /* _PSMOUSE_H */ |