On Fri, Oct 04, 2019 at 08:21:22PM -0400, Vivien Didelot wrote: > On Fri, 4 Oct 2019 23:09:33 +0200, Andrew Lunn <and...@lunn.ch> wrote: > > 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 <and...@lunn.ch> > > --- > > include/net/dsa.h | 23 +++++++++++++++++++++++ > > net/dsa/dsa.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ > > net/dsa/dsa2.c | 7 ++++++- > > 3 files changed, 77 insertions(+), 1 deletion(-) > > > > diff --git a/include/net/dsa.h b/include/net/dsa.h > > index 8c3ea0530f65..6623f4428930 100644 > > --- a/include/net/dsa.h > > +++ b/include/net/dsa.h > > @@ -541,6 +541,29 @@ struct dsa_switch_ops { > > */ > > netdev_tx_t (*port_deferred_xmit)(struct dsa_switch *ds, int port, > > struct sk_buff *skb); > > + /* Devlink parameters */ > > + int (*devlink_param_get)(struct dsa_switch *ds, u32 id, > > + struct devlink_param_gset_ctx *ctx); > > + int (*devlink_param_set)(struct dsa_switch *ds, u32 id, > > + struct devlink_param_gset_ctx *ctx); > > Unless that is how devlink is designed, shouldn't ctx be const on _set?
It is the way devlink is designed. The devlink structure is truct devlink_param { u32 id; const char *name; bool generic; enum devlink_param_type type; unsigned long supported_cmodes; int (*get)(struct devlink *devlink, u32 id, struct devlink_param_gset_ctx *ctx); int (*set)(struct devlink *devlink, u32 id, struct devlink_param_gset_ctx *ctx); int (*validate)(struct devlink *devlink, u32 id, union devlink_param_value val, struct netlink_ext_ack *extack); }; No const on set. Andrew