From 0fa0801a3296e50fdc49c93373645ed5fa9d8639 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Thu, 11 Oct 2007 15:09:50 +0000 Subject: [PATCH] coding style fixes SVN-Revision: 9263 --- .../files/arch/mips/adm5120/adm5120_info.c | 2 +- .../adm5120/files/arch/mips/adm5120/board.c | 18 +- .../files/arch/mips/adm5120/boards/mikrotik.c | 26 +- .../adm5120/files/arch/mips/adm5120/clock.c | 12 +- .../adm5120/files/arch/mips/adm5120/gpio.c | 79 +++--- .../adm5120/files/arch/mips/adm5120/irq.c | 11 +- .../adm5120/files/arch/mips/adm5120/memory.c | 13 +- .../adm5120/files/arch/mips/adm5120/prom.c | 59 ++--- .../files/arch/mips/adm5120/prom/bootbase.c | 8 +- .../files/arch/mips/adm5120/prom/cfe.c | 12 +- .../files/arch/mips/adm5120/prom/myloader.c | 2 +- .../files/arch/mips/adm5120/prom/routerboot.c | 12 +- .../adm5120/files/arch/mips/adm5120/reset.c | 25 +- .../adm5120/files/arch/mips/adm5120/setup.c | 23 +- .../adm5120/files/arch/mips/adm5120/time.c | 4 +- .../adm5120/files/arch/mips/pci/pci-adm5120.c | 16 +- .../adm5120/files/drivers/leds/leds-adm5120.c | 225 +++++++++--------- .../files/drivers/mtd/maps/adm5120-flash.c | 20 +- .../adm5120/files/drivers/mtd/myloader.c | 5 +- .../adm5120/files/drivers/mtd/trxsplit.c | 38 +-- .../asm-mips/mach-adm5120/adm5120_info.h | 1 - 21 files changed, 303 insertions(+), 308 deletions(-) diff --git a/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c b/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c index 46d2c8ef45..0abb961fd1 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/adm5120_info.c @@ -24,8 +24,8 @@ #include #include #include +#include -#include #include #include diff --git a/target/linux/adm5120/files/arch/mips/adm5120/board.c b/target/linux/adm5120/files/arch/mips/adm5120/board.c index 44e59aa09b..1d0cc66189 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/board.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/board.c @@ -37,6 +37,8 @@ #include #include +#define PFX "adm5120: " + static LIST_HEAD(adm5120_boards); static char adm5120_board_name[ADM5120_BOARD_NAMELEN]; @@ -70,14 +72,14 @@ static int __init adm5120_board_setup(void) board = adm5120_board_find(mips_machtype); if (board == NULL) { - printk(KERN_ALERT "adm5120: no board registered for machtype %lu" - ", trying generic\n", mips_machtype); + printk(KERN_ALERT PFX"no board registered for " + "machtype %lu, trying generic\n", mips_machtype); board = adm5120_board_find(MACH_ADM5120_GENERIC); if (board == NULL) - panic("adm5120: unsupported board\n"); + panic(PFX "unsupported board\n"); } - printk(KERN_INFO "adm5120: setting up board '%s'\n", board->name); + printk(KERN_INFO PFX "setting up board '%s'\n", board->name); memcpy(&adm5120_board_name, board->name, ADM5120_BOARD_NAMELEN); @@ -100,10 +102,10 @@ static int __init adm5120_board_setup(void) adm5120_pci_set_irq_map(board->pci_nr_irqs, board->pci_irq_map); /* register board devices */ - if (board->num_devices > 0 && board->devices != NULL ) { + if (board->num_devices > 0 && board->devices != NULL) { err = platform_add_devices(board->devices, board->num_devices); if (err) - printk(KERN_ALERT "adm5120: adding board devices failed\n"); + printk(KERN_ALERT PFX "adding board devices failed\n"); } return 0; @@ -113,7 +115,7 @@ arch_initcall(adm5120_board_setup); void __init adm5120_board_register(struct adm5120_board *board) { list_add(&board->list, &adm5120_boards); - printk(KERN_INFO "adm5120: registered board '%s'\n", board->name); + printk(KERN_INFO PFX "registered board '%s'\n", board->name); } void __init adm5120_register_boards(struct adm5120_board **boards, @@ -121,7 +123,7 @@ void __init adm5120_register_boards(struct adm5120_board **boards, { int i; - for (i=0; i #include -#include +#include struct clk { unsigned long rate; @@ -46,16 +46,16 @@ static struct clk uart_clk = { struct clk *clk_get(struct device *dev, const char *id) { - if (!strcmp(id, "UARTCLK")) - return &uart_clk; + if (!strcmp(id, "UARTCLK")) + return &uart_clk; - return ERR_PTR(-ENOENT); + return ERR_PTR(-ENOENT); } EXPORT_SYMBOL(clk_get); int clk_enable(struct clk *clk) { - return 0; + return 0; } EXPORT_SYMBOL(clk_enable); @@ -66,7 +66,7 @@ EXPORT_SYMBOL(clk_disable); unsigned long clk_get_rate(struct clk *clk) { - return clk->rate; + return clk->rate; } EXPORT_SYMBOL(clk_get_rate); diff --git a/target/linux/adm5120/files/arch/mips/adm5120/gpio.c b/target/linux/adm5120/files/arch/mips/adm5120/gpio.c index d073b659ad..075ea87416 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/gpio.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/gpio.c @@ -29,19 +29,19 @@ #include #include #include +#include #include -#include #include -#include -#include -#include +#include +#include +#include -typedef void __iomem * gpio_reg_t; -#define GPIO_READ(r) readl((r)) -#define GPIO_WRITE(v,r) writel((v),(r)) -#define GPIO_REG(r) (gpio_reg_t)(KSEG1ADDR(ADM5120_SWITCH_BASE)+r) + +#define GPIO_READ(r) readl((r)) +#define GPIO_WRITE(v, r) writel((v), (r)) +#define GPIO_REG(r) (void __iomem *)(KSEG1ADDR(ADM5120_SWITCH_BASE)+r) struct adm5120_gpio_line { u32 flags; @@ -52,15 +52,15 @@ struct adm5120_gpio_line { #define GPIO_FLAG_USED 0x02 struct led_desc { - gpio_reg_t reg; /* LED register address */ - u8 iv_shift; /* shift amount for input bit */ - u8 mode_shift; /* shift amount for mode bits */ + void __iomem *reg; /* LED register address */ + u8 iv_shift; /* shift amount for input bit */ + u8 mode_shift; /* shift amount for mode bits */ }; -#define LED_DESC(_port,_led) { \ - .reg = GPIO_REG(SWITCH_REG_PORT0_LED+_port*4), \ - .iv_shift = LED0_IV_SHIFT+_led, \ - .mode_shift = _led*4 \ +#define LED_DESC(p, l) { \ + .reg = GPIO_REG(SWITCH_REG_PORT0_LED+((p) * 4)), \ + .iv_shift = LED0_IV_SHIFT + (l), \ + .mode_shift = (l) * 4 \ } static struct led_desc led_table[15] = { @@ -97,10 +97,8 @@ static struct adm5120_gpio_line adm5120_gpio_map[ADM5120_GPIO_COUNT] = { [ADM5120_GPIO_P4L2] = {.flags = GPIO_FLAG_VALID} }; -#define gpio_is_invalid(g) ( \ - (g) > ADM5120_GPIO_MAX || \ - ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_VALID) == 0) \ - ) +#define gpio_is_invalid(g) ((g) > ADM5120_GPIO_MAX || \ + ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_VALID) == 0)) #define gpio_is_used(g) ((adm5120_gpio_map[(g)].flags & GPIO_FLAG_USED) != 0) @@ -114,7 +112,7 @@ static struct adm5120_gpio_line adm5120_gpio_map[ADM5120_GPIO_COUNT] = { static inline int pins_direction_input(unsigned pin) { - gpio_reg_t *reg; + void __iomem **reg; u32 t; reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); @@ -122,14 +120,14 @@ static inline int pins_direction_input(unsigned pin) t = GPIO_READ(reg); t &= ~(PIN_OE(pin)); t |= PIN_IM(pin); - GPIO_WRITE(t,reg); + GPIO_WRITE(t, reg); return 0; } static inline int pins_direction_output(unsigned pin, int value) { - gpio_reg_t *reg; + void __iomem **reg; u32 t; reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); @@ -141,14 +139,14 @@ static inline int pins_direction_output(unsigned pin, int value) if (value) t |= PIN_OV(pin); - GPIO_WRITE(t,reg); + GPIO_WRITE(t, reg); return 0; } static inline int pins_get_value(unsigned pin) { - gpio_reg_t *reg; + void __iomem **reg; u32 t; reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); @@ -164,7 +162,7 @@ static inline int pins_get_value(unsigned pin) static inline void pins_set_value(unsigned pin, int value) { - gpio_reg_t *reg; + void __iomem **reg; u32 t; reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); @@ -175,7 +173,7 @@ static inline void pins_set_value(unsigned pin, int value) else t |= PIN_OV(pin); - GPIO_WRITE(t,reg); + GPIO_WRITE(t, reg); } /* @@ -183,20 +181,20 @@ static inline void pins_set_value(unsigned pin, int value) */ static inline int leds_direction_input(unsigned led) { - gpio_reg_t *reg; + void __iomem **reg; u32 t; reg = led_table[led].reg; t = GPIO_READ(reg); t &= ~(LED_MODE_MASK << led_table[led].mode_shift); - GPIO_WRITE(t,reg); + GPIO_WRITE(t, reg); return 0; } static inline int leds_direction_output(unsigned led, int value) { - gpio_reg_t *reg; + void __iomem **reg; u32 t, s; reg = led_table[led].reg; @@ -226,14 +224,14 @@ static inline int leds_direction_output(unsigned led, int value) break; } - GPIO_WRITE(t,reg); + GPIO_WRITE(t, reg); return 0; } static inline int leds_get_value(unsigned led) { - gpio_reg_t *reg; + void __iomem **reg; u32 t, m; reg = led_table[led].reg; @@ -263,6 +261,7 @@ int adm5120_gpio_direction_input(unsigned gpio) gpio -= ADM5120_GPIO_P0L0; return leds_direction_input(gpio); } +EXPORT_SYMBOL(adm5120_gpio_direction_input); int adm5120_gpio_direction_output(unsigned gpio, int value) { @@ -275,6 +274,7 @@ int adm5120_gpio_direction_output(unsigned gpio, int value) gpio -= ADM5120_GPIO_P0L0; return leds_direction_output(gpio, value); } +EXPORT_SYMBOL(adm5120_gpio_direction_output); int adm5120_gpio_get_value(unsigned gpio) { @@ -284,6 +284,7 @@ int adm5120_gpio_get_value(unsigned gpio) gpio -= ADM5120_GPIO_P0L0; return leds_get_value(gpio); } +EXPORT_SYMBOL(adm5120_gpio_get_value); void adm5120_gpio_set_value(unsigned gpio, int value) { @@ -295,6 +296,7 @@ void adm5120_gpio_set_value(unsigned gpio, int value) gpio -= ADM5120_GPIO_P0L0; leds_direction_output(gpio, value); } +EXPORT_SYMBOL(adm5120_gpio_set_value); int adm5120_gpio_request(unsigned gpio, const char *label) { @@ -309,6 +311,7 @@ int adm5120_gpio_request(unsigned gpio, const char *label) return 0; } +EXPORT_SYMBOL(adm5120_gpio_request); void adm5120_gpio_free(unsigned gpio) { @@ -318,18 +321,21 @@ void adm5120_gpio_free(unsigned gpio) adm5120_gpio_map[gpio].flags &= ~GPIO_FLAG_USED; adm5120_gpio_map[gpio].label = NULL; } +EXPORT_SYMBOL(adm5120_gpio_free); int adm5120_gpio_to_irq(unsigned gpio) { /* FIXME: not yet implemented */ return -EINVAL; } +EXPORT_SYMBOL(adm5120_gpio_to_irq); int adm5120_irq_to_gpio(unsigned irq) { /* FIXME: not yet implemented */ return -EINVAL; } +EXPORT_SYMBOL(adm5120_irq_to_gpio); static int __init adm5120_gpio_init(void) { @@ -337,7 +343,7 @@ static int __init adm5120_gpio_init(void) if (adm5120_package_pqfp()) { /* GPIO pins 4-7 are unavailable in ADM5120P */ - for (i=ADM5120_GPIO_PIN4; i<=ADM5120_GPIO_PIN7; i++) + for (i = ADM5120_GPIO_PIN4; i <= ADM5120_GPIO_PIN7; i++) adm5120_gpio_map[i].flags &= ~GPIO_FLAG_VALID; } @@ -345,12 +351,3 @@ static int __init adm5120_gpio_init(void) } pure_initcall(adm5120_gpio_init); - -EXPORT_SYMBOL(adm5120_gpio_direction_output); -EXPORT_SYMBOL(adm5120_gpio_direction_input); -EXPORT_SYMBOL(adm5120_gpio_get_value); -EXPORT_SYMBOL(adm5120_gpio_set_value); -EXPORT_SYMBOL(adm5120_gpio_request); -EXPORT_SYMBOL(adm5120_gpio_free); -EXPORT_SYMBOL(adm5120_gpio_to_irq); -EXPORT_SYMBOL(adm5120_irq_to_gpio); diff --git a/target/linux/adm5120/files/arch/mips/adm5120/irq.c b/target/linux/adm5120/files/arch/mips/adm5120/irq.c index 5838e5e334..6e3fc62220 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/irq.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/irq.c @@ -29,19 +29,19 @@ #include #include -#include +#include #include #include #include #include -#include -#include +#include +#include #define INTC_WRITE(reg, val) __raw_writel((val), \ (void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg)) -#define INTC_READ(reg) __raw_readl( \ +#define INTC_READ(reg) __raw_readl(\ (void __iomem *)(KSEG1ADDR(ADM5120_INTC_BASE) + reg)) static void adm5120_intc_irq_unmask(unsigned int irq); @@ -168,7 +168,8 @@ static void __init adm5120_intc_irq_init(int base) /* disable usage of the TEST_SOURCE register */ INTC_WRITE(INTC_REG_IRQ_SOURCE_SELECT, 0); - for (i = ADM5120_INTC_IRQ_BASE; i <= ADM5120_INTC_IRQ_BASE+INTC_IRQ_LAST; + for (i = ADM5120_INTC_IRQ_BASE; + i <= ADM5120_INTC_IRQ_BASE+INTC_IRQ_LAST; i++) { irq_desc[i].status = INTC_IRQ_STATUS; set_irq_chip_and_handler(i, &adm5120_intc_irq_chip, diff --git a/target/linux/adm5120/files/arch/mips/adm5120/memory.c b/target/linux/adm5120/files/arch/mips/adm5120/memory.c index 605df26016..79e9cb417a 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/memory.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/memory.c @@ -24,8 +24,8 @@ #include #include #include +#include -#include #include #include @@ -34,8 +34,8 @@ #include #include -#if 1 -# define mem_dbg(f, a...) printk("mem_detect: " f, ## a) +#ifdef DEBUG +# define mem_dbg(f, a...) printk(KERN_INFO "mem_detect: " f, ## a) #else # define mem_dbg(f, a...) #endif @@ -49,7 +49,7 @@ static int __init mem_check_pattern(u8 *addr, unsigned long offs) { u32 *p1 = (u32 *)addr; u32 *p2 = (u32 *)(addr+offs); - u32 t,u,v; + u32 t, u, v; /* save original value */ t = MEM_READL(p1); @@ -128,9 +128,8 @@ static void __init adm5120_detect_memsize(void) mem_dbg("check presence of 2nd bank\n"); p = (u8 *)KSEG1ADDR(maxsize+size-4); - if (mem_check_pattern(p, 0)) { + if (mem_check_pattern(p, 0)) adm5120_memsize += size; - } if (maxsize != size) { /* adjusting MECTRL register */ @@ -154,7 +153,7 @@ static void __init adm5120_detect_memsize(void) out: mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 , - size >>20); + size>>20); } void __init adm5120_mem_init(void) diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom.c b/target/linux/adm5120/files/arch/mips/adm5120/prom.c index 4c2f658eed..2f6fb918c0 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/prom.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/prom.c @@ -27,8 +27,8 @@ #include #include #include +#include -#include #include #include @@ -52,31 +52,31 @@ struct board_desc { #define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)} static struct board_desc common_boards[] __initdata = { /* Cellvision/SparkLAN boards */ - DEFBOARD("CAS-630", MACH_ADM5120_CAS630), - DEFBOARD("CAS-670", MACH_ADM5120_CAS670), - DEFBOARD("CAS-771", MACH_ADM5120_CAS771), - DEFBOARD("CAS-790", MACH_ADM5120_CAS790), - DEFBOARD("CAS-861", MACH_ADM5120_CAS861), + DEFBOARD("CAS-630", MACH_ADM5120_CAS630), + DEFBOARD("CAS-670", MACH_ADM5120_CAS670), + DEFBOARD("CAS-771", MACH_ADM5120_CAS771), + DEFBOARD("CAS-790", MACH_ADM5120_CAS790), + DEFBOARD("CAS-861", MACH_ADM5120_CAS861), /* Compex boards */ - DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT), + DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT), /* Edimax boards */ - DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K), - DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K), + DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K), + DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104K), /* Infineon boards */ DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA), DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT), DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP), DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000), /* Mikrotik RouterBOARDs */ - DEFBOARD("111", MACH_ADM5120_RB_111), - DEFBOARD("112", MACH_ADM5120_RB_112), - DEFBOARD("133", MACH_ADM5120_RB_133), - DEFBOARD("133C", MACH_ADM5120_RB_133C), - DEFBOARD("133C3", MACH_ADM5120_RB_133C), - DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */ - DEFBOARD("153", MACH_ADM5120_RB_153), - DEFBOARD("192", MACH_ADM5120_RB_192), - DEFBOARD("miniROUTER", MACH_ADM5120_RB_150), + DEFBOARD("111", MACH_ADM5120_RB_111), + DEFBOARD("112", MACH_ADM5120_RB_112), + DEFBOARD("133", MACH_ADM5120_RB_133), + DEFBOARD("133C", MACH_ADM5120_RB_133C), + DEFBOARD("133C3", MACH_ADM5120_RB_133C), + DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */ + DEFBOARD("153", MACH_ADM5120_RB_153), + DEFBOARD("192", MACH_ADM5120_RB_192), + DEFBOARD("miniROUTER", MACH_ADM5120_RB_150), }; static unsigned long __init find_machtype_byname(char *name) @@ -91,7 +91,7 @@ static unsigned long __init find_machtype_byname(char *name) if (*name == '\0') goto out; - for (i=0; i 0) strcpy( &(arcs_cmdline[0]), cmd); - else strcpy(&(arcs_cmdline[0]), CONFIG_CMDLINE); + if (strlen(cmd) > 0) + strcpy(arcs_cmdline, cmd); + else + strcpy(arcs_cmdline, CONFIG_CMDLINE); } diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c index 7ab9d46bd6..cb6479c4af 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/bootbase.c @@ -41,7 +41,7 @@ #define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE) #define BOOTEXT_ADDR_MAX (BOOTEXT_ADDR_MIN + (2*1024*1024)) -static int bootbase_found = 0; +static int bootbase_found; static struct zynos_board_info *board_info; struct bootbase_info bootbase_info; @@ -68,12 +68,12 @@ static inline u32 bootbase_get_bootext_addr(void) static inline u16 bootbase_get_vendor_id(void) { -#define CHECK_VENDOR(n) (strnicmp(board_info->vendor,(n),strlen(n)) == 0) +#define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0) unsigned char vendor[ZYNOS_NAME_LEN]; int i; - for (i=0; ivendor[i]; + for (i = 0; i < ZYNOS_NAME_LEN; i++) + vendor[i] = board_info->vendor[i]; if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL) return ZYNOS_VENDOR_ID_ZYXEL; diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c index 6c03a4e859..28b61206d3 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/cfe.c @@ -37,7 +37,7 @@ #define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE from other bootloaders */ -static int cfe_found = 0; +static int cfe_found; static u32 cfe_handle; static u32 cfe_entry; @@ -58,20 +58,16 @@ int __init cfe_present(void) cfe_seal = (u32) fw_arg3; /* Check for CFE by finding the CFE magic number */ - if (cfe_seal != CFE_EPTSEAL) { - /* We are not booted from CFE */ + if (cfe_seal != CFE_EPTSEAL) return 0; - } /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */ - if (a1 != 0) { + if (a1 != 0) return 0; - } /* The cfe_handle, and the cfe_entry must be kernel mode addresses */ - if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0)) { + if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0)) return 0; - } cfe_found = 1; return 1; diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c index 8a44509a08..b7d992c70c 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/myloader.c @@ -40,7 +40,7 @@ #define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800) #define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000) -static int myloader_found = 0; +static int myloader_found; struct myloader_info myloader_info; diff --git a/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c b/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c index 7116f412f5..47483450fd 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c @@ -36,13 +36,13 @@ #include "prom_read.h" static struct rb_hard_settings rb_hs; -static int rb_found = 0; +static int rb_found; static int __init routerboot_load_hs(u8 *buf, u16 buflen) { - u16 id,len; + u16 id, len; u8 *mac; - int i,j; + int i, j; memset(&rb_hs, 0, sizeof(rb_hs)); @@ -88,8 +88,8 @@ static int __init routerboot_load_hs(u8 *buf, u16 buflen) if (rb_hs.mac_count > RB_MAX_MAC_COUNT) rb_hs.mac_count = RB_MAX_MAC_COUNT; mac = buf; - for (i=0; i < rb_hs.mac_count; i++) { - for (j=0; j < RB_MAC_SIZE; j++) + for (i = 0; i < rb_hs.mac_count; i++) { + for (j = 0; j < RB_MAC_SIZE; j++) rb_hs.macs[i][j] = mac[j]; mac += RB_MAC_SIZE; } @@ -111,7 +111,7 @@ int __init routerboot_present(void) { struct rb_bios_settings *bs; u8 *base; - u32 off,len; + u32 off, len; if (rb_found) goto out; diff --git a/target/linux/adm5120/files/arch/mips/adm5120/reset.c b/target/linux/adm5120/files/arch/mips/adm5120/reset.c index abcbb1c8b9..aa278fd2aa 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/reset.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/reset.c @@ -29,14 +29,15 @@ #include #include +#include +#include + #include #include -#include -#include -#include - -#define ADM5120_SOFTRESET 0x12000004 +#include +#include +#include void (*adm5120_board_reset)(void); @@ -47,16 +48,16 @@ void adm5120_restart(char *command) if (adm5120_board_reset) adm5120_board_reset(); - *(u32*)KSEG1ADDR(ADM5120_SOFTRESET)=1; + SW_WRITE_REG(SOFT_RESET, 1); } void adm5120_halt(void) { - printk(KERN_NOTICE "\n** You can safely turn off the power\n"); - while (1); -} + local_irq_disable(); -void adm5120_power_off(void) -{ - adm5120_halt(); + printk(KERN_NOTICE "\n** You can safely turn off the power\n"); + while (1) { + if (cpu_wait) + cpu_wait(); + }; } diff --git a/target/linux/adm5120/files/arch/mips/adm5120/setup.c b/target/linux/adm5120/files/arch/mips/adm5120/setup.c index ed7966b41a..e09a00361a 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/setup.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/setup.c @@ -27,15 +27,15 @@ #include #include +#include #include -#include #include -#include -#include -#include -#include +#include +#include +#include +#include static char *prom_names[ADM5120_PROM_LAST+1] __initdata = { [ADM5120_PROM_GENERIC] = "Generic", @@ -48,12 +48,13 @@ static char *prom_names[ADM5120_PROM_LAST+1] __initdata = { static void __init adm5120_report(void) { - printk(KERN_INFO "SoC : ADM%04X%s revision %d, running at %ldMHz\n", + printk(KERN_INFO "SoC : ADM%04X%s revision %d, running " + "at %ldMHz\n", adm5120_product_code, - (adm5120_package == ADM5120_PACKAGE_BGA) ? "" : "P", - adm5120_revision, (adm5120_speed / 1000000) - ); - printk(KERN_INFO "Bootdev : %s flash\n", adm5120_nand_boot ? "NAND":"NOR"); + adm5120_package_bga() ? "" : "P", + adm5120_revision, (adm5120_speed / 1000000)); + printk(KERN_INFO "Bootdev : %s flash\n", + adm5120_nand_boot ? "NAND":"NOR"); printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]); } @@ -67,7 +68,7 @@ void __init plat_mem_setup(void) _machine_restart = adm5120_restart; _machine_halt = adm5120_halt; - pm_power_off = adm5120_power_off; + pm_power_off = adm5120_halt; set_io_port_base(KSEG1); } diff --git a/target/linux/adm5120/files/arch/mips/adm5120/time.c b/target/linux/adm5120/files/arch/mips/adm5120/time.c index 27393d4fe2..86aab23360 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/time.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/time.c @@ -37,8 +37,8 @@ #include #include -#include -#include +#include +#include void __init adm5120_time_init(void) { diff --git a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c index 5aa5a633d5..722d47ceb7 100644 --- a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c +++ b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c @@ -28,12 +28,12 @@ #include #include #include +#include #include #include #include -#include #include #include @@ -45,7 +45,7 @@ #undef DEBUG #ifdef DEBUG -#define DBG(f, a...) printk(KERN_DEBUG f, ## a ) +#define DBG(f, a...) printk(KERN_DEBUG f, ## a) #else #define DBG(f, a...) do {} while (0) #endif @@ -54,8 +54,8 @@ /* -------------------------------------------------------------------------*/ -static unsigned int adm5120_pci_nr_irqs __initdata = 0; -static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata = NULL; +static unsigned int adm5120_pci_nr_irqs __initdata; +static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata; static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED; @@ -93,7 +93,7 @@ static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, spin_lock_irqsave(&pci_lock, flags); - write_cfgaddr(mkaddr(bus,devfn,where)); + write_cfgaddr(mkaddr(bus, devfn, where)); data = read_cfgdata(); DBG("PCI: cfg_read %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", @@ -132,7 +132,7 @@ static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, spin_lock_irqsave(&pci_lock, flags); - write_cfgaddr(mkaddr(bus,devfn,where)); + write_cfgaddr(mkaddr(bus, devfn, where)); data = read_cfgdata(); DBG("PCI: cfg_write %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", @@ -226,10 +226,10 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) if (irq < 0) { printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n", - pci_name(dev), pin); + pci_name((struct pci_dev *)dev), pin); } else { printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n", - pci_name(dev), pin, irq); + pci_name((struct pci_dev *)dev), pin, irq); } out: diff --git a/target/linux/adm5120/files/drivers/leds/leds-adm5120.c b/target/linux/adm5120/files/drivers/leds/leds-adm5120.c index c71aeb20df..368a13b7c6 100644 --- a/target/linux/adm5120/files/drivers/leds/leds-adm5120.c +++ b/target/linux/adm5120/files/drivers/leds/leds-adm5120.c @@ -54,80 +54,80 @@ struct adm5120_leddev { struct gpio_led_platform_data pdata; }; -static int led_count = 0; +static int led_count; static struct adm5120_leddev *led_devs[NUM_LEDS_MAX]; #define LED_ARRAY(n) \ static struct gpio_led n ## _leds [] __initdata = -#define LED_DATA(n,t,g,al) { \ - .name = (n), \ - .default_trigger = (t), \ - .gpio = (g), \ - .active_low = (al) \ - } +#define LED_DATA(n, t, g, a) { \ + .name = (n), \ + .default_trigger = (t), \ + .gpio = (g), \ + .active_low = (a) \ +} -#define LED_STD(g,n,t) LED_DATA((n),(t),(g), 0) -#define LED_INV(g,n,t) LED_DATA((n),(t),(g), 1) +#define LED_STD(g, n, t) LED_DATA((n), (t), (g), 0) +#define LED_INV(g, n, t) LED_DATA((n), (t), (g), 1) /* * Compex boards */ #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) LED_ARRAY(np27g) { /* FIXME: untested */ - LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "lan4", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "wan_cond", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "wan_act", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL ), - LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "diag", NULL ), + LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL), + LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL), + LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL), + LED_STD(ADM5120_GPIO_xxxx, "lan4", NULL), + LED_STD(ADM5120_GPIO_xxxx, "wan_cond", NULL), + LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL), + LED_STD(ADM5120_GPIO_xxxx, "wan_act", NULL), + LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL), + LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL), + LED_INV(ADM5120_GPIO_PIN2, "power", NULL), + LED_STD(ADM5120_GPIO_xxxx, "diag", NULL), }; #endif #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) LED_ARRAY(np28g) { /* FIXME: untested */ - LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "wan", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "usb3", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "usb4", NULL ), - LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), - LED_STD(ADM5120_GPIO_xxxx, "diag", NULL ), + LED_STD(ADM5120_GPIO_xxxx, "lan1", NULL), + LED_STD(ADM5120_GPIO_xxxx, "lan2", NULL), + LED_STD(ADM5120_GPIO_xxxx, "lan3", NULL), + LED_STD(ADM5120_GPIO_xxxx, "wan", NULL), + LED_STD(ADM5120_GPIO_xxxx, "wlan", NULL), + LED_STD(ADM5120_GPIO_xxxx, "usb1", NULL), + LED_STD(ADM5120_GPIO_xxxx, "usb2", NULL), + LED_STD(ADM5120_GPIO_xxxx, "usb3", NULL), + LED_STD(ADM5120_GPIO_xxxx, "usb4", NULL), + LED_INV(ADM5120_GPIO_PIN2, "power", NULL), + LED_STD(ADM5120_GPIO_xxxx, "diag", NULL), }; #endif LED_ARRAY(wp54g) { - LED_INV(ADM5120_GPIO_PIN2, "diag", NULL ), - LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL ), - LED_INV(ADM5120_GPIO_PIN7, "wan", NULL ), - LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL ), - LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL ), + LED_INV(ADM5120_GPIO_PIN2, "diag", NULL), + LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL), + LED_INV(ADM5120_GPIO_PIN7, "wan", NULL), + LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL), + LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL), }; /* * Edimax boards */ LED_ARRAY(br6104k) { - LED_STD(ADM5120_GPIO_PIN0, "power", NULL ), - LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL ), - LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL ), - LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL ), - LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL ), - LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL ), - LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL ), - LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL ), - LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL ), - LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL ), - LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL ), + LED_STD(ADM5120_GPIO_PIN0, "power", NULL), + LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), + LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), + LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), + LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), + LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), + LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), + LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), + LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), + LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), + LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), }; /* @@ -135,14 +135,14 @@ LED_ARRAY(br6104k) { */ #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) LED_ARRAY(rb100) { /* FIXME: untested */ - LED_STD(ADM5120_GPIO_PIN6, "power", NULL ), - LED_STD(ADM5120_GPIO_PIN3, "user", NULL ), + LED_STD(ADM5120_GPIO_PIN6, "power", NULL), + LED_STD(ADM5120_GPIO_PIN3, "user", NULL), }; #endif LED_ARRAY(rb133) { - LED_STD(ADM5120_GPIO_PIN6, "power", NULL ), - LED_STD(ADM5120_GPIO_PIN5, "user", NULL ), + LED_STD(ADM5120_GPIO_PIN6, "power", NULL), + LED_STD(ADM5120_GPIO_PIN5, "user", NULL), }; /* @@ -150,38 +150,38 @@ LED_ARRAY(rb133) { */ #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) LED_ARRAY(p334) { /* FIXME: untested */ - LED_INV(ADM5120_GPIO_xxxx, "power", NULL ), - LED_INV(ADM5120_GPIO_xxxx, "lan1", NULL ), - LED_INV(ADM5120_GPIO_xxxx, "lan2", NULL ), - LED_INV(ADM5120_GPIO_xxxx, "lan3", NULL ), - LED_INV(ADM5120_GPIO_xxxx, "lan4", NULL ), - LED_INV(ADM5120_GPIO_xxxx, "wan", NULL ), + LED_INV(ADM5120_GPIO_xxxx, "power", NULL), + LED_INV(ADM5120_GPIO_xxxx, "lan1", NULL), + LED_INV(ADM5120_GPIO_xxxx, "lan2", NULL), + LED_INV(ADM5120_GPIO_xxxx, "lan3", NULL), + LED_INV(ADM5120_GPIO_xxxx, "lan4", NULL), + LED_INV(ADM5120_GPIO_xxxx, "wan", NULL), }; #endif LED_ARRAY(p334wt) { - LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), - LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL ), - LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL ), - LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL ), - LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL ), - LED_INV(ADM5120_GPIO_P4L0, "wan", NULL ), - LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL ), - LED_INV(ADM5120_GPIO_P2L2, "otist", NULL ), - LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL ), + LED_INV(ADM5120_GPIO_PIN2, "power", NULL), + LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL), + LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL), + LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL), + LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL), + LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), + LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL), + LED_INV(ADM5120_GPIO_P2L2, "otist", NULL), + LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL), }; #if defined(CONFIG_LEDS_ADM5120_EXPERIMENTAL) LED_ARRAY(p335) { /* FIXME: untested */ - LED_INV(ADM5120_GPIO_PIN2, "power", NULL ), - LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL ), - LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL ), - LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL ), - LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL ), - LED_INV(ADM5120_GPIO_P4L0, "wan", NULL ), - LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL ), - LED_INV(ADM5120_GPIO_P2L2, "otist", NULL ), - LED_INV(ADM5120_GPIO_xxxx, "usb", NULL ), + LED_INV(ADM5120_GPIO_PIN2, "power", NULL), + LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL), + LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL), + LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL), + LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL), + LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), + LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL), + LED_INV(ADM5120_GPIO_P2L2, "otist", NULL), + LED_INV(ADM5120_GPIO_xxxx, "usb", NULL), }; #endif @@ -190,36 +190,36 @@ LED_ARRAY(p335) { /* FIXME: untested */ */ LED_ARRAY(generic) { #if defined(CONFIG_LEDS_ADM5120_DIAG) - LED_STD(ADM5120_GPIO_PIN0, "gpio0", NULL ), - LED_STD(ADM5120_GPIO_PIN1, "gpio1", NULL ), - LED_STD(ADM5120_GPIO_PIN2, "gpio2", NULL ), - LED_STD(ADM5120_GPIO_PIN3, "gpio3", NULL ), - LED_STD(ADM5120_GPIO_PIN4, "gpio4", NULL ), - LED_STD(ADM5120_GPIO_PIN5, "gpio5", NULL ), - LED_STD(ADM5120_GPIO_PIN6, "gpio6", NULL ), - LED_STD(ADM5120_GPIO_PIN7, "gpio7", NULL ), - LED_STD(ADM5120_GPIO_P0L0, "port0led0", NULL ), - LED_STD(ADM5120_GPIO_P0L1, "port0led1", NULL ), - LED_STD(ADM5120_GPIO_P0L2, "port0led2", NULL ), - LED_STD(ADM5120_GPIO_P1L0, "port1led0", NULL ), - LED_STD(ADM5120_GPIO_P1L1, "port1led1", NULL ), - LED_STD(ADM5120_GPIO_P1L2, "port1led2", NULL ), - LED_STD(ADM5120_GPIO_P2L0, "port2led0", NULL ), - LED_STD(ADM5120_GPIO_P2L1, "port2led1", NULL ), - LED_STD(ADM5120_GPIO_P2L2, "port2led2", NULL ), - LED_STD(ADM5120_GPIO_P3L0, "port3led0", NULL ), - LED_STD(ADM5120_GPIO_P3L1, "port3led1", NULL ), - LED_STD(ADM5120_GPIO_P3L2, "port3led2", NULL ), - LED_STD(ADM5120_GPIO_P4L0, "port4led0", NULL ), - LED_STD(ADM5120_GPIO_P4L1, "port4led1", NULL ), - LED_STD(ADM5120_GPIO_P4L2, "port4led2", NULL ), + LED_STD(ADM5120_GPIO_PIN0, "gpio0", NULL), + LED_STD(ADM5120_GPIO_PIN1, "gpio1", NULL), + LED_STD(ADM5120_GPIO_PIN2, "gpio2", NULL), + LED_STD(ADM5120_GPIO_PIN3, "gpio3", NULL), + LED_STD(ADM5120_GPIO_PIN4, "gpio4", NULL), + LED_STD(ADM5120_GPIO_PIN5, "gpio5", NULL), + LED_STD(ADM5120_GPIO_PIN6, "gpio6", NULL), + LED_STD(ADM5120_GPIO_PIN7, "gpio7", NULL), + LED_STD(ADM5120_GPIO_P0L0, "port0led0", NULL), + LED_STD(ADM5120_GPIO_P0L1, "port0led1", NULL), + LED_STD(ADM5120_GPIO_P0L2, "port0led2", NULL), + LED_STD(ADM5120_GPIO_P1L0, "port1led0", NULL), + LED_STD(ADM5120_GPIO_P1L1, "port1led1", NULL), + LED_STD(ADM5120_GPIO_P1L2, "port1led2", NULL), + LED_STD(ADM5120_GPIO_P2L0, "port2led0", NULL), + LED_STD(ADM5120_GPIO_P2L1, "port2led1", NULL), + LED_STD(ADM5120_GPIO_P2L2, "port2led2", NULL), + LED_STD(ADM5120_GPIO_P3L0, "port3led0", NULL), + LED_STD(ADM5120_GPIO_P3L1, "port3led1", NULL), + LED_STD(ADM5120_GPIO_P3L2, "port3led2", NULL), + LED_STD(ADM5120_GPIO_P4L0, "port4led0", NULL), + LED_STD(ADM5120_GPIO_P4L1, "port4led1", NULL), + LED_STD(ADM5120_GPIO_P4L2, "port4led2", NULL), #endif }; -#define MACH_DATA(m, n) { \ +#define MACH_DATA(m, n) { \ .machtype = (m), \ .nr_leds = ARRAY_SIZE(n ## _leds), \ - .leds = n ## _leds \ + .leds = n ## _leds \ } static struct mach_data machines[] __initdata = { @@ -262,19 +262,12 @@ create_leddev(int id, struct gpio_led *led) p->pdev.name = "leds-gpio"; p->pdev.id = id; p->pdev.dev.platform_data = &p->pdata; - p->pdata.num_leds=1; + p->pdata.num_leds = 1; p->pdata.leds = &p->led; return p; } -static void -destroy_leddev(struct adm5120_leddev *leddev) -{ - if (leddev) - kfree(leddev); -} - static struct mach_data * __init adm5120_leds_findmach(unsigned long machtype) { @@ -282,7 +275,7 @@ adm5120_leds_findmach(unsigned long machtype) int i; mach = NULL; - for (i=0; inr_leds; i++) { + for (i = 0; i < mach->nr_leds; i++) { led_devs[i] = create_leddev(i, &mach->leds[i]); if (led_devs[i] == NULL) { ret = -ENOMEM; @@ -323,7 +316,7 @@ adm5120_leds_init(void) } } - for (i=0; i < mach->nr_leds; i++) { + for (i = 0; i < mach->nr_leds; i++) { ret = platform_device_register(&led_devs[i]->pdev); if (ret) goto err_unregister; @@ -333,12 +326,12 @@ adm5120_leds_init(void) return 0; err_unregister: - for (i--; i>=0; i--) + for (i--; i >= 0; i--) platform_device_unregister(&led_devs[i]->pdev); err_destroy: - for (i=0; ipdev); - destroy_leddev(led_devs[i]); + kfree(led_devs[i]); } } diff --git a/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c b/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c index 7a55396e7f..e07fb96d26 100644 --- a/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c +++ b/target/linux/adm5120/files/drivers/mtd/maps/adm5120-flash.c @@ -32,15 +32,14 @@ #include #include #include +#include #include - #include + #include #include #include -#include - #include #include #include @@ -173,7 +172,7 @@ static void adm5120_flash_write(struct map_info *map, const map_word datum, { struct adm5120_map_info *amap = map_to_amap(map); - MAP_DBG(map,"writing to ofs %lX\n", ofs); + MAP_DBG(map, "writing to ofs %lX\n", ofs); if (ofs > amap->window_size) return; @@ -329,7 +328,7 @@ static void adm5120_flash_initbanks(struct adm5120_flash_info *info) #ifdef CONFIG_MTD_PARTITIONS static int adm5120_flash_initparts(struct adm5120_flash_info *info) { - struct adm5120_flash_platform_data *pdata = info->dev->dev.platform_data; + struct adm5120_flash_platform_data *pdata; struct map_info *map = &info->amap.map; int num_parsers; const char *parser[2]; @@ -339,6 +338,7 @@ static int adm5120_flash_initparts(struct adm5120_flash_info *info) info->nr_parts = 0; + pdata = info->dev->dev.platform_data; if (pdata == NULL) goto out; @@ -357,7 +357,7 @@ static int adm5120_flash_initparts(struct adm5120_flash_info *info) num_parsers = MAX_PARSED_PARTS; parser[1] = NULL; - for (i=0; inr_parts) { del_mtd_partitions(info->mtd); - for (i=0; iparts[i] != NULL) kfree(info->parts[i]); } else { @@ -496,7 +496,8 @@ static int adm5120_flash_probe(struct platform_device *dev) goto err_out; if (info->nr_parts == 0) { - MAP_INFO(map, "no partitions available, registering whole flash\n"); + MAP_INFO(map, "no partitions available, registering " + "whole flash\n"); add_mtd_device(info->mtd); } @@ -508,7 +509,8 @@ err_out: } #ifdef CONFIG_PM -static int adm5120_flash_suspend(struct platform_device *dev, pm_message_t state) +static int adm5120_flash_suspend(struct platform_device *dev, + pm_message_t state) { struct adm5120_flash_info *info = platform_get_drvdata(dev); int ret = 0; diff --git a/target/linux/adm5120/files/drivers/mtd/myloader.c b/target/linux/adm5120/files/drivers/mtd/myloader.c index ad207e5559..24d41c559b 100644 --- a/target/linux/adm5120/files/drivers/mtd/myloader.c +++ b/target/linux/adm5120/files/drivers/mtd/myloader.c @@ -54,7 +54,6 @@ int parse_myloader_partitions(struct mtd_info *master, int num_parts; int ret, i; size_t retlen; - size_t parts_len; char *names; unsigned long offset; unsigned long blocklen; @@ -104,8 +103,8 @@ int parse_myloader_partitions(struct mtd_info *master, num_parts++; } - mtd_parts = kzalloc((num_parts*sizeof(*mtd_part) + num_parts*NAME_LEN_MAX), - GFP_KERNEL); + mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) + + num_parts * NAME_LEN_MAX), GFP_KERNEL); if (!mtd_parts) { ret = -ENOMEM; diff --git a/target/linux/adm5120/files/drivers/mtd/trxsplit.c b/target/linux/adm5120/files/drivers/mtd/trxsplit.c index ad0e25a113..19d1e9da97 100644 --- a/target/linux/adm5120/files/drivers/mtd/trxsplit.c +++ b/target/linux/adm5120/files/drivers/mtd/trxsplit.c @@ -38,24 +38,24 @@ #define TRX_MAGIC 0x30524448 /* "HDR0" */ #define TRX_VERSION 1 #define TRX_MAX_LEN 0x3A0000 -#define TRX_NO_HEADER 1 /* Do not write TRX header */ -#define TRX_GZ_FILES 0x2 /* Contains up to TRX_MAX_OFFSET individual gzip files */ +#define TRX_NO_HEADER 0x1 /* do not write TRX header */ +#define TRX_GZ_FILES 0x2 /* contains individual gzip files */ #define TRX_MAX_OFFSET 3 #define TRX_MIN_KERNEL_SIZE 256*1024 struct trx_header { - u32 magic; /* "HDR0" */ - u32 len; /* Length of file including header */ - u32 crc32; /* 32-bit CRC from flag_version to end of file */ - u32 flag_version; /* 0:15 flags, 16:31 version */ - u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of header */ + u32 magic; /* "HDR0" */ + u32 len; /* Length of file including header */ + u32 crc32; /* 32-bit CRC from flag_version to end of file */ + u32 flag_version; /* 0:15 flags, 16:31 version */ + u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */ }; #define BLOCK_LEN_MIN 0x10000 -static struct mtd_info *trx_mtd = NULL; -static unsigned long trx_offset = 0; -static int trx_nr_parts = 0; +static int trx_nr_parts; +static unsigned long trx_offset; +static struct mtd_info *trx_mtd; static struct mtd_partition trx_parts[TRX_MAX_OFFSET]; static struct trx_header trx_hdr; @@ -66,7 +66,8 @@ static int trxsplit_checktrx(struct mtd_info *mtd, unsigned long offset) size_t retlen; int err; - err = mtd->read(mtd, offset, sizeof(trx_hdr), &retlen, (void *)&trx_hdr); + err = mtd->read(mtd, offset, sizeof(trx_hdr), &retlen, + (void *)&trx_hdr); if (err) { printk(KERN_ALERT PFX "unable to read from '%s'\n", mtd->name); goto err_out; @@ -113,7 +114,7 @@ static void trxsplit_findtrx(struct mtd_info *mtd) printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name); err = 0; - for (offset=0; offset < mtd->size; offset+=blocklen) { + for (offset = 0; offset < mtd->size; offset += blocklen) { err = trxsplit_checktrx(mtd, offset); if (err == 0) break; @@ -134,7 +135,7 @@ static void trxsplit_create_partitions(struct mtd_info *mtd) int err; int i; - for (i=0; isize - trx_parts[i].offset; - i=0; + i = 0; part = &trx_parts[i]; if (part->size < TRX_MIN_KERNEL_SIZE) { part->name = "loader"; @@ -216,8 +217,9 @@ static int __init trxsplit_init(void) trxsplit_scan(); if (trx_mtd) { - printk(KERN_INFO PFX "creating TRX partitions in '%s' (%d,%d)\n", - trx_mtd->name, MTD_BLOCK_MAJOR, trx_mtd->index); + printk(KERN_INFO PFX "creating TRX partitions in '%s' " + "(%d,%d)\n", trx_mtd->name, MTD_BLOCK_MAJOR, + trx_mtd->index); trxsplit_create_partitions(trx_mtd); } diff --git a/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_info.h b/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_info.h index b8b9c5d475..ac452ef30f 100644 --- a/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_info.h +++ b/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_info.h @@ -65,7 +65,6 @@ extern void adm5120_ndelay(u32 ns); extern void adm5120_restart(char *command); extern void adm5120_halt(void); -extern void adm5120_power_off(void); extern void (*adm5120_board_reset)(void); -- 2.30.2