diff mbox series

[2/2] hwmon: (ltc2992) Set `can_sleep` flag for GPIO chip

Message ID 20230314093146.2443845-2-lars@metafoo.de (mailing list archive)
State Accepted
Headers show
Series [1/2] hwmon: (adm1266) Set `can_sleep` flag for GPIO chip | expand

Commit Message

Lars-Peter Clausen March 14, 2023, 9:31 a.m. UTC
The ltc2992 drivers uses a mutex and I2C bus access in its GPIO chip `set`
and `get` implementation. This means these functions can sleep and the GPIO
chip should set the `can_sleep` property to true.

This will ensure that a warning is printed when trying to set or get the
GPIO value from a context that potentially can't sleep.

Fixes: 9ca26df1ba25 ("hwmon: (ltc2992) Add support for GPIOs.")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/hwmon/ltc2992.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Guenter Roeck March 16, 2023, 2:15 a.m. UTC | #1
On Tue, Mar 14, 2023 at 02:31:46AM -0700, Lars-Peter Clausen wrote:
> The ltc2992 drivers uses a mutex and I2C bus access in its GPIO chip `set`
> and `get` implementation. This means these functions can sleep and the GPIO
> chip should set the `can_sleep` property to true.
> 
> This will ensure that a warning is printed when trying to set or get the
> GPIO value from a context that potentially can't sleep.
> 
> Fixes: 9ca26df1ba25 ("hwmon: (ltc2992) Add support for GPIOs.")
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/ltc2992.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwmon/ltc2992.c b/drivers/hwmon/ltc2992.c
> index 88514152d930..69341de397cb 100644
> --- a/drivers/hwmon/ltc2992.c
> +++ b/drivers/hwmon/ltc2992.c
> @@ -323,6 +323,7 @@ static int ltc2992_config_gpio(struct ltc2992_state *st)
>  	st->gc.label = name;
>  	st->gc.parent = &st->client->dev;
>  	st->gc.owner = THIS_MODULE;
> +	st->gc.can_sleep = true;
>  	st->gc.base = -1;
>  	st->gc.names = st->gpio_names;
>  	st->gc.ngpio = ARRAY_SIZE(st->gpio_names);
diff mbox series

Patch

diff --git a/drivers/hwmon/ltc2992.c b/drivers/hwmon/ltc2992.c
index 88514152d930..69341de397cb 100644
--- a/drivers/hwmon/ltc2992.c
+++ b/drivers/hwmon/ltc2992.c
@@ -323,6 +323,7 @@  static int ltc2992_config_gpio(struct ltc2992_state *st)
 	st->gc.label = name;
 	st->gc.parent = &st->client->dev;
 	st->gc.owner = THIS_MODULE;
+	st->gc.can_sleep = true;
 	st->gc.base = -1;
 	st->gc.names = st->gpio_names;
 	st->gc.ngpio = ARRAY_SIZE(st->gpio_names);