From d52fb7e3d135704334bd6f97f3444e824665b76f Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Sat, 11 Mar 2006 22:53:33 +0100 Subject: Some code cleanup for GCC 4.x --- drivers/dataflash.c | 9 ++++----- drivers/lan91c96.c | 16 ++++++++-------- drivers/lan91c96.h | 2 +- drivers/nand/nand_base.c | 5 +++-- drivers/smc91111.c | 29 ++++++++++++++++++----------- drivers/smc91111.h | 2 +- 6 files changed, 35 insertions(+), 28 deletions(-) (limited to 'drivers') diff --git a/drivers/dataflash.c b/drivers/dataflash.c index ded039578a..17eb8597f8 100644 --- a/drivers/dataflash.c +++ b/drivers/dataflash.c @@ -174,8 +174,7 @@ void dataflash_print_info (void) /* Function Name : AT91F_DataflashSelect */ /* Object : Select the correct device */ /*------------------------------------------------------------------------------*/ -AT91PS_DataFlash AT91F_DataflashSelect (AT91PS_DataFlash pFlash, - unsigned int *addr) +AT91PS_DataFlash AT91F_DataflashSelect (AT91PS_DataFlash pFlash, unsigned long *addr) { char addr_valid = 0; int i; @@ -291,7 +290,7 @@ int i,j, area1, area2, addr_valid = 0; /*------------------------------------------------------------------------------*/ int read_dataflash (unsigned long addr, unsigned long size, char *result) { - int AddrToRead = addr; + unsigned long AddrToRead = addr; AT91PS_DataFlash pFlash = &DataFlashInst; pFlash = AT91F_DataflashSelect (pFlash, &AddrToRead); @@ -313,7 +312,7 @@ int read_dataflash (unsigned long addr, unsigned long size, char *result) int write_dataflash (unsigned long addr_dest, unsigned long addr_src, unsigned long size) { - int AddrToWrite = addr_dest; + unsigned long AddrToWrite = addr_dest; AT91PS_DataFlash pFlash = &DataFlashInst; pFlash = AT91F_DataflashSelect (pFlash, &AddrToWrite); @@ -330,7 +329,7 @@ int write_dataflash (unsigned long addr_dest, unsigned long addr_src, if (AddrToWrite == -1) return -1; - return AT91F_DataFlashWrite (pFlash, (char *) addr_src, AddrToWrite, size); + return AT91F_DataFlashWrite (pFlash, (uchar *)addr_src, AddrToWrite, size); } diff --git a/drivers/lan91c96.c b/drivers/lan91c96.c index bb03dae39c..a50c5f0abe 100644 --- a/drivers/lan91c96.c +++ b/drivers/lan91c96.c @@ -185,21 +185,21 @@ static int smc_rcv (void); . If an EEPROM is present it really should be consulted. */ int smc_get_ethaddr(bd_t *bd); -int get_rom_mac(char *v_rom_mac); +int get_rom_mac(unsigned char *v_rom_mac); /* ------------------------------------------------------------ * Internal routines * ------------------------------------------------------------ */ -static char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c }; +static unsigned char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c }; /* * This function must be called before smc_open() if you want to override * the default mac address. */ -void smc_set_mac_addr (const char *addr) +void smc_set_mac_addr (const unsigned char *addr) { int i; @@ -883,7 +883,7 @@ int smc_get_ethaddr (bd_t * bd) char *s = NULL; char *e = NULL; char *v_mac, es[] = "11:22:33:44:55:66"; - uchar s_env_mac[64]; + char s_env_mac[64]; uchar v_env_mac[6]; uchar v_rom_mac[6]; @@ -905,7 +905,7 @@ int smc_get_ethaddr (bd_t * bd) if (!env_present) { /* if NO env */ if (rom_valid) { /* but ROM is valid */ - v_mac = v_rom_mac; + v_mac = (char *)v_rom_mac; sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X", v_mac[0], v_mac[1], v_mac[2], v_mac[3], v_mac[4], v_mac[5]); @@ -915,7 +915,7 @@ int smc_get_ethaddr (bd_t * bd) return (-1); } } else { /* good env, don't care ROM */ - v_mac = v_env_mac; /* always use a good env over a ROM */ + v_mac = (char *)v_env_mac; /* always use a good env over a ROM */ } if (env_present && rom_valid) { /* if both env and ROM are good */ @@ -935,7 +935,7 @@ int smc_get_ethaddr (bd_t * bd) } } memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */ - smc_set_mac_addr (v_mac); /* use old function to update smc default */ + smc_set_mac_addr ((unsigned char *)v_mac); /* use old function to update smc default */ PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1], v_mac[2], v_mac[3], v_mac[4], v_mac[5]); return (0); @@ -946,7 +946,7 @@ int smc_get_ethaddr (bd_t * bd) * Note, this has omly been tested for the OMAP730 P2. */ -int get_rom_mac (char *v_rom_mac) +int get_rom_mac (unsigned char *v_rom_mac) { #ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */ char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 }; diff --git a/drivers/lan91c96.h b/drivers/lan91c96.h index b7d7455b9d..7d33a821f3 100644 --- a/drivers/lan91c96.h +++ b/drivers/lan91c96.h @@ -51,7 +51,7 @@ * in order to override the default mac address. */ -void smc_set_mac_addr(const char *addr); +void smc_set_mac_addr(const unsigned char *addr); /* I want some simple types */ diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c index d91d90bfec..e0b406041f 100644 --- a/drivers/nand/nand_base.c +++ b/drivers/nand/nand_base.c @@ -897,7 +897,7 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa int i, status; u_char ecc_code[32]; int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE; - int *oob_config = oobsel->eccpos; + uint *oob_config = oobsel->eccpos; int datidx = 0, eccidx = 0, eccsteps = this->eccsteps; int eccbytes = 0; @@ -1119,7 +1119,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, u_char ecc_calc[32]; u_char ecc_code[32]; int eccmode, eccsteps; - int *oob_config, datidx; + unsigned *oob_config; + int datidx; int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1; int eccbytes; int compareecc = 1; diff --git a/drivers/smc91111.c b/drivers/smc91111.c index 060da8ff2a..84e243ddd5 100644 --- a/drivers/smc91111.c +++ b/drivers/smc91111.c @@ -210,7 +210,7 @@ static int smc_rcv(void); . If an EEPROM is present it really should be consulted. */ int smc_get_ethaddr(bd_t *bd); -int get_rom_mac(char *v_rom_mac); +int get_rom_mac(uchar *v_rom_mac); /* ------------------------------------------------------------ @@ -276,17 +276,23 @@ static inline void SMC_outb(byte value, dword offset) static inline void SMC_insw(dword offset, volatile uchar* buf, dword len) { + volatile word *p = (volatile word *)buf; + while (len-- > 0) { - *((word*)buf)++ = SMC_inw(offset); - barrier(); *((volatile u32*)(0xc0000000)); + *p++ = SMC_inw(offset); + barrier(); + *((volatile u32*)(0xc0000000)); } } static inline void SMC_outsw(dword offset, uchar* buf, dword len) { + volatile word *p = (volatile word *)buf; + while (len-- > 0) { - SMC_outw(*((word*)buf)++, offset); - barrier(); *(volatile u32*)(0xc0000000); + SMC_outw(*p++, offset); + barrier(); + *(volatile u32*)(0xc0000000); } } #endif /* CONFIG_SMC_USE_IOFUNCS */ @@ -298,7 +304,7 @@ static char unsigned smc_mac_addr[6] = {0x02, 0x80, 0xad, 0x20, 0x31, 0xb8}; * the default mac address. */ -void smc_set_mac_addr(const char *addr) { +void smc_set_mac_addr(const unsigned char *addr) { int i; for (i=0; i < sizeof(smc_mac_addr); i++){ @@ -1524,7 +1530,8 @@ int smc_get_ethaddr (bd_t * bd) { int env_size, rom_valid, env_present = 0, reg; char *s = NULL, *e, *v_mac, es[] = "11:22:33:44:55:66"; - uchar s_env_mac[64], v_env_mac[6], v_rom_mac[6]; + char s_env_mac[64]; + uchar v_env_mac[6], v_rom_mac[6]; env_size = getenv_r ("ethaddr", s_env_mac, sizeof (s_env_mac)); if ((env_size > 0) && (env_size < sizeof (es))) { /* exit if env is bad */ @@ -1547,7 +1554,7 @@ int smc_get_ethaddr (bd_t * bd) if (!env_present) { /* if NO env */ if (rom_valid) { /* but ROM is valid */ - v_mac = v_rom_mac; + v_mac = (char *)v_rom_mac; sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X", v_mac[0], v_mac[1], v_mac[2], v_mac[3], v_mac[4], v_mac[5]); @@ -1557,7 +1564,7 @@ int smc_get_ethaddr (bd_t * bd) return (-1); } } else { /* good env, don't care ROM */ - v_mac = v_env_mac; /* always use a good env over a ROM */ + v_mac = (char *)v_env_mac; /* always use a good env over a ROM */ } if (env_present && rom_valid) { /* if both env and ROM are good */ @@ -1577,13 +1584,13 @@ int smc_get_ethaddr (bd_t * bd) } } memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */ - smc_set_mac_addr (v_mac); /* use old function to update smc default */ + smc_set_mac_addr ((uchar *)v_mac); /* use old function to update smc default */ PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1], v_mac[2], v_mac[3], v_mac[4], v_mac[5]); return (0); } -int get_rom_mac (char *v_rom_mac) +int get_rom_mac (uchar *v_rom_mac) { #ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */ char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 }; diff --git a/drivers/smc91111.h b/drivers/smc91111.h index cf08582fbf..c3c33672ab 100644 --- a/drivers/smc91111.h +++ b/drivers/smc91111.h @@ -49,7 +49,7 @@ * in order to override the default mac address. */ -void smc_set_mac_addr(const char *addr); +void smc_set_mac_addr (const unsigned char *addr); /* I want some simple types */ -- cgit v1.2.1