aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid/usbkbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/usbhid/usbkbd.c')
-rw-r--r--drivers/hid/usbhid/usbkbd.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index 65aa12e8d7b3..130978780713 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -133,12 +133,11 @@ resubmit:
133static int usb_kbd_event(struct input_dev *dev, unsigned int type, 133static int usb_kbd_event(struct input_dev *dev, unsigned int type,
134 unsigned int code, int value) 134 unsigned int code, int value)
135{ 135{
136 struct usb_kbd *kbd = dev->private; 136 struct usb_kbd *kbd = input_get_drvdata(dev);
137 137
138 if (type != EV_LED) 138 if (type != EV_LED)
139 return -1; 139 return -1;
140 140
141
142 kbd->newleds = (!!test_bit(LED_KANA, dev->led) << 3) | (!!test_bit(LED_COMPOSE, dev->led) << 3) | 141 kbd->newleds = (!!test_bit(LED_KANA, dev->led) << 3) | (!!test_bit(LED_COMPOSE, dev->led) << 3) |
143 (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_CAPSL, dev->led) << 1) | 142 (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_CAPSL, dev->led) << 1) |
144 (!!test_bit(LED_NUML, dev->led)); 143 (!!test_bit(LED_NUML, dev->led));
@@ -175,7 +174,7 @@ static void usb_kbd_led(struct urb *urb)
175 174
176static int usb_kbd_open(struct input_dev *dev) 175static int usb_kbd_open(struct input_dev *dev)
177{ 176{
178 struct usb_kbd *kbd = dev->private; 177 struct usb_kbd *kbd = input_get_drvdata(dev);
179 178
180 kbd->irq->dev = kbd->usbdev; 179 kbd->irq->dev = kbd->usbdev;
181 if (usb_submit_urb(kbd->irq, GFP_KERNEL)) 180 if (usb_submit_urb(kbd->irq, GFP_KERNEL))
@@ -186,7 +185,7 @@ static int usb_kbd_open(struct input_dev *dev)
186 185
187static void usb_kbd_close(struct input_dev *dev) 186static void usb_kbd_close(struct input_dev *dev)
188{ 187{
189 struct usb_kbd *kbd = dev->private; 188 struct usb_kbd *kbd = input_get_drvdata(dev);
190 189
191 usb_kill_urb(kbd->irq); 190 usb_kill_urb(kbd->irq);
192} 191}
@@ -211,12 +210,9 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd)
211{ 210{
212 usb_free_urb(kbd->irq); 211 usb_free_urb(kbd->irq);
213 usb_free_urb(kbd->led); 212 usb_free_urb(kbd->led);
214 if (kbd->new) 213 usb_buffer_free(dev, 8, kbd->new, kbd->new_dma);
215 usb_buffer_free(dev, 8, kbd->new, kbd->new_dma); 214 usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd->cr, kbd->cr_dma);
216 if (kbd->cr) 215 usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
217 usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd->cr, kbd->cr_dma);
218 if (kbd->leds)
219 usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
220} 216}
221 217
222static int usb_kbd_probe(struct usb_interface *iface, 218static int usb_kbd_probe(struct usb_interface *iface,
@@ -274,8 +270,9 @@ static int usb_kbd_probe(struct usb_interface *iface,
274 input_dev->name = kbd->name; 270 input_dev->name = kbd->name;
275 input_dev->phys = kbd->phys; 271 input_dev->phys = kbd->phys;
276 usb_to_input_id(dev, &input_dev->id); 272 usb_to_input_id(dev, &input_dev->id);
277 input_dev->cdev.dev = &iface->dev; 273 input_dev->dev.parent = &iface->dev;
278 input_dev->private = kbd; 274
275 input_set_drvdata(input_dev, kbd);
279 276
280 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); 277 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
281 input_dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL) | BIT(LED_COMPOSE) | BIT(LED_KANA); 278 input_dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL) | BIT(LED_COMPOSE) | BIT(LED_KANA);