generic: rtl8366: generealize rtl8366{s,rb}_sw_get_port_mib functions
authorGabor Juhos <juhosg@openwrt.org>
Thu, 15 Jul 2010 13:05:32 +0000 (13:05 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Thu, 15 Jul 2010 13:05:32 +0000 (13:05 +0000)
SVN-Revision: 22199

target/linux/generic/files/drivers/net/phy/rtl8366rb.c
target/linux/generic/files/drivers/net/phy/rtl8366s.c

index f71f4f2b5b3d33852ea43534aaca762505bb8f37..d4fa74a864ef4f75f1083c464d9a38b0cce15892 100644 (file)
@@ -801,17 +801,18 @@ static int rtl8366rb_sw_get_port_mib(struct switch_dev *dev,
        unsigned long long counter = 0;
        char *buf = smi->buf;
 
-       if (val->port_vlan >= RTL8366RB_NUM_PORTS)
+       if (val->port_vlan >= smi->num_ports)
                return -EINVAL;
 
        len += snprintf(buf + len, sizeof(smi->buf) - len,
                        "Port %d MIB counters\n",
                        val->port_vlan);
 
-       for (i = 0; i < ARRAY_SIZE(rtl8366rb_mib_counters); ++i) {
+       for (i = 0; i < smi->num_mib_counters; ++i) {
                len += snprintf(buf + len, sizeof(smi->buf) - len,
-                               "%-36s: ", rtl8366rb_mib_counters[i].name);
-               if (!rtl8366rb_get_mib_counter(smi, i, val->port_vlan, &counter))
+                               "%-36s: ", smi->mib_counters[i].name);
+               if (!smi->ops->get_mib_counter(smi, i, val->port_vlan,
+                                              &counter))
                        len += snprintf(buf + len, sizeof(smi->buf) - len,
                                        "%llu\n", counter);
                else
index 7ed6c5fc1c6c766fe4a41fdfb571f9d39277c908..b603c2336041b0cbf5bb6917143c094bbe02eb68 100644 (file)
@@ -828,17 +828,18 @@ static int rtl8366s_sw_get_port_mib(struct switch_dev *dev,
        unsigned long long counter = 0;
        char *buf = smi->buf;
 
-       if (val->port_vlan >= RTL8366S_NUM_PORTS)
+       if (val->port_vlan >= smi->num_ports)
                return -EINVAL;
 
        len += snprintf(buf + len, sizeof(smi->buf) - len,
                        "Port %d MIB counters\n",
                        val->port_vlan);
 
-       for (i = 0; i < ARRAY_SIZE(rtl8366s_mib_counters); ++i) {
+       for (i = 0; i < smi->num_mib_counters; ++i) {
                len += snprintf(buf + len, sizeof(smi->buf) - len,
-                               "%-36s: ", rtl8366s_mib_counters[i].name);
-               if (!rtl8366_get_mib_counter(smi, i, val->port_vlan, &counter))
+                               "%-36s: ", smi->mib_counters[i].name);
+               if (!smi->ops->get_mib_counter(smi, i, val->port_vlan,
+                                              &counter))
                        len += snprintf(buf + len, sizeof(smi->buf) - len,
                                        "%llu\n", counter);
                else