Eliminate all 'inline's from the flashrom code
They serve pretty much no purpose, compilers can optimize pretty much
all of what we might mark as inline anyway, _and_ inlines are not
enforced in any way by the compiler either. They're totally unneeded.
Kill them.
Corresponding to flashrom svn r522.
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/am29f040b.c b/am29f040b.c
index 1f08e77..7b11e25 100644
--- a/am29f040b.c
+++ b/am29f040b.c
@@ -20,8 +20,7 @@
#include "flash.h"
-static __inline__ int erase_sector_29f040b(chipaddr bios,
- unsigned long address)
+static int erase_sector_29f040b(chipaddr bios, unsigned long address)
{
chip_writeb(0xAA, bios + 0x555);
chip_writeb(0x55, bios + 0x2AA);
@@ -38,10 +37,8 @@
return 0;
}
-static __inline__ int write_sector_29f040b(chipaddr bios,
- uint8_t *src,
- chipaddr dst,
- unsigned int page_size)
+static int write_sector_29f040b(chipaddr bios, uint8_t *src, chipaddr dst,
+ unsigned int page_size)
{
int i;
diff --git a/flash.h b/flash.h
index 31f4bfd..671f1a1 100644
--- a/flash.h
+++ b/flash.h
@@ -104,55 +104,17 @@
extern const struct programmer_entry programmer_table[];
-static inline int programmer_init(void)
-{
- return programmer_table[programmer].init();
-}
-
-static inline int programmer_shutdown(void)
-{
- return programmer_table[programmer].shutdown();
-}
-
-static inline void *programmer_map_flash_region(const char *descr, unsigned long phys_addr, size_t len)
-{
- return programmer_table[programmer].map_flash_region(descr, phys_addr, len);
-}
-
-static inline void programmer_unmap_flash_region(void *virt_addr, size_t len)
-{
- programmer_table[programmer].unmap_flash_region(virt_addr, len);
-}
-
-static inline void chip_writeb(uint8_t val, chipaddr addr)
-{
- programmer_table[programmer].chip_writeb(val, addr);
-}
-
-static inline void chip_writew(uint16_t val, chipaddr addr)
-{
- programmer_table[programmer].chip_writew(val, addr);
-}
-
-static inline void chip_writel(uint32_t val, chipaddr addr)
-{
- programmer_table[programmer].chip_writel(val, addr);
-}
-
-static inline uint8_t chip_readb(const chipaddr addr)
-{
- return programmer_table[programmer].chip_readb(addr);
-}
-
-static inline uint16_t chip_readw(const chipaddr addr)
-{
- return programmer_table[programmer].chip_readw(addr);
-}
-
-static inline uint32_t chip_readl(const chipaddr addr)
-{
- return programmer_table[programmer].chip_readl(addr);
-}
+int programmer_init(void);
+int programmer_shutdown(void);
+void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
+ size_t len);
+void programmer_unmap_flash_region(void *virt_addr, size_t len);
+void chip_writeb(uint8_t val, chipaddr addr);
+void chip_writew(uint16_t val, chipaddr addr);
+void chip_writel(uint32_t val, chipaddr addr);
+uint8_t chip_readb(const chipaddr addr);
+uint16_t chip_readw(const chipaddr addr);
+uint32_t chip_readl(const chipaddr addr);
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
diff --git a/flashrom.c b/flashrom.c
index 116d55c..cd16d71 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -77,6 +77,58 @@
{},
};
+int programmer_init(void)
+{
+ return programmer_table[programmer].init();
+}
+
+int programmer_shutdown(void)
+{
+ return programmer_table[programmer].shutdown();
+}
+
+void *programmer_map_flash_region(const char *descr, unsigned long phys_addr,
+ size_t len)
+{
+ return programmer_table[programmer].map_flash_region(descr,
+ phys_addr, len);
+}
+
+void programmer_unmap_flash_region(void *virt_addr, size_t len)
+{
+ programmer_table[programmer].unmap_flash_region(virt_addr, len);
+}
+
+void chip_writeb(uint8_t val, chipaddr addr)
+{
+ programmer_table[programmer].chip_writeb(val, addr);
+}
+
+void chip_writew(uint16_t val, chipaddr addr)
+{
+ programmer_table[programmer].chip_writew(val, addr);
+}
+
+void chip_writel(uint32_t val, chipaddr addr)
+{
+ programmer_table[programmer].chip_writel(val, addr);
+}
+
+uint8_t chip_readb(const chipaddr addr)
+{
+ return programmer_table[programmer].chip_readb(addr);
+}
+
+uint16_t chip_readw(const chipaddr addr)
+{
+ return programmer_table[programmer].chip_readw(addr);
+}
+
+uint32_t chip_readl(const chipaddr addr)
+{
+ return programmer_table[programmer].chip_readl(addr);
+}
+
void map_flash_registers(struct flashchip *flash)
{
size_t size = flash->total_size * 1024;
diff --git a/ichspi.c b/ichspi.c
index f53b31f..4ddf2ad 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -127,14 +127,14 @@
static OPCODES *curopcodes = NULL;
/* HW access functions */
-static inline uint32_t REGREAD32(int X)
+static uint32_t REGREAD32(int X)
{
volatile uint32_t regval;
regval = *(volatile uint32_t *)((uint8_t *) spibar + X);
return regval;
}
-static inline uint16_t REGREAD16(int X)
+static uint16_t REGREAD16(int X)
{
volatile uint16_t regval;
regval = *(volatile uint16_t *)((uint8_t *) spibar + X);
@@ -146,8 +146,8 @@
#define REGWRITE8(X,Y) (*(uint8_t *)((uint8_t *)spibar+X)=Y)
/* Common SPI functions */
-static inline int find_opcode(OPCODES *op, uint8_t opcode);
-static inline int find_preop(OPCODES *op, uint8_t preop);
+static int find_opcode(OPCODES *op, uint8_t opcode);
+static int find_preop(OPCODES *op, uint8_t preop);
static int generate_opcodes(OPCODES * op);
static int program_opcodes(OPCODES * op);
static int run_opcode(OPCODE op, uint32_t offset,
@@ -192,7 +192,7 @@
OPCODES O_EXISTING = {};
-static inline int find_opcode(OPCODES *op, uint8_t opcode)
+static int find_opcode(OPCODES *op, uint8_t opcode)
{
int a;
@@ -204,7 +204,7 @@
return -1;
}
-static inline int find_preop(OPCODES *op, uint8_t preop)
+static int find_preop(OPCODES *op, uint8_t preop)
{
int a;
diff --git a/sst28sf040.c b/sst28sf040.c
index 806497a..c858f54 100644
--- a/sst28sf040.c
+++ b/sst28sf040.c
@@ -28,7 +28,7 @@
#define RESET 0xFF
#define READ_ID 0x90
-static __inline__ void protect_28sf040(chipaddr bios)
+static void protect_28sf040(chipaddr bios)
{
uint8_t tmp;
@@ -41,7 +41,7 @@
tmp = chip_readb(bios + 0x040A);
}
-static __inline__ void unprotect_28sf040(chipaddr bios)
+static void unprotect_28sf040(chipaddr bios)
{
uint8_t tmp;
@@ -54,8 +54,7 @@
tmp = chip_readb(bios + 0x041A);
}
-static __inline__ int erase_sector_28sf040(chipaddr bios,
- unsigned long address)
+static int erase_sector_28sf040(chipaddr bios, unsigned long address)
{
chip_writeb(AUTO_PG_ERASE1, bios);
chip_writeb(AUTO_PG_ERASE2, bios + address);
@@ -66,10 +65,8 @@
return 0;
}
-static __inline__ int write_sector_28sf040(chipaddr bios,
- uint8_t *src,
- chipaddr dst,
- unsigned int page_size)
+static int write_sector_28sf040(chipaddr bios, uint8_t *src, chipaddr dst,
+ unsigned int page_size)
{
int i;
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index 896564f..d9dcd9b 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -38,8 +38,8 @@
#define STATUS_ESS (1 << 6)
#define STATUS_WSMS (1 << 7)
-static __inline__ int write_lockbits_49lfxxxc(chipaddr bios, int size,
- unsigned char bits)
+static int write_lockbits_49lfxxxc(chipaddr bios, int size,
+ unsigned char bits)
{
int i, left = size;
unsigned long address;
@@ -65,8 +65,7 @@
return 0;
}
-static __inline__ int erase_sector_49lfxxxc(chipaddr bios,
- unsigned long address)
+static int erase_sector_49lfxxxc(chipaddr bios, unsigned long address)
{
unsigned char status;
@@ -85,10 +84,8 @@
return 0;
}
-static __inline__ int write_sector_49lfxxxc(chipaddr bios,
- uint8_t *src,
- chipaddr dst,
- unsigned int page_size)
+static int write_sector_49lfxxxc(chipaddr bios, uint8_t *src, chipaddr dst,
+ unsigned int page_size)
{
int i;
unsigned char status;