diff mbox series

[2/2] usb: host: ehci-exynos: switch to using gpiod API

Message ID 20220927220504.3744878-2-dmitry.torokhov@gmail.com (mailing list archive)
State Accepted
Commit a0d381caf99317977942e1228cdc2e14392e1d72
Headers show
Series [1/2] ARM: dts: exynos: fix polarity of VBUS GPIO | expand

Commit Message

Dmitry Torokhov Sept. 27, 2022, 10:05 p.m. UTC
This patch switches the driver from using legacy gpio API to the newer
gpiod API.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/usb/host/ehci-exynos.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

Comments

Krzysztof Kozlowski Sept. 28, 2022, 6:55 a.m. UTC | #1
On 28/09/2022 00:05, Dmitry Torokhov wrote:
> This patch switches the driver from using legacy gpio API to the newer
> gpiod API.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---

Greg,
I'll take the DTS change via Samsung SoC tree.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Alan Stern Sept. 28, 2022, 3:15 p.m. UTC | #2
On Tue, Sep 27, 2022 at 03:05:04PM -0700, Dmitry Torokhov wrote:
> This patch switches the driver from using legacy gpio API to the newer
> gpiod API.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---

Acked-by: Alan Stern <stern@rowland.harvard.edu>

>  drivers/usb/host/ehci-exynos.c | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> index c8e152c2e0ce..a333231616f4 100644
> --- a/drivers/usb/host/ehci-exynos.c
> +++ b/drivers/usb/host/ehci-exynos.c
> @@ -13,7 +13,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> -#include <linux/of_gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
>  #include <linux/usb.h>
> @@ -131,20 +131,13 @@ static void exynos_ehci_phy_disable(struct device *dev)
>  
>  static void exynos_setup_vbus_gpio(struct device *dev)
>  {
> +	struct gpio_desc *gpio;
>  	int err;
> -	int gpio;
>  
> -	if (!dev->of_node)
> -		return;
> -
> -	gpio = of_get_named_gpio(dev->of_node, "samsung,vbus-gpio", 0);
> -	if (!gpio_is_valid(gpio))
> -		return;
> -
> -	err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
> -				    "ehci_vbus_gpio");
> +	gpio = devm_gpiod_get_optional(dev, "samsung,vbus", GPIOD_OUT_HIGH);
> +	err = PTR_ERR_OR_ZERO(gpio);
>  	if (err)
> -		dev_err(dev, "can't request ehci vbus gpio %d", gpio);
> +		dev_err(dev, "can't request ehci vbus gpio: %d\n", err);
>  }
>  
>  static int exynos_ehci_probe(struct platform_device *pdev)
> -- 
> 2.38.0.rc1.362.ged0d419d3c-goog
>
Greg Kroah-Hartman Sept. 30, 2022, 11:52 a.m. UTC | #3
On Wed, Sep 28, 2022 at 08:55:53AM +0200, Krzysztof Kozlowski wrote:
> On 28/09/2022 00:05, Dmitry Torokhov wrote:
> > This patch switches the driver from using legacy gpio API to the newer
> > gpiod API.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> 
> Greg,
> I'll take the DTS change via Samsung SoC tree.
> 
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Ok, thanks!

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index c8e152c2e0ce..a333231616f4 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -13,7 +13,7 @@ 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/usb.h>
@@ -131,20 +131,13 @@  static void exynos_ehci_phy_disable(struct device *dev)
 
 static void exynos_setup_vbus_gpio(struct device *dev)
 {
+	struct gpio_desc *gpio;
 	int err;
-	int gpio;
 
-	if (!dev->of_node)
-		return;
-
-	gpio = of_get_named_gpio(dev->of_node, "samsung,vbus-gpio", 0);
-	if (!gpio_is_valid(gpio))
-		return;
-
-	err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
-				    "ehci_vbus_gpio");
+	gpio = devm_gpiod_get_optional(dev, "samsung,vbus", GPIOD_OUT_HIGH);
+	err = PTR_ERR_OR_ZERO(gpio);
 	if (err)
-		dev_err(dev, "can't request ehci vbus gpio %d", gpio);
+		dev_err(dev, "can't request ehci vbus gpio: %d\n", err);
 }
 
 static int exynos_ehci_probe(struct platform_device *pdev)