net: switchdev: remove dev from switchdev_obj cb
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Tue, 29 Sep 2015 16:07:15 +0000 (12:07 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Sep 2015 04:31:59 +0000 (21:31 -0700)
The net_device associated to a dump operation does not have to be passed
to the callback. switchdev stores it in a superset struct, if needed.

Also some drivers (such as DSA drivers) may not have easy access to it.

This will simplify pushing the callback function down to the drivers.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.c
include/net/switchdev.h
net/dsa/slave.c
net/switchdev/switchdev.c

index d3f663262184e6771d42cc44998ed02370c0577e..78fd443f2ea163e943c9bf1783cacbfadbce95de 100644 (file)
@@ -4556,7 +4556,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port,
                fdb->ndm_state = NUD_REACHABLE;
                fdb->vid = rocker_port_vlan_to_vid(rocker_port,
                                                   found->key.vlan_id);
-               err = obj->cb(rocker_port->dev, obj);
+               err = obj->cb(obj);
                if (err)
                        break;
        }
@@ -4579,7 +4579,7 @@ static int rocker_port_vlan_dump(const struct rocker_port *rocker_port,
                if (rocker_vlan_id_is_internal(htons(vid)))
                        vlan->flags |= BRIDGE_VLAN_INFO_PVID;
                vlan->vid_begin = vlan->vid_end = vid;
-               err = obj->cb(rocker_port->dev, obj);
+               err = obj->cb(obj);
                if (err)
                        break;
        }
index 18207878e407baaf7f96566a6ee9b2f2eca55e0a..9ef7c563576986af8ac6e2173042245c43531b3d 100644 (file)
@@ -66,7 +66,7 @@ enum switchdev_obj_id {
 
 struct switchdev_obj {
        enum switchdev_obj_id id;
-       int (*cb)(struct net_device *dev, struct switchdev_obj *obj);
+       int (*cb)(struct switchdev_obj *obj);
        union {
                struct switchdev_obj_vlan {             /* PORT_VLAN */
                        u16 flags;
index f18cae54a5d8f3103d29e914f305f05f85f69c8e..0b47647961e8c044ccc5fe1dc1f150c20536c067 100644 (file)
@@ -334,7 +334,7 @@ static int dsa_slave_port_vlan_dump(struct net_device *dev,
                if (test_bit(p->port, untagged))
                        vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
 
-               err = obj->cb(dev, obj);
+               err = obj->cb(obj);
                if (err)
                        break;
        }
@@ -397,7 +397,7 @@ static int dsa_slave_port_fdb_dump(struct net_device *dev,
                obj->u.fdb.vid = vid;
                obj->u.fdb.ndm_state = is_static ? NUD_NOARP : NUD_REACHABLE;
 
-               ret = obj->cb(dev, obj);
+               ret = obj->cb(obj);
                if (ret < 0)
                        break;
        }
index c0e2047f89845d683018d79caa8e1d9ffe7f93d5..93f4971e68dbad66427bf56ec323449661613813 100644 (file)
@@ -514,8 +514,7 @@ static int switchdev_port_vlan_dump_put(struct switchdev_vlan_dump *dump)
        return 0;
 }
 
-static int switchdev_port_vlan_dump_cb(struct net_device *dev,
-                                      struct switchdev_obj *obj)
+static int switchdev_port_vlan_dump_cb(struct switchdev_obj *obj)
 {
        struct switchdev_vlan_dump *dump =
                container_of(obj, struct switchdev_vlan_dump, obj);
@@ -864,8 +863,7 @@ struct switchdev_fdb_dump {
        int idx;
 };
 
-static int switchdev_port_fdb_dump_cb(struct net_device *dev,
-                                     struct switchdev_obj *obj)
+static int switchdev_port_fdb_dump_cb(struct switchdev_obj *obj)
 {
        struct switchdev_fdb_dump *dump =
                container_of(obj, struct switchdev_fdb_dump, obj);