diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-04 11:40:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-04 11:40:45 -0400 |
commit | 014642cb0a08d1b12c6089c48c7ba6002a0f6811 (patch) | |
tree | c4c3783d465bdd0c321f11996506bf17b90981c8 | |
parent | 8d448270fee5675adf81df9e35c2ec341735558f (diff) | |
parent | f1a9a149abc86903e81dd1b2e720f3f89874384b (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID fixes from Jiri Kosina:
- Workaround for device ID conflict between Masterkit MA901 usb radio
device and Atmel V-USB devices, to avoid regressions from older
kernels, by Alexey Klimov
- fix for possible race during input device registration in magicmouse
driver, by Benjamin Tissoires
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: magicmouse: fix race between input_register() and probe()
media: radio-ma901: return ENODEV in probe if usb_device doesn't match
HID: fix Masterkit MA901 hid quirks
-rw-r--r-- | drivers/hid/hid-core.c | 13 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 5 | ||||
-rw-r--r-- | drivers/hid/hid-magicmouse.c | 29 | ||||
-rw-r--r-- | drivers/media/radio/radio-ma901.c | 11 |
4 files changed, 45 insertions, 13 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 512b01c04ea7..aa341d135867 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
2077 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, | 2077 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
2078 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, | 2078 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
2079 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, | 2079 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, |
2080 | { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) }, | ||
2081 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | 2080 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
2082 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | 2081 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
2083 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | 2082 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
@@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev) | |||
2244 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) | 2243 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) |
2245 | return true; | 2244 | return true; |
2246 | break; | 2245 | break; |
2246 | case USB_VENDOR_ID_ATMEL_V_USB: | ||
2247 | /* Masterkit MA901 usb radio based on Atmel tiny85 chip and | ||
2248 | * it has the same USB ID as many Atmel V-USB devices. This | ||
2249 | * usb radio is handled by radio-ma901.c driver so we want | ||
2250 | * ignore the hid. Check the name, bus, product and ignore | ||
2251 | * if we have MA901 usb radio. | ||
2252 | */ | ||
2253 | if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && | ||
2254 | hdev->bus == BUS_USB && | ||
2255 | strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) | ||
2256 | return true; | ||
2257 | break; | ||
2247 | } | 2258 | } |
2248 | 2259 | ||
2249 | if (hdev->type == HID_TYPE_USBMOUSE && | 2260 | if (hdev->type == HID_TYPE_USBMOUSE && |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index c4388776f4e4..5309fd5eb0eb 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -158,6 +158,8 @@ | |||
158 | #define USB_VENDOR_ID_ATMEL 0x03eb | 158 | #define USB_VENDOR_ID_ATMEL 0x03eb |
159 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 159 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
160 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 | 160 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 |
161 | #define USB_VENDOR_ID_ATMEL_V_USB 0x16c0 | ||
162 | #define USB_DEVICE_ID_ATMEL_V_USB 0x05df | ||
161 | 163 | ||
162 | #define USB_VENDOR_ID_AUREAL 0x0755 | 164 | #define USB_VENDOR_ID_AUREAL 0x0755 |
163 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 | 165 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 |
@@ -557,9 +559,6 @@ | |||
557 | #define USB_VENDOR_ID_MADCATZ 0x0738 | 559 | #define USB_VENDOR_ID_MADCATZ 0x0738 |
558 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 | 560 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 |
559 | 561 | ||
560 | #define USB_VENDOR_ID_MASTERKIT 0x16c0 | ||
561 | #define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df | ||
562 | |||
563 | #define USB_VENDOR_ID_MCC 0x09db | 562 | #define USB_VENDOR_ID_MCC 0x09db |
564 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | 563 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
565 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | 564 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index f7f113ba083e..a8ce44296cfd 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev, | |||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||
465 | static void magicmouse_input_configured(struct hid_device *hdev, | ||
466 | struct hid_input *hi) | ||
467 | |||
468 | { | ||
469 | struct magicmouse_sc *msc = hid_get_drvdata(hdev); | ||
470 | |||
471 | int ret = magicmouse_setup_input(msc->input, hdev); | ||
472 | if (ret) { | ||
473 | hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); | ||
474 | /* clean msc->input to notify probe() of the failure */ | ||
475 | msc->input = NULL; | ||
476 | } | ||
477 | } | ||
478 | |||
479 | |||
465 | static int magicmouse_probe(struct hid_device *hdev, | 480 | static int magicmouse_probe(struct hid_device *hdev, |
466 | const struct hid_device_id *id) | 481 | const struct hid_device_id *id) |
467 | { | 482 | { |
@@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
493 | goto err_free; | 508 | goto err_free; |
494 | } | 509 | } |
495 | 510 | ||
496 | /* We do this after hid-input is done parsing reports so that | 511 | if (!msc->input) { |
497 | * hid-input uses the most natural button and axis IDs. | 512 | hid_err(hdev, "magicmouse input not registered\n"); |
498 | */ | 513 | ret = -ENOMEM; |
499 | if (msc->input) { | 514 | goto err_stop_hw; |
500 | ret = magicmouse_setup_input(msc->input, hdev); | ||
501 | if (ret) { | ||
502 | hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); | ||
503 | goto err_stop_hw; | ||
504 | } | ||
505 | } | 515 | } |
506 | 516 | ||
507 | if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) | 517 | if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) |
@@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = { | |||
568 | .remove = magicmouse_remove, | 578 | .remove = magicmouse_remove, |
569 | .raw_event = magicmouse_raw_event, | 579 | .raw_event = magicmouse_raw_event, |
570 | .input_mapping = magicmouse_input_mapping, | 580 | .input_mapping = magicmouse_input_mapping, |
581 | .input_configured = magicmouse_input_configured, | ||
571 | }; | 582 | }; |
572 | module_hid_driver(magicmouse_driver); | 583 | module_hid_driver(magicmouse_driver); |
573 | 584 | ||
diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c index c61f590029ad..348dafc0318a 100644 --- a/drivers/media/radio/radio-ma901.c +++ b/drivers/media/radio/radio-ma901.c | |||
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev) | |||
347 | static int usb_ma901radio_probe(struct usb_interface *intf, | 347 | static int usb_ma901radio_probe(struct usb_interface *intf, |
348 | const struct usb_device_id *id) | 348 | const struct usb_device_id *id) |
349 | { | 349 | { |
350 | struct usb_device *dev = interface_to_usbdev(intf); | ||
350 | struct ma901radio_device *radio; | 351 | struct ma901radio_device *radio; |
351 | int retval = 0; | 352 | int retval = 0; |
352 | 353 | ||
354 | /* Masterkit MA901 usb radio has the same USB ID as many others | ||
355 | * Atmel V-USB devices. Let's make additional checks to be sure | ||
356 | * that this is our device. | ||
357 | */ | ||
358 | |||
359 | if (dev->product && dev->manufacturer && | ||
360 | (strncmp(dev->product, "MA901", 5) != 0 | ||
361 | || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0)) | ||
362 | return -ENODEV; | ||
363 | |||
353 | radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); | 364 | radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); |
354 | if (!radio) { | 365 | if (!radio) { |
355 | dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); | 366 | dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); |