aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/xpad.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 21:13:17 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 21:16:12 -0400
commita3d52136ee8f7399859f9a0824470fd49b1d1a00 (patch)
treeac0fd3d1efc356029cbbc5e413f778f7231cd909 /drivers/usb/input/xpad.c
parent5b339915762d30b21995aa7263e74081f2f1110a (diff)
parent84767d00a8fd54dd97866561f6e2ee246c8e1cdc (diff)
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input: (65 commits) Input: gpio_keys - add support for switches (EV_SW) Input: cobalt_btns - convert to use polldev library Input: add skeleton for simple polled devices Input: update some documentation Input: wistron - fix typo in keymap for Acer TM610 Input: add input_set_capability() helper Input: i8042 - add Fujitsu touchscreen/touchpad PNP IDs Input: i8042 - add Panasonic CF-29 to nomux list Input: lifebook - split into 2 devices Input: lifebook - add signature of Panasonic CF-29 Input: lifebook - activate 6-byte protocol on select models Input: lifebook - work properly on Panasonic CF-18 Input: cobalt buttons - separate device and driver registration Input: ati_remote - make button repeat sensitivity configurable Input: pxa27x - do not use deprecated SA_INTERRUPT flag Input: ucb1400 - make delays configurable Input: misc devices - switch to using input_dev->dev.parent Input: joysticks - switch to using input_dev->dev.parent Input: touchscreens - switch to using input_dev->dev.parent Input: mice - switch to using input_dev->dev.parent ... Fixed up conflicts with core device model removal of "struct subsystem" manually. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/input/xpad.c')
-rw-r--r--drivers/usb/input/xpad.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index e4bc76ebc835..735723912950 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -267,7 +267,7 @@ exit:
267 267
268static int xpad_open (struct input_dev *dev) 268static int xpad_open (struct input_dev *dev)
269{ 269{
270 struct usb_xpad *xpad = dev->private; 270 struct usb_xpad *xpad = input_get_drvdata(dev);
271 271
272 xpad->irq_in->dev = xpad->udev; 272 xpad->irq_in->dev = xpad->udev;
273 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) 273 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
@@ -278,7 +278,7 @@ static int xpad_open (struct input_dev *dev)
278 278
279static void xpad_close (struct input_dev *dev) 279static void xpad_close (struct input_dev *dev)
280{ 280{
281 struct usb_xpad *xpad = dev->private; 281 struct usb_xpad *xpad = input_get_drvdata(dev);
282 282
283 usb_kill_urb(xpad->irq_in); 283 usb_kill_urb(xpad->irq_in);
284} 284}
@@ -312,6 +312,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
312 struct input_dev *input_dev; 312 struct input_dev *input_dev;
313 struct usb_endpoint_descriptor *ep_irq_in; 313 struct usb_endpoint_descriptor *ep_irq_in;
314 int i; 314 int i;
315 int error = -ENOMEM;
315 316
316 for (i = 0; xpad_device[i].idVendor; i++) { 317 for (i = 0; xpad_device[i].idVendor; i++) {
317 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && 318 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
@@ -344,8 +345,10 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
344 input_dev->name = xpad_device[i].name; 345 input_dev->name = xpad_device[i].name;
345 input_dev->phys = xpad->phys; 346 input_dev->phys = xpad->phys;
346 usb_to_input_id(udev, &input_dev->id); 347 usb_to_input_id(udev, &input_dev->id);
347 input_dev->cdev.dev = &intf->dev; 348 input_dev->dev.parent = &intf->dev;
348 input_dev->private = xpad; 349
350 input_set_drvdata(input_dev, xpad);
351
349 input_dev->open = xpad_open; 352 input_dev->open = xpad_open;
350 input_dev->close = xpad_close; 353 input_dev->close = xpad_close;
351 354
@@ -373,15 +376,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
373 xpad->irq_in->transfer_dma = xpad->idata_dma; 376 xpad->irq_in->transfer_dma = xpad->idata_dma;
374 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 377 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
375 378
376 input_register_device(xpad->dev); 379 error = input_register_device(xpad->dev);
380 if (error)
381 goto fail3;
377 382
378 usb_set_intfdata(intf, xpad); 383 usb_set_intfdata(intf, xpad);
379 return 0; 384 return 0;
380 385
381fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); 386 fail3: usb_free_urb(xpad->irq_in);
382fail1: input_free_device(input_dev); 387 fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
388 fail1: input_free_device(input_dev);
383 kfree(xpad); 389 kfree(xpad);
384 return -ENOMEM; 390 return error;
385 391
386} 392}
387 393