summaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa_priv.h
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-10-16 11:12:16 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-18 12:24:33 +0100
commitd0006b002208936d36af8e4dce1f6dfeebb2dfba (patch)
tree414a1d4ba8c9c403fa88544b9f490eeb323facf4 /net/dsa/dsa_priv.h
parentd945097bb19501bd95790d8220d4eeb418b6ebb2 (diff)
downloadlinux-d0006b002208936d36af8e4dce1f6dfeebb2dfba.tar.gz
linux-d0006b002208936d36af8e4dce1f6dfeebb2dfba.tar.bz2
linux-d0006b002208936d36af8e4dce1f6dfeebb2dfba.zip
net: dsa: add slave to master helper
Many part of the DSA slave code require to get the master device assigned to a slave device. Remove dsa_master_netdev() in favor of a dsa_slave_to_master() helper which does that. 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>
Diffstat (limited to 'net/dsa/dsa_priv.h')
-rw-r--r--net/dsa/dsa_priv.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 569a4929b4c9..eedda1f1b099 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -176,6 +176,14 @@ static inline struct dsa_port *dsa_slave_to_port(const struct net_device *dev)
return p->dp;
}
+static inline struct net_device *
+dsa_slave_to_master(const struct net_device *dev)
+{
+ struct dsa_port *dp = dsa_slave_to_port(dev);
+
+ return dp->cpu_dp->netdev;
+}
+
/* switch.c */
int dsa_switch_register_notifier(struct dsa_switch *ds);
void dsa_switch_unregister_notifier(struct dsa_switch *ds);
@@ -204,9 +212,4 @@ extern const struct dsa_device_ops qca_netdev_ops;
/* tag_trailer.c */
extern const struct dsa_device_ops trailer_netdev_ops;
-static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)
-{
- return p->dp->cpu_dp->netdev;
-}
-
#endif