diff options
author | Andrew Lunn <andrew@lunn.ch> | 2019-10-25 01:03:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-29 00:21:02 +0100 |
commit | 6b297524234ccf3954b54609ab6bc2e8c4d3f677 (patch) | |
tree | dcce1a7f6db75e20d32723a21b09ee380f2b58c1 /net/dsa/dsa2.c | |
parent | r8169: use helper rtl_hw_aspm_clkreq_enable also in rtl_hw_start_8168g_2 (diff) | |
download | linux-6b297524234ccf3954b54609ab6bc2e8c4d3f677.tar.xz linux-6b297524234ccf3954b54609ab6bc2e8c4d3f677.zip |
net: dsa: Add support for devlink device parameters
Add plumbing to allow DSA drivers to register parameters with devlink.
To keep with the abstraction, the DSA drivers pass the ds structure to
these helpers, and the DSA core then translates that to the devlink
structure associated to the device.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r-- | net/dsa/dsa2.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 214dd703b0cc..e7aae96b54bb 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -349,6 +349,7 @@ static void dsa_port_teardown(struct dsa_port *dp) static int dsa_switch_setup(struct dsa_switch *ds) { + struct dsa_devlink_priv *dl_priv; int err; if (ds->setup) @@ -364,9 +365,11 @@ static int dsa_switch_setup(struct dsa_switch *ds) /* Add the switch to devlink before calling setup, so that setup can * add dpipe tables */ - ds->devlink = devlink_alloc(&dsa_devlink_ops, 0); + ds->devlink = devlink_alloc(&dsa_devlink_ops, sizeof(*dl_priv)); if (!ds->devlink) return -ENOMEM; + dl_priv = devlink_priv(ds->devlink); + dl_priv->ds = ds; err = devlink_register(ds->devlink, ds->dev); if (err) @@ -380,6 +383,8 @@ static int dsa_switch_setup(struct dsa_switch *ds) if (err < 0) goto unregister_notifier; + devlink_params_publish(ds->devlink); + if (!ds->slave_mii_bus && ds->ops->phy_read) { ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); if (!ds->slave_mii_bus) { |