From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, Maxime Ripard <maxime@cerno.tech>,
Florian Fainelli <f.fainelli@gmail.com>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [RFC PATCH 3/3] pinctrl-sunxi: don't call pinctrl_gpio_direction()
Date: Mon, 6 Dec 2021 14:16:48 +0100 [thread overview]
Message-ID: <20211206131648.1521868-4-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20211206131648.1521868-1-hverkuil-cisco@xs4all.nl>
Set the direction directly without calling pinctrl_gpio_direction().
This avoids the mutex_lock() calls in that function, which would
invalid the can_sleep = false.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 862c84efb718..80d6750c74a6 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -835,7 +835,9 @@ static const struct pinmux_ops sunxi_pmx_ops = {
static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
unsigned offset)
{
- return pinctrl_gpio_direction_input(chip->base + offset);
+ struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);
+
+ return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, true);
}
static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -885,8 +887,10 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,
static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
+ struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);
+
sunxi_pinctrl_gpio_set(chip, offset, value);
- return pinctrl_gpio_direction_output(chip->base + offset);
+ return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, false);
}
static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
--
2.33.0
next prev parent reply other threads:[~2021-12-06 13:17 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 ` Hans Verkuil [this message]
2021-12-16 2:44 ` [RFC PATCH 3/3] pinctrl-sunxi: " 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
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=20211206131648.1521868-4-hverkuil-cisco@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--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.