]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ptp: switch to using FIELD_GET_SIGNED()
authorYury Norov <ynorov@nvidia.com>
Mon, 27 Apr 2026 21:41:26 +0000 (17:41 -0400)
committerYury Norov <ynorov@nvidia.com>
Wed, 20 May 2026 15:18:27 +0000 (11:18 -0400)
Switch from sign_extend32(FIELD_GET()) to the dedicated
FIELD_GET_SIGNED() and don't calculate the fields length explicitly.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
drivers/ptp/ptp_fc3.c

index 70002500170eae445244cc82ec3979c3ac07d634..f0e000428a3f4c26ddd9c93cd229f72fc47be2b0 100644 (file)
@@ -55,8 +55,8 @@ static s64 tdc_meas2offset(struct idtfc3 *idtfc3, u64 meas_read)
 {
        s64 coarse, fine;
 
-       fine = sign_extend64(FIELD_GET(FINE_MEAS_MASK, meas_read), 12);
-       coarse = sign_extend64(FIELD_GET(COARSE_MEAS_MASK, meas_read), (39 - 13));
+       fine = FIELD_GET_SIGNED(FINE_MEAS_MASK, meas_read);
+       coarse = FIELD_GET_SIGNED(COARSE_MEAS_MASK, meas_read);
 
        fine = div64_s64(fine * NSEC_PER_SEC, idtfc3->tdc_apll_freq * 62LL);
        coarse = div64_s64(coarse * NSEC_PER_SEC, idtfc3->time_ref_freq);