aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-12-10 11:38:26 -0500
committerRalf Baechle <ralf@linux-mips.org>2015-04-01 11:22:10 -0400
commitd548ca6b0784a99f0fcae397f115823ccd0361a5 (patch)
tree17a178461b3762bc78c301892abeeec4fcaf7d16 /arch
parent05f5507f59d6d3eab1c2172c6266b664b61599b5 (diff)
MIPS: BCM47XX: Fix coding style to match kernel standards
[ralf@linux-mips.org: Fixed conflicts.] Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Cc: linux-mips@linux-mips.org Cc: Paul Walmsley <paul@pwsan.com> Patchwork: https://patchwork.linux-mips.org/patch/8665/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/bcm47xx/bcm47xx_private.h4
-rw-r--r--arch/mips/bcm47xx/board.c3
-rw-r--r--arch/mips/bcm47xx/nvram.c25
-rw-r--r--arch/mips/bcm47xx/prom.c3
-rw-r--r--arch/mips/bcm47xx/serial.c8
-rw-r--r--arch/mips/bcm47xx/setup.c12
-rw-r--r--arch/mips/bcm47xx/sprom.c8
-rw-r--r--arch/mips/bcm47xx/time.c1
8 files changed, 34 insertions, 30 deletions
diff --git a/arch/mips/bcm47xx/bcm47xx_private.h b/arch/mips/bcm47xx/bcm47xx_private.h
index ea909a56a3ee..41796befa9df 100644
--- a/arch/mips/bcm47xx/bcm47xx_private.h
+++ b/arch/mips/bcm47xx/bcm47xx_private.h
@@ -1,6 +1,10 @@
1#ifndef LINUX_BCM47XX_PRIVATE_H_ 1#ifndef LINUX_BCM47XX_PRIVATE_H_
2#define LINUX_BCM47XX_PRIVATE_H_ 2#define LINUX_BCM47XX_PRIVATE_H_
3 3
4#ifndef pr_fmt
5#define pr_fmt(fmt) "bcm47xx: " fmt
6#endif
7
4#include <linux/kernel.h> 8#include <linux/kernel.h>
5 9
6/* prom.c */ 10/* prom.c */
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
index 6e8513068325..d4a5a51ce232 100644
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -330,9 +330,8 @@ void __init bcm47xx_board_detect(void)
330 err = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf)); 330 err = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
331 331
332 /* init of nvram failed, probably too early now */ 332 /* init of nvram failed, probably too early now */
333 if (err == -ENXIO) { 333 if (err == -ENXIO)
334 return; 334 return;
335 }
336 335
337 board_detected = bcm47xx_board_get_nvram(); 336 board_detected = bcm47xx_board_get_nvram();
338 bcm47xx_board.board = board_detected->board; 337 bcm47xx_board.board = board_detected->board;
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 7c77a88eedf9..6a97732c1eeb 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -18,8 +18,10 @@
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/bcm47xx_nvram.h> 19#include <linux/bcm47xx_nvram.h>
20 20
21#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ 21#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
22#define NVRAM_SPACE 0x8000 22#define NVRAM_SPACE 0x8000
23#define NVRAM_MAX_GPIO_ENTRIES 32
24#define NVRAM_MAX_GPIO_VALUE_LEN 30
23 25
24#define FLASH_MIN 0x00020000 /* Minimum flash size */ 26#define FLASH_MIN 0x00020000 /* Minimum flash size */
25 27
@@ -97,8 +99,8 @@ found:
97 pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", 99 pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
98 header->len, NVRAM_SPACE); 100 header->len, NVRAM_SPACE);
99 101
100 src = (u32 *) header; 102 src = (u32 *)header;
101 dst = (u32 *) nvram_buf; 103 dst = (u32 *)nvram_buf;
102 for (i = 0; i < sizeof(struct nvram_header); i += 4) 104 for (i = 0; i < sizeof(struct nvram_header); i += 4)
103 *dst++ = __raw_readl(src++); 105 *dst++ = __raw_readl(src++);
104 for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4) 106 for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
@@ -189,7 +191,8 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
189 /* Look for name=value and return value */ 191 /* Look for name=value and return value */
190 var = &nvram_buf[sizeof(struct nvram_header)]; 192 var = &nvram_buf[sizeof(struct nvram_header)];
191 end = nvram_buf + sizeof(nvram_buf) - 2; 193 end = nvram_buf + sizeof(nvram_buf) - 2;
192 end[0] = end[1] = '\0'; 194 end[0] = '\0';
195 end[1] = '\0';
193 for (; *var; var = value + strlen(value) + 1) { 196 for (; *var; var = value + strlen(value) + 1) {
194 data_left = end - var; 197 data_left = end - var;
195 198
@@ -197,11 +200,10 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
197 if (!eq) 200 if (!eq)
198 break; 201 break;
199 value = eq + 1; 202 value = eq + 1;
200 if ((eq - var) == strlen(name) && 203 if (eq - var == strlen(name) &&
201 strncmp(var, name, (eq - var)) == 0) { 204 strncmp(var, name, eq - var) == 0)
202 return snprintf(val, val_len, "%s", value); 205 return snprintf(val, val_len, "%s", value);
203 } 206 }
204 }
205 return -ENOENT; 207 return -ENOENT;
206} 208}
207EXPORT_SYMBOL(bcm47xx_nvram_getenv); 209EXPORT_SYMBOL(bcm47xx_nvram_getenv);
@@ -209,10 +211,11 @@ EXPORT_SYMBOL(bcm47xx_nvram_getenv);
209int bcm47xx_nvram_gpio_pin(const char *name) 211int bcm47xx_nvram_gpio_pin(const char *name)
210{ 212{
211 int i, err; 213 int i, err;
212 char nvram_var[10]; 214 char nvram_var[] = "gpioXX";
213 char buf[30]; 215 char buf[NVRAM_MAX_GPIO_VALUE_LEN];
214 216
215 for (i = 0; i < 32; i++) { 217 /* TODO: Optimize it to don't call getenv so many times */
218 for (i = 0; i < NVRAM_MAX_GPIO_ENTRIES; i++) {
216 err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); 219 err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
217 if (err <= 0) 220 if (err <= 0)
218 continue; 221 continue;
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 1b170bf5f7f0..ab698bad6d62 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -35,7 +35,6 @@
35#include <bcm47xx.h> 35#include <bcm47xx.h>
36#include <bcm47xx_board.h> 36#include <bcm47xx_board.h>
37 37
38
39static char bcm47xx_system_type[20] = "Broadcom BCM47XX"; 38static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
40 39
41const char *get_system_type(void) 40const char *get_system_type(void)
@@ -83,7 +82,7 @@ static __init void prom_init_mem(void)
83 /* Loop condition may be not enough, off may be over 1 MiB */ 82 /* Loop condition may be not enough, off may be over 1 MiB */
84 if (off + mem >= max) { 83 if (off + mem >= max) {
85 mem = max; 84 mem = max;
86 printk(KERN_DEBUG "assume 128MB RAM\n"); 85 pr_debug("Assume 128MB RAM\n");
87 break; 86 break;
88 } 87 }
89 if (!memcmp(prom_init, prom_init + mem, 32)) 88 if (!memcmp(prom_init, prom_init + mem, 32))
diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
index 2f5bbd68e9a0..df761d38f7fc 100644
--- a/arch/mips/bcm47xx/serial.c
+++ b/arch/mips/bcm47xx/serial.c
@@ -36,8 +36,8 @@ static int __init uart8250_init_ssb(void)
36 struct plat_serial8250_port *p = &(uart8250_data[i]); 36 struct plat_serial8250_port *p = &(uart8250_data[i]);
37 struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]); 37 struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]);
38 38
39 p->mapbase = (unsigned int) ssb_port->regs; 39 p->mapbase = (unsigned int)ssb_port->regs;
40 p->membase = (void *) ssb_port->regs; 40 p->membase = (void *)ssb_port->regs;
41 p->irq = ssb_port->irq + 2; 41 p->irq = ssb_port->irq + 2;
42 p->uartclk = ssb_port->baud_base; 42 p->uartclk = ssb_port->baud_base;
43 p->regshift = ssb_port->reg_shift; 43 p->regshift = ssb_port->reg_shift;
@@ -62,8 +62,8 @@ static int __init uart8250_init_bcma(void)
62 struct bcma_serial_port *bcma_port; 62 struct bcma_serial_port *bcma_port;
63 bcma_port = &(cc->serial_ports[i]); 63 bcma_port = &(cc->serial_ports[i]);
64 64
65 p->mapbase = (unsigned int) bcma_port->regs; 65 p->mapbase = (unsigned int)bcma_port->regs;
66 p->membase = (void *) bcma_port->regs; 66 p->membase = (void *)bcma_port->regs;
67 p->irq = bcma_port->irq; 67 p->irq = bcma_port->irq;
68 p->uartclk = bcma_port->baud_base; 68 p->uartclk = bcma_port->baud_base;
69 p->regshift = bcma_port->reg_shift; 69 p->regshift = bcma_port->reg_shift;
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index b26c9c24275e..82ff9fd2ab6e 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(bcm47xx_bus_type);
52 52
53static void bcm47xx_machine_restart(char *command) 53static void bcm47xx_machine_restart(char *command)
54{ 54{
55 printk(KERN_ALERT "Please stand by while rebooting the system...\n"); 55 pr_alert("Please stand by while rebooting the system...\n");
56 local_irq_disable(); 56 local_irq_disable();
57 /* Set the watchdog timer to reset immediately */ 57 /* Set the watchdog timer to reset immediately */
58 switch (bcm47xx_bus_type) { 58 switch (bcm47xx_bus_type) {
@@ -107,7 +107,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
107 char buf[20]; 107 char buf[20];
108 108
109 /* Fill boardinfo structure */ 109 /* Fill boardinfo structure */
110 memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); 110 memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
111 111
112 bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL); 112 bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
113 113
@@ -126,7 +126,7 @@ static void __init bcm47xx_register_ssb(void)
126 char buf[100]; 126 char buf[100];
127 struct ssb_mipscore *mcore; 127 struct ssb_mipscore *mcore;
128 128
129 err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE, 129 err = ssb_bus_ssbbus_register(&bcm47xx_bus.ssb, SSB_ENUM_BASE,
130 bcm47xx_get_invariants); 130 bcm47xx_get_invariants);
131 if (err) 131 if (err)
132 panic("Failed to initialize SSB bus (err %d)", err); 132 panic("Failed to initialize SSB bus (err %d)", err);
@@ -136,7 +136,7 @@ static void __init bcm47xx_register_ssb(void)
136 if (strstr(buf, "console=ttyS1")) { 136 if (strstr(buf, "console=ttyS1")) {
137 struct ssb_serial_port port; 137 struct ssb_serial_port port;
138 138
139 printk(KERN_DEBUG "Swapping serial ports!\n"); 139 pr_debug("Swapping serial ports!\n");
140 /* swap serial ports */ 140 /* swap serial ports */
141 memcpy(&port, &mcore->serial_ports[0], sizeof(port)); 141 memcpy(&port, &mcore->serial_ports[0], sizeof(port));
142 memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], 142 memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
@@ -168,7 +168,7 @@ void __init plat_mem_setup(void)
168 struct cpuinfo_mips *c = &current_cpu_data; 168 struct cpuinfo_mips *c = &current_cpu_data;
169 169
170 if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) { 170 if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) {
171 printk(KERN_INFO "bcm47xx: using bcma bus\n"); 171 pr_info("Using bcma bus\n");
172#ifdef CONFIG_BCM47XX_BCMA 172#ifdef CONFIG_BCM47XX_BCMA
173 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA; 173 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
174 bcm47xx_sprom_register_fallbacks(); 174 bcm47xx_sprom_register_fallbacks();
@@ -179,7 +179,7 @@ void __init plat_mem_setup(void)
179#endif 179#endif
180#endif 180#endif
181 } else { 181 } else {
182 printk(KERN_INFO "bcm47xx: using ssb bus\n"); 182 pr_info("Using ssb bus\n");
183#ifdef CONFIG_BCM47XX_SSB 183#ifdef CONFIG_BCM47XX_SSB
184 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB; 184 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
185 bcm47xx_sprom_register_fallbacks(); 185 bcm47xx_sprom_register_fallbacks();
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index c114b0239758..5d32afcf5b95 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -780,8 +780,8 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
780 bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback); 780 bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
781 break; 781 break;
782 default: 782 default:
783 pr_warn("Unsupported SPROM revision %d detected. Will extract" 783 pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n",
784 " v1\n", sprom->revision); 784 sprom->revision);
785 sprom->revision = 1; 785 sprom->revision = 1;
786 bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback); 786 bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
787 bcm47xx_fill_sprom_r12389(sprom, prefix, fallback); 787 bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
@@ -828,7 +828,7 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
828 bcm47xx_fill_sprom(out, prefix, false); 828 bcm47xx_fill_sprom(out, prefix, false);
829 return 0; 829 return 0;
830 } else { 830 } else {
831 pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); 831 pr_warn("Unable to fill SPROM for given bustype.\n");
832 return -EINVAL; 832 return -EINVAL;
833 } 833 }
834} 834}
@@ -893,7 +893,7 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
893 } 893 }
894 return 0; 894 return 0;
895 default: 895 default:
896 pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); 896 pr_warn("Unable to fill SPROM for given bustype.\n");
897 return -EINVAL; 897 return -EINVAL;
898 } 898 }
899} 899}
diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
index 5b46510daa7b..74224cf2e84d 100644
--- a/arch/mips/bcm47xx/time.c
+++ b/arch/mips/bcm47xx/time.c
@@ -22,7 +22,6 @@
22 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/ssb/ssb.h> 26#include <linux/ssb/ssb.h>
28#include <asm/time.h> 27#include <asm/time.h>