All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH intel-next] ice: Use div64_u64 instead of div_u64 in adjfine
@ 2021-11-04 13:52 Karol Kolacinski
  2021-12-14  9:35 ` G, GurucharanX
  0 siblings, 1 reply; 2+ messages in thread
From: Karol Kolacinski @ 2021-11-04 13:52 UTC (permalink / raw)
  To: intel-wired-lan

Change the division in ice_ptp_adjfine from div_u64 to div64_u64.
div_u64 is used when the divisor is 32 bit but in this case incval is
64 bit and it caused incorrect calculations and incval adjustments.

Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 2b3b2060b504..2149595cc632 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -1104,7 +1104,7 @@ static int ice_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm)
 		scaled_ppm = -scaled_ppm;
 	}
 
-	while ((u64)scaled_ppm > div_u64(U64_MAX, incval)) {
+	while ((u64)scaled_ppm > div64_u64(U64_MAX, incval)) {
 		/* handle overflow by scaling down the scaled_ppm and
 		 * the divisor, losing some precision
 		 */
-- 
2.32.0


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

* [Intel-wired-lan] [PATCH intel-next] ice: Use div64_u64 instead of div_u64 in adjfine
  2021-11-04 13:52 [Intel-wired-lan] [PATCH intel-next] ice: Use div64_u64 instead of div_u64 in adjfine Karol Kolacinski
@ 2021-12-14  9:35 ` G, GurucharanX
  0 siblings, 0 replies; 2+ messages in thread
From: G, GurucharanX @ 2021-12-14  9:35 UTC (permalink / raw)
  To: intel-wired-lan



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Karol
> Kolacinski
> Sent: Thursday, November 4, 2021 7:22 PM
> To: intel-wired-lan at lists.osuosl.org
> Cc: Kolacinski, Karol <karol.kolacinski@intel.com>
> Subject: [Intel-wired-lan] [PATCH intel-next] ice: Use div64_u64 instead of
> div_u64 in adjfine
> 
> Change the division in ice_ptp_adjfine from div_u64 to div64_u64.
> div_u64 is used when the divisor is 32 bit but in this case incval is
> 64 bit and it caused incorrect calculations and incval adjustments.
> 
> Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)

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

end of thread, other threads:[~2021-12-14  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 13:52 [Intel-wired-lan] [PATCH intel-next] ice: Use div64_u64 instead of div_u64 in adjfine Karol Kolacinski
2021-12-14  9:35 ` G, GurucharanX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.