[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0ab671c5-2855-4818-98b2-a52af4477e23@vivo.com>
Date: Tue, 26 Aug 2025 02:53:56 +0000
From: 赵西超 <zhao.xichao@...o.com>
To: Markus Elfring <Markus.Elfring@....de>, "linux-can@...r.kernel.org"
<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
> [You don't often get email from markus.elfring@....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
Powered by blists - more mailing lists