remove abs64()
authorAndrew Morton <akpm@linux-foundation.org>
Mon, 9 Nov 2015 22:58:13 +0000 (14:58 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 Nov 2015 23:11:24 +0000 (15:11 -0800)
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>
13 files changed:
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/tegra/sor.c
drivers/input/joystick/walkera0701.c
drivers/media/i2c/ov9650.c
drivers/net/wireless/mac80211_hwsim.c
drivers/thermal/power_allocator.c
fs/ext4/mballoc.c
fs/gfs2/lock_dlm.c
include/linux/kernel.h
kernel/time/clocksource.c
kernel/time/timekeeping.c
lib/div64.c
net/sctp/transport.c

index 22d207e211e719b76b17c2a470d8323bb73ae6ba..22d8b78d537ebcdf83b8ff49819538001f55c7d4 100644 (file)
@@ -261,7 +261,7 @@ static void vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
         * available. In that case we can't account for this and just
         * hope for the best.
         */
-       if (vblrc && (abs64(diff_ns) > 1000000))
+       if (vblrc && (abs(diff_ns) > 1000000))
                store_vblank(dev, pipe, 1, &tvblank);
 
        spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
@@ -1772,7 +1772,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
         * e.g., due to spurious vblank interrupts. We need to
         * ignore those for accounting.
         */
-       if (abs64(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS)
+       if (abs(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS)
                store_vblank(dev, pipe, 1, &tvblank);
        else
                DRM_DEBUG("crtc %u: Redundant vblirq ignored. diff_ns = %d\n",
index da1715ebdd7118c698621e574764b0054aeb125b..3eff7cf75d2555a08c0f54dee0aa76cec42f6b3d 100644 (file)
@@ -555,11 +555,11 @@ static int tegra_sor_compute_params(struct tegra_sor *sor,
        error = div_s64(active_sym - approx, tu_size);
        error *= params->num_clocks;
 
-       if (error <= 0 && abs64(error) < params->error) {
+       if (error <= 0 && abs(error) < params->error) {
                params->active_count = div_u64(active_count, f);
                params->active_polarity = active_polarity;
                params->active_frac = active_frac;
-               params->error = abs64(error);
+               params->error = abs(error);
                params->tu_size = tu_size;
 
                if (error == 0)
index d88f5dd3c9d9e9a7080cbd9bacecb740e0791488..9c07fe911075f3e1dba089f07d7d60d10ac327ba 100644 (file)
@@ -150,7 +150,7 @@ static void walkera0701_irq_handler(void *handler_data)
                if (w->counter == 24) { /* full frame */
                        walkera0701_parse_frame(w);
                        w->counter = NO_SYNC;
-                       if (abs64(pulse_time - SYNC_PULSE) < RESERVE)   /* new frame sync */
+                       if (abs(pulse_time - SYNC_PULSE) < RESERVE)     /* new frame sync */
                                w->counter = 0;
                } else {
                        if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE)
@@ -161,7 +161,7 @@ static void walkera0701_irq_handler(void *handler_data)
                        } else
                                w->counter = NO_SYNC;
                }
-       } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) <
+       } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) <
                                RESERVE + BIN1_PULSE - BIN0_PULSE)      /* frame sync .. */
                w->counter = 0;
 
index e691bba1945b7a77c2078bf9ee577cbffa9ade7d..1ee6a5527c384676333587115a18565ba76f0519 100644 (file)
@@ -1133,7 +1133,7 @@ static int __ov965x_set_frame_interval(struct ov965x *ov965x,
                if (mbus_fmt->width != iv->size.width ||
                    mbus_fmt->height != iv->size.height)
                        continue;
-               err = abs64((u64)(iv->interval.numerator * 10000) /
+               err = abs((u64)(iv->interval.numerator * 10000) /
                            iv->interval.denominator - req_int);
                if (err < min_err) {
                        fiv = iv;
index ee46f4647fbc4803d629047462b4f696fcfea2f6..c00a7daaa4bc7be08c290cb2f159fb2e3a0ff19c 100644 (file)
@@ -787,7 +787,7 @@ static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
        struct mac80211_hwsim_data *data = hw->priv;
        u64 now = mac80211_hwsim_get_tsf(hw, vif);
        u32 bcn_int = data->beacon_int;
-       u64 delta = abs64(tsf - now);
+       u64 delta = abs(tsf - now);
 
        /* adjust after beaconing with new timestamp at old TBTT */
        if (tsf > now) {
index e570ff084add5b0596cbac05d07bca560d350b01..f0fbea386869a66d9ab60fdcc7f74d7e0179b095 100644 (file)
@@ -228,7 +228,7 @@ static u32 pid_controller(struct thermal_zone_device *tz,
        if (err < int_to_frac(tz->tzp->integral_cutoff)) {
                s64 i_next = i + mul_frac(tz->tzp->k_i, err);
 
-               if (abs64(i_next) < max_power_frac) {
+               if (abs(i_next) < max_power_frac) {
                        i = i_next;
                        params->err_integral += err;
                }
index b4b3c1f9181484767c0d812d262f57e115d91991..61eaf74dca3794b122a9e782e87c568ac99a8a65 100644 (file)
@@ -3333,8 +3333,8 @@ ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
                atomic_inc(&pa->pa_count);
                return pa;
        }
-       cur_distance = abs64(goal_block - cpa->pa_pstart);
-       new_distance = abs64(goal_block - pa->pa_pstart);
+       cur_distance = abs(goal_block - cpa->pa_pstart);
+       new_distance = abs(goal_block - pa->pa_pstart);
 
        if (cur_distance <= new_distance)
                return cpa;
index 284c1542783eb03dcdec9c1d5b5b91e92754ea12..8b907c5cc9135caad82506f921c1f0b56bb1acda 100644 (file)
@@ -50,7 +50,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index,
        s64 delta = sample - s->stats[index];
        s->stats[index] += (delta >> 3);
        index++;
-       s->stats[index] += ((abs64(delta) - s->stats[index]) >> 2);
+       s->stats[index] += ((abs(delta) - s->stats[index]) >> 2);
 }
 
 /**
index 05ce782d53ab2c196385494fcda0f683249ca467..350dfb08aee36bdce54c8ecf683dd7afed7b46ab 100644 (file)
@@ -223,9 +223,6 @@ extern int _cond_resched(void);
                ret;                                                    \
        }))
 
-/* Deprecated, use abs instead. */
-#define abs64(x) abs((s64)(x))
-
 /**
  * reciprocal_scale - "scale" a value into range [0, ep_ro)
  * @val: value
index 0d8fe8b8f72772e0899662c29011d1d22c261c8f..1347882d131e11a404b029d83edfb281483b9c9c 100644 (file)
@@ -217,7 +217,7 @@ static void clocksource_watchdog(unsigned long data)
                        continue;
 
                /* Check the deviation from the watchdog clocksource. */
-               if (abs64(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
+               if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
                        pr_warn("timekeeping watchdog: Marking clocksource '%s' as unstable because the skew is too large:\n",
                                cs->name);
                        pr_warn("                      '%s' wd_now: %llx wd_last: %llx mask: %llx\n",
index b1356b7ae57057139acf46c2c68cfa27688bcb63..d563c19603029bc6c57ac55154f71ed027320276 100644 (file)
@@ -1614,7 +1614,7 @@ static __always_inline void timekeeping_freqadjust(struct timekeeper *tk,
        negative = (tick_error < 0);
 
        /* Sort out the magnitude of the correction */
-       tick_error = abs64(tick_error);
+       tick_error = abs(tick_error);
        for (adj = 0; tick_error > interval; adj++)
                tick_error >>= 1;
 
index 19ea7ed4b948297ae8f03367d3484840ec4456f6..62a698a432bc6f618cd7b3ae1938b24e2215a93f 100644 (file)
@@ -162,7 +162,7 @@ s64 div64_s64(s64 dividend, s64 divisor)
 {
        s64 quot, t;
 
-       quot = div64_u64(abs64(dividend), abs64(divisor));
+       quot = div64_u64(abs(dividend), abs(divisor));
        t = (dividend ^ divisor) >> 63;
 
        return (quot ^ t) - t;
index a0a431824f63a731728bd36279dc76b86cc2471b..aab9e3f29755a58eb7584aa763b4b1a46d2e6608 100644 (file)
@@ -331,7 +331,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
                 * 1/8, rto_alpha would be expressed as 3.
                 */
                tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta)
-                       + (((__u32)abs64((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta);
+                       + (((__u32)abs((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta);
                tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha)
                        + (rtt >> net->sctp.rto_alpha);
        } else {