summaryrefslogtreecommitdiff
path: root/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2020-09-18 22:11:03 +0300
committerDavid S. Miller <davem@davemloft.net>2020-09-19 04:17:45 +0300
commitccc3e6b0191c58784c4b4ffc735f81970df33a11 (patch)
tree6b23909ce6c621dae8178433c422d8a600b89dfa /net/dsa
parentd4602a9f47196dd62deba66ec361b5897f1ae62b (diff)
downloadlinux-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 'net/dsa')
-rw-r--r--net/dsa/dsa.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 1ce9ba8cf545..9b7019d86165 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -330,11 +330,7 @@ EXPORT_SYMBOL_GPL(call_dsa_notifiers);
int dsa_devlink_param_get(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx)
{
- struct dsa_devlink_priv *dl_priv;
- struct dsa_switch *ds;
-
- dl_priv = devlink_priv(dl);
- ds = dl_priv->ds;
+ struct dsa_switch *ds = dsa_devlink_to_ds(dl);
if (!ds->ops->devlink_param_get)
return -EOPNOTSUPP;
@@ -346,11 +342,7 @@ EXPORT_SYMBOL_GPL(dsa_devlink_param_get);
int dsa_devlink_param_set(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx)
{
- struct dsa_devlink_priv *dl_priv;
- struct dsa_switch *ds;
-
- dl_priv = devlink_priv(dl);
- ds = dl_priv->ds;
+ struct dsa_switch *ds = dsa_devlink_to_ds(dl);
if (!ds->ops->devlink_param_set)
return -EOPNOTSUPP;