diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2013-02-12 17:48:37 +0000 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-02-13 10:11:53 +0000 |
commit | e80beb27d2f81a1c3c8887e0e0a82d77bb392d28 (patch) | |
tree | 1f81c7ffb20b23d5f7a157e996fbb176779af88a /drivers/net/phy/mdio-mux-gpio.c | |
parent | bd69f73f2c81eed9a398708b8c4bb3409ba1b0f9 (diff) | |
download | linux-e80beb27d2f81a1c3c8887e0e0a82d77bb392d28.tar.bz2 |
gpio: Make of_count_named_gpios() use new of_count_phandle_with_args()
This patch replaces the horribly coded of_count_named_gpios() with a
call to of_count_phandle_with_args() which is far more efficient. This
also changes the return value of of_gpio_count() & of_gpio_named_count()
from 'unsigned int' to 'int' so that it can return an error code. All
the users of that function are fixed up to correctly handle a negative
return value.
v2: Split GPIO portion into a separate patch
Tested-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'drivers/net/phy/mdio-mux-gpio.c')
-rw-r--r-- | drivers/net/phy/mdio-mux-gpio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c index 0c9accb1c14f..e91d7d736ae2 100644 --- a/drivers/net/phy/mdio-mux-gpio.c +++ b/drivers/net/phy/mdio-mux-gpio.c @@ -53,7 +53,7 @@ static int mdio_mux_gpio_probe(struct platform_device *pdev) { enum of_gpio_flags f; struct mdio_mux_gpio_state *s; - unsigned int num_gpios; + int num_gpios; unsigned int n; int r; @@ -61,7 +61,7 @@ static int mdio_mux_gpio_probe(struct platform_device *pdev) return -ENODEV; num_gpios = of_gpio_count(pdev->dev.of_node); - if (num_gpios == 0 || num_gpios > MDIO_MUX_GPIO_MAX_BITS) + if (num_gpios <= 0 || num_gpios > MDIO_MUX_GPIO_MAX_BITS) return -ENODEV; s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); |