[PATCH v3 2/2] can: bittiming: add temporary variable to increase readability

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

 



Introduce a temporary variable sample_point_in_tq which will hold the
sample point value expressed in time quanta instead of tenth of
percent.

This change is only to increase readability.

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

Please squash this patch into:
c2cd2b376005 ("can: bittiming: add calculation for CAN FD Transmitter Delay Compensation (TDC)")
---
 drivers/net/can/dev/bittiming.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/dev/bittiming.c b/drivers/net/can/dev/bittiming.c
index 853b0ffb443c..f49170eadd54 100644
--- a/drivers/net/can/dev/bittiming.c
+++ b/drivers/net/can/dev/bittiming.c
@@ -191,8 +191,9 @@ void can_calc_tdco(struct net_device *dev)
 	 */
 	if (dbt->brp == 1 || dbt->brp == 2) {
 		/* Reuse "normal" sample point and convert it to time quanta */
-		tdc->tdco = min(can_bit_time(dbt) * dbt->sample_point / 1000,
-				tdc_const->tdco_max);
+		u32 sample_point_in_tq = can_bit_time(dbt) * dbt->sample_point / 1000;
+
+		tdc->tdco = min(sample_point_in_tq, tdc_const->tdco_max);
 	} else {
 		tdc->tdco = 0;
 	}
-- 
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