diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-04 02:40:20 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-04 02:40:20 -0400 |
commit | cfe9e88866fe892f4f71bf132c64ec8bd5256e5e (patch) | |
tree | c1da19c8a2b1f9f1a32597554660747fe0aa5132 /drivers/input/mouse/logips2pp.c | |
parent | 15c42e5a1f0bccb69508059b8ae0720840068b8e (diff) |
Input: rework psmouse attributes to reduce module size
Rearrange attribute code to use generic show and set handlers
instead of replicating them for every attribute; switch to
using attribute_group instead of creating all attributes
manually. All this saves about 4K.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/logips2pp.c')
-rw-r--r-- | drivers/input/mouse/logips2pp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 48d2b20d2642..e65c2798a491 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -150,12 +150,12 @@ static void ps2pp_set_smartscroll(struct psmouse *psmouse, unsigned int smartscr | |||
150 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | 150 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); |
151 | } | 151 | } |
152 | 152 | ||
153 | static ssize_t psmouse_attr_show_smartscroll(struct psmouse *psmouse, char *buf) | 153 | static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, void *data, char *buf) |
154 | { | 154 | { |
155 | return sprintf(buf, "%d\n", psmouse->smartscroll ? 1 : 0); | 155 | return sprintf(buf, "%d\n", psmouse->smartscroll ? 1 : 0); |
156 | } | 156 | } |
157 | 157 | ||
158 | static ssize_t psmouse_attr_set_smartscroll(struct psmouse *psmouse, const char *buf, size_t count) | 158 | static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, const char *buf, size_t count) |
159 | { | 159 | { |
160 | unsigned long value; | 160 | unsigned long value; |
161 | char *rest; | 161 | char *rest; |
@@ -169,7 +169,8 @@ static ssize_t psmouse_attr_set_smartscroll(struct psmouse *psmouse, const char | |||
169 | return count; | 169 | return count; |
170 | } | 170 | } |
171 | 171 | ||
172 | PSMOUSE_DEFINE_ATTR(smartscroll); | 172 | PSMOUSE_DEFINE_ATTR(smartscroll, S_IWUSR | S_IRUGO, NULL, |
173 | ps2pp_attr_show_smartscroll, ps2pp_attr_set_smartscroll); | ||
173 | 174 | ||
174 | /* | 175 | /* |
175 | * Support 800 dpi resolution _only_ if the user wants it (there are good | 176 | * Support 800 dpi resolution _only_ if the user wants it (there are good |
@@ -194,7 +195,7 @@ static void ps2pp_set_resolution(struct psmouse *psmouse, unsigned int resolutio | |||
194 | 195 | ||
195 | static void ps2pp_disconnect(struct psmouse *psmouse) | 196 | static void ps2pp_disconnect(struct psmouse *psmouse) |
196 | { | 197 | { |
197 | device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll); | 198 | device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll.dattr); |
198 | } | 199 | } |
199 | 200 | ||
200 | static struct ps2pp_info *get_model_info(unsigned char model) | 201 | static struct ps2pp_info *get_model_info(unsigned char model) |
@@ -379,7 +380,8 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties) | |||
379 | psmouse->set_resolution = ps2pp_set_resolution; | 380 | psmouse->set_resolution = ps2pp_set_resolution; |
380 | psmouse->disconnect = ps2pp_disconnect; | 381 | psmouse->disconnect = ps2pp_disconnect; |
381 | 382 | ||
382 | device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll); | 383 | device_create_file(&psmouse->ps2dev.serio->dev, |
384 | &psmouse_attr_smartscroll.dattr); | ||
383 | } | 385 | } |
384 | } | 386 | } |
385 | 387 | ||