linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Tobias Klauser <tklauser@distanz.ch>
Subject: Re: [PATCH 4/4] tty: serial: do unlock on a common path in altera_jtaguart_console_putc()
Date: Wed, 28 Sep 2022 13:27:45 +0300 (EEST)	[thread overview]
Message-ID: <fdfd4174-37d1-fc0-9a5-57f5bcebbe7f@linux.intel.com> (raw)
In-Reply-To: <20220927111819.18516-4-jslaby@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

On Tue, 27 Sep 2022, Jiri Slaby wrote:

> port->lock is unlocked in each branch in altera_jtaguart_console_putc(),
> so do it before the "if". "status" needs not be under the lock, as the
> register was already read.
> 
> Cc: Tobias Klauser <tklauser@distanz.ch>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/tty/serial/altera_jtaguart.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
> index ac8ce418de36..c2d154d78e54 100644
> --- a/drivers/tty/serial/altera_jtaguart.c
> +++ b/drivers/tty/serial/altera_jtaguart.c
> @@ -310,11 +310,12 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c
>  
>  	spin_lock_irqsave(&port->lock, flags);
>  	while (!altera_jtaguart_tx_space(port, &status)) {
> +		spin_unlock_irqrestore(&port->lock, flags);
> +
>  		if ((status & ALTERA_JTAGUART_CONTROL_AC_MSK) == 0) {
> -			spin_unlock_irqrestore(&port->lock, flags);
>  			return;	/* no connection activity */
>  		}

There braces are now unnecessary.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.


> -		spin_unlock_irqrestore(&port->lock, flags);
> +
>  		cpu_relax();
>  		spin_lock_irqsave(&port->lock, flags);
>  	}
> 

  parent reply	other threads:[~2022-09-28 10:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 11:18 [PATCH 1/4] tty: serial: extend lqasc_tx_ready() to lqasc_console_putchar() Jiri Slaby
2022-09-27 11:18 ` [PATCH 2/4] tty: serial: use FIELD_GET() in lqasc_tx_ready() Jiri Slaby
2022-09-27 11:48   ` Ilpo Järvinen
2022-09-27 11:18 ` [PATCH 3/4] tty: serial: unify TX space reads under altera_jtaguart_tx_space() Jiri Slaby
2022-09-27 15:04   ` Tobias Klauser
2022-09-28 10:26   ` Ilpo Järvinen
2022-09-27 11:18 ` [PATCH 4/4] tty: serial: do unlock on a common path in altera_jtaguart_console_putc() Jiri Slaby
2022-09-27 14:59   ` Tobias Klauser
2022-09-28 10:27   ` Ilpo Järvinen [this message]
2022-09-27 11:47 ` [PATCH 1/4] tty: serial: extend lqasc_tx_ready() to lqasc_console_putchar() Ilpo Järvinen

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=fdfd4174-37d1-fc0-9a5-57f5bcebbe7f@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tklauser@distanz.ch \
    /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;
as well as URLs for NNTP newsgroup(s).