public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH iwl-next] igb: use ktime_get_real helpers in igb_ptp_reset()
@ 2026-04-08  8:35 Aleksandr Loktionov
  2026-04-08 11:57 ` [Intel-wired-lan] " Paul Menzel
  0 siblings, 1 reply; 3+ messages in thread
From: Aleksandr Loktionov @ 2026-04-08  8:35 UTC (permalink / raw)
  To: intel-wired-lan, anthony.l.nguyen, aleksandr.loktionov
  Cc: netdev, Jacob Keller, Simon Horman

Replace ktime_to_ns(ktime_get_real()) with the direct equivalent
ktime_get_real_ns() and ktime_to_timespec64(ktime_get_real()) with
ktime_get_real_ts64() in igb_ptp_reset().  Using the combined helpers
avoids the unnecessary intermediate ktime_t variable and makes the
intent clearer.

Suggested-by: Jacob Keller <jacob.e.keller@intel.com>
Suggested-by: Simon Horman <horms@kernel.org>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index bd85d02..638d824 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -1500,12 +1500,13 @@ void igb_ptp_reset(struct igb_adapter *adapter)
 
 	/* Re-initialize the timer. */
 	if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
-		struct timespec64 ts = ktime_to_timespec64(ktime_get_real());
+		struct timespec64 ts;
 
+		ktime_get_real_ts64(&ts);
 		igb_ptp_write_i210(adapter, &ts);
 	} else {
 		timecounter_init(&adapter->tc, &adapter->cc,
-				 ktime_to_ns(ktime_get_real()));
+				 ktime_get_real_ns());
 	}
 out:
 	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-next] igb: use ktime_get_real helpers in igb_ptp_reset()
  2026-04-08  8:35 [PATCH iwl-next] igb: use ktime_get_real helpers in igb_ptp_reset() Aleksandr Loktionov
@ 2026-04-08 11:57 ` Paul Menzel
  2026-04-08 15:51   ` Jacob Keller
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Menzel @ 2026-04-08 11:57 UTC (permalink / raw)
  To: Aleksandr Loktionov
  Cc: intel-wired-lan, anthony.l.nguyen, netdev, Jacob Keller,
	Simon Horman

Dear Aleksandr,


Thank you for your patch.

Am 08.04.26 um 10:35 schrieb Aleksandr Loktionov:
> Replace ktime_to_ns(ktime_get_real()) with the direct equivalent
> ktime_get_real_ns() and ktime_to_timespec64(ktime_get_real()) with
> ktime_get_real_ts64() in igb_ptp_reset().  Using the combined helpers
> avoids the unnecessary intermediate ktime_t variable and makes the
> intent clearer.

No intermediate variable is removed in the diff below. What am I missing?

> Suggested-by: Jacob Keller <jacob.e.keller@intel.com>
> Suggested-by: Simon Horman <horms@kernel.org>
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
>   drivers/net/ethernet/intel/igb/igb_ptp.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index bd85d02..638d824 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -1500,12 +1500,13 @@ void igb_ptp_reset(struct igb_adapter *adapter)
>   
>   	/* Re-initialize the timer. */
>   	if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
> -		struct timespec64 ts = ktime_to_timespec64(ktime_get_real());
> +		struct timespec64 ts;
>   
> +		ktime_get_real_ts64(&ts);
>   		igb_ptp_write_i210(adapter, &ts);
>   	} else {
>   		timecounter_init(&adapter->tc, &adapter->cc,
> -				 ktime_to_ns(ktime_get_real()));
> +				 ktime_get_real_ns());
>   	}
>   out:
>   	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);

With the commit message clarified, feel free to add:

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-next] igb: use ktime_get_real helpers in igb_ptp_reset()
  2026-04-08 11:57 ` [Intel-wired-lan] " Paul Menzel
@ 2026-04-08 15:51   ` Jacob Keller
  0 siblings, 0 replies; 3+ messages in thread
From: Jacob Keller @ 2026-04-08 15:51 UTC (permalink / raw)
  To: Paul Menzel, Aleksandr Loktionov
  Cc: intel-wired-lan, anthony.l.nguyen, netdev, Simon Horman

On 4/8/2026 4:57 AM, Paul Menzel wrote:
> Dear Aleksandr,
> 
> 
> Thank you for your patch.
> 
> Am 08.04.26 um 10:35 schrieb Aleksandr Loktionov:
>> Replace ktime_to_ns(ktime_get_real()) with the direct equivalent
>> ktime_get_real_ns() and ktime_to_timespec64(ktime_get_real()) with
>> ktime_get_real_ts64() in igb_ptp_reset().  Using the combined helpers
>> avoids the unnecessary intermediate ktime_t variable and makes the
>> intent clearer.
> 
> No intermediate variable is removed in the diff below. What am I missing?
> 

The commit message is seems clear to me:

ktime_get_real() returns the current time as a ktime_t, and this is then
converted into a timepsec64 with ktime_to_timespec64.

The ktime_get_real_ts64() is implemented to generate the current time as
a timespec64 directly, avoiding the ktime_t passed between
ktime_get_real() and ktime_to_timespec64.

Thanks,
Jake

>> Suggested-by: Jacob Keller <jacob.e.keller@intel.com>
>> Suggested-by: Simon Horman <horms@kernel.org>
>> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
>> ---
>>   drivers/net/ethernet/intel/igb/igb_ptp.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/
>> ethernet/intel/igb/igb_ptp.c
>> index bd85d02..638d824 100644
>> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
>> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> @@ -1500,12 +1500,13 @@ void igb_ptp_reset(struct igb_adapter *adapter)
>>         /* Re-initialize the timer. */
>>       if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
>> -        struct timespec64 ts = ktime_to_timespec64(ktime_get_real());
>> +        struct timespec64 ts;
>>   +        ktime_get_real_ts64(&ts);
>>           igb_ptp_write_i210(adapter, &ts);
>>       } else {
>>           timecounter_init(&adapter->tc, &adapter->cc,
>> -                 ktime_to_ns(ktime_get_real()));
>> +                 ktime_get_real_ns());
>>       }
>>   out:
>>       spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
> 
> With the commit message clarified, feel free to add:
> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> 
> 
> Kind regards,
> 
> Paul


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-08 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08  8:35 [PATCH iwl-next] igb: use ktime_get_real helpers in igb_ptp_reset() Aleksandr Loktionov
2026-04-08 11:57 ` [Intel-wired-lan] " Paul Menzel
2026-04-08 15:51   ` Jacob Keller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox