[PATCH v4 1/1] can: netlink: do tdco calculation after data bittiming is copied to can_priv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The call to can_calc_tdco() is done too early. The data_bittiming
field of can_priv is not yet updated.

Moving the call after tdco is memcopied solves the issue.

Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
---
Hi Marc,

Please squash this into below commit:
2b3d40020eca ("can: bittiming: add calculation for CAN FD Transmitter Delay Compensation (TDC)")
---
 drivers/net/can/dev/netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c
index 88dc56268670..18f7beeaf7d8 100644
--- a/drivers/net/can/dev/netlink.c
+++ b/drivers/net/can/dev/netlink.c
@@ -177,7 +177,6 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
 					priv->data_bitrate_const_cnt);
 		if (err)
 			return err;
-		can_calc_tdco(dev);
 
 		if (priv->bitrate_max && dbt.bitrate > priv->bitrate_max) {
 			netdev_err(dev, "canfd data bitrate surpasses transceiver capabilities of %d bps\n",
@@ -187,6 +186,8 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
 
 		memcpy(&priv->data_bittiming, &dbt, sizeof(dbt));
 
+		can_calc_tdco(dev);
+
 		if (priv->do_set_data_bittiming) {
 			/* Finally, set the bit-timing registers */
 			err = priv->do_set_data_bittiming(dev);
-- 
2.26.2




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux