Skip to contentSkip to conversation

net: dsa: microchip: Use gpiod_set_value_cansleep()

PATCH Applied Marek Vasut 3 participants 3 messages Jun 23, 2019 – Jun 26, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: dsa: microchip: Use gpiod_set_value_cansleep()

Replace gpiod_set_value() with gpiod_set_value_cansleep(), as the switch reset GPIO can be connected to e.g. I2C GPIO expander and it is perfectly fine for the kernel to sleep for a bit in ksz_switch_register().

Cc Andrew Lunn <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tristram Ha <[email protected]>
Cc Woojung Huh <[email protected]>

---
V2: use _cansleep in .remove as well

---
 drivers/net/dsa/microchip/ksz_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +3 -3
index 4f6648d5ac8b..978c59aa8efb 100644
@@ -436,9 +436,9 @@ int ksz_switch_register(struct ksz_device *dev,
 		return PTR_ERR(dev->reset_gpio);
 
 	if (dev->reset_gpio) {
-		gpiod_set_value(dev->reset_gpio, 1);
+		gpiod_set_value_cansleep(dev->reset_gpio, 1);
 		mdelay(10);
-		gpiod_set_value(dev->reset_gpio, 0);
+		gpiod_set_value_cansleep(dev->reset_gpio, 0);
 	}
 
 	mutex_init(&dev->dev_mutex);
@@ -489,7 +489,7 @@ void ksz_switch_remove(struct ksz_device *dev)
 	dsa_unregister_switch(dev->ds);
 
 	if (dev->reset_gpio)
-		gpiod_set_value(dev->reset_gpio, 1);
+		gpiod_set_value_cansleep(dev->reset_gpio, 1);
 
 }
 EXPORT_SYMBOL(ksz_switch_remove);
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Marek Vasut

Replace gpiod_set_value() with gpiod_set_value_cansleep(), as the switch reset GPIO can be connected to e.g. I2C GPIO expander and it is perfectly fine for the kernel to sleep for a bit in ksz_switch_register().

Cc Andrew Lunn <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tristram Ha <[email protected]>
Cc Woojung Huh <[email protected]>
Quoted 2 lines

---
V2: use _cansleep in .remove as well

Yours,
Linus Walleij

maintainer Applied
#2 lore raw
In reply to Marek Vasut

From: Marek Vasut <[email protected]>
Date: Sun, 23 Jun 2019 17:12:57 +0200

Quoted 11 lines

Replace gpiod_set_value() with gpiod_set_value_cansleep(), as the switch reset GPIO can be connected to e.g. I2C GPIO expander and it is perfectly fine for the kernel to sleep for a bit in ksz_switch_register().

Cc Andrew Lunn <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tristram Ha <[email protected]>
Cc Woojung Huh <[email protected]>
Quoted 2 lines

---
V2: use _cansleep in .remove as well

Applied, thank you.