diff mbox series

HID: Add reserved item tag for main items

Message ID 20240926072541.109493-1-tatsuya.s2862@gmail.com
State Superseded
Headers show
Series HID: Add reserved item tag for main items | expand

Commit Message

Tatsuya S Sept. 26, 2024, 7:25 a.m. UTC
For main items, separate warning of reserved item tag from
warning of unknown item tag.
---
 drivers/hid/hid-core.c | 6 +++++-
 include/linux/hid.h    | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Jiri Kosina Nov. 6, 2024, 1:51 p.m. UTC | #1
On Thu, 26 Sep 2024, Tatsuya S wrote:

> For main items, separate warning of reserved item tag from
> warning of unknown item tag.

Sorry for the delay, this patch fell in between cracks.

I think the change is fine, could you please just extend the changelog 
with the reference to the relevant part of the specification, so that it's 
properly documented?

Thanks,
Tatsuya S Nov. 7, 2024, 5:38 a.m. UTC | #2
On 2024/11/06 22:51, Jiri Kosina wrote:
> On Thu, 26 Sep 2024, Tatsuya S wrote:
>
>> For main items, separate warning of reserved item tag from
>> warning of unknown item tag.
> Sorry for the delay, this patch fell in between cracks.

No problem, thank you for your review.

>
> I think the change is fine, could you please just extend the changelog
> with the reference to the relevant part of the specification, so that it's
> properly documented?
OK.
>
> Thanks,
>
diff mbox series

Patch

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 30de92d0bf0f..1793edb6239d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -629,7 +629,11 @@  static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)
 		ret = hid_add_field(parser, HID_FEATURE_REPORT, data);
 		break;
 	default:
-		hid_warn(parser->device, "unknown main item tag 0x%x\n", item->tag);
+		if (item->tag >= HID_MAIN_ITEM_TAG_RESERVED_MIN &&
+			item->tag <= HID_MAIN_ITEM_TAG_RESERVED_MAX)
+			hid_warn(parser->device, "reserved main item tag 0x%x\n", item->tag);
+		else
+			hid_warn(parser->device, "unknown main item tag 0x%x\n", item->tag);
 		ret = 0;
 	}
 
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 121d5b8bc867..e3894f38bd96 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -81,6 +81,8 @@  struct hid_item {
 #define HID_MAIN_ITEM_TAG_FEATURE		11
 #define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION	10
 #define HID_MAIN_ITEM_TAG_END_COLLECTION	12
+#define HID_MAIN_ITEM_TAG_RESERVED_MIN		13
+#define HID_MAIN_ITEM_TAG_RESERVED_MAX		15
 
 /*
  * HID report descriptor main item contents