Commit ff8787d6 authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] convert private ABS() to kernel's abs()

Convert private ABS() defines and callers to use abs() from linux/kernel.h.
 Builds successfully.  stv0299, riva, & sstfb modules load.
Signed-off-by: default avatarRandy Dunlap <rddunlap@osdl.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 62d10271
......@@ -37,6 +37,7 @@
*/
#include <linux/config.h>
#include <linux/efi.h>
#include <linux/kernel.h>
#include <asm/pal.h>
#include <asm/sal.h>
#include <asm/sn/sn_sal.h>
......@@ -78,7 +79,6 @@
#define BOOT_PARAM_ADDR 0x40000
#define MAX(i,j) ((i) > (j) ? (i) : (j))
#define MIN(i,j) ((i) < (j) ? (i) : (j))
#define ABS(i) ((i) > 0 ? (i) : -(i))
#define ALIGN8(p) (((long)(p) +7) & ~7)
#define FPROM_BUG() do {while (1);} while (0)
......@@ -670,7 +670,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
for (i=0; i<=max_nasid; i++)
for (j=0; j<=max_nasid; j++)
if (nasid_present(i) && nasid_present(j))
*(cp+PROXIMITY_DOMAIN(i)*acpi_slit->localities+PROXIMITY_DOMAIN(j)) = 10 + MIN(254, 5*ABS(i-j));
*(cp+PROXIMITY_DOMAIN(i)*acpi_slit->localities+PROXIMITY_DOMAIN(j)) = 10 + MIN(254, 5*abs(i-j));
cp = acpi_slit->entry + acpi_slit->localities*acpi_slit->localities;
acpi_checksum(&acpi_slit->header, cp - (char*)acpi_slit);
......
......@@ -31,6 +31,7 @@
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/dma.h>
......@@ -786,8 +787,8 @@ int fdc_seek(int track)
}
}
#ifdef TESTING
time = ftape_timediff(time, ftape_timestamp()) / ABS(track - ftape_current_cylinder);
if ((time < 900 || time > 3100) && ABS(track - ftape_current_cylinder) > 5) {
time = ftape_timediff(time, ftape_timestamp()) / abs(track - ftape_current_cylinder);
if ((time < 900 || time > 3100) && abs(track - ftape_current_cylinder) > 5) {
TRACE(ft_t_warn, "Wrong FDC STEP interval: %d usecs (%d)",
time, track - ftape_current_cylinder);
}
......
......@@ -418,8 +418,6 @@ static int tsa5059_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype, in
}
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define MIN2(a,b) ((a) < (b) ? (a) : (b))
#define MIN3(a,b,c) MIN2(MIN2(a,b),c)
......@@ -436,8 +434,8 @@ static int tua6100_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq,
first_ZF = (freq) / 1000;
if (ABS(MIN2(ABS(first_ZF-1190),ABS(first_ZF-1790))) <
ABS(MIN3(ABS(first_ZF-1202),ABS(first_ZF-1542),ABS(first_ZF-1890))))
if (abs(MIN2(abs(first_ZF-1190),abs(first_ZF-1790))) <
abs(MIN3(abs(first_ZF-1202),abs(first_ZF-1542),abs(first_ZF-1890))))
_fband = 2;
else
_fband = 3;
......
......@@ -46,6 +46,7 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.33 2002/08/05 20:47:06 mvojkovi Exp $ */
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include "riva_hw.h"
......@@ -147,7 +148,7 @@ static int ShowHideCursor
#define GFIFO_SIZE_128 256
#define MFIFO_SIZE 120
#define VFIFO_SIZE 256
#define ABS(a) (a>0?a:-a)
typedef struct {
int gdrain_rate;
int vdrain_rate;
......@@ -376,44 +377,44 @@ static int nv3_iterate(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_arb_i
}
ns = 1000000*ainfo->gburst_size/(state->memory_width/8)/state->mclk_khz;
tmp = ns * ainfo->gdrain_rate/1000000;
if (ABS(ainfo->gburst_size) + ((ABS(ainfo->wcglwm) + 16 ) & ~0x7) - tmp > max_gfsize)
if (abs(ainfo->gburst_size) + ((abs(ainfo->wcglwm) + 16 ) & ~0x7) - tmp > max_gfsize)
{
ainfo->converged = 0;
return (1);
}
ns = 1000000*ainfo->vburst_size/(state->memory_width/8)/state->mclk_khz;
tmp = ns * ainfo->vdrain_rate/1000000;
if (ABS(ainfo->vburst_size) + (ABS(ainfo->wcvlwm + 32) & ~0xf) - tmp> VFIFO_SIZE)
if (abs(ainfo->vburst_size) + (abs(ainfo->wcvlwm + 32) & ~0xf) - tmp> VFIFO_SIZE)
{
ainfo->converged = 0;
return (1);
}
if (ABS(ainfo->gocc) > max_gfsize)
if (abs(ainfo->gocc) > max_gfsize)
{
ainfo->converged = 0;
return (1);
}
if (ABS(ainfo->vocc) > VFIFO_SIZE)
if (abs(ainfo->vocc) > VFIFO_SIZE)
{
ainfo->converged = 0;
return (1);
}
if (ABS(ainfo->mocc) > MFIFO_SIZE)
if (abs(ainfo->mocc) > MFIFO_SIZE)
{
ainfo->converged = 0;
return (1);
}
if (ABS(vfsize) > VFIFO_SIZE)
if (abs(vfsize) > VFIFO_SIZE)
{
ainfo->converged = 0;
return (1);
}
if (ABS(gfsize) > max_gfsize)
if (abs(gfsize) > max_gfsize)
{
ainfo->converged = 0;
return (1);
}
if (ABS(mfsize) > MFIFO_SIZE)
if (abs(mfsize) > MFIFO_SIZE)
{
ainfo->converged = 0;
return (1);
......@@ -493,8 +494,8 @@ static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state, nv3_arb_in
}
if (ainfo->converged)
{
res_info->graphics_lwm = (int)ABS(ainfo->wcglwm) + 16;
res_info->video_lwm = (int)ABS(ainfo->wcvlwm) + 32;
res_info->graphics_lwm = (int)abs(ainfo->wcglwm) + 16;
res_info->video_lwm = (int)abs(ainfo->wcvlwm) + 32;
res_info->graphics_burst_size = ainfo->gburst_size;
res_info->video_burst_size = ainfo->vburst_size;
res_info->graphics_hi_priority = (ainfo->priority == GRAPHICS);
......
......@@ -349,10 +349,10 @@ static int sst_calc_pll(const int freq, int *freq_out, struct pll_timing *t)
if (m >= 128)
break;
fout = (DAC_FREF * (m + 2)) / ((1 << p) * (n + 2));
if ((ABS(fout - freq) < best_err) && (m > 0)) {
if ((abs(fout - freq) < best_err) && (m > 0)) {
best_n = n;
best_m = m;
best_err = ABS(fout - freq);
best_err = abs(fout - freq);
/* we get the lowest m , allowing 0.5% error in freq*/
if (200*best_err < freq) break;
}
......
......@@ -195,7 +195,6 @@ typedef union {
/* some useful macro's
*/
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define NR_ITEMS(x) (int)(sizeof(x)/ sizeof(*x))
#endif /* __KERNEL__ */
......
......@@ -72,10 +72,6 @@
#define BIT(x) (1ul<<(x))
#define POW2(x) (1ul<<(x))
#ifndef ABS
# define ABS(x) (((x)<0)?-(x):(x))
#endif
/*
*
* Const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment