summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-01-20 20:36:21 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-01-20 20:36:21 +0000
commit50849c6cff31ed09066961a21cfb0902c305037e (patch)
treec4280cdd148993214714188bce294c48c133326a /target/linux
parent3e6b3ea08846581f63f1d017fb1e8c6ae748e8cb (diff)
downloadmtk-20170518-50849c6cff31ed09066961a21cfb0902c305037e.zip
mtk-20170518-50849c6cff31ed09066961a21cfb0902c305037e.tar.gz
mtk-20170518-50849c6cff31ed09066961a21cfb0902c305037e.tar.bz2
rtl8366_smi: minor code optimalizations
SVN-Revision: 19247
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c b/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c
index 6b909b5..a50366a 100644
--- a/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c
@@ -553,13 +553,10 @@ static int rtl8366_get_mib_counter(struct rtl8366_smi *smi, int counter,
if (port > RTL8366_NUM_PORTS || counter >= RTL8366S_MIB_COUNT)
return -EINVAL;
- i = 0;
regoffset = RTL8366S_MIB_COUNTER_PORT_OFFSET * (port);
- while (i < counter) {
+ for (i = 0; i < counter; i++)
regoffset += mibLength[i];
- i++;
- }
addr = RTL8366S_MIB_COUNTER_BASE + regoffset;
@@ -833,7 +830,7 @@ static int rtl8366_set_port_vlan_index(struct rtl8366_smi *smi, int port,
if (err)
return err;
- vlan_data &= ~(vlan_data & bits);
+ vlan_data &= ~bits;
vlan_data |= data;
err = rtl8366_smi_write_reg(smi, addr, vlan_data);
@@ -918,9 +915,10 @@ static int rtl8366_vlan_set_vlan(struct rtl8366_smi *smi, int enable)
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
- data &= ~(data & RTL8366_CHIP_CTRL_VLAN);
if (enable)
data |= RTL8366_CHIP_CTRL_VLAN;
+ else
+ data &= ~RTL8366_CHIP_CTRL_VLAN;
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
@@ -931,9 +929,10 @@ static int rtl8366_vlan_set_4ktable(struct rtl8366_smi *smi, int enable)
rtl8366_smi_read_reg(smi, RTL8366S_VLAN_TB_CTRL_REG, &data);
- data &= ~(data & 1);
if (enable)
data |= 1;
+ else
+ data &= ~1;
return rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TB_CTRL_REG, data);
}
@@ -1274,7 +1273,7 @@ static int rtl8366_global_set_blinkrate(struct switch_dev *dev,
rtl8366_smi_read_reg(smi, RTL8366_LED_BLINKRATE_REG, &data);
- data &= ~(data & RTL8366_LED_BLINKRATE_MASK);
+ data &= ~RTL8366_LED_BLINKRATE_MASK;
data |= val->value.i;
rtl8366_smi_write_reg(smi, RTL8366_LED_BLINKRATE_REG, data);