aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2013-09-11 16:12:24 -0400
committerJiri Kosina <jkosina@suse.cz>2013-09-24 05:47:47 -0400
commit0c5218362b429ab9cbf295dfe069ce410d180493 (patch)
tree56b2d893485168173b3253f39e72eeacb83779c8
parent01ab35f14aafbc6e159254f52444895661c2f604 (diff)
HID: lenovo-tpkbd: remove usb dependency
lenovo tpkbd currently relies on the usb interface number to detect if it is dealing with the touchpad interface or not. As the report descriptors of the interface 0 does not contain the button 3, we can use this to remove the need to check for usb. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/Kconfig2
-rw-r--r--drivers/hid/hid-lenovo-tpkbd.c20
2 files changed, 7 insertions, 15 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 71b70e3a7a71..53747245d904 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -322,7 +322,7 @@ config HID_LCPOWER
322 322
323config HID_LENOVO_TPKBD 323config HID_LENOVO_TPKBD
324 tristate "Lenovo ThinkPad USB Keyboard with TrackPoint" 324 tristate "Lenovo ThinkPad USB Keyboard with TrackPoint"
325 depends on USB_HID 325 depends on HID
326 select NEW_LEDS 326 select NEW_LEDS
327 select LEDS_CLASS 327 select LEDS_CLASS
328 ---help--- 328 ---help---
diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c
index 0d9a276af16a..2d25b6cbbc05 100644
--- a/drivers/hid/hid-lenovo-tpkbd.c
+++ b/drivers/hid/hid-lenovo-tpkbd.c
@@ -14,11 +14,9 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sysfs.h> 15#include <linux/sysfs.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/usb.h>
18#include <linux/hid.h> 17#include <linux/hid.h>
19#include <linux/input.h> 18#include <linux/input.h>
20#include <linux/leds.h> 19#include <linux/leds.h>
21#include "usbhid/usbhid.h"
22 20
23#include "hid-ids.h" 21#include "hid-ids.h"
24 22
@@ -41,10 +39,9 @@ static int tpkbd_input_mapping(struct hid_device *hdev,
41 struct hid_input *hi, struct hid_field *field, 39 struct hid_input *hi, struct hid_field *field,
42 struct hid_usage *usage, unsigned long **bit, int *max) 40 struct hid_usage *usage, unsigned long **bit, int *max)
43{ 41{
44 struct usbhid_device *uhdev; 42 if (usage->hid == (HID_UP_BUTTON | 0x0010)) {
45 43 /* mark the device as pointer */
46 uhdev = (struct usbhid_device *) hdev->driver_data; 44 hid_set_drvdata(hdev, (void *)1);
47 if (uhdev->ifnum == 1 && usage->hid == (HID_UP_BUTTON | 0x0010)) {
48 map_key_clear(KEY_MICMUTE); 45 map_key_clear(KEY_MICMUTE);
49 return 1; 46 return 1;
50 } 47 }
@@ -398,7 +395,6 @@ static int tpkbd_probe(struct hid_device *hdev,
398 const struct hid_device_id *id) 395 const struct hid_device_id *id)
399{ 396{
400 int ret; 397 int ret;
401 struct usbhid_device *uhdev;
402 398
403 ret = hid_parse(hdev); 399 ret = hid_parse(hdev);
404 if (ret) { 400 if (ret) {
@@ -412,9 +408,8 @@ static int tpkbd_probe(struct hid_device *hdev,
412 goto err; 408 goto err;
413 } 409 }
414 410
415 uhdev = (struct usbhid_device *) hdev->driver_data; 411 if (hid_get_drvdata(hdev)) {
416 412 hid_set_drvdata(hdev, NULL);
417 if (uhdev->ifnum == 1) {
418 ret = tpkbd_probe_tp(hdev); 413 ret = tpkbd_probe_tp(hdev);
419 if (ret) 414 if (ret)
420 goto err_hid; 415 goto err_hid;
@@ -442,10 +437,7 @@ static void tpkbd_remove_tp(struct hid_device *hdev)
442 437
443static void tpkbd_remove(struct hid_device *hdev) 438static void tpkbd_remove(struct hid_device *hdev)
444{ 439{
445 struct usbhid_device *uhdev; 440 if (hid_get_drvdata(hdev))
446
447 uhdev = (struct usbhid_device *) hdev->driver_data;
448 if (uhdev->ifnum == 1)
449 tpkbd_remove_tp(hdev); 441 tpkbd_remove_tp(hdev);
450 442
451 hid_hw_stop(hdev); 443 hid_hw_stop(hdev);