Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Piotr Kubik" <piotr@kubik.pl>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] USB: cdc-acm: restore the line coding after a reset-resume
Date: Fri, 20 Nov 2026 17:30:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-225667@kernel.org> (raw)
In-Reply-To: <20261120171809.1494779-1-piotr@kubik.pl>

> A device that loses power during system suspend comes back at its
> power-on line coding. With USB persist, the USB core then resets the
> device and calls acm_reset_resume(), but acm->line still holds the line
> coding that the driver sent last. acm_tty_set_termios() sends
> SET_LINE_CODING only when the termios differ from acm->line, so an open
> with the same settings sends nothing. The port then runs at the wrong
> rate until the termios change or the device is probed again.
> 
> Send the cached line coding from acm_reset_resume() of the last
> interface to resume, which acm->susp_count shows, before acm_resume()
> restarts the URBs. The USB core calls reset_resume for each interface in
> the order of the configuration descriptor, so the control interface is
> not always the last one. Use the variant without the autopm reference,
> because reset_resume also runs in a runtime resume of the device, where
> usb_autopm_get_interface() would wait for that same resume and never
> return. Ignore the result, as acm_probe() does, because a device without
> USB_CDC_CAP_LINE need not support the request.
> 
> I saw the fault on my workstation while using serial consoles.
> Claude Code agent (Opus 5.5) traced the cause to the cached
> acm->line and wrote the first draft of this patch and this commit message.
> It also wrote and ran the test: a QEMU guest with the adapter passed
> through, and a USB power cut while the guest was in S3.
> Two other Claude instances reviewed the patch, the message and the test
> record. I reviewed the patch and I understand the change.
> 
> Fixes: a91b0c502285 ("cdc_acm: add reset_resume method")
> Cc: stable@vger.kernel.org
> Signed-off-by: Piotr Kubik <piotr@kubik.pl>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120171809.1494779-1-piotr@kubik.pl?part=1


      reply	other threads:[~2026-11-20 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 17:18 [PATCH v2] USB: cdc-acm: restore the line coding after a reset-resume Piotr Kubik
2026-11-20 17:30 ` sashiko-bot [this message]

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=sashiko-outbox-225667@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=piotr@kubik.pl \
    --cc=sashiko-reviews@lists.linux.dev \
    /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