From: Esben Haabendal <esben@geanix.com>
To: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
John Ogness <john.ogness@linuxtronix.de>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
imx@lists.linux.dev
Subject: Re: [PATCH 2/2] serial: imx: Add more comments on port lock status
Date: Fri, 13 Sep 2024 12:02:57 +0200 [thread overview]
Message-ID: <87v7yz50ry.fsf@geanix.com> (raw)
In-Reply-To: <2200890.irdbgypaU6@steina-w> (Alexander Stein's message of "Fri, 13 Sep 2024 11:17:04 +0200")
Alexander Stein <alexander.stein@ew.tq-group.com> writes:
> Hi,
>
> Am Freitag, 13. September 2024, 10:39:50 CEST schrieb Esben Haabendal:
>> Comments regarding status of port.lock on internal functions is useful when
>> reviewing correct handling of registers that must be protected by this
>> lock.
>>
>> Signed-off-by: Esben Haabendal <esben@geanix.com>
>> ---
>> drivers/tty/serial/imx.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
>> index efa3eb3a2c57..bea4510743ef 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -370,6 +370,7 @@ static void imx_uart_soft_reset(struct imx_port *sport)
>> sport->idle_counter = 0;
>> }
>>
>> +/* called with port.lock taken and irqs off */
>> static void imx_uart_disable_loopback_rs485(struct imx_port *sport)
>> {
>> unsigned int uts;
>
> I think you are referring to sport.lock.
Yes.
> On the other hand, instead of just adding comments, wouldn't it be
> better to make it explicit?
> Adding
>> lockdep_assert_held(&sport->port->lock);
> and/or sparse annoations
>> __must_hold(&sport->port->lock)
>
> seems more reasonable to me than adding non-enforcing comments.
I fear that due to the way that legacy console works, assertations might
trigger in special situations, such as printk during panic.
Converting comments to assertations could definitely be a good idea, but
I think it might be better to wait with that until the driver has been
converted to NBCON (in progress, see
https://lore.kernel.org/all/20240913-serial-imx-nbcon-v3-1-4c627302335b@geanix.com/),
as that will change the code paths this code will be used in.
/Esben
prev parent reply other threads:[~2024-09-13 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 8:39 [PATCH 0/2] serial: imx: Grab port lock in imx_uart_enable_wakeup() Esben Haabendal
2024-09-13 8:39 ` [PATCH 1/2] " Esben Haabendal
2024-09-13 8:39 ` [PATCH 2/2] serial: imx: Add more comments on port lock status Esben Haabendal
2024-09-13 9:17 ` Alexander Stein
2024-09-13 10:02 ` Esben Haabendal [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=87v7yz50ry.fsf@geanix.com \
--to=esben@geanix.com \
--cc=alexander.stein@ew.tq-group.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--cc=jirislaby@kernel.org \
--cc=john.ogness@linuxtronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.