net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs

Up until commit 7e5fbd1e07 ("net: mdio-gpio: Convert to use gpiod
functions where possible"), the _cansleep variants of the gpio_ API was
used. After that commit and the change to gpiod_ API, the _cansleep()
was dropped. This then results in WARN_ON() when used with GPIO
devices which do sleep. Add back the _cansleep() to avoid this.

Fixes: 7e5fbd1e07 ("net: mdio-gpio: Convert to use gpiod functions where possible")
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Martin Schiller 2018-11-16 08:38:36 +01:00 committed by David S. Miller
parent 160396a722
commit df5a8ec64e
1 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@ static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir)
* assume the pin serves as pull-up. If direction is * assume the pin serves as pull-up. If direction is
* output, the default value is high. * output, the default value is high.
*/ */
gpiod_set_value(bitbang->mdo, 1); gpiod_set_value_cansleep(bitbang->mdo, 1);
return; return;
} }
@ -78,7 +78,7 @@ static int mdio_get(struct mdiobb_ctrl *ctrl)
struct mdio_gpio_info *bitbang = struct mdio_gpio_info *bitbang =
container_of(ctrl, struct mdio_gpio_info, ctrl); container_of(ctrl, struct mdio_gpio_info, ctrl);
return gpiod_get_value(bitbang->mdio); return gpiod_get_value_cansleep(bitbang->mdio);
} }
static void mdio_set(struct mdiobb_ctrl *ctrl, int what) static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
@ -87,9 +87,9 @@ static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
container_of(ctrl, struct mdio_gpio_info, ctrl); container_of(ctrl, struct mdio_gpio_info, ctrl);
if (bitbang->mdo) if (bitbang->mdo)
gpiod_set_value(bitbang->mdo, what); gpiod_set_value_cansleep(bitbang->mdo, what);
else else
gpiod_set_value(bitbang->mdio, what); gpiod_set_value_cansleep(bitbang->mdio, what);
} }
static void mdc_set(struct mdiobb_ctrl *ctrl, int what) static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
@ -97,7 +97,7 @@ static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
struct mdio_gpio_info *bitbang = struct mdio_gpio_info *bitbang =
container_of(ctrl, struct mdio_gpio_info, ctrl); container_of(ctrl, struct mdio_gpio_info, ctrl);
gpiod_set_value(bitbang->mdc, what); gpiod_set_value_cansleep(bitbang->mdc, what);
} }
static const struct mdiobb_ops mdio_gpio_ops = { static const struct mdiobb_ops mdio_gpio_ops = {