aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-01-30 15:25:12 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-01-30 15:25:12 +0000
commitc253898e89c84973956b69ba629425051a47a6a8 (patch)
tree8c4cff720e5cf3a42e07a44a314c0443d44ed41b /target/linux/generic-2.6/files
parente2dde81ead5f2448344f39137a9a4f30fd7b841c (diff)
downloadupstream-c253898e89c84973956b69ba629425051a47a6a8.tar.gz
upstream-c253898e89c84973956b69ba629425051a47a6a8.tar.bz2
upstream-c253898e89c84973956b69ba629425051a47a6a8.zip
rtl8366_smi: sanitize gpio values to a 0/1 boolean
SVN-Revision: 19402
Diffstat (limited to 'target/linux/generic-2.6/files')
-rw-r--r--target/linux/generic-2.6/files/drivers/net/phy/rtl8366_smi.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic-2.6/files/drivers/net/phy/rtl8366_smi.c
index 70218fc6ca..7091190b8d 100644
--- a/target/linux/generic-2.6/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic-2.6/files/drivers/net/phy/rtl8366_smi.c
@@ -91,10 +91,7 @@ static void rtl8366_smi_write_bits(struct rtl8366_smi *smi, u32 data, u32 len)
rtl8366_smi_clk_delay(smi);
/* prepare data */
- if ( data & ( 1 << (len - 1)) )
- gpio_set_value(sda, 1);
- else
- gpio_set_value(sda, 0);
+ gpio_set_value(sda, !!(data & ( 1 << (len - 1))));
rtl8366_smi_clk_delay(smi);
/* clocking */
@@ -119,7 +116,7 @@ static void rtl8366_smi_read_bits(struct rtl8366_smi *smi, u32 len, u32 *data)
/* clocking */
gpio_set_value(sck, 1);
rtl8366_smi_clk_delay(smi);
- u = gpio_get_value(sda);
+ u = !!gpio_get_value(sda);
gpio_set_value(sck, 0);
*data |= (u << (len - 1));