Author: uwe Date: 2009-05-17 00:36:00 +0200 (Sun, 17 May 2009) New Revision: 522
Modified: trunk/am29f040b.c trunk/flash.h trunk/flashrom.c trunk/ichspi.c trunk/sst28sf040.c trunk/sst49lfxxxc.c Log: 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.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/am29f040b.c =================================================================== --- trunk/am29f040b.c 2009-05-16 22:05:42 UTC (rev 521) +++ trunk/am29f040b.c 2009-05-16 22:36:00 UTC (rev 522) @@ -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;
Modified: trunk/flash.h =================================================================== --- trunk/flash.h 2009-05-16 22:05:42 UTC (rev 521) +++ trunk/flash.h 2009-05-16 22:36:00 UTC (rev 522) @@ -104,56 +104,18 @@
extern const struct programmer_entry programmer_table[];
-static inline int programmer_init(void) -{ - return programmer_table[programmer].init(); -} +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);
-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); -} - #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
struct flashchip {
Modified: trunk/flashrom.c =================================================================== --- trunk/flashrom.c 2009-05-16 22:05:42 UTC (rev 521) +++ trunk/flashrom.c 2009-05-16 22:36:00 UTC (rev 522) @@ -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;
Modified: trunk/ichspi.c =================================================================== --- trunk/ichspi.c 2009-05-16 22:05:42 UTC (rev 521) +++ trunk/ichspi.c 2009-05-16 22:36:00 UTC (rev 522) @@ -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;
Modified: trunk/sst28sf040.c =================================================================== --- trunk/sst28sf040.c 2009-05-16 22:05:42 UTC (rev 521) +++ trunk/sst28sf040.c 2009-05-16 22:36:00 UTC (rev 522) @@ -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;
Modified: trunk/sst49lfxxxc.c =================================================================== --- trunk/sst49lfxxxc.c 2009-05-16 22:05:42 UTC (rev 521) +++ trunk/sst49lfxxxc.c 2009-05-16 22:36:00 UTC (rev 522) @@ -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;