public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC 1/2] hid: usbhid: call usb_queue_reset_device directly
@ 2026-03-25 10:31 Oliver Neukum
  2026-03-25 10:31 ` [RFC 2/2] hid: usbhid: rename reset_work Oliver Neukum
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2026-03-25 10:31 UTC (permalink / raw)
  To: linux-usb; +Cc: Oliver Neukum

There is no point in scheduling a work to schedule another
work. Just schedule it directly.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/hid/usbhid/hid-core.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index fd3e1aedc5cb..a70721b3add6 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -132,13 +132,9 @@ static void hid_reset(struct work_struct *work)
 			dev_dbg(&usbhid->intf->dev,
 					"clear-halt failed: %d\n", rc);
 			set_bit(HID_RESET_PENDING, &usbhid->iofl);
+			usb_queue_reset_device(usbhid->intf);
 		}
 	}
-
-	if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) {
-		dev_dbg(&usbhid->intf->dev, "resetting device\n");
-		usb_queue_reset_device(usbhid->intf);
-	}
 }
 
 /* Main I/O error handler */
@@ -171,7 +167,7 @@ static void hid_io_error(struct hid_device *hid)
 		if (!test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
 		     && !test_and_set_bit(HID_RESET_PENDING, &usbhid->iofl)) {
 
-			schedule_work(&usbhid->reset_work);
+			usb_queue_reset_device(usbhid->intf);
 			goto done;
 		}
 	}
@@ -1496,18 +1492,18 @@ static void hid_restart_io(struct hid_device *hid)
 {
 	struct usbhid_device *usbhid = hid->driver_data;
 	int clear_halt = test_bit(HID_CLEAR_HALT, &usbhid->iofl);
-	int reset_pending = test_bit(HID_RESET_PENDING, &usbhid->iofl);
 
 	spin_lock_irq(&usbhid->lock);
 	clear_bit(HID_SUSPENDED, &usbhid->iofl);
 	usbhid_mark_busy(usbhid);
 
-	if (clear_halt || reset_pending)
+	if (clear_halt)
 		schedule_work(&usbhid->reset_work);
+
 	usbhid->retry_delay = 0;
 	spin_unlock_irq(&usbhid->lock);
 
-	if (reset_pending || !test_bit(HID_STARTED, &usbhid->iofl))
+	if (!test_bit(HID_STARTED, &usbhid->iofl))
 		return;
 
 	if (!clear_halt) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-25 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 10:31 [RFC 1/2] hid: usbhid: call usb_queue_reset_device directly Oliver Neukum
2026-03-25 10:31 ` [RFC 2/2] hid: usbhid: rename reset_work Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox