All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Lee Jones <lee@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [bug report] tty: st-asc: switch to using devm_gpiod_get()
Date: Wed, 26 Oct 2022 10:33:07 -0700	[thread overview]
Message-ID: <Y1lvU/EN/xR8jbXk@google.com> (raw)
In-Reply-To: <Y1k+nMCs0gCh0/er@kili>

Hi Dan,

On Wed, Oct 26, 2022 at 05:05:16PM +0300, Dan Carpenter wrote:
> Hello Dmitry Torokhov,
> 
> The patch 8c44f9b566a3: "tty: st-asc: switch to using
> devm_gpiod_get()" from Jan 4, 2020, leads to the following Smatch
> static checker warning:
> 
> 	drivers/gpio/gpiolib-devres.c:118 devm_gpiod_get_index()
> 	warn: sleeping in atomic context

You already reported this one:

https://lore.kernel.org/all/20210813124155.GA7367@kili/

As I mentioned back then my change simply swapped one devm invocation
for another, with the problem of sleeping in an atomic context being
already present. In fact the issue was introduced in:

commit d7356256488c544b8fdc2c3a775ce069546d7933
Author: Lee Jones <lee.jones@linaro.org>
Date:   Fri Feb 3 10:23:13 2017 +0000

    serial: st-asc: (De)Register GPIOD and swap Pinctrl profiles

    When hardware flow-control is disabled, manual toggling of the UART's
    reset line (RTS) using userland applications (e.g. stty) is not
    possible, since the ASC IP does not provide this functionality in the
    same was as some other IPs do.  Thus, we have to do this manually.

    This patch ensures that when HW flow-control is disabled the RTS/CTS
    lines are free to be registered via the GPIO API.  It also ensures
    any registered GPIO lines are unregistered when HW flow-control is
    requested, allowing the IP to control them automatically.

    Acked-by: Peter Griffin <peter.griffin@linaro.org>
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

and I mentioned that Lee and Greg should look into fixing it. In
general, doing gpio allocation, or pin control switching while holding a
lock and/or with interrupts disabled is problematic...

Thanks.

-- 
Dmitry

  reply	other threads:[~2022-10-26 17:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 14:05 [bug report] tty: st-asc: switch to using devm_gpiod_get() Dan Carpenter
2022-10-26 17:33 ` Dmitry Torokhov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-08-13 12:41 Dan Carpenter
2021-08-15  0:15 ` Dmitry Torokhov

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=Y1lvU/EN/xR8jbXk@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee@kernel.org \
    --cc=linux-gpio@vger.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.