diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2020-09-26 01:04:21 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-26 01:35:27 +0200 |
commit | ff4cf8eae0a316a09bfff2eb281caa58354be6d3 (patch) | |
tree | 0260a30ff8b491c3fd6ca70267ff2935ceef9de4 | |
parent | net: dsa: sja1105: expose static config as devlink region (diff) | |
download | linux-ff4cf8eae0a316a09bfff2eb281caa58354be6d3.tar.xz linux-ff4cf8eae0a316a09bfff2eb281caa58354be6d3.zip |
net: dsa: sja1105: implement .devlink_info_get
Return the driver name and ASIC ID so that generic user space
application are able to know they're looking at sja1105 devlink regions
when pretty-printing them.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/dsa/sja1105/sja1105.h | 3 | ||||
-rw-r--r-- | drivers/net/dsa/sja1105/sja1105_devlink.c | 17 | ||||
-rw-r--r-- | drivers/net/dsa/sja1105/sja1105_main.c | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/dsa/sja1105/sja1105.h b/drivers/net/dsa/sja1105/sja1105.h index 4af70f619d8e..d582308c2401 100644 --- a/drivers/net/dsa/sja1105/sja1105.h +++ b/drivers/net/dsa/sja1105/sja1105.h @@ -255,6 +255,9 @@ int sja1105_devlink_param_get(struct dsa_switch *ds, u32 id, struct devlink_param_gset_ctx *ctx); int sja1105_devlink_param_set(struct dsa_switch *ds, u32 id, struct devlink_param_gset_ctx *ctx); +int sja1105_devlink_info_get(struct dsa_switch *ds, + struct devlink_info_req *req, + struct netlink_ext_ack *extack); /* From sja1105_spi.c */ int sja1105_xfer_buf(const struct sja1105_private *priv, diff --git a/drivers/net/dsa/sja1105/sja1105_devlink.c b/drivers/net/dsa/sja1105/sja1105_devlink.c index 07ae6913d188..b4bf1b10e66c 100644 --- a/drivers/net/dsa/sja1105/sja1105_devlink.c +++ b/drivers/net/dsa/sja1105/sja1105_devlink.c @@ -214,6 +214,23 @@ static void sja1105_teardown_devlink_params(struct dsa_switch *ds) ARRAY_SIZE(sja1105_devlink_params)); } +int sja1105_devlink_info_get(struct dsa_switch *ds, + struct devlink_info_req *req, + struct netlink_ext_ack *extack) +{ + struct sja1105_private *priv = ds->priv; + int rc; + + rc = devlink_info_driver_name_put(req, "sja1105"); + if (rc) + return rc; + + rc = devlink_info_version_fixed_put(req, + DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, + priv->info->name); + return rc; +} + int sja1105_devlink_setup(struct dsa_switch *ds) { int rc; diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index de4773e99549..547487c535df 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -3316,6 +3316,7 @@ static const struct dsa_switch_ops sja1105_switch_ops = { .crosschip_bridge_leave = sja1105_crosschip_bridge_leave, .devlink_param_get = sja1105_devlink_param_get, .devlink_param_set = sja1105_devlink_param_set, + .devlink_info_get = sja1105_devlink_info_get, }; static const struct of_device_id sja1105_dt_ids[]; |