summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2021-11-05 12:11:10 +0100
committerJiri Kosina <jkosina@suse.cz>2021-11-05 12:11:10 +0100
commitb026277a8403fe72acb4b52b9bebe716499c064c (patch)
tree1f2f45ab4591fe5fb7996e03c821fbe44c24764a /drivers/hid
parentMerge branch 'for-5.16/asus' into for-linus (diff)
parentHID: cougar: Make use of the helper function devm_add_action_or_reset() (diff)
downloadlinux-b026277a8403fe72acb4b52b9bebe716499c064c.tar.xz
linux-b026277a8403fe72acb4b52b9bebe716499c064c.zip
Merge branch 'for-5.16/core' into for-linus
- update to handle TransducerSerialNumber2 which has been recently added to the specification (Felipe Balbi)
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-cougar.c3
-rw-r--r--drivers/hid/hid-debug.c10
-rw-r--r--drivers/hid/hid-input.c1
3 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hid/hid-cougar.c b/drivers/hid/hid-cougar.c
index 28d671c5e0ca..cb8bd8aae15b 100644
--- a/drivers/hid/hid-cougar.c
+++ b/drivers/hid/hid-cougar.c
@@ -179,10 +179,9 @@ static int cougar_bind_shared_data(struct hid_device *hdev,
cougar->shared = shared;
- error = devm_add_action(&hdev->dev, cougar_remove_shared_data, cougar);
+ error = devm_add_action_or_reset(&hdev->dev, cougar_remove_shared_data, cougar);
if (error) {
mutex_unlock(&cougar_udev_list_lock);
- cougar_remove_shared_data(cougar);
return error;
}
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index fa57d05badf7..7a92e2a04a09 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -160,6 +160,7 @@ static const struct hid_usage_entry hid_usage_table[] = {
{0, 0x59, "ButtonType"},
{0, 0x5A, "SecondaryBarrelSwitch"},
{0, 0x5B, "TransducerSerialNumber"},
+ {0, 0x6e, "TransducerSerialNumber2"},
{ 15, 0, "PhysicalInterfaceDevice" },
{0, 0x00, "Undefined"},
{0, 0x01, "Physical_Interface_Device"},
@@ -486,8 +487,7 @@ char *hid_resolv_usage(unsigned usage, struct seq_file *f) {
if (!f) {
len = strlen(buf);
- snprintf(buf+len, max(0, HID_DEBUG_BUFSIZE - len), ".");
- len++;
+ len += scnprintf(buf + len, HID_DEBUG_BUFSIZE - len, ".");
}
else {
seq_printf(f, ".");
@@ -498,7 +498,7 @@ char *hid_resolv_usage(unsigned usage, struct seq_file *f) {
if (p->usage == (usage & 0xffff)) {
if (!f)
snprintf(buf + len,
- max(0,HID_DEBUG_BUFSIZE - len - 1),
+ HID_DEBUG_BUFSIZE - len,
"%s", p->description);
else
seq_printf(f,
@@ -509,8 +509,8 @@ char *hid_resolv_usage(unsigned usage, struct seq_file *f) {
break;
}
if (!f)
- snprintf(buf + len, max(0, HID_DEBUG_BUFSIZE - len - 1),
- "%04x", usage & 0xffff);
+ snprintf(buf + len, HID_DEBUG_BUFSIZE - len, "%04x",
+ usage & 0xffff);
else
seq_printf(f, "%04x", usage & 0xffff);
return buf;
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 4b5ebeacd283..2c72ce4147b1 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -871,6 +871,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
break;
case 0x5b: /* TransducerSerialNumber */
+ case 0x6e: /* TransducerSerialNumber2 */
usage->type = EV_MSC;
usage->code = MSC_SERIAL;
bit = input->mscbit;