From: Jiri Kosina <jkosina@suse.cz>
Date: Fri, 6 Sep 2013 09:58:37 +0000 (+0200)
Subject: Merge branches 'for-3.12/devm', 'for-3.12/i2c-hid', 'for-3.12/i2c-hid-dt', 'for-3... 
X-Git-Tag: firefly_0821_release~176^2~5413^2~1
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=63faf15dba4a7d6fb18ed5c45670a152d0c5330b;p=firefly-linux-kernel-4.4.55.git

Merge branches 'for-3.12/devm', 'for-3.12/i2c-hid', 'for-3.12/i2c-hid-dt', 'for-3.12/logitech', 'for-3.12/multitouch-win8', 'for-3.12/trasnport-driver-cleanup', 'for-3.12/uhid', 'for-3.12/upstream' and 'for-3.12/wiimote' into for-linus
---

63faf15dba4a7d6fb18ed5c45670a152d0c5330b
diff --cc drivers/hid/hid-core.c
index 36668d1aca8f,e39dac68063c,e39dac68063c,660dce964162,e39dac68063c,36668d1aca8f,2ac13ca6edaa,627fea6593a3..2c778542e40d
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@@@@@@@@ -690,48 -690,48 -690,48 -739,41 -690,48 -690,48 -694,48 -690,48 +743,41 @@@@@@@@@ static int hid_scan_main(struct hid_par
         */
        static int hid_scan_report(struct hid_device *hid)
        {
--- ----	unsigned int page = 0, delim = 0;
+++ ++++	struct hid_parser *parser;
+++ ++++	struct hid_item item;
        	__u8 *start = hid->dev_rdesc;
        	__u8 *end = start + hid->dev_rsize;
--- ----	unsigned int u, u_min = 0, u_max = 0;
--- ----	struct hid_item item;
+++ ++++	static int (*dispatch_type[])(struct hid_parser *parser,
+++ ++++				      struct hid_item *item) = {
+++ ++++		hid_scan_main,
+++ ++++		hid_parser_global,
+++ ++++		hid_parser_local,
+++ ++++		hid_parser_reserved
+++ ++++	};
+++ +++ 
+++ ++++	parser = vzalloc(sizeof(struct hid_parser));
+++ ++++	if (!parser)
+++ ++++		return -ENOMEM;
       +
+++ ++++	parser->device = hid;
        	hid->group = HID_GROUP_GENERIC;
--- ----	while ((start = fetch_item(start, end, &item)) != NULL) {
--- ----		if (item.format != HID_ITEM_FORMAT_SHORT)
--- ----			return -EINVAL;
--- ----		if (item.type == HID_ITEM_TYPE_GLOBAL) {
--- ----			if (item.tag == HID_GLOBAL_ITEM_TAG_USAGE_PAGE)
--- ----				page = item_udata(&item) << 16;
--- ----		} else if (item.type == HID_ITEM_TYPE_LOCAL) {
--- ----			if (delim > 1)
--- ----				break;
--- ----			u = item_udata(&item);
--- ----			if (item.size <= 2)
--- ----				u += page;
--- ----			switch (item.tag) {
--- ----			case HID_LOCAL_ITEM_TAG_DELIMITER:
--- ----				delim += !!u;
--- ----				break;
--- ----			case HID_LOCAL_ITEM_TAG_USAGE:
--- ----				hid_scan_usage(hid, u);
--- ----				break;
--- ----			case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
--- ----				u_min = u;
--- ----				break;
--- ----			case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
--- ----				u_max = u;
--- ----				for (u = u_min; u <= u_max; u++)
--- ----					hid_scan_usage(hid, u);
--- ----				break;
--- ----			}
--- ----		} else if (page == HID_UP_SENSOR &&
--- ----			item.type == HID_ITEM_TYPE_MAIN &&
--- ----			item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
--- ----			(item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL)
--- ----			hid->group = HID_GROUP_SENSOR_HUB;
--- ----	}
        
+++ ++++	/*
+++ ++++	 * The parsing is simpler than the one in hid_open_report() as we should
+++ ++++	 * be robust against hid errors. Those errors will be raised by
+++ ++++	 * hid_open_report() anyway.
+++ ++++	 */
+++ ++++	while ((start = fetch_item(start, end, &item)) != NULL)
+++ ++++		dispatch_type[item.type](parser, &item);
+++ ++++
+++ ++++	/*
+++ ++++	 * Handle special flags set during scanning.
+++ ++++	 */
+++ ++++	if ((parser->scan_flags & HID_SCAN_FLAG_MT_WIN_8) &&
+++ ++++	    (hid->group == HID_GROUP_MULTITOUCH))
+++ ++++		hid->group = HID_GROUP_MULTITOUCH_WIN_8;
+++ ++++
+++ ++++	vfree(parser);
        	return 0;
        }