Skip to content

Commit f9e0232

Browse files
committed
Merge tag 'for-linus-2024042501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Benjamin Tissoires: - A couple of i2c-hid fixes (Kenny Levinsen & Nam Cao) - A config issue with mcp-2221 when CONFIG_IIO is not enabled (Abdelrahman Morsy) - A dev_err fix in intel-ish-hid (Zhang Lixu) - A couple of mouse fixes for both nintendo and Logitech-dj (Nuno Pereira and Yaraslau Furman) - I'm changing my main kernel email address as it's way simpler for me than the Red Hat one (Benjamin Tissoires) * tag 'for-linus-2024042501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: mcp-2221: cancel delayed_work only when CONFIG_IIO is enabled HID: logitech-dj: allow mice to use all types of reports HID: i2c-hid: Revert to await reset ACK before reading report descriptor HID: nintendo: Fix N64 controller being identified as mouse MAINTAINERS: update Benjamin's email address HID: intel-ish-hid: ipc: Fix dev_err usage with uninitialized dev->devc HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up
2 parents e88c4cf + 3cba9cf commit f9e0232

File tree

7 files changed

+20
-40
lines changed

7 files changed

+20
-40
lines changed

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ Ben Widawsky <[email protected]> <[email protected]>
9898
9999
100100
101+
Benjamin Tissoires <[email protected]> <[email protected]>
102+
Benjamin Tissoires <[email protected]> <[email protected]>
101103
102104
103105

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9576,7 +9576,7 @@ F: kernel/power/
95769576

95779577
HID CORE LAYER
95789578
M: Jiri Kosina <[email protected]>
9579-
M: Benjamin Tissoires <[email protected]>
9579+
M: Benjamin Tissoires <[email protected]>
95809580
95819581
S: Maintained
95829582
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
@@ -22839,7 +22839,7 @@ F: drivers/usb/host/ehci*
2283922839

2284022840
USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
2284122841
M: Jiri Kosina <[email protected]>
22842-
M: Benjamin Tissoires <[email protected]>
22842+
M: Benjamin Tissoires <[email protected]>
2284322843
2284422844
S: Maintained
2284522845
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git

drivers/hid/hid-logitech-dj.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
965965
}
966966
break;
967967
case REPORT_TYPE_MOUSE:
968-
workitem->reports_supported |= STD_MOUSE | HIDPP;
969-
if (djrcv_dev->type == recvr_type_mouse_only)
970-
workitem->reports_supported |= MULTIMEDIA;
968+
workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
971969
break;
972970
}
973971
}

drivers/hid/hid-mcp2221.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,9 +944,11 @@ static void mcp2221_hid_unregister(void *ptr)
944944
/* This is needed to be sure hid_hw_stop() isn't called twice by the subsystem */
945945
static void mcp2221_remove(struct hid_device *hdev)
946946
{
947+
#if IS_REACHABLE(CONFIG_IIO)
947948
struct mcp2221 *mcp = hid_get_drvdata(hdev);
948949

949950
cancel_delayed_work_sync(&mcp->init_work);
951+
#endif
950952
}
951953

952954
#if IS_REACHABLE(CONFIG_IIO)

drivers/hid/hid-nintendo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,10 @@ static const struct joycon_ctlr_button_mapping n64con_button_mappings[] = {
481481
{ BTN_TR, JC_BTN_R, },
482482
{ BTN_TR2, JC_BTN_LSTICK, }, /* ZR */
483483
{ BTN_START, JC_BTN_PLUS, },
484-
{ BTN_FORWARD, JC_BTN_Y, }, /* C UP */
485-
{ BTN_BACK, JC_BTN_ZR, }, /* C DOWN */
486-
{ BTN_LEFT, JC_BTN_X, }, /* C LEFT */
487-
{ BTN_RIGHT, JC_BTN_MINUS, }, /* C RIGHT */
484+
{ BTN_SELECT, JC_BTN_Y, }, /* C UP */
485+
{ BTN_X, JC_BTN_ZR, }, /* C DOWN */
486+
{ BTN_Y, JC_BTN_X, }, /* C LEFT */
487+
{ BTN_C, JC_BTN_MINUS, }, /* C RIGHT */
488488
{ BTN_MODE, JC_BTN_HOME, },
489489
{ BTN_Z, JC_BTN_CAP, },
490490
{ /* sentinel */ },

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
/* flags */
6565
#define I2C_HID_STARTED 0
6666
#define I2C_HID_RESET_PENDING 1
67-
#define I2C_HID_READ_PENDING 2
6867

6968
#define I2C_HID_PWR_ON 0x00
7069
#define I2C_HID_PWR_SLEEP 0x01
@@ -190,15 +189,10 @@ static int i2c_hid_xfer(struct i2c_hid *ihid,
190189
msgs[n].len = recv_len;
191190
msgs[n].buf = recv_buf;
192191
n++;
193-
194-
set_bit(I2C_HID_READ_PENDING, &ihid->flags);
195192
}
196193

197194
ret = i2c_transfer(client->adapter, msgs, n);
198195

199-
if (recv_len)
200-
clear_bit(I2C_HID_READ_PENDING, &ihid->flags);
201-
202196
if (ret != n)
203197
return ret < 0 ? ret : -EIO;
204198

@@ -556,9 +550,6 @@ static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
556550
{
557551
struct i2c_hid *ihid = dev_id;
558552

559-
if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
560-
return IRQ_HANDLED;
561-
562553
i2c_hid_get_input(ihid);
563554

564555
return IRQ_HANDLED;
@@ -735,12 +726,15 @@ static int i2c_hid_parse(struct hid_device *hid)
735726
mutex_lock(&ihid->reset_lock);
736727
do {
737728
ret = i2c_hid_start_hwreset(ihid);
738-
if (ret)
729+
if (ret == 0)
730+
ret = i2c_hid_finish_hwreset(ihid);
731+
else
739732
msleep(1000);
740733
} while (tries-- > 0 && ret);
734+
mutex_unlock(&ihid->reset_lock);
741735

742736
if (ret)
743-
goto abort_reset;
737+
return ret;
744738

745739
use_override = i2c_hid_get_dmi_hid_report_desc_override(client->name,
746740
&rsize);
@@ -750,11 +744,8 @@ static int i2c_hid_parse(struct hid_device *hid)
750744
i2c_hid_dbg(ihid, "Using a HID report descriptor override\n");
751745
} else {
752746
rdesc = kzalloc(rsize, GFP_KERNEL);
753-
754-
if (!rdesc) {
755-
ret = -ENOMEM;
756-
goto abort_reset;
757-
}
747+
if (!rdesc)
748+
return -ENOMEM;
758749

759750
i2c_hid_dbg(ihid, "asking HID report descriptor\n");
760751

@@ -763,23 +754,10 @@ static int i2c_hid_parse(struct hid_device *hid)
763754
rdesc, rsize);
764755
if (ret) {
765756
hid_err(hid, "reading report descriptor failed\n");
766-
goto abort_reset;
757+
goto out;
767758
}
768759
}
769760

770-
/*
771-
* Windows directly reads the report-descriptor after sending reset
772-
* and then waits for resets completion afterwards. Some touchpads
773-
* actually wait for the report-descriptor to be read before signalling
774-
* reset completion.
775-
*/
776-
ret = i2c_hid_finish_hwreset(ihid);
777-
abort_reset:
778-
clear_bit(I2C_HID_RESET_PENDING, &ihid->flags);
779-
mutex_unlock(&ihid->reset_lock);
780-
if (ret)
781-
goto out;
782-
783761
i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc);
784762

785763
ret = hid_parse_report(hid, rdesc, rsize);

drivers/hid/intel-ish-hid/ipc/ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
948948
if (!dev)
949949
return NULL;
950950

951+
dev->devc = &pdev->dev;
951952
ishtp_device_init(dev);
952953

953954
init_waitqueue_head(&dev->wait_hw_ready);
@@ -983,7 +984,6 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
983984
}
984985

985986
dev->ops = &ish_hw_ops;
986-
dev->devc = &pdev->dev;
987987
dev->mtu = IPC_PAYLOAD_SIZE - sizeof(struct ishtp_msg_hdr);
988988
return dev;
989989
}

0 commit comments

Comments
 (0)