[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190115101512.GD2290@nanopsycho>
Date: Tue, 15 Jan 2019 11:15:12 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
oss-drivers@...ronome.com
Subject: Re: [RFC net-next 1/6] devlink: add device information API
Tue, Jan 15, 2019 at 01:50:03AM CET, jakub.kicinski@...ronome.com wrote:
[...]
>+static int devlink_nl_info_sn_fill(struct sk_buff *msg, struct devlink *devlink,
>+ struct netlink_ext_ack *extack)
>+{
>+ unsigned char sn[32];
:/ Not good to have number directly here.
>+ size_t len = 0;
>+ int err;
>+
>+ if (!devlink->ops->serial_get)
>+ return 0;
>+
>+ err = devlink->ops->serial_get(devlink, sn, ARRAY_SIZE(sn), &len,
>+ extack);
Maybe it would be good to have a helper to fill this as well. That way,
driver could pass buffer of any length and helper would encode it into
skb.
>+ if (err)
>+ return err;
>+
>+ return nla_put(msg, DEVLINK_ATTR_INFO_SERIAL_NUMBER, len, sn);
>+}
[...]
Powered by blists - more mailing lists