net: dsa: mv88e6xxx: move STU GetNext operation
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 1 May 2017 18:05:19 +0000 (14:05 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 May 2017 19:03:11 +0000 (15:03 -0400)
Extract the generic portion of code to issue an STU GetNext operation,
which will be used in other implementations.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/mv88e6xxx/global1.h
drivers/net/dsa/mv88e6xxx/global1_vtu.c

index b163e40bf42ecfc95c030a837dd1088d26aa703e..5441b05f519bf4a7eec751f8af2d805a214e4d88 100644 (file)
@@ -1422,19 +1422,7 @@ static int _mv88e6xxx_stu_getnext(struct mv88e6xxx_chip *chip, u8 sid,
        if (err)
                return err;
 
-       err = mv88e6xxx_g1_vtu_sid_write(chip, &next);
-       if (err)
-               return err;
-
-       err = mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_STU_GET_NEXT);
-       if (err)
-               return err;
-
-       err = mv88e6xxx_g1_vtu_sid_read(chip, &next);
-       if (err)
-               return err;
-
-       err = mv88e6xxx_g1_vtu_vid_read(chip, &next);
+       err = mv88e6xxx_g1_vtu_stu_getnext(chip, &next);
        if (err)
                return err;
 
index 9644ca649838248e1ff648046d892ca45090f447..5d276cc4262ba5159292fc5bd7ff6918a6f7e425 100644 (file)
@@ -70,6 +70,8 @@ int mv88e6xxx_g1_vtu_op_wait(struct mv88e6xxx_chip *chip);
 int mv88e6xxx_g1_vtu_op(struct mv88e6xxx_chip *chip, u16 op);
 int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
                             struct mv88e6xxx_vtu_entry *entry);
+int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
+                                struct mv88e6xxx_vtu_entry *vtu);
 int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip);
 
 #endif /* _MV88E6XXX_GLOBAL1_H */
index 060c4a5a802d22038a68bde28f3a60a0d4e261e2..cf572ba761952849806743860211b7def8551524 100644 (file)
@@ -174,6 +174,26 @@ int mv88e6185_g1_vtu_data_write(struct mv88e6xxx_chip *chip,
 
 /* VLAN Translation Unit Operations */
 
+int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
+                                struct mv88e6xxx_vtu_entry *entry)
+{
+       int err;
+
+       err = mv88e6xxx_g1_vtu_sid_write(chip, entry);
+       if (err)
+               return err;
+
+       err = mv88e6xxx_g1_vtu_op(chip, GLOBAL_VTU_OP_STU_GET_NEXT);
+       if (err)
+               return err;
+
+       err = mv88e6xxx_g1_vtu_sid_read(chip, entry);
+       if (err)
+               return err;
+
+       return mv88e6xxx_g1_vtu_vid_read(chip, entry);
+}
+
 int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
                             struct mv88e6xxx_vtu_entry *entry)
 {