Re: [PATCH v2] USB: cdc-acm: restore the line coding after a reset-resume

From: Piotr Kubik

Date: Mon Nov 30 2026 - 14:35:13 EST


On 11/23/26 11:23, Oliver Neukum wrote:
> On 20.11.26 18:18, Piotr Kubik wrote:
>> +    if (last)
>> +        __acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0,
>> +                   &acm->line, sizeof(acm->line));
>
> Thank you, I was a bit premature unfortunately. Could you use
> the acm_set_line() macro, so that the driver stays consistent
> in that regard?

Hi Oliver,

acm_set_line() goes through acm_ctrl_msg(), which takes an autopm
reference. reset_resume also runs in a runtime resume: for a device
with USB_QUIRK_RESET_RESUME, and when finish_port_resume() retries a
failed resume as a reset-resume. There, usb_autopm_get_interface()
waits for the resume that called acm_reset_resume(), and it never
returns.

I tested this in the same QEMU setup with the CH344, with
usbcore.quirks=1a86:55d5:b. The ports are closed, the device
autosuspends, and an open of the tty resumes it. With acm_set_line()
in place of __acm_ctrl_msg(), the open stays in D state, and the
runtime status of the device stays "resuming". SysRq-w shows:

 rpm_resume
 rpm_resume
 __pm_runtime_resume
 usb_autopm_get_interface
 acm_ctrl_msg
 acm_reset_resume
 usb_resume_interface
 usb_resume_both
 __rpm_callback
 rpm_callback
 rpm_resume
 rpm_resume
 __pm_runtime_resume
 usb_autopm_get_interface
 acm_port_activate
 tty_port_open
 tty_open

With v2 the same open returns. After a system suspend with a power cut
of the adapter, acm_set_line() works, because no runtime resume is
involved there.

To keep the driver consistent, I can add a macro next to
acm_set_line(), something like:

#define __acm_set_line(acm, line) \
    __acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line))

and use it in acm_reset_resume(). Is that fine with you?

Regards,
/Piotr