AA: generic: rtl8366_smi: only assign pvid if no pvid was set yet
authorJonas Gorski <jogo@openwrt.org>
Fri, 18 Jan 2013 15:21:59 +0000 (15:21 +0000)
committerJonas Gorski <jogo@openwrt.org>
Fri, 18 Jan 2013 15:21:59 +0000 (15:21 +0000)
Backport or r35227.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 35228

target/linux/generic/files/drivers/net/phy/rtl8366_smi.c

index be85274e783a001128e7e8eed4403ede622e470b..5ad1ff6fe4fa1c35f03d8d3f09ae14b5a1a966f5 100644 (file)
@@ -1106,6 +1106,7 @@ int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
 
        port = &val->value.ports[0];
        for (i = 0; i < val->len; i++, port++) {
+               int pvid;
                member |= BIT(port->id);
 
                if (!(port->flags & BIT(SWITCH_PORT_FLAG_TAGGED)))
@@ -1115,9 +1116,14 @@ int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
                 * To ensure that we have a valid MC entry for this VLAN,
                 * initialize the port VLAN ID here.
                 */
-               err = rtl8366_set_pvid(smi, port->id, val->port_vlan);
+               err = rtl8366_get_pvid(smi, port->id, &pvid);
                if (err < 0)
                        return err;
+               if (pvid == 0) {
+                       err = rtl8366_set_pvid(smi, port->id, val->port_vlan);
+                       if (err < 0)
+                               return err;
+               }
        }
 
        return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);