summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-01-20 20:36:21 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-01-20 20:36:21 +0000
commit64f1c1d827b9cae51f0d72af0cd3ee99ebf1a8d3 (patch)
treee3f967fe44d26f41f55f109e89c16d69f6b91080 /target/linux
parentaac113a5bf2d2fa0a1d5cce714f6028a0fea8a2c (diff)
rtl8366_smi: minor code optimalizations
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19247 3c298f89-4303-0410-b956-a3cf2f4a3e73
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 6b909b564c..a50366a331 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);