Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Leonid Konontsov <lkonontsov@gmail.com>
Cc: Johan Hovold <johan@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: serial: replacing mutex_lock to guard(mutex)
Date: Mon, 15 Jun 2026 04:29:13 +0200	[thread overview]
Message-ID: <2026061540-drivable-campsite-8ba0@gregkh> (raw)
In-Reply-To: <20260614192337.9449-1-lkonontsov@gmail.com>

On Sun, Jun 14, 2026 at 10:23:37PM +0300, Leonid Konontsov wrote:
> Moving from manual mutex_lock's and mutex_unlock's to guard(mutex) in
> ark3116.c file.
> 
> Signed-off-by: Leonid Konontsov <lkonontsov@gmail.com>
> ---
>  drivers/usb/serial/ark3116.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
> index d974da43fba3..9cd8179de583 100644
> --- a/drivers/usb/serial/ark3116.c
> +++ b/drivers/usb/serial/ark3116.c
> @@ -237,7 +237,7 @@ static void ark3116_set_termios(struct tty_struct *tty,
>  	}
>  
>  	/* Update state: synchronize */
> -	mutex_lock(&priv->hw_lock);
> +	guard(mutex)(&priv->hw_lock);
>  
>  	/* keep old LCR_SBC bit */
>  	lcr |= (priv->lcr & UART_LCR_SBC);
> @@ -280,8 +280,6 @@ static void ark3116_set_termios(struct tty_struct *tty,
>  		ark3116_write_reg(serial, UART_LCR, lcr);
>  	}
>  
> -	mutex_unlock(&priv->hw_lock);
> -
>  	/* check for software flow control */
>  	if (I_IXOFF(tty) || I_IXON(tty)) {
>  		dev_warn(&port->dev,
> @@ -379,9 +377,8 @@ static int ark3116_tiocmget(struct tty_struct *tty)
>  	__u32 ctrl;
>  	unsigned long flags;
>  
> -	mutex_lock(&priv->hw_lock);
> +	guard(mutex)(&priv->hw_lock);
>  	ctrl = priv->mcr;
> -	mutex_unlock(&priv->hw_lock);

As "proof" you shouldn't be doing this, you just changed the logic here
and might have broken the driver :(

Did you test this change?

thanks,

greg k-h

      parent reply	other threads:[~2026-06-15  2:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-14 19:23 [PATCH] usb: serial: replacing mutex_lock to guard(mutex) Leonid Konontsov
2026-06-15  2:28 ` Greg Kroah-Hartman
2026-06-15  2:29 ` Greg Kroah-Hartman [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=2026061540-drivable-campsite-8ba0@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lkonontsov@gmail.com \
    /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