Linux CAN drivers development
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Xichao Zhao <zhao.xichao@vivo.com>, linux-can@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Chandrasekar Ramakrishnan <rcsekar@samsung.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Subject: Re: [PATCH] can: m_can: use us_to_ktime() where appropriate
Date: Mon, 25 Aug 2025 19:01:12 +0200	[thread overview]
Message-ID: <6ff39d21-5770-44da-9d1f-c4447b8baa3f@web.de> (raw)
In-Reply-To: <20250825090904.248927-1-zhao.xichao@vivo.com>

> 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

  parent reply	other threads:[~2025-08-25 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-08-26  2:53   ` 赵西超
2025-08-26  8:41 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ff39d21-5770-44da-9d1f-c4447b8baa3f@web.de \
    --to=markus.elfring@web.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=rcsekar@samsung.com \
    --cc=zhao.xichao@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox