diff mbox series

i2c: pca: Fix GPIO lookup code

Message ID 20190530202424.13937-1-linus.walleij@linaro.org
State Accepted
Commit a0cac264a86fbf4d6cb201fbbb73c1d335e3248a
Headers show
Series i2c: pca: Fix GPIO lookup code | expand

Commit Message

Linus Walleij May 30, 2019, 8:24 p.m. UTC
The devm_gpiod_request_gpiod() call will add "-gpios" to
any passed connection ID before looking it up.

I do not think the reset GPIO on this platform is named
"reset-gpios-gpios" but rather "reset-gpios" in the device
tree, so fix this up so that we get a proper reset GPIO
handle.

Also drop the inclusion of the legacy GPIO header.

Fixes: 0e8ce93bdceb ("i2c: pca-platform: add devicetree awareness")
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/i2c/busses/i2c-pca-platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.20.1

Comments

Chris Packham May 30, 2019, 8:59 p.m. UTC | #1
Hi Linus,

On 31/05/19 8:24 AM, Linus Walleij wrote:
> The devm_gpiod_request_gpiod() call will add "-gpios" to
> any passed connection ID before looking it up.
> 
> I do not think the reset GPIO on this platform is named
> "reset-gpios-gpios" but rather "reset-gpios" in the device
> tree, so fix this up so that we get a proper reset GPIO
> handle.
> 
> Also drop the inclusion of the legacy GPIO header.
> 
> Fixes: 0e8ce93bdceb ("i2c: pca-platform: add devicetree awareness")
> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Thanks.

> ---
>   drivers/i2c/busses/i2c-pca-platform.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
> index de3fe6e828cb..f50afa8e3cba 100644
> --- a/drivers/i2c/busses/i2c-pca-platform.c
> +++ b/drivers/i2c/busses/i2c-pca-platform.c
> @@ -21,7 +21,6 @@
>   #include <linux/platform_device.h>
>   #include <linux/i2c-algo-pca.h>
>   #include <linux/platform_data/i2c-pca-platform.h>
> -#include <linux/gpio.h>
>   #include <linux/gpio/consumer.h>
>   #include <linux/io.h>
>   #include <linux/of.h>
> @@ -173,7 +172,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
>   	i2c->adap.dev.parent = &pdev->dev;
>   	i2c->adap.dev.of_node = np;
>   
> -	i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset-gpios", GPIOD_OUT_LOW);
> +	i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
>   	if (IS_ERR(i2c->gpio))
>   		return PTR_ERR(i2c->gpio);
>   
>
Wolfram Sang June 12, 2019, 10:56 a.m. UTC | #2
On Thu, May 30, 2019 at 10:24:24PM +0200, Linus Walleij wrote:
> The devm_gpiod_request_gpiod() call will add "-gpios" to

> any passed connection ID before looking it up.

> 

> I do not think the reset GPIO on this platform is named

> "reset-gpios-gpios" but rather "reset-gpios" in the device

> tree, so fix this up so that we get a proper reset GPIO

> handle.

> 

> Also drop the inclusion of the legacy GPIO header.

> 

> Fixes: 0e8ce93bdceb ("i2c: pca-platform: add devicetree awareness")

> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Applied to for-current, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index de3fe6e828cb..f50afa8e3cba 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -21,7 +21,6 @@ 
 #include <linux/platform_device.h>
 #include <linux/i2c-algo-pca.h>
 #include <linux/platform_data/i2c-pca-platform.h>
-#include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
 #include <linux/io.h>
 #include <linux/of.h>
@@ -173,7 +172,7 @@  static int i2c_pca_pf_probe(struct platform_device *pdev)
 	i2c->adap.dev.parent = &pdev->dev;
 	i2c->adap.dev.of_node = np;
 
-	i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset-gpios", GPIOD_OUT_LOW);
+	i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(i2c->gpio))
 		return PTR_ERR(i2c->gpio);