Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

remove abs64()

Switch everything to the new and more capable implementation of abs().
Mainly to give the new abs() a bit of a workout.

Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrew Morton and committed by
Linus Torvalds
79211c8e c8299cb6

+16 -19
+2 -2
drivers/gpu/drm/drm_irq.c
··· 261 261 * available. In that case we can't account for this and just 262 262 * hope for the best. 263 263 */ 264 - if (vblrc && (abs64(diff_ns) > 1000000)) 264 + if (vblrc && (abs(diff_ns) > 1000000)) 265 265 store_vblank(dev, pipe, 1, &tvblank); 266 266 267 267 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); ··· 1772 1772 * e.g., due to spurious vblank interrupts. We need to 1773 1773 * ignore those for accounting. 1774 1774 */ 1775 - if (abs64(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) 1775 + if (abs(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) 1776 1776 store_vblank(dev, pipe, 1, &tvblank); 1777 1777 else 1778 1778 DRM_DEBUG("crtc %u: Redundant vblirq ignored. diff_ns = %d\n",
+2 -2
drivers/gpu/drm/tegra/sor.c
··· 555 555 error = div_s64(active_sym - approx, tu_size); 556 556 error *= params->num_clocks; 557 557 558 - if (error <= 0 && abs64(error) < params->error) { 558 + if (error <= 0 && abs(error) < params->error) { 559 559 params->active_count = div_u64(active_count, f); 560 560 params->active_polarity = active_polarity; 561 561 params->active_frac = active_frac; 562 - params->error = abs64(error); 562 + params->error = abs(error); 563 563 params->tu_size = tu_size; 564 564 565 565 if (error == 0)
+2 -2
drivers/input/joystick/walkera0701.c
··· 150 150 if (w->counter == 24) { /* full frame */ 151 151 walkera0701_parse_frame(w); 152 152 w->counter = NO_SYNC; 153 - if (abs64(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ 153 + if (abs(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ 154 154 w->counter = 0; 155 155 } else { 156 156 if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) ··· 161 161 } else 162 162 w->counter = NO_SYNC; 163 163 } 164 - } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) < 164 + } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < 165 165 RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ 166 166 w->counter = 0; 167 167
+1 -1
drivers/media/i2c/ov9650.c
··· 1133 1133 if (mbus_fmt->width != iv->size.width || 1134 1134 mbus_fmt->height != iv->size.height) 1135 1135 continue; 1136 - err = abs64((u64)(iv->interval.numerator * 10000) / 1136 + err = abs((u64)(iv->interval.numerator * 10000) / 1137 1137 iv->interval.denominator - req_int); 1138 1138 if (err < min_err) { 1139 1139 fiv = iv;
+1 -1
drivers/net/wireless/mac80211_hwsim.c
··· 787 787 struct mac80211_hwsim_data *data = hw->priv; 788 788 u64 now = mac80211_hwsim_get_tsf(hw, vif); 789 789 u32 bcn_int = data->beacon_int; 790 - u64 delta = abs64(tsf - now); 790 + u64 delta = abs(tsf - now); 791 791 792 792 /* adjust after beaconing with new timestamp at old TBTT */ 793 793 if (tsf > now) {
+1 -1
drivers/thermal/power_allocator.c
··· 228 228 if (err < int_to_frac(tz->tzp->integral_cutoff)) { 229 229 s64 i_next = i + mul_frac(tz->tzp->k_i, err); 230 230 231 - if (abs64(i_next) < max_power_frac) { 231 + if (abs(i_next) < max_power_frac) { 232 232 i = i_next; 233 233 params->err_integral += err; 234 234 }
+2 -2
fs/ext4/mballoc.c
··· 3333 3333 atomic_inc(&pa->pa_count); 3334 3334 return pa; 3335 3335 } 3336 - cur_distance = abs64(goal_block - cpa->pa_pstart); 3337 - new_distance = abs64(goal_block - pa->pa_pstart); 3336 + cur_distance = abs(goal_block - cpa->pa_pstart); 3337 + new_distance = abs(goal_block - pa->pa_pstart); 3338 3338 3339 3339 if (cur_distance <= new_distance) 3340 3340 return cpa;
+1 -1
fs/gfs2/lock_dlm.c
··· 50 50 s64 delta = sample - s->stats[index]; 51 51 s->stats[index] += (delta >> 3); 52 52 index++; 53 - s->stats[index] += ((abs64(delta) - s->stats[index]) >> 2); 53 + s->stats[index] += ((abs(delta) - s->stats[index]) >> 2); 54 54 } 55 55 56 56 /**
-3
include/linux/kernel.h
··· 223 223 ret; \ 224 224 })) 225 225 226 - /* Deprecated, use abs instead. */ 227 - #define abs64(x) abs((s64)(x)) 228 - 229 226 /** 230 227 * reciprocal_scale - "scale" a value into range [0, ep_ro) 231 228 * @val: value
+1 -1
kernel/time/clocksource.c
··· 217 217 continue; 218 218 219 219 /* Check the deviation from the watchdog clocksource. */ 220 - if (abs64(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { 220 + if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { 221 221 pr_warn("timekeeping watchdog: Marking clocksource '%s' as unstable because the skew is too large:\n", 222 222 cs->name); 223 223 pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %llx\n",
+1 -1
kernel/time/timekeeping.c
··· 1614 1614 negative = (tick_error < 0); 1615 1615 1616 1616 /* Sort out the magnitude of the correction */ 1617 - tick_error = abs64(tick_error); 1617 + tick_error = abs(tick_error); 1618 1618 for (adj = 0; tick_error > interval; adj++) 1619 1619 tick_error >>= 1; 1620 1620
+1 -1
lib/div64.c
··· 162 162 { 163 163 s64 quot, t; 164 164 165 - quot = div64_u64(abs64(dividend), abs64(divisor)); 165 + quot = div64_u64(abs(dividend), abs(divisor)); 166 166 t = (dividend ^ divisor) >> 63; 167 167 168 168 return (quot ^ t) - t;
+1 -1
net/sctp/transport.c
··· 331 331 * 1/8, rto_alpha would be expressed as 3. 332 332 */ 333 333 tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta) 334 - + (((__u32)abs64((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta); 334 + + (((__u32)abs((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta); 335 335 tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha) 336 336 + (rtt >> net->sctp.rto_alpha); 337 337 } else {