Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] Alchemy PCI code style cleanup

Fix 15 errors and 4 warnings given by checkpatch.pl:

- space between the asterisk and variable name;

- space after opening and before closing parentheses;

- leading spaces instead of tabs;

- printk() without KERN_* facility level;

- unnecessary braces for single-statement block;

- line over 80 characters.

In addition to these changes, also do the following:

- combine the nested 'if' statements into one when possible;

- remove needless parentheses;

- add missing and remove excess spaces between operator and its operands;

- fix printk() format specifiers mismatching the argument types;

- put the function's result type and name/parameters on the same line;

- insert missing and remove excess new lines;

- properly indent multi-line expressions;

- make the multi-line comment style consistent with the kernel style elsewhere
by adding empty first line;

- fix typos, capitalize acronyms, etc. in the comments;

- update MontaVista copyright;

- remove Pete Popov's old email address...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Sergei Shtylyov and committed by
Ralf Baechle
a9633279 c1dcb14e

+56 -66
+3 -4
arch/mips/pci/fixup-au1000.c
··· 1 1 /* 2 2 * BRIEF MODULE DESCRIPTION 3 - * Board specific pci fixups. 3 + * Board specific PCI fixups. 4 4 * 5 - * Copyright 2001-2003 MontaVista Software Inc. 6 - * Author: MontaVista Software, Inc. 7 - * ppopov@mvista.com or source@mvista.com 5 + * Copyright 2001-2003, 2008 MontaVista Software Inc. 6 + * Author: MontaVista Software, Inc. <source@mvista.com> 8 7 * 9 8 * This program is free software; you can redistribute it and/or modify it 10 9 * under the terms of the GNU General Public License as published by the
+53 -62
arch/mips/pci/ops-au1000.c
··· 1 1 /* 2 2 * BRIEF MODULE DESCRIPTION 3 - * Alchemy/AMD Au1x00 PCI support. 3 + * Alchemy/AMD Au1xx0 PCI support. 4 4 * 5 - * Copyright 2001-2003, 2007 MontaVista Software Inc. 6 - * Author: MontaVista Software, Inc. 7 - * ppopov@mvista.com or source@mvista.com 5 + * Copyright 2001-2003, 2007-2008 MontaVista Software Inc. 6 + * Author: MontaVista Software, Inc. <source@mvista.com> 8 7 * 9 8 * Support for all devices (greater than 16) added by David Gathright. 10 9 * ··· 27 28 * with this program; if not, write to the Free Software Foundation, Inc., 28 29 * 675 Mass Ave, Cambridge, MA 02139, USA. 29 30 */ 31 + 30 32 #include <linux/types.h> 31 33 #include <linux/pci.h> 32 34 #include <linux/kernel.h> ··· 36 36 37 37 #include <asm/mach-au1x00/au1000.h> 38 38 39 - #undef DEBUG 40 - #ifdef DEBUG 41 - #define DBG(x...) printk(x) 39 + #undef DEBUG 40 + #ifdef DEBUG 41 + #define DBG(x...) printk(KERN_DEBUG x) 42 42 #else 43 43 #define DBG(x...) 44 44 #endif 45 45 46 46 #define PCI_ACCESS_READ 0 47 47 #define PCI_ACCESS_WRITE 1 48 - 49 48 50 49 int (*board_pci_idsel)(unsigned int devsel, int assert); 51 50 ··· 91 92 } 92 93 93 94 static int config_access(unsigned char access_type, struct pci_bus *bus, 94 - unsigned int dev_fn, unsigned char where, 95 - u32 * data) 95 + unsigned int dev_fn, unsigned char where, u32 *data) 96 96 { 97 - #if defined( CONFIG_SOC_AU1500 ) || defined( CONFIG_SOC_AU1550 ) 97 + #if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) 98 98 unsigned int device = PCI_SLOT(dev_fn); 99 99 unsigned int function = PCI_FUNC(dev_fn); 100 100 unsigned long offset, status; ··· 112 114 Au1500_PCI_STATCMD); 113 115 au_sync_udelay(1); 114 116 115 - /* Allow board vendors to implement their own off-chip idsel. 117 + /* 118 + * Allow board vendors to implement their own off-chip IDSEL. 116 119 * If it doesn't succeed, may as well bail out at this point. 117 120 */ 118 - if (board_pci_idsel) { 119 - if (board_pci_idsel(device, 1) == 0) { 120 - *data = 0xffffffff; 121 - local_irq_restore(flags); 122 - return -1; 123 - } 121 + if (board_pci_idsel && board_pci_idsel(device, 1) == 0) { 122 + *data = 0xffffffff; 123 + local_irq_restore(flags); 124 + return -1; 124 125 } 125 126 126 - /* setup the config window */ 127 - if (bus->number == 0) { 128 - cfg_base = ((1<<device)<<11); 129 - } else { 130 - cfg_base = 0x80000000 | (bus->number<<16) | (device<<11); 131 - } 127 + /* Setup the config window */ 128 + if (bus->number == 0) 129 + cfg_base = (1 << device) << 11; 130 + else 131 + cfg_base = 0x80000000 | (bus->number << 16) | (device << 11); 132 132 133 - /* setup the lower bits of the 36 bit address */ 134 - offset = (function << 8) | (where & ~0x3); 135 - /* pick up any address that falls below the page mask */ 133 + /* Setup the lower bits of the 36-bit address */ 134 + offset = (function << 8) | (where & ~0x3); 135 + /* Pick up any address that falls below the page mask */ 136 136 offset |= cfg_base & ~PAGE_MASK; 137 137 138 - /* page boundary */ 138 + /* Page boundary */ 139 139 cfg_base = cfg_base & PAGE_MASK; 140 140 141 141 /* 142 142 * To improve performance, if the current device is the same as 143 143 * the last device accessed, we don't touch the TLB. 144 144 */ 145 - entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7; 146 - entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7; 145 + entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7; 146 + entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7; 147 147 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) { 148 148 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1, 149 149 (unsigned long)pci_cfg_vm->addr, PM_4K); ··· 149 153 last_entryLo1 = entryLo1; 150 154 } 151 155 152 - if (access_type == PCI_ACCESS_WRITE) { 156 + if (access_type == PCI_ACCESS_WRITE) 153 157 au_writel(*data, (int)(pci_cfg_vm->addr + offset)); 154 - } else { 158 + else 155 159 *data = au_readl((int)(pci_cfg_vm->addr + offset)); 156 - } 160 + 157 161 au_sync_udelay(2); 158 162 159 - DBG("cfg_access %d bus->number %d dev %d at %x *data %x conf %x\n", 160 - access_type, bus->number, device, where, *data, offset); 163 + DBG("cfg_access %d bus->number %u dev %u at %x *data %x conf %lx\n", 164 + access_type, bus->number, device, where, *data, offset); 161 165 162 - /* check master abort */ 166 + /* Check master abort */ 163 167 status = au_readl(Au1500_PCI_STATCMD); 164 168 165 - if (status & (1<<29)) { 169 + if (status & (1 << 29)) { 166 170 *data = 0xffffffff; 167 171 error = -1; 168 172 DBG("Au1x Master Abort\n"); 169 173 } else if ((status >> 28) & 0xf) { 170 - DBG("PCI ERR detected: device %d, status %x\n", device, ((status >> 28) & 0xf)); 174 + DBG("PCI ERR detected: device %u, status %lx\n", 175 + device, (status >> 28) & 0xf); 171 176 172 - /* clear errors */ 177 + /* Clear errors */ 173 178 au_writel(status & 0xf000ffff, Au1500_PCI_STATCMD); 174 179 175 180 *data = 0xffffffff; 176 181 error = -1; 177 182 } 178 183 179 - /* Take away the idsel. 180 - */ 181 - if (board_pci_idsel) { 184 + /* Take away the IDSEL. */ 185 + if (board_pci_idsel) 182 186 (void)board_pci_idsel(device, 0); 183 - } 184 187 185 188 local_irq_restore(flags); 186 189 return error; ··· 187 192 } 188 193 189 194 static int read_config_byte(struct pci_bus *bus, unsigned int devfn, 190 - int where, u8 * val) 195 + int where, u8 *val) 191 196 { 192 197 u32 data; 193 198 int ret; ··· 201 206 return ret; 202 207 } 203 208 204 - 205 209 static int read_config_word(struct pci_bus *bus, unsigned int devfn, 206 - int where, u16 * val) 210 + int where, u16 *val) 207 211 { 208 212 u32 data; 209 213 int ret; ··· 215 221 } 216 222 217 223 static int read_config_dword(struct pci_bus *bus, unsigned int devfn, 218 - int where, u32 * val) 224 + int where, u32 *val) 219 225 { 220 226 int ret; 221 227 ··· 223 229 return ret; 224 230 } 225 231 226 - static int 227 - write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, 228 - u8 val) 232 + static int write_config_byte(struct pci_bus *bus, unsigned int devfn, 233 + int where, u8 val) 229 234 { 230 235 u32 data = 0; 231 236 ··· 232 239 return -1; 233 240 234 241 data = (data & ~(0xff << ((where & 3) << 3))) | 235 - (val << ((where & 3) << 3)); 242 + (val << ((where & 3) << 3)); 236 243 237 244 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 238 245 return -1; ··· 240 247 return PCIBIOS_SUCCESSFUL; 241 248 } 242 249 243 - static int 244 - write_config_word(struct pci_bus *bus, unsigned int devfn, int where, 245 - u16 val) 250 + static int write_config_word(struct pci_bus *bus, unsigned int devfn, 251 + int where, u16 val) 246 252 { 247 253 u32 data = 0; 248 254 ··· 249 257 return -1; 250 258 251 259 data = (data & ~(0xffff << ((where & 3) << 3))) | 252 - (val << ((where & 3) << 3)); 260 + (val << ((where & 3) << 3)); 253 261 254 262 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) 255 263 return -1; 256 264 257 - 258 265 return PCIBIOS_SUCCESSFUL; 259 266 } 260 267 261 - static int 262 - write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, 263 - u32 val) 268 + static int write_config_dword(struct pci_bus *bus, unsigned int devfn, 269 + int where, u32 val) 264 270 { 265 271 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val)) 266 272 return -1; ··· 267 277 } 268 278 269 279 static int config_read(struct pci_bus *bus, unsigned int devfn, 270 - int where, int size, u32 * val) 280 + int where, int size, u32 *val) 271 281 { 272 282 switch (size) { 273 283 case 1: { 274 284 u8 _val; 275 285 int rc = read_config_byte(bus, devfn, where, &_val); 286 + 276 287 *val = _val; 277 288 return rc; 278 289 } 279 - case 2: { 290 + case 2: { 280 291 u16 _val; 281 292 int rc = read_config_word(bus, devfn, where, &_val); 293 + 282 294 *val = _val; 283 295 return rc; 284 296 } ··· 301 309 return write_config_dword(bus, devfn, where, val); 302 310 } 303 311 } 304 - 305 312 306 313 struct pci_ops au1x_pci_ops = { 307 314 config_read,