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

From: Piotr Kubik

Date: Fri Nov 20 2026 - 12:17:49 EST


Hi Oliver,

thank you for the review. You are right. usb_resume_both() resumes the
interfaces in the order of the configuration descriptor, so the control
interface is not always the last one. On the CH344 that I tested, each
control interface resumes before its data interface, so v1 sent the
request while the data interface was still suspended.

In v2, acm_reset_resume() reads acm->susp_count under write_lock and
sends the line coding only when the count is 1. So the last interface
to resume sends it, before acm_resume() restarts the URBs. 
I tested v2 in the same way as v1, and an extra print showed that on the
CH344 the data interface now sends the request.
I will send v2 as a new thread.

Regards,
Piotr


On 11/19/26 13:47, Oliver Neukum wrote:
>
>
> On 19.11.26 13:28, Piotr Kubik wrote:
> Hi,
>
> thank you for this patch. However, it has an issue.
> Let me comment on this inline.
>
>  
>> +    /*
>> +     * The device can lose its line coding, for example when it loses
>> +     * power during system suspend, and acm_tty_set_termios() sends the
>> +     * line coding only when it differs from acm->line. Send it once, for
>> +     * the control interface. In a runtime resume of the device, an autopm
>> +     * reference here would wait for this resume and never return.
>> +     */
>> +    if (intf == acm->control)
>
> This test is problematic. The interfaces may be resumed in any order.
> You are setting a line coding before the rest of the device is
> resumed.
>
> To do this cleanly, you need to look at the counter.
>
>     Regards
>         Oliver