aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2011-11-17 06:23:50 -0500
committerJiri Kosina <jkosina@suse.cz>2011-12-21 05:18:35 -0500
commit4371ea8202e98c8ef77ca887de3b19affbb3498f (patch)
treefc69c8be52b10dd549237ac117870e1fb872dfe8 /drivers/hid/hid-input.c
parentf0befcd64bc57e6a0b7a96c37c55f79e6b999af7 (diff)
HID: usbhid: defer LED setting to a workqueue
Defer LED setting action to a workqueue. This is more likely to send all LED change events in a single URB. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Acked-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index b9b8c75a6f9a..c6ee632bfd68 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -976,6 +976,48 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
976} 976}
977EXPORT_SYMBOL_GPL(hidinput_find_field); 977EXPORT_SYMBOL_GPL(hidinput_find_field);
978 978
979struct hid_field *hidinput_get_led_field(struct hid_device *hid)
980{
981 struct hid_report *report;
982 struct hid_field *field;
983 int i, j;
984
985 list_for_each_entry(report,
986 &hid->report_enum[HID_OUTPUT_REPORT].report_list,
987 list) {
988 for (i = 0; i < report->maxfield; i++) {
989 field = report->field[i];
990 for (j = 0; j < field->maxusage; j++)
991 if (field->usage[j].type == EV_LED)
992 return field;
993 }
994 }
995 return NULL;
996}
997EXPORT_SYMBOL_GPL(hidinput_get_led_field);
998
999unsigned int hidinput_count_leds(struct hid_device *hid)
1000{
1001 struct hid_report *report;
1002 struct hid_field *field;
1003 int i, j;
1004 unsigned int count = 0;
1005
1006 list_for_each_entry(report,
1007 &hid->report_enum[HID_OUTPUT_REPORT].report_list,
1008 list) {
1009 for (i = 0; i < report->maxfield; i++) {
1010 field = report->field[i];
1011 for (j = 0; j < field->maxusage; j++)
1012 if (field->usage[j].type == EV_LED &&
1013 field->value[j])
1014 count += 1;
1015 }
1016 }
1017 return count;
1018}
1019EXPORT_SYMBOL_GPL(hidinput_count_leds);
1020
979static int hidinput_open(struct input_dev *dev) 1021static int hidinput_open(struct input_dev *dev)
980{ 1022{
981 struct hid_device *hid = input_get_drvdata(dev); 1023 struct hid_device *hid = input_get_drvdata(dev);