From: Oliver Neukum <oneukum@suse.com>
To: linux-usb@vger.kernel.org
Cc: Oliver Neukum <oneukum@suse.com>
Subject: [RFC 1/2] hid: usbhid: call usb_queue_reset_device directly
Date: Wed, 25 Mar 2026 11:31:48 +0100 [thread overview]
Message-ID: <20260325103210.198820-1-oneukum@suse.com> (raw)
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
next reply other threads:[~2026-03-25 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 10:31 Oliver Neukum [this message]
2026-03-25 10:31 ` [RFC 2/2] hid: usbhid: rename reset_work Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260325103210.198820-1-oneukum@suse.com \
--to=oneukum@suse.com \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox