Re: [PATCH v2 2/2] can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC)

From: Marc Kleine-Budde
Date: Wed Jun 16 2021 - 05:46:40 EST


On 04.06.2021 00:15:50, Vincent Mailhol wrote:
[...]

> +static size_t can_tdc_get_size(const struct net_device *dev)
> +{
> + struct can_priv *priv = netdev_priv(dev);
> + size_t size;
> +
> + if (!priv->tdc_const)
> + return 0;
> +
> + size = nla_total_size(0); /* nest IFLA_CAN_TDC */
> + size += nla_total_size(sizeof(u32)); /* IFLA_CAN_TDCV_MAX */
> + size += nla_total_size(sizeof(u32)); /* IFLA_CAN_TDCO_MAX */
> + size += nla_total_size(sizeof(u32)); /* IFLA_CAN_TDCF_MAX */
> +
> + if (priv->tdc.tdco) {

Naively I'd say, iff the device has tdc_const give the user space the
tdc parameters, regardless if some value is 0 or not.

What do you think?

Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature