All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Maxime Ripard <maxime@cerno.tech>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [RFC PATCH 0/3] pinctrl: can_sleep and pinctrl_gpio_direction
Date: Wed, 8 Dec 2021 10:26:19 +0100	[thread overview]
Message-ID: <d1ce87a0-decb-ac29-7906-1181c83c1067@xs4all.nl> (raw)
In-Reply-To: <CACRpkda2d9j7_HOM1Q1dEsK+U4-4KmbvjvTAEvx2AbxMQtOgFA@mail.gmail.com>

On 08/12/2021 01:30, Linus Walleij wrote:
> On Tue, Dec 7, 2021 at 11:14 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>> On Monday, December 6, 2021, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
>>>
>>> Hi all,
>>>
>>> Based on this discussion:
>>>
>>> https://lore.kernel.org/linux-gpio/CACRpkdb3q4-9O3dHS6QDWnZZ5JJjXWXS9KPvwXVaowLMRhcejA@mail.gmail.com/T/#t
>>>
>>> I propose this RFC series.
>>
>>
>> When I first saw your report I was thinking about actually adding a new callback ->set_direction_atomic()
>> and then make pinctrl use it, otherwise like you do, I.e. issue a warning when it’s called in atomic context
> 
> The problem is inside of pinctrl core, not in any driver. It takes a
> mutex when going over
> the GPIO ranges.
> 
> I suggested maybe just replacing these mutexes with spinlocks, or RCU.

RCU or spinlock would most likely work as a replacement for pinctrldev_list_mutex, but
not for pctldev->mutex. I didn't see any obvious way of replacing it with something else.

I'm open to any suggestions, but for now this was the best I could come up with, given
my limited knowledge of the gpio/pinctrl subsystems. It at least warns you that something
is wrong.

Personally I think that for combined gpio/pinctrl drivers it doesn't make sense to take
this additional loop through the pinctrl core, regardless of whatever locking mechanism
is used. I actually think that it obfuscates those drivers a bit, but that might just be
me.

Regards,

	Hans

> 
> Yours,
> Linus Walleij
> 


  reply	other threads:[~2021-12-08  9:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 13:16 [RFC PATCH 0/3] pinctrl: can_sleep and pinctrl_gpio_direction Hans Verkuil
2021-12-06 13:16 ` [RFC PATCH 1/3] pinctrl/core: check that can_sleep is true in pinctrl_gpio_direction() Hans Verkuil
2021-12-06 13:16 ` [RFC PATCH 2/3] pinctrl-bcm2835: don't call pinctrl_gpio_direction() Hans Verkuil
2021-12-06 17:29   ` Florian Fainelli
2021-12-16  2:43   ` Linus Walleij
2021-12-06 13:16 ` [RFC PATCH 3/3] pinctrl-sunxi: " Hans Verkuil
2021-12-16  2:44   ` Linus Walleij
     [not found] ` <CAHp75VcPhSvQvjA5WBO72Lb5idc6vkkodai_V=YmLWtsz-qg1A@mail.gmail.com>
2021-12-08  0:30   ` [RFC PATCH 0/3] pinctrl: can_sleep and pinctrl_gpio_direction Linus Walleij
2021-12-08  9:26     ` Hans Verkuil [this message]
2021-12-08 14:24       ` Andy Shevchenko
2022-01-26 11:02 ` [PATCH for 5.17] pinctrl-sunxi: sunxi_pinctrl_gpio_direction_in/output: use correct offset Hans Verkuil
2022-01-26 15:22   ` Corentin Labbe
2022-01-26 16:38   ` Jernej Škrabec
2022-01-28 20:40   ` Guenter Roeck
2022-02-13 20:42   ` Guenter Roeck
2022-02-14  8:44     ` Hans Verkuil
2022-02-14 21:28       ` Guenter Roeck
2022-02-15  0:19       ` Guenter Roeck

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=d1ce87a0-decb-ac29-7906-1181c83c1067@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=andy.shevchenko@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime@cerno.tech \
    /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.