summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-06-30 09:40:19 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2014-07-01 10:15:26 +0200
commit931c1dcec043e6baac718a94f8731cc31461d4db (patch)
tree5a7df8a3924f3feec91121c2f98988c84d52faf1 /src
parentf41cb4ecd23c951e1c1c4fef0c99772983a3eba4 (diff)
downloadcoreboot-931c1dcec043e6baac718a94f8731cc31461d4db.tar.xz
stdlib: Drop duplicates of min() and max()
Change-Id: Ib2f6fad735e085d237a0d46e0586e123eef6e0e2 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/6161 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/ati/ragexl/atyfb.h2
-rw-r--r--src/drivers/pc80/tpm.c2
-rw-r--r--src/include/spi_flash.h2
-rw-r--r--src/include/stdlib.h3
-rw-r--r--src/northbridge/intel/gm45/raminit.c2
-rw-r--r--src/northbridge/intel/nehalem/raminit.c4
-rw-r--r--src/southbridge/intel/common/spi.c2
7 files changed, 5 insertions, 12 deletions
diff --git a/src/drivers/ati/ragexl/atyfb.h b/src/drivers/ati/ragexl/atyfb.h
index 557ead7752..94f31fe86e 100644
--- a/src/drivers/ati/ragexl/atyfb.h
+++ b/src/drivers/ati/ragexl/atyfb.h
@@ -6,8 +6,6 @@
#define EINVAL -1
-#define max(x,y) (x>=y)?x:y
-
#if CONFIG_CONSOLE_BTEXT
/*
* Elements of the hardware specific atyfb_par structure
diff --git a/src/drivers/pc80/tpm.c b/src/drivers/pc80/tpm.c
index f581ab49d3..40f1e7bd4e 100644
--- a/src/drivers/pc80/tpm.c
+++ b/src/drivers/pc80/tpm.c
@@ -50,8 +50,6 @@
TPM_DEBUG("Write reg 0x%x with 0x%x\n", (reg_), (val_))
#define printf(x...) printk(BIOS_ERR, x)
-#define min(a,b) MIN(a,b)
-#define max(a,b) MAX(a,b)
#define readb(_a) (*(volatile unsigned char *) (_a))
#define writeb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
#define readl(_a) (*(volatile unsigned long *) (_a))
diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h
index fe48d3b757..8e514719a1 100644
--- a/src/include/spi_flash.h
+++ b/src/include/spi_flash.h
@@ -39,8 +39,6 @@
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
-#define min(a, b) ((a)<(b)?(a):(b))
-
#define CONFIG_ICH_SPI
#ifdef CONFIG_ICH_SPI
#define CONTROLLER_PAGE_LIMIT 64
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index cb5a6ca703..44d7c0126b 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -13,6 +13,9 @@
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define min(a,b) MIN((a),(b))
+#define max(a,b) MAX((a),(b))
+
#if !defined(__PRE_RAM__)
void *memalign(size_t boundary, size_t size);
void *malloc(size_t size);
diff --git a/src/northbridge/intel/gm45/raminit.c b/src/northbridge/intel/gm45/raminit.c
index d607f84e10..0636d9f9f2 100644
--- a/src/northbridge/intel/gm45/raminit.c
+++ b/src/northbridge/intel/gm45/raminit.c
@@ -20,6 +20,7 @@
*/
#include <stdint.h>
+#include <stdlib.h>
#include <arch/cpu.h>
#include <arch/io.h>
#include <device/pci_def.h>
@@ -361,7 +362,6 @@ static void collect_ddr3(spdinfo_t *const config)
}
}
-#define min(a, b) ((a) < (b))?(a):(b)
#define ROUNDUP_DIV(val, by) (((val) + (by) - 1) / (by))
#define ROUNDUP_DIV_THIS(val, by) val = ROUNDUP_DIV(val, by)
static fsb_clock_t read_fsb_clock(void)
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
index 2ddc35caee..761dc527bf 100644
--- a/src/northbridge/intel/nehalem/raminit.c
+++ b/src/northbridge/intel/nehalem/raminit.c
@@ -25,6 +25,7 @@
#endif
#if REAL
+#include <stdlib.h>
#include <console/console.h>
#include <string.h>
#include <arch/hlt.h>
@@ -571,9 +572,6 @@ static int find_lowest_bit_set32(u32 val)
return -1;
}
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-
enum {
DEVICE_TYPE = 2,
MODULE_TYPE = 3,
diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c
index b323dbbb2c..51586ccddb 100644
--- a/src/southbridge/intel/common/spi.c
+++ b/src/southbridge/intel/common/spi.c
@@ -35,8 +35,6 @@
#include <spi-generic.h>
-#define min(a, b) ((a)<(b)?(a):(b))
-
#define HSFC_FCYCLE_OFF 1 /* 1-2: FLASH Cycle */
#define HSFC_FCYCLE (0x3 << HSFC_FCYCLE_OFF)
#define HSFC_FDBC_OFF 8 /* 8-13: Flash Data Byte Count */