Skip to content

Commit

Permalink
net: dsa: microchip: Use gpiod_set_value_cansleep()
Browse files Browse the repository at this point in the history
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().

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Tristram Ha <Tristram.Ha@microchip.com>
Cc: Woojung Huh <Woojung.Huh@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Marek Vasut authored and David S. Miller committed Jun 26, 2019
1 parent 48dd73d commit 22e72b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/dsa/microchip/ksz_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -487,7 +487,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);
Expand Down

0 comments on commit 22e72b5

Please sign in to comment.