diff options
author | Andrew Lunn <andrew@lunn.ch> | 2020-09-18 22:11:03 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-19 04:17:45 +0300 |
commit | ccc3e6b0191c58784c4b4ffc735f81970df33a11 (patch) | |
tree | 6b23909ce6c621dae8178433c422d8a600b89dfa /include | |
parent | d4602a9f47196dd62deba66ec361b5897f1ae62b (diff) | |
download | linux-ccc3e6b0191c58784c4b4ffc735f81970df33a11.tar.xz |
net: dsa: Add helper to convert from devlink to ds
Given a devlink instance, return the dsa switch it is associated to.
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/dsa.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 75c8fac82017..42ae6d4d9d43 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -664,6 +664,13 @@ struct dsa_devlink_priv { struct dsa_switch *ds; }; +static inline struct dsa_switch *dsa_devlink_to_ds(struct devlink *dl) +{ + struct dsa_devlink_priv *dl_priv = devlink_priv(dl); + + return dl_priv->ds; +} + struct dsa_switch_driver { struct list_head list; const struct dsa_switch_ops *ops; |