Patchwork Fix gpio-mdio driver to work for gpio's that return something other than 0 and 1.

login
register
mail settings
Submitter Lennart Sorensen
Date Nov. 9, 2009, 7:02 p.m.
Message ID <20091109190219.GB15159@caffeine.csclub.uwaterloo.ca>
Download mbox | patch
Permalink /patch/38019/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Lennart Sorensen - Nov. 9, 2009, 7:02 p.m.
The gpio-mdio driver seems to assume GPIOs return 0 and 1, although that
doesn't seem to be the case.  I see return values of 0 and 0x1000000
for the GPIO I happen to be using.  A simple application of !! solves
that though.

Tested on a RuggedCom RX5000 (mpc8360e based).

Signed-off-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 8659d34..7e76f0c 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -55,7 +55,7 @@  static int mdio_get(struct mdiobb_ctrl *ctrl)
 	struct mdio_gpio_info *bitbang =
 		container_of(ctrl, struct mdio_gpio_info, ctrl);
 
-	return gpio_get_value(bitbang->mdio);
+	return !!gpio_get_value(bitbang->mdio);
 }
 
 static void mdio_set(struct mdiobb_ctrl *ctrl, int what)