aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/kbtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input/kbtab.c')
-rw-r--r--drivers/usb/input/kbtab.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index a68c5b4e7b37..d2f0f90a9bcd 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -36,7 +36,6 @@ struct kbtab {
36 struct input_dev dev; 36 struct input_dev dev;
37 struct usb_device *usbdev; 37 struct usb_device *usbdev;
38 struct urb *irq; 38 struct urb *irq;
39 int open;
40 int x, y; 39 int x, y;
41 int button; 40 int button;
42 int pressure; 41 int pressure;
@@ -79,12 +78,12 @@ static void kbtab_irq(struct urb *urb, struct pt_regs *regs)
79 /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/ 78 /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/
80 input_report_key(dev, BTN_RIGHT, data[0] & 0x02); 79 input_report_key(dev, BTN_RIGHT, data[0] & 0x02);
81 80
82 if( -1 == kb_pressure_click){ 81 if (-1 == kb_pressure_click) {
83 input_report_abs(dev, ABS_PRESSURE, kbtab->pressure); 82 input_report_abs(dev, ABS_PRESSURE, kbtab->pressure);
84 } else { 83 } else {
85 input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0); 84 input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0);
86 }; 85 };
87 86
88 input_sync(dev); 87 input_sync(dev);
89 88
90 exit: 89 exit:
@@ -105,14 +104,9 @@ static int kbtab_open(struct input_dev *dev)
105{ 104{
106 struct kbtab *kbtab = dev->private; 105 struct kbtab *kbtab = dev->private;
107 106
108 if (kbtab->open++)
109 return 0;
110
111 kbtab->irq->dev = kbtab->usbdev; 107 kbtab->irq->dev = kbtab->usbdev;
112 if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) { 108 if (usb_submit_urb(kbtab->irq, GFP_KERNEL))
113 kbtab->open--;
114 return -EIO; 109 return -EIO;
115 }
116 110
117 return 0; 111 return 0;
118} 112}
@@ -121,8 +115,7 @@ static void kbtab_close(struct input_dev *dev)
121{ 115{
122 struct kbtab *kbtab = dev->private; 116 struct kbtab *kbtab = dev->private;
123 117
124 if (!--kbtab->open) 118 usb_kill_urb(kbtab->irq);
125 usb_kill_urb(kbtab->irq);
126} 119}
127 120
128static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *id) 121static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *id)
@@ -161,7 +154,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
161 kbtab->dev.absmax[ABS_X] = 0x2000; 154 kbtab->dev.absmax[ABS_X] = 0x2000;
162 kbtab->dev.absmax[ABS_Y] = 0x1750; 155 kbtab->dev.absmax[ABS_Y] = 0x1750;
163 kbtab->dev.absmax[ABS_PRESSURE] = 0xff; 156 kbtab->dev.absmax[ABS_PRESSURE] = 0xff;
164 157
165 kbtab->dev.absfuzz[ABS_X] = 4; 158 kbtab->dev.absfuzz[ABS_X] = 4;
166 kbtab->dev.absfuzz[ABS_Y] = 4; 159 kbtab->dev.absfuzz[ABS_Y] = 4;
167 160