diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-06-26 01:48:47 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-06-26 01:48:47 -0400 |
commit | 1e0afb288e56d469ca1c583342bb9782d49333c6 (patch) | |
tree | 5d2f5d4ebc029a5361d66acebec3a8023ea05ad4 /drivers/input/mousedev.c | |
parent | f60d2b111cd55c335c2b70e50d66a612d2b10856 (diff) |
Input: fix formatting to better follow CodingStyle
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r-- | drivers/input/mousedev.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index b685a507955d..eb721b11ff37 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -123,7 +123,9 @@ static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mous | |||
123 | 123 | ||
124 | if (mousedev->touch) { | 124 | if (mousedev->touch) { |
125 | size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; | 125 | size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; |
126 | if (size == 0) size = 256 * 2; | 126 | if (size == 0) |
127 | size = 256 * 2; | ||
128 | |||
127 | switch (code) { | 129 | switch (code) { |
128 | case ABS_X: | 130 | case ABS_X: |
129 | fx(0) = value; | 131 | fx(0) = value; |
@@ -155,18 +157,24 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, | |||
155 | switch (code) { | 157 | switch (code) { |
156 | case ABS_X: | 158 | case ABS_X: |
157 | size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; | 159 | size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; |
158 | if (size == 0) size = xres ? : 1; | 160 | if (size == 0) |
159 | if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; | 161 | size = xres ? : 1; |
160 | if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; | 162 | if (value > dev->absmax[ABS_X]) |
163 | value = dev->absmax[ABS_X]; | ||
164 | if (value < dev->absmin[ABS_X]) | ||
165 | value = dev->absmin[ABS_X]; | ||
161 | mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; | 166 | mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; |
162 | mousedev->packet.abs_event = 1; | 167 | mousedev->packet.abs_event = 1; |
163 | break; | 168 | break; |
164 | 169 | ||
165 | case ABS_Y: | 170 | case ABS_Y: |
166 | size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; | 171 | size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; |
167 | if (size == 0) size = yres ? : 1; | 172 | if (size == 0) |
168 | if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; | 173 | size = yres ? : 1; |
169 | if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; | 174 | if (value > dev->absmax[ABS_Y]) |
175 | value = dev->absmax[ABS_Y]; | ||
176 | if (value < dev->absmin[ABS_Y]) | ||
177 | value = dev->absmin[ABS_Y]; | ||
170 | mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; | 178 | mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; |
171 | mousedev->packet.abs_event = 1; | 179 | mousedev->packet.abs_event = 1; |
172 | break; | 180 | break; |
@@ -202,7 +210,7 @@ static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int | |||
202 | case BTN_SIDE: index = 3; break; | 210 | case BTN_SIDE: index = 3; break; |
203 | case BTN_4: | 211 | case BTN_4: |
204 | case BTN_EXTRA: index = 4; break; | 212 | case BTN_EXTRA: index = 4; break; |
205 | default: return; | 213 | default: return; |
206 | } | 214 | } |
207 | 215 | ||
208 | if (value) { | 216 | if (value) { |
@@ -285,10 +293,9 @@ static void mousedev_touchpad_touch(struct mousedev *mousedev, int value) | |||
285 | mousedev->touch = mousedev->pkt_count = 0; | 293 | mousedev->touch = mousedev->pkt_count = 0; |
286 | mousedev->frac_dx = 0; | 294 | mousedev->frac_dx = 0; |
287 | mousedev->frac_dy = 0; | 295 | mousedev->frac_dy = 0; |
288 | } | 296 | |
289 | else | 297 | } else if (!mousedev->touch) |
290 | if (!mousedev->touch) | 298 | mousedev->touch = jiffies; |
291 | mousedev->touch = jiffies; | ||
292 | } | 299 | } |
293 | 300 | ||
294 | static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | 301 | static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) |
@@ -327,7 +334,7 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig | |||
327 | mousedev->pkt_count++; | 334 | mousedev->pkt_count++; |
328 | /* Input system eats duplicate events, but we need all of them | 335 | /* Input system eats duplicate events, but we need all of them |
329 | * to do correct averaging so apply present one forward | 336 | * to do correct averaging so apply present one forward |
330 | */ | 337 | */ |
331 | fx(0) = fx(1); | 338 | fx(0) = fx(1); |
332 | fy(0) = fy(1); | 339 | fy(0) = fy(1); |
333 | } | 340 | } |
@@ -346,7 +353,9 @@ static int mousedev_fasync(int fd, struct file *file, int on) | |||
346 | { | 353 | { |
347 | int retval; | 354 | int retval; |
348 | struct mousedev_list *list = file->private_data; | 355 | struct mousedev_list *list = file->private_data; |
356 | |||
349 | retval = fasync_helper(fd, file, on, &list->fasync); | 357 | retval = fasync_helper(fd, file, on, &list->fasync); |
358 | |||
350 | return retval < 0 ? retval : 0; | 359 | return retval < 0 ? retval : 0; |
351 | } | 360 | } |
352 | 361 | ||
@@ -507,14 +516,16 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si | |||
507 | list->imexseq = 0; | 516 | list->imexseq = 0; |
508 | list->mode = MOUSEDEV_EMUL_EXPS; | 517 | list->mode = MOUSEDEV_EMUL_EXPS; |
509 | } | 518 | } |
510 | } else list->imexseq = 0; | 519 | } else |
520 | list->imexseq = 0; | ||
511 | 521 | ||
512 | if (c == mousedev_imps_seq[list->impsseq]) { | 522 | if (c == mousedev_imps_seq[list->impsseq]) { |
513 | if (++list->impsseq == MOUSEDEV_SEQ_LEN) { | 523 | if (++list->impsseq == MOUSEDEV_SEQ_LEN) { |
514 | list->impsseq = 0; | 524 | list->impsseq = 0; |
515 | list->mode = MOUSEDEV_EMUL_IMPS; | 525 | list->mode = MOUSEDEV_EMUL_IMPS; |
516 | } | 526 | } |
517 | } else list->impsseq = 0; | 527 | } else |
528 | list->impsseq = 0; | ||
518 | 529 | ||
519 | list->ps2[0] = 0xfa; | 530 | list->ps2[0] = 0xfa; |
520 | 531 | ||
@@ -598,6 +609,7 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co | |||
598 | static unsigned int mousedev_poll(struct file *file, poll_table *wait) | 609 | static unsigned int mousedev_poll(struct file *file, poll_table *wait) |
599 | { | 610 | { |
600 | struct mousedev_list *list = file->private_data; | 611 | struct mousedev_list *list = file->private_data; |
612 | |||
601 | poll_wait(file, &list->mousedev->wait, wait); | 613 | poll_wait(file, &list->mousedev->wait, wait); |
602 | return ((list->ready || list->buffer) ? (POLLIN | POLLRDNORM) : 0) | | 614 | return ((list->ready || list->buffer) ? (POLLIN | POLLRDNORM) : 0) | |
603 | (list->mousedev->exist ? 0 : (POLLHUP | POLLERR)); | 615 | (list->mousedev->exist ? 0 : (POLLHUP | POLLERR)); |