aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r--drivers/input/mousedev.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 2d0af44ac4b9..81fd7a97a93d 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -40,15 +40,15 @@ MODULE_LICENSE("GPL");
40#endif 40#endif
41 41
42static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X; 42static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X;
43module_param(xres, uint, 0); 43module_param(xres, uint, 0644);
44MODULE_PARM_DESC(xres, "Horizontal screen resolution"); 44MODULE_PARM_DESC(xres, "Horizontal screen resolution");
45 45
46static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y; 46static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y;
47module_param(yres, uint, 0); 47module_param(yres, uint, 0644);
48MODULE_PARM_DESC(yres, "Vertical screen resolution"); 48MODULE_PARM_DESC(yres, "Vertical screen resolution");
49 49
50static unsigned tap_time = 200; 50static unsigned tap_time = 200;
51module_param(tap_time, uint, 0); 51module_param(tap_time, uint, 0644);
52MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)"); 52MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)");
53 53
54struct mousedev_hw_data { 54struct mousedev_hw_data {
@@ -155,7 +155,7 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev,
155 switch (code) { 155 switch (code) {
156 case ABS_X: 156 case ABS_X:
157 size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; 157 size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
158 if (size == 0) size = xres; 158 if (size == 0) size = xres ? : 1;
159 if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; 159 if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X];
160 if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; 160 if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X];
161 mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; 161 mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size;
@@ -164,7 +164,7 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev,
164 164
165 case ABS_Y: 165 case ABS_Y:
166 size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; 166 size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y];
167 if (size == 0) size = yres; 167 if (size == 0) size = yres ? : 1;
168 if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; 168 if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y];
169 if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; 169 if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y];
170 mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; 170 mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size;