mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
David S. Miller
parent
ebdcebcb8b
commit
6b29752423
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user