diff mbox series

[v1] usb: typec: mux: gpio-sbu: Allow GPIO operations to sleep

Message ID 20240409190910.4707-1-francesco@dolcini.it (mailing list archive)
State Accepted
Commit 3d122e6d27e417a9fa91181922743df26b2cd679
Headers show
Series [v1] usb: typec: mux: gpio-sbu: Allow GPIO operations to sleep | expand

Commit Message

Francesco Dolcini April 9, 2024, 7:09 p.m. UTC
From: Francesco Dolcini <francesco.dolcini@toradex.com>

Use gpiod_set_value_cansleep() to support gpiochips which can
sleep like, e.g. I2C GPIO expanders.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
 drivers/usb/typec/mux/gpio-sbu-mux.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Dmitry Baryshkov April 9, 2024, 11:01 p.m. UTC | #1
On Tue, Apr 09, 2024 at 09:09:10PM +0200, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> Use gpiod_set_value_cansleep() to support gpiochips which can
> sleep like, e.g. I2C GPIO expanders.
> 
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> ---
>  drivers/usb/typec/mux/gpio-sbu-mux.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

>
Heikki Krogerus April 15, 2024, 6:54 a.m. UTC | #2
On Tue, Apr 09, 2024 at 09:09:10PM +0200, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> Use gpiod_set_value_cansleep() to support gpiochips which can
> sleep like, e.g. I2C GPIO expanders.
> 
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/mux/gpio-sbu-mux.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
> index ad60fd4e8431..374168482d36 100644
> --- a/drivers/usb/typec/mux/gpio-sbu-mux.c
> +++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
> @@ -48,10 +48,10 @@ static int gpio_sbu_switch_set(struct typec_switch_dev *sw,
>  	}
>  
>  	if (enabled != sbu_mux->enabled)
> -		gpiod_set_value(sbu_mux->enable_gpio, enabled);
> +		gpiod_set_value_cansleep(sbu_mux->enable_gpio, enabled);
>  
>  	if (swapped != sbu_mux->swapped)
> -		gpiod_set_value(sbu_mux->select_gpio, swapped);
> +		gpiod_set_value_cansleep(sbu_mux->select_gpio, swapped);
>  
>  	sbu_mux->enabled = enabled;
>  	sbu_mux->swapped = swapped;
> @@ -82,7 +82,7 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
>  		break;
>  	}
>  
> -	gpiod_set_value(sbu_mux->enable_gpio, sbu_mux->enabled);
> +	gpiod_set_value_cansleep(sbu_mux->enable_gpio, sbu_mux->enabled);
>  
>  	mutex_unlock(&sbu_mux->lock);
>  
> @@ -141,7 +141,7 @@ static void gpio_sbu_mux_remove(struct platform_device *pdev)
>  {
>  	struct gpio_sbu_mux *sbu_mux = platform_get_drvdata(pdev);
>  
> -	gpiod_set_value(sbu_mux->enable_gpio, 0);
> +	gpiod_set_value_cansleep(sbu_mux->enable_gpio, 0);
>  
>  	typec_mux_unregister(sbu_mux->mux);
>  	typec_switch_unregister(sbu_mux->sw);
> -- 
> 2.39.2
diff mbox series

Patch

diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
index ad60fd4e8431..374168482d36 100644
--- a/drivers/usb/typec/mux/gpio-sbu-mux.c
+++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
@@ -48,10 +48,10 @@  static int gpio_sbu_switch_set(struct typec_switch_dev *sw,
 	}
 
 	if (enabled != sbu_mux->enabled)
-		gpiod_set_value(sbu_mux->enable_gpio, enabled);
+		gpiod_set_value_cansleep(sbu_mux->enable_gpio, enabled);
 
 	if (swapped != sbu_mux->swapped)
-		gpiod_set_value(sbu_mux->select_gpio, swapped);
+		gpiod_set_value_cansleep(sbu_mux->select_gpio, swapped);
 
 	sbu_mux->enabled = enabled;
 	sbu_mux->swapped = swapped;
@@ -82,7 +82,7 @@  static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
 		break;
 	}
 
-	gpiod_set_value(sbu_mux->enable_gpio, sbu_mux->enabled);
+	gpiod_set_value_cansleep(sbu_mux->enable_gpio, sbu_mux->enabled);
 
 	mutex_unlock(&sbu_mux->lock);
 
@@ -141,7 +141,7 @@  static void gpio_sbu_mux_remove(struct platform_device *pdev)
 {
 	struct gpio_sbu_mux *sbu_mux = platform_get_drvdata(pdev);
 
-	gpiod_set_value(sbu_mux->enable_gpio, 0);
+	gpiod_set_value_cansleep(sbu_mux->enable_gpio, 0);
 
 	typec_mux_unregister(sbu_mux->mux);
 	typec_switch_unregister(sbu_mux->sw);