mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-03 11:07:29 +03:00
rtl8366_smi: sanitize gpio values to a 0/1 boolean
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19402 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
4b55dec3ed
commit
48e652dc63
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user