[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ff39d21-5770-44da-9d1f-c4447b8baa3f@web.de>
Date: Mon, 25 Aug 2025 19:01:12 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Xichao Zhao <zhao.xichao@...o.com>, linux-can@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>,
Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: Re: [PATCH] can: m_can: use us_to_ktime() where appropriate
> The tx_coalesce_usecs_irq are more suitable for using the
> us_to_ktime(). This can make the code more concise and
> enhance readability.
Wording suggestion:
The data structure members “rx_coalesce_usecs_irq” and
“tx_coalesce_usecs_irq” are more suitable for using us_to_ktime()
instead of calling ns_to_ktime().
Thus make the code more concise and enhance readability.
Should the information “where appropriate” be replaced by the hint
“in m_can_set_coalesce()” for the summary phrase?
…
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -2214,10 +2214,10 @@ static int m_can_set_coalesce(struct net_device *dev,
>
> if (cdev->rx_coalesce_usecs_irq)
> cdev->irq_timer_wait =
> - ns_to_ktime(cdev->rx_coalesce_usecs_irq * NSEC_PER_USEC);
> + us_to_ktime(cdev->rx_coalesce_usecs_irq);
> else
> cdev->irq_timer_wait =
> - ns_to_ktime(cdev->tx_coalesce_usecs_irq * NSEC_PER_USEC);
> + us_to_ktime(cdev->tx_coalesce_usecs_irq);
…
How do you think about to apply the following source code variant instead?
cdev->irq_timer_wait = us_to_ktime(cdev->rx_coalesce_usecs_irq
? cdev->rx_coalesce_usecs_irq
: cdev->tx_coalesce_usecs_irq);
Regards,
Markus
Powered by blists - more mailing lists