Skip to contentSkip to conversation

phy: tusb1210: Use devm_gpiod_get_optional for optional GPIOs

PATCH RESEND In review Axel Lin 3 participants 5 messages Jun 20, 2015 – Jul 15, 2015 Generic PHY framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH RESEND 1/1 phy: tusb1210: Use devm_gpiod_get_optional for optional GPIOs

Also simplify the code a bit by specify direction and initial value for output in devm_gpiod_get_optional function.

---
Hi
This patch was sent on https://lkml.org/lkml/2015/5/31/221 with ACKs. It's still not in linux-next, so here is a resend.

 drivers/phy/phy-tusb1210.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)
drivers/phy/phy-tusb1210.c +10 -18
index 07efdd3..e0174da 100644
@@ -61,32 +61,24 @@ static struct phy_ops phy_ops = {
 
 static int tusb1210_probe(struct ulpi *ulpi)
 {
-	struct gpio_desc *gpio;
 	struct tusb1210 *tusb;
 	u8 val, reg;
-	int ret;
 
 	tusb = devm_kzalloc(&ulpi->dev, sizeof(*tusb), GFP_KERNEL);
 	if (!tusb)
 		return -ENOMEM;
 
-	gpio = devm_gpiod_get(&ulpi->dev, "reset");
-	if (!IS_ERR(gpio)) {
-		ret = gpiod_direction_output(gpio, 0);
-		if (ret)
-			return ret;
-		gpiod_set_value_cansleep(gpio, 1);
-		tusb->gpio_reset = gpio;
-	}
+	tusb->gpio_reset = devm_gpiod_get_optional(&ulpi->dev, "reset",
+						   GPIOD_OUT_LOW);
+	if (IS_ERR(tusb->gpio_reset))
+		return PTR_ERR(tusb->gpio_reset);
+	gpiod_set_value_cansleep(tusb->gpio_reset, 1);
 
-	gpio = devm_gpiod_get(&ulpi->dev, "cs");
-	if (!IS_ERR(gpio)) {
-		ret = gpiod_direction_output(gpio, 0);
-		if (ret)
-			return ret;
-		gpiod_set_value_cansleep(gpio, 1);
-		tusb->gpio_cs = gpio;
-	}
+	tusb->gpio_cs = devm_gpiod_get_optional(&ulpi->dev, "cs",
+						GPIOD_OUT_LOW);
+	if (IS_ERR(tusb->gpio_cs))
+		return PTR_ERR(tusb->gpio_cs);
+	gpiod_set_value_cansleep(tusb->gpio_cs, 1);
 
 	/*
 	 * VENDOR_SPECIFIC2 register in TUSB1210 can be used for configuring eye
Signature · 7 lines
2.1.0



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/
author
#1 lore raw

2015-06-20 15:39 GMT+08:00 Axel Lin <[email protected]>:

Quoted 10 lines

Also simplify the code a bit by specify direction and initial value for output in devm_gpiod_get_optional function.

---
Hi
This patch was sent on https://lkml.org/lkml/2015/5/31/221 with ACKs. It's still not in linux-next, so here is a resend.

Hi Kishon,
No response from Felipe.
The phy-tusb1210 driver is already in Linus' tree, maybe you can pick up this patch.

Regards,
Axel

#2 lore raw

Hi,

Quoted 12 lines · Axel Lin

2015-06-20 15:39 GMT+08:00 Axel Lin <[email protected]>:

Quoted 10 lines

Also simplify the code a bit by specify direction and initial value for output in devm_gpiod_get_optional function.

---
Hi
This patch was sent on https://lkml.org/lkml/2015/5/31/221 with ACKs. It's still not in linux-next, so here is a resend.

Quoted 4 lines

Hi Kishon,
No response from Felipe.
The phy-tusb1210 driver is already in Linus' tree, maybe you can pick up this patch.

A similar patch was done by Uwe [1]. But since you've sent this patch before Uwe, IMO your patch must be merged.

Uwe,
How do you want this patch to be merged. Is it okay If I take this in PHY tree? Can you give your Acked-by?

Thanks
Kishon

[1] -> https://www.mail-archive.com/[email protected]/msg90203.html

Quoted 4 lines

Regards,
Axel

#3 lore raw

Hello,

Quoted 20 lines · Kishon Vijay Abraham I

Hi,

Quoted 12 lines · Axel Lin

2015-06-20 15:39 GMT+08:00 Axel Lin <[email protected]>:

Quoted 10 lines

Also simplify the code a bit by specify direction and initial value for output in devm_gpiod_get_optional function.

---
Hi
This patch was sent on https://lkml.org/lkml/2015/5/31/221 with ACKs. It's still not in linux-next, so here is a resend.

Quoted 4 lines

Hi Kishon,
No response from Felipe.
The phy-tusb1210 driver is already in Linus' tree, maybe you can pick up this patch.

Quoted 6 lines

A similar patch was done by Uwe [1]. But since you've sent this patch before Uwe, IMO your patch must be merged.

Uwe,
How do you want this patch to be merged. Is it okay If I take this in PHY tree? Can you give your Acked-by?

I intend to change the gpiod functions to make the flags mandatory for 4.3. I already sent the respective change to Linus Walleij to pull for next and my commit to fix phy-tusb1210 is included to not break this driver.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
author
#4 lore raw

2015-07-15 16:29 GMT+08:00 Uwe Kleine-König <[email protected]>:

Quoted 26 lines

Hello,

Quoted 23 lines · Kishon Vijay Abraham I

Hi,

Quoted 12 lines · Axel Lin

2015-06-20 15:39 GMT+08:00 Axel Lin <[email protected]>:

Quoted 10 lines

Also simplify the code a bit by specify direction and initial value for output in devm_gpiod_get_optional function.

---
Hi
This patch was sent on https://lkml.org/lkml/2015/5/31/221 with ACKs. It's still not in linux-next, so here is a resend.

Quoted 4 lines

Hi Kishon,
No response from Felipe.
The phy-tusb1210 driver is already in Linus' tree, maybe you can pick up this patch.

A similar patch was done by Uwe [1]. But since you've sent this patch before Uwe, IMO your patch must be merged.

Quoted 7 lines
Quoted 3 lines

Uwe,
How do you want this patch to be merged. Is it okay If I take this in PHY tree? Can you give your Acked-by?

I intend to change the gpiod functions to make the flags mandatory for 4.3. I already sent the respective change to Linus Walleij to pull for next and my commit to fix phy-tusb1210 is included to not break this driver.

I'm fine to just apply Uwe's patch if it make things easier.

Axel