Commit 3b720944 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: psmouse - allow defining read-only attributes

Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 25a70e38
...@@ -116,9 +116,7 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *at ...@@ -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, ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count); const char *buf, size_t count);
#define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \ #define __PSMOUSE_DEFINE_ATTR_VAR(_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); \
static struct psmouse_attribute psmouse_attr_##_name = { \ static struct psmouse_attribute psmouse_attr_##_name = { \
.dattr = { \ .dattr = { \
.attr = { \ .attr = { \
...@@ -134,7 +132,20 @@ static struct psmouse_attribute psmouse_attr_##_name = { \ ...@@ -134,7 +132,20 @@ static struct psmouse_attribute psmouse_attr_##_name = { \
.protect = _protect, \ .protect = _protect, \
} }
#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) \ #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \
__PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1) __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 */ #endif /* _PSMOUSE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment