From b94e3c94aae04a911d61f620f4ff5b575fc196ad Mon Sep 17 00:00:00 2001 From: Matthieu CASTET Date: Thu, 28 Jun 2012 16:53:11 +0200 Subject: HID: hid-core: optimize in case of hidraw When using hidraw, hid buffer can be big and take lot's of time to process (interrupt) kernel context. Don't try to parse report if we are only interrested in hidraw. Also don't prepare data for debug stuff if no debugfs file are opened. Signed-off-by: Matthieu CASTET Signed-off-by: Jiri Kosina --- drivers/hid/hid-picolcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/hid/hid-picolcd.c') diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 45c3433f798..3e0a1e5d2ad 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c @@ -1846,7 +1846,7 @@ static void picolcd_debug_out_report(struct picolcd_data *data, #define BUFF_SZ 256 /* Avoid unnecessary overhead if debugfs is disabled */ - if (!hdev->debug_events) + if (list_empty(&hdev->debug_list)) return; buff = kmalloc(BUFF_SZ, GFP_ATOMIC); -- cgit v1.2.3 From 4bc19f62c57b8ccdd1c48e875752bd59abfb7aae Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 20 Jul 2012 11:49:09 +0200 Subject: HID: Allow drivers to be their own listener hid-picolcd and hid-wiimote do not allow any of hidinput, hiddev or hidraw to claim the device but still want to remain on the bus. Hence, if a driver uses the raw_event callback but no other listener claimed the device, we still leave it on the bus as the driver handles everything by itself. It thus becomes its own listener. Under some circumstances (eg., hidinput_connect() fails and raw_event set) a device may be left on the bus even though it requires external listeners. But then if hidinput_connect() fails there are bigger issues than a device that is left unhandled. So we can safely use this heuristic to avoid adding another flag for special devices like hid-picolcd and hid-wiimote. This also removes the ugly hack from hid-picolcd as this is no longer required. Signed-off-by: David Herrmann Acked-by: Henrik Rydberg Signed-off-by: Jiri Kosina --- drivers/hid/hid-picolcd.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/hid/hid-picolcd.c') diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 45c3433f798..74c388dcb5b 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c @@ -2613,11 +2613,7 @@ static int picolcd_probe(struct hid_device *hdev, goto err_cleanup_data; } - /* We don't use hidinput but hid_hw_start() fails if nothing is - * claimed. So spoof claimed input. */ - hdev->claimed = HID_CLAIMED_INPUT; error = hid_hw_start(hdev, 0); - hdev->claimed = 0; if (error) { hid_err(hdev, "hardware start failed\n"); goto err_cleanup_data; -- cgit v1.2.3