linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] gpio: regmap: use new regmap_might_sleep()
@ 2023-01-05 15:06 Michael Walle
  2023-01-06 13:14 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2023-01-05 15:06 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, William Breathitt Gray, Michael Walle

Now that the regmap can be queried whether it might sleep, we can get
rid of the conservative setting "can_sleep = true". New drivers which
want to use gpio-regmap and can access the registers memory-mapped won't
have the restriction that their consumers have to use the
gpiod_*cansleep() variants anymore.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/gpio/gpio-regmap.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index f907c9c19fce..fca17d478984 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -254,15 +254,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	chip->ngpio = config->ngpio;
 	chip->names = config->names;
 	chip->label = config->label ?: dev_name(config->parent);
-
-	/*
-	 * If our regmap is fast_io we should probably set can_sleep to false.
-	 * Right now, the regmap doesn't save this property, nor is there any
-	 * access function for it.
-	 * The only regmap type which uses fast_io is regmap-mmio. For now,
-	 * assume a safe default of true here.
-	 */
-	chip->can_sleep = true;
+	chip->can_sleep = regmap_might_sleep(config->regmap);
 
 	chip->get = gpio_regmap_get;
 	if (gpio->reg_set_base && gpio->reg_clr_base)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] gpio: regmap: use new regmap_might_sleep()
  2023-01-05 15:06 [PATCH RESEND] gpio: regmap: use new regmap_might_sleep() Michael Walle
@ 2023-01-06 13:14 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2023-01-06 13:14 UTC (permalink / raw)
  To: Michael Walle
  Cc: Linus Walleij, linux-gpio, linux-kernel, William Breathitt Gray

On Thu, Jan 5, 2023 at 4:06 PM Michael Walle <michael@walle.cc> wrote:
>
> Now that the regmap can be queried whether it might sleep, we can get
> rid of the conservative setting "can_sleep = true". New drivers which
> want to use gpio-regmap and can access the registers memory-mapped won't
> have the restriction that their consumers have to use the
> gpiod_*cansleep() variants anymore.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
>  drivers/gpio/gpio-regmap.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index f907c9c19fce..fca17d478984 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -254,15 +254,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
>         chip->ngpio = config->ngpio;
>         chip->names = config->names;
>         chip->label = config->label ?: dev_name(config->parent);
> -
> -       /*
> -        * If our regmap is fast_io we should probably set can_sleep to false.
> -        * Right now, the regmap doesn't save this property, nor is there any
> -        * access function for it.
> -        * The only regmap type which uses fast_io is regmap-mmio. For now,
> -        * assume a safe default of true here.
> -        */
> -       chip->can_sleep = true;
> +       chip->can_sleep = regmap_might_sleep(config->regmap);
>
>         chip->get = gpio_regmap_get;
>         if (gpio->reg_set_base && gpio->reg_clr_base)
> --
> 2.30.2
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-06 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 15:06 [PATCH RESEND] gpio: regmap: use new regmap_might_sleep() Michael Walle
2023-01-06 13:14 ` Bartosz Golaszewski

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).