net: dsa: constify cpu_dp member of dsa_port
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 6 Nov 2017 21:11:43 +0000 (16:11 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Nov 2017 00:26:49 +0000 (09:26 +0900)
A DSA port has a dedicated CPU port assigned to it, stored in the cpu_dp
member. It is not meant to be modified by a port, thus make it const.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dsa.h
net/dsa/slave.c

index e54332968417b5995acf4712f55a082a1a1dcfd1..2a8613b5a23d67dd7e7ccd6149718b32a9c05088 100644 (file)
@@ -190,7 +190,7 @@ struct dsa_port {
        struct dsa_switch       *ds;
        unsigned int            index;
        const char              *name;
-       struct dsa_port         *cpu_dp;
+       const struct dsa_port   *cpu_dp;
        struct device_node      *dn;
        unsigned int            ageing_time;
        u8                      stp_state;
index 814ced75a0ccfb7945c966aaecc7d30536868e4a..cc7fe47dd4bffcb37cc87312b94af2dff95ae0c9 100644 (file)
@@ -1147,7 +1147,7 @@ static void dsa_slave_notify(struct net_device *dev, unsigned long val)
 
 int dsa_slave_create(struct dsa_port *port)
 {
-       struct dsa_port *cpu_dp = port->cpu_dp;
+       const struct dsa_port *cpu_dp = port->cpu_dp;
        struct net_device *master = cpu_dp->master;
        struct dsa_switch *ds = port->ds;
        const char *name = port->name;