diff options
author | Guenter Roeck <linux@roeck-us.net> | 2017-01-11 12:59:49 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-12 15:05:10 -0500 |
commit | 08d9665cfed37b51766284ca2f9b6e4f3ccd6959 (patch) | |
tree | dfffaace2ee4716b5aa49bca46945780aa6abacd /drivers/net/phy | |
parent | 37c9782c7306efcc831f7c989c0b7ab040956089 (diff) | |
download | linux-08d9665cfed37b51766284ca2f9b6e4f3ccd6959.tar.bz2 |
net: mdio-gpio: Use devm_gpio_request_one instead of devm_gpio_request
Using devm_gpio_request_one lets us request gpio pins with initial state
in one go.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/mdio-gpio.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index 27ab63064f95..f6e773256c82 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c @@ -137,6 +137,9 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, struct mii_bus *new_bus; struct mdio_gpio_info *bitbang; int i; + unsigned long mdc_flags = GPIOF_OUT_INIT_LOW; + unsigned long mdio_flags = GPIOF_DIR_IN; + unsigned long mdo_flags = GPIOF_OUT_INIT_HIGH; bitbang = devm_kzalloc(dev, sizeof(*bitbang), GFP_KERNEL); if (!bitbang) @@ -174,21 +177,17 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, else strncpy(new_bus->id, "gpio", MII_BUS_ID_SIZE); - if (devm_gpio_request(dev, bitbang->mdc, "mdc")) + if (devm_gpio_request_one(dev, bitbang->mdc, mdc_flags, "mdc")) goto out_free_bus; - if (devm_gpio_request(dev, bitbang->mdio, "mdio")) + if (devm_gpio_request_one(dev, bitbang->mdio, mdio_flags, "mdio")) goto out_free_bus; if (bitbang->mdo) { - if (devm_gpio_request(dev, bitbang->mdo, "mdo")) + if (devm_gpio_request_one(dev, bitbang->mdo, mdo_flags, "mdo")) goto out_free_bus; - gpio_direction_output(bitbang->mdo, 1); - gpio_direction_input(bitbang->mdio); } - gpio_direction_output(bitbang->mdc, 0); - dev_set_drvdata(dev, new_bus); return new_bus; |