* [PATCH] can: m_can: use us_to_ktime() where appropriate
@ 2025-08-25 9:09 Xichao Zhao
2025-08-25 10:42 ` Vincent Mailhol
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Xichao Zhao @ 2025-08-25 9:09 UTC (permalink / raw)
To: rcsekar, mkl, mailhol.vincent; +Cc: linux-can, linux-kernel, Xichao Zhao
The tx_coalesce_usecs_irq are more suitable for using the
us_to_ktime(). This can make the code more concise and
enhance readability.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
drivers/net/can/m_can/m_can.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index fe74dbd2c966..32a57fbcce69 100644
--- a/drivers/net/can/m_can/m_can.c
+++ 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);
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] can: m_can: use us_to_ktime() where appropriate
2025-08-25 9:09 [PATCH] can: m_can: use us_to_ktime() where appropriate Xichao Zhao
@ 2025-08-25 10:42 ` Vincent Mailhol
2025-08-25 17:01 ` Markus Elfring
2025-08-26 8:41 ` Marc Kleine-Budde
2 siblings, 0 replies; 5+ messages in thread
From: Vincent Mailhol @ 2025-08-25 10:42 UTC (permalink / raw)
To: Xichao Zhao; +Cc: linux-can, linux-kernel, rcsekar, mkl
Hi Xichao,
Thanks for the patch!
On 25/08/2025 at 18:09, Xichao Zhao wrote:
> The tx_coalesce_usecs_irq are more suitable for using the
> us_to_ktime(). This can make the code more concise and
> enhance readability.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: m_can: use us_to_ktime() where appropriate
2025-08-25 9:09 [PATCH] can: m_can: use us_to_ktime() where appropriate Xichao Zhao
2025-08-25 10:42 ` Vincent Mailhol
@ 2025-08-25 17:01 ` Markus Elfring
2025-08-26 2:53 ` 赵西超
2025-08-26 8:41 ` Marc Kleine-Budde
2 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2025-08-25 17:01 UTC (permalink / raw)
To: Xichao Zhao, linux-can
Cc: LKML, Chandrasekar Ramakrishnan, Marc Kleine-Budde,
Vincent Mailhol
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: m_can: use us_to_ktime() where appropriate
2025-08-25 17:01 ` Markus Elfring
@ 2025-08-26 2:53 ` 赵西超
0 siblings, 0 replies; 5+ messages in thread
From: 赵西超 @ 2025-08-26 2:53 UTC (permalink / raw)
To: Markus Elfring, linux-can@vger.kernel.org
Cc: LKML, Chandrasekar Ramakrishnan, Marc Kleine-Budde,
Vincent Mailhol
> [You don't often get email from markus.elfring@web.de. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
>> 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
Thank you for your suggestions. I have incorporated them and sent the
second version of the patch.
Regards,
Xichao Zhao
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: m_can: use us_to_ktime() where appropriate
2025-08-25 9:09 [PATCH] can: m_can: use us_to_ktime() where appropriate Xichao Zhao
2025-08-25 10:42 ` Vincent Mailhol
2025-08-25 17:01 ` Markus Elfring
@ 2025-08-26 8:41 ` Marc Kleine-Budde
2 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2025-08-26 8:41 UTC (permalink / raw)
To: Xichao Zhao; +Cc: rcsekar, mailhol.vincent, linux-can, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
On 25.08.2025 17:09:04, Xichao Zhao wrote:
> The tx_coalesce_usecs_irq are more suitable for using the
> us_to_ktime(). This can make the code more concise and
> enhance readability.
Applied to linux-can-next.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-27 7:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25 9:09 [PATCH] can: m_can: use us_to_ktime() where appropriate Xichao Zhao
2025-08-25 10:42 ` Vincent Mailhol
2025-08-25 17:01 ` Markus Elfring
2025-08-26 2:53 ` 赵西超
2025-08-26 8:41 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).