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

PCI: Fix all whitespace issues

Fix all whitespace issues (missing or needed whitespace) in all files in
drivers/pci. Code is compiled with allyesconfig before and after code
changes and objects are recorded and checked with objdiff and they are not
changed after this commit.

Signed-off-by: Bogicevic Sasa <brutallesale@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Bogicevic Sasa and committed by
Bjorn Helgaas
ff3ce480 1d1e8cdc

+1430 -1430
+4 -4
drivers/pci/access.c
··· 25 25 #define PCI_word_BAD (pos & 1) 26 26 #define PCI_dword_BAD (pos & 3) 27 27 28 - #define PCI_OP_READ(size,type,len) \ 28 + #define PCI_OP_READ(size, type, len) \ 29 29 int pci_bus_read_config_##size \ 30 30 (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \ 31 31 { \ ··· 40 40 return res; \ 41 41 } 42 42 43 - #define PCI_OP_WRITE(size,type,len) \ 43 + #define PCI_OP_WRITE(size, type, len) \ 44 44 int pci_bus_write_config_##size \ 45 45 (struct pci_bus *bus, unsigned int devfn, int pos, type value) \ 46 46 { \ ··· 231 231 } 232 232 233 233 /* Returns 0 on success, negative values indicate error. */ 234 - #define PCI_USER_READ_CONFIG(size,type) \ 234 + #define PCI_USER_READ_CONFIG(size, type) \ 235 235 int pci_user_read_config_##size \ 236 236 (struct pci_dev *dev, int pos, type *val) \ 237 237 { \ ··· 251 251 EXPORT_SYMBOL_GPL(pci_user_read_config_##size); 252 252 253 253 /* Returns 0 on success, negative values indicate error. */ 254 - #define PCI_USER_WRITE_CONFIG(size,type) \ 254 + #define PCI_USER_WRITE_CONFIG(size, type) \ 255 255 int pci_user_write_config_##size \ 256 256 (struct pci_dev *dev, int pos, type val) \ 257 257 { \
+1 -1
drivers/pci/host/pci-imx6.c
··· 122 122 } 123 123 124 124 /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ 125 - static int pcie_phy_read(void __iomem *dbi_base, int addr , int *data) 125 + static int pcie_phy_read(void __iomem *dbi_base, int addr, int *data) 126 126 { 127 127 u32 val, phy_ctl; 128 128 int ret;
+5 -5
drivers/pci/hotplug/acpi_pcihp.c
··· 36 36 37 37 #define MY_NAME "acpi_pcihp" 38 38 39 - #define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0) 40 - #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) 41 - #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) 42 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) 39 + #define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt, MY_NAME, __func__, ## arg); } while (0) 40 + #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 41 + #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 42 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 43 43 44 44 #define METHOD_NAME__SUN "_SUN" 45 45 #define METHOD_NAME_OSHP "OSHP" ··· 132 132 133 133 while (handle) { 134 134 acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); 135 - dbg("Trying to get hotplug control for %s \n", 135 + dbg("Trying to get hotplug control for %s\n", 136 136 (char *)string.pointer); 137 137 status = acpi_run_oshp(handle); 138 138 if (ACPI_SUCCESS(status))
+1 -1
drivers/pci/hotplug/acpiphp.h
··· 181 181 /* function prototypes */ 182 182 183 183 /* acpiphp_core.c */ 184 - int acpiphp_register_attention(struct acpiphp_attention_info*info); 184 + int acpiphp_register_attention(struct acpiphp_attention_info *info); 185 185 int acpiphp_unregister_attention(struct acpiphp_attention_info *info); 186 186 int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot, unsigned int sun); 187 187 void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
+7 -7
drivers/pci/hotplug/acpiphp_core.c
··· 63 63 MODULE_PARM_DESC(disable, "disable acpiphp driver"); 64 64 module_param_named(disable, acpiphp_disabled, bool, 0444); 65 65 66 - static int enable_slot (struct hotplug_slot *slot); 67 - static int disable_slot (struct hotplug_slot *slot); 68 - static int set_attention_status (struct hotplug_slot *slot, u8 value); 69 - static int get_power_status (struct hotplug_slot *slot, u8 *value); 70 - static int get_attention_status (struct hotplug_slot *slot, u8 *value); 71 - static int get_latch_status (struct hotplug_slot *slot, u8 *value); 72 - static int get_adapter_status (struct hotplug_slot *slot, u8 *value); 66 + static int enable_slot(struct hotplug_slot *slot); 67 + static int disable_slot(struct hotplug_slot *slot); 68 + static int set_attention_status(struct hotplug_slot *slot, u8 value); 69 + static int get_power_status(struct hotplug_slot *slot, u8 *value); 70 + static int get_attention_status(struct hotplug_slot *slot, u8 *value); 71 + static int get_latch_status(struct hotplug_slot *slot, u8 *value); 72 + static int get_adapter_status(struct hotplug_slot *slot, u8 *value); 73 73 74 74 static struct hotplug_slot_ops acpi_hotplug_slot_ops = { 75 75 .enable_slot = enable_slot,
+1 -1
drivers/pci/hotplug/acpiphp_glue.c
··· 707 707 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; 708 708 709 709 list_for_each_entry_safe_reverse(dev, tmp, &bus->devices, bus_list) { 710 - for (i=0; i<PCI_BRIDGE_RESOURCES; i++) { 710 + for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) { 711 711 struct resource *res = &dev->resource[i]; 712 712 if ((res->flags & type_mask) && !res->start && 713 713 res->end) {
+1 -1
drivers/pci/hotplug/acpiphp_ibm.c
··· 325 325 } 326 326 327 327 size = 0; 328 - for (i=0; i<package->package.count; i++) { 328 + for (i = 0; i < package->package.count; i++) { 329 329 memcpy(&lbuf[size], 330 330 package->package.elements[i].buffer.pointer, 331 331 package->package.elements[i].buffer.length);
+7 -7
drivers/pci/hotplug/cpci_hotplug.h
··· 52 52 }; 53 53 54 54 struct cpci_hp_controller_ops { 55 - int (*query_enum) (void); 56 - int (*enable_irq) (void); 57 - int (*disable_irq) (void); 58 - int (*check_irq) (void *dev_id); 59 - int (*hardware_test) (struct slot *slot, u32 value); 60 - u8 (*get_power) (struct slot *slot); 61 - int (*set_power) (struct slot *slot, int value); 55 + int (*query_enum)(void); 56 + int (*enable_irq)(void); 57 + int (*disable_irq)(void); 58 + int (*check_irq)(void *dev_id); 59 + int (*hardware_test)(struct slot *slot, u32 value); 60 + u8 (*get_power)(struct slot *slot); 61 + int (*set_power)(struct slot *slot, int value); 62 62 }; 63 63 64 64 struct cpci_hp_controller {
+8 -8
drivers/pci/hotplug/cpci_hotplug_core.c
··· 45 45 #define dbg(format, arg...) \ 46 46 do { \ 47 47 if (cpci_debug) \ 48 - printk (KERN_DEBUG "%s: " format "\n", \ 49 - MY_NAME , ## arg); \ 48 + printk(KERN_DEBUG "%s: " format "\n", \ 49 + MY_NAME, ## arg); \ 50 50 } while (0) 51 - #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) 52 - #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) 53 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 51 + #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) 52 + #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) 53 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) 54 54 55 55 /* local variables */ 56 56 static DECLARE_RWSEM(list_rwsem); ··· 238 238 * with the pci_hotplug subsystem. 239 239 */ 240 240 for (i = first; i <= last; ++i) { 241 - slot = kzalloc(sizeof (struct slot), GFP_KERNEL); 241 + slot = kzalloc(sizeof(struct slot), GFP_KERNEL); 242 242 if (!slot) { 243 243 status = -ENOMEM; 244 244 goto error; 245 245 } 246 246 247 247 hotplug_slot = 248 - kzalloc(sizeof (struct hotplug_slot), GFP_KERNEL); 248 + kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL); 249 249 if (!hotplug_slot) { 250 250 status = -ENOMEM; 251 251 goto error_slot; 252 252 } 253 253 slot->hotplug_slot = hotplug_slot; 254 254 255 - info = kzalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL); 255 + info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); 256 256 if (!info) { 257 257 status = -ENOMEM; 258 258 goto error_hpslot;
+5 -5
drivers/pci/hotplug/cpci_hotplug_pci.c
··· 38 38 #define dbg(format, arg...) \ 39 39 do { \ 40 40 if (cpci_debug) \ 41 - printk (KERN_DEBUG "%s: " format "\n", \ 42 - MY_NAME , ## arg); \ 41 + printk(KERN_DEBUG "%s: " format "\n", \ 42 + MY_NAME, ## arg); \ 43 43 } while (0) 44 - #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) 45 - #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) 46 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 44 + #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) 45 + #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) 46 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) 47 47 48 48 49 49 u8 cpci_get_attention_status(struct slot *slot)
+6 -6
drivers/pci/hotplug/cpcihp_generic.c
··· 54 54 #define dbg(format, arg...) \ 55 55 do { \ 56 56 if (debug) \ 57 - printk (KERN_DEBUG "%s: " format "\n", \ 58 - MY_NAME , ## arg); \ 57 + printk(KERN_DEBUG "%s: " format "\n", \ 58 + MY_NAME, ## arg); \ 59 59 } while (0) 60 - #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) 61 - #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) 62 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 60 + #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) 61 + #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) 62 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) 63 63 64 64 /* local variables */ 65 65 static bool debug; ··· 164 164 bus = dev->subordinate; 165 165 pci_dev_put(dev); 166 166 167 - memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller)); 167 + memset(&generic_hpc, 0, sizeof(struct cpci_hp_controller)); 168 168 generic_hpc_ops.query_enum = query_enum; 169 169 generic_hpc.ops = &generic_hpc_ops; 170 170
+7 -7
drivers/pci/hotplug/cpcihp_zt5550.c
··· 49 49 #define dbg(format, arg...) \ 50 50 do { \ 51 51 if (debug) \ 52 - printk (KERN_DEBUG "%s: " format "\n", \ 53 - MY_NAME , ## arg); \ 52 + printk(KERN_DEBUG "%s: " format "\n", \ 53 + MY_NAME, ## arg); \ 54 54 } while (0) 55 - #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) 56 - #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) 57 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 55 + #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) 56 + #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) 57 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) 58 58 59 59 /* local variables */ 60 60 static bool debug; ··· 204 204 return 0; 205 205 } 206 206 207 - static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 207 + static int zt5550_hc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 208 208 { 209 209 int status; 210 210 ··· 214 214 215 215 dbg("returned from zt5550_hc_config"); 216 216 217 - memset(&zt5550_hpc, 0, sizeof (struct cpci_hp_controller)); 217 + memset(&zt5550_hpc, 0, sizeof(struct cpci_hp_controller)); 218 218 zt5550_hpc_ops.query_enum = zt5550_hc_query_enum; 219 219 zt5550_hpc.ops = &zt5550_hpc_ops; 220 220 if (!poll) {
+7 -7
drivers/pci/hotplug/cpqphp.h
··· 36 36 37 37 #define MY_NAME "cpqphp" 38 38 39 - #define dbg(fmt, arg...) do { if (cpqhp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) 40 - #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) 41 - #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) 42 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) 39 + #define dbg(fmt, arg...) do { if (cpqhp_debug) printk(KERN_DEBUG "%s: " fmt, MY_NAME, ## arg); } while (0) 40 + #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 41 + #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 42 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 43 43 44 44 45 45 ··· 424 424 int cpqhp_hardware_test(struct controller *ctrl, int test_num); 425 425 426 426 /* resource functions */ 427 - int cpqhp_resource_sort_and_combine (struct pci_resource **head); 427 + int cpqhp_resource_sort_and_combine(struct pci_resource **head); 428 428 429 429 /* pci functions */ 430 430 int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num); ··· 685 685 u8 hp_slot; 686 686 687 687 hp_slot = slot->device - ctrl->slot_device_offset; 688 - dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n", 688 + dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d\n", 689 689 __func__, slot->device, ctrl->slot_device_offset); 690 690 691 691 status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)); ··· 712 712 713 713 static inline int wait_for_ctrl_irq(struct controller *ctrl) 714 714 { 715 - DECLARE_WAITQUEUE(wait, current); 715 + DECLARE_WAITQUEUE(wait, current); 716 716 int retval = 0; 717 717 718 718 dbg("%s - start\n", __func__);
+16 -16
drivers/pci/hotplug/cpqphp_core.c
··· 291 291 kfree(slot); 292 292 } 293 293 294 - static int ctrl_slot_cleanup (struct controller *ctrl) 294 + static int ctrl_slot_cleanup(struct controller *ctrl) 295 295 { 296 296 struct slot *old_slot, *next_slot; 297 297 ··· 301 301 while (old_slot) { 302 302 /* memory will be freed by the release_slot callback */ 303 303 next_slot = old_slot->next; 304 - pci_hp_deregister (old_slot->hotplug_slot); 304 + pci_hp_deregister(old_slot->hotplug_slot); 305 305 old_slot = next_slot; 306 306 } 307 307 ··· 413 413 mutex_lock(&ctrl->crit_sect); 414 414 415 415 if (status == 1) 416 - amber_LED_on (ctrl, hp_slot); 416 + amber_LED_on(ctrl, hp_slot); 417 417 else if (status == 0) 418 - amber_LED_off (ctrl, hp_slot); 418 + amber_LED_off(ctrl, hp_slot); 419 419 else { 420 420 /* Done with exclusive hardware access */ 421 421 mutex_unlock(&ctrl->crit_sect); ··· 425 425 set_SOGO(ctrl); 426 426 427 427 /* Wait for SOBS to be unset */ 428 - wait_for_ctrl_irq (ctrl); 428 + wait_for_ctrl_irq(ctrl); 429 429 430 430 /* Done with exclusive hardware access */ 431 431 mutex_unlock(&ctrl->crit_sect); ··· 439 439 * @hotplug_slot: slot to change LED on 440 440 * @status: LED control flag 441 441 */ 442 - static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) 442 + static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) 443 443 { 444 444 struct pci_func *slot_func; 445 445 struct slot *slot = hotplug_slot->private; ··· 610 610 u8 ctrl_slot; 611 611 u32 tempdword; 612 612 char name[SLOT_NAME_SIZE]; 613 - void __iomem *slot_entry= NULL; 613 + void __iomem *slot_entry = NULL; 614 614 int result; 615 615 616 616 dbg("%s\n", __func__); ··· 755 755 if (cpqhp_debug) 756 756 pci_print_IRQ_route(); 757 757 758 - dbg("Initialize + Start the notification mechanism \n"); 758 + dbg("Initialize + Start the notification mechanism\n"); 759 759 760 760 retval = cpqhp_event_start_thread(); 761 761 if (retval) ··· 772 772 /* Map rom address */ 773 773 cpqhp_rom_start = ioremap(ROM_PHY_ADDR, ROM_PHY_LEN); 774 774 if (!cpqhp_rom_start) { 775 - err ("Could not ioremap memory region for ROM\n"); 775 + err("Could not ioremap memory region for ROM\n"); 776 776 retval = -EIO; 777 777 goto error; 778 778 } ··· 786 786 smbios_table = detect_SMBIOS_pointer(cpqhp_rom_start, 787 787 cpqhp_rom_start + ROM_PHY_LEN); 788 788 if (!smbios_table) { 789 - err ("Could not find the SMBIOS pointer in memory\n"); 789 + err("Could not find the SMBIOS pointer in memory\n"); 790 790 retval = -EIO; 791 791 goto error_rom_start; 792 792 } ··· 794 794 smbios_start = ioremap(readl(smbios_table + ST_ADDRESS), 795 795 readw(smbios_table + ST_LENGTH)); 796 796 if (!smbios_start) { 797 - err ("Could not ioremap memory region taken from SMBIOS values\n"); 797 + err("Could not ioremap memory region taken from SMBIOS values\n"); 798 798 retval = -EIO; 799 799 goto error_smbios_start; 800 800 } ··· 1181 1181 * Finish setting up the hot plug ctrl device 1182 1182 */ 1183 1183 ctrl->slot_device_offset = readb(ctrl->hpc_reg + SLOT_MASK) >> 4; 1184 - dbg("NumSlots %d \n", ctrl->slot_device_offset); 1184 + dbg("NumSlots %d\n", ctrl->slot_device_offset); 1185 1185 1186 1186 ctrl->next_event = 0; 1187 1187 ··· 1198 1198 writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK); 1199 1199 1200 1200 /* set up the interrupt */ 1201 - dbg("HPC interrupt = %d \n", ctrl->interrupt); 1201 + dbg("HPC interrupt = %d\n", ctrl->interrupt); 1202 1202 if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, 1203 1203 IRQF_SHARED, MY_NAME, ctrl)) { 1204 1204 err("Can't get irq %d for the hotplug pci controller\n", ··· 1321 1321 while (ctrl) { 1322 1322 if (ctrl->hpc_reg) { 1323 1323 u16 misc; 1324 - rc = read_slot_enable (ctrl); 1324 + rc = read_slot_enable(ctrl); 1325 1325 1326 1326 writeb(0, ctrl->hpc_reg + SLOT_SERR); 1327 1327 writel(0xFFFFFFC0L | ~rc, ctrl->hpc_reg + INT_MASK); ··· 1361 1361 kfree(tres); 1362 1362 } 1363 1363 1364 - kfree (ctrl->pci_bus); 1364 + kfree(ctrl->pci_bus); 1365 1365 1366 1366 tctrl = ctrl; 1367 1367 ctrl = ctrl->next; ··· 1446 1446 1447 1447 cpqhp_debug = debug; 1448 1448 1449 - info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); 1449 + info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 1450 1450 cpqhp_initialize_debugfs(); 1451 1451 result = pci_register_driver(&cpqhpc_driver); 1452 1452 dbg("pci_register_driver = %d\n", result);
+100 -100
drivers/pci/hotplug/cpqphp_ctrl.c
··· 155 155 * Presence Change 156 156 */ 157 157 dbg("cpqsbd: Presence/Notify input change.\n"); 158 - dbg(" Changed bits are 0x%4.4x\n", change ); 158 + dbg(" Changed bits are 0x%4.4x\n", change); 159 159 160 160 for (hp_slot = 0; hp_slot < 6; hp_slot++) { 161 161 if (change & (0x0101 << hp_slot)) { ··· 276 276 taskInfo->event_type = INT_POWER_FAULT; 277 277 278 278 if (ctrl->rev < 4) { 279 - amber_LED_on (ctrl, hp_slot); 280 - green_LED_off (ctrl, hp_slot); 281 - set_SOGO (ctrl); 279 + amber_LED_on(ctrl, hp_slot); 280 + green_LED_off(ctrl, hp_slot); 281 + set_SOGO(ctrl); 282 282 283 283 /* this is a fatal condition, we want 284 284 * to crash the machine to protect from ··· 438 438 439 439 node = *head; 440 440 441 - if (node->length & (alignment -1)) { 441 + if (node->length & (alignment - 1)) { 442 442 /* this one isn't an aligned length, so we'll make a new entry 443 443 * and split it up. 444 444 */ ··· 835 835 if (!(*head)) 836 836 return 1; 837 837 838 - dbg("*head->next = %p\n",(*head)->next); 838 + dbg("*head->next = %p\n", (*head)->next); 839 839 840 840 if (!(*head)->next) 841 841 return 0; /* only one item on the list, already sorted! */ 842 842 843 - dbg("*head->base = 0x%x\n",(*head)->base); 844 - dbg("*head->next->base = 0x%x\n",(*head)->next->base); 843 + dbg("*head->base = 0x%x\n", (*head)->base); 844 + dbg("*head->next->base = 0x%x\n", (*head)->next->base); 845 845 while (out_of_order) { 846 846 out_of_order = 0; 847 847 ··· 917 917 /* Read to clear posted writes */ 918 918 misc = readw(ctrl->hpc_reg + MISC); 919 919 920 - dbg ("%s - waking up\n", __func__); 920 + dbg("%s - waking up\n", __func__); 921 921 wake_up_interruptible(&ctrl->queue); 922 922 } 923 923 ··· 1285 1285 /* 1286 1286 * The board is already on 1287 1287 */ 1288 - else if (is_slot_enabled (ctrl, hp_slot)) 1288 + else if (is_slot_enabled(ctrl, hp_slot)) 1289 1289 rc = CARD_FUNCTIONING; 1290 1290 else { 1291 1291 mutex_lock(&ctrl->crit_sect); 1292 1292 1293 1293 /* turn on board without attaching to the bus */ 1294 - enable_slot_power (ctrl, hp_slot); 1294 + enable_slot_power(ctrl, hp_slot); 1295 1295 1296 1296 set_SOGO(ctrl); 1297 1297 1298 1298 /* Wait for SOBS to be unset */ 1299 - wait_for_ctrl_irq (ctrl); 1299 + wait_for_ctrl_irq(ctrl); 1300 1300 1301 1301 /* Change bits in slot power register to force another shift out 1302 1302 * NOTE: this is to work around the timer bug */ ··· 1307 1307 set_SOGO(ctrl); 1308 1308 1309 1309 /* Wait for SOBS to be unset */ 1310 - wait_for_ctrl_irq (ctrl); 1310 + wait_for_ctrl_irq(ctrl); 1311 1311 1312 1312 adapter_speed = get_adapter_speed(ctrl, hp_slot); 1313 1313 if (bus->cur_bus_speed != adapter_speed) ··· 1315 1315 rc = WRONG_BUS_FREQUENCY; 1316 1316 1317 1317 /* turn off board without attaching to the bus */ 1318 - disable_slot_power (ctrl, hp_slot); 1318 + disable_slot_power(ctrl, hp_slot); 1319 1319 1320 1320 set_SOGO(ctrl); 1321 1321 1322 1322 /* Wait for SOBS to be unset */ 1323 - wait_for_ctrl_irq (ctrl); 1323 + wait_for_ctrl_irq(ctrl); 1324 1324 1325 1325 mutex_unlock(&ctrl->crit_sect); 1326 1326 ··· 1329 1329 1330 1330 mutex_lock(&ctrl->crit_sect); 1331 1331 1332 - slot_enable (ctrl, hp_slot); 1333 - green_LED_blink (ctrl, hp_slot); 1332 + slot_enable(ctrl, hp_slot); 1333 + green_LED_blink(ctrl, hp_slot); 1334 1334 1335 - amber_LED_off (ctrl, hp_slot); 1335 + amber_LED_off(ctrl, hp_slot); 1336 1336 1337 1337 set_SOGO(ctrl); 1338 1338 1339 1339 /* Wait for SOBS to be unset */ 1340 - wait_for_ctrl_irq (ctrl); 1340 + wait_for_ctrl_irq(ctrl); 1341 1341 1342 1342 mutex_unlock(&ctrl->crit_sect); 1343 1343 ··· 1366 1366 1367 1367 mutex_lock(&ctrl->crit_sect); 1368 1368 1369 - amber_LED_on (ctrl, hp_slot); 1370 - green_LED_off (ctrl, hp_slot); 1371 - slot_disable (ctrl, hp_slot); 1369 + amber_LED_on(ctrl, hp_slot); 1370 + green_LED_off(ctrl, hp_slot); 1371 + slot_disable(ctrl, hp_slot); 1372 1372 1373 1373 set_SOGO(ctrl); 1374 1374 1375 1375 /* Wait for SOBS to be unset */ 1376 - wait_for_ctrl_irq (ctrl); 1376 + wait_for_ctrl_irq(ctrl); 1377 1377 1378 1378 mutex_unlock(&ctrl->crit_sect); 1379 1379 ··· 1392 1392 1393 1393 mutex_lock(&ctrl->crit_sect); 1394 1394 1395 - amber_LED_on (ctrl, hp_slot); 1396 - green_LED_off (ctrl, hp_slot); 1397 - slot_disable (ctrl, hp_slot); 1395 + amber_LED_on(ctrl, hp_slot); 1396 + green_LED_off(ctrl, hp_slot); 1397 + slot_disable(ctrl, hp_slot); 1398 1398 1399 1399 set_SOGO(ctrl); 1400 1400 1401 1401 /* Wait for SOBS to be unset */ 1402 - wait_for_ctrl_irq (ctrl); 1402 + wait_for_ctrl_irq(ctrl); 1403 1403 1404 1404 mutex_unlock(&ctrl->crit_sect); 1405 1405 } ··· 1443 1443 set_SOGO(ctrl); 1444 1444 1445 1445 /* Wait for SOBS to be unset */ 1446 - wait_for_ctrl_irq (ctrl); 1446 + wait_for_ctrl_irq(ctrl); 1447 1447 1448 1448 /* Change bits in slot power register to force another shift out 1449 1449 * NOTE: this is to work around the timer bug ··· 1455 1455 set_SOGO(ctrl); 1456 1456 1457 1457 /* Wait for SOBS to be unset */ 1458 - wait_for_ctrl_irq (ctrl); 1458 + wait_for_ctrl_irq(ctrl); 1459 1459 1460 1460 adapter_speed = get_adapter_speed(ctrl, hp_slot); 1461 1461 if (bus->cur_bus_speed != adapter_speed) ··· 1463 1463 rc = WRONG_BUS_FREQUENCY; 1464 1464 1465 1465 /* turn off board without attaching to the bus */ 1466 - disable_slot_power (ctrl, hp_slot); 1466 + disable_slot_power(ctrl, hp_slot); 1467 1467 1468 1468 set_SOGO(ctrl); 1469 1469 ··· 1484 1484 dbg("%s: after down\n", __func__); 1485 1485 1486 1486 dbg("%s: before slot_enable\n", __func__); 1487 - slot_enable (ctrl, hp_slot); 1487 + slot_enable(ctrl, hp_slot); 1488 1488 1489 1489 dbg("%s: before green_LED_blink\n", __func__); 1490 - green_LED_blink (ctrl, hp_slot); 1490 + green_LED_blink(ctrl, hp_slot); 1491 1491 1492 1492 dbg("%s: before amber_LED_blink\n", __func__); 1493 - amber_LED_off (ctrl, hp_slot); 1493 + amber_LED_off(ctrl, hp_slot); 1494 1494 1495 1495 dbg("%s: before set_SOGO\n", __func__); 1496 1496 set_SOGO(ctrl); 1497 1497 1498 1498 /* Wait for SOBS to be unset */ 1499 1499 dbg("%s: before wait_for_ctrl_irq\n", __func__); 1500 - wait_for_ctrl_irq (ctrl); 1500 + wait_for_ctrl_irq(ctrl); 1501 1501 dbg("%s: after wait_for_ctrl_irq\n", __func__); 1502 1502 1503 1503 dbg("%s: before up\n", __func__); ··· 1520 1520 } else { 1521 1521 /* Get vendor/device ID u32 */ 1522 1522 ctrl->pci_bus->number = func->bus; 1523 - rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register); 1523 + rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register); 1524 1524 dbg("%s: pci_read_config_dword returns %d\n", __func__, rc); 1525 1525 dbg("%s: temp_register is %x\n", __func__, temp_register); 1526 1526 ··· 1557 1557 if (rc) { 1558 1558 mutex_lock(&ctrl->crit_sect); 1559 1559 1560 - amber_LED_on (ctrl, hp_slot); 1561 - green_LED_off (ctrl, hp_slot); 1562 - slot_disable (ctrl, hp_slot); 1560 + amber_LED_on(ctrl, hp_slot); 1561 + green_LED_off(ctrl, hp_slot); 1562 + slot_disable(ctrl, hp_slot); 1563 1563 1564 1564 set_SOGO(ctrl); 1565 1565 1566 1566 /* Wait for SOBS to be unset */ 1567 - wait_for_ctrl_irq (ctrl); 1567 + wait_for_ctrl_irq(ctrl); 1568 1568 1569 1569 mutex_unlock(&ctrl->crit_sect); 1570 1570 return rc; ··· 1589 1589 1590 1590 mutex_lock(&ctrl->crit_sect); 1591 1591 1592 - green_LED_on (ctrl, hp_slot); 1592 + green_LED_on(ctrl, hp_slot); 1593 1593 1594 1594 set_SOGO(ctrl); 1595 1595 1596 1596 /* Wait for SOBS to be unset */ 1597 - wait_for_ctrl_irq (ctrl); 1597 + wait_for_ctrl_irq(ctrl); 1598 1598 1599 1599 mutex_unlock(&ctrl->crit_sect); 1600 1600 } else { 1601 1601 mutex_lock(&ctrl->crit_sect); 1602 1602 1603 - amber_LED_on (ctrl, hp_slot); 1604 - green_LED_off (ctrl, hp_slot); 1605 - slot_disable (ctrl, hp_slot); 1603 + amber_LED_on(ctrl, hp_slot); 1604 + green_LED_off(ctrl, hp_slot); 1605 + slot_disable(ctrl, hp_slot); 1606 1606 1607 1607 set_SOGO(ctrl); 1608 1608 1609 1609 /* Wait for SOBS to be unset */ 1610 - wait_for_ctrl_irq (ctrl); 1610 + wait_for_ctrl_irq(ctrl); 1611 1611 1612 1612 mutex_unlock(&ctrl->crit_sect); 1613 1613 ··· 1672 1672 1673 1673 mutex_lock(&ctrl->crit_sect); 1674 1674 1675 - green_LED_off (ctrl, hp_slot); 1676 - slot_disable (ctrl, hp_slot); 1675 + green_LED_off(ctrl, hp_slot); 1676 + slot_disable(ctrl, hp_slot); 1677 1677 1678 1678 set_SOGO(ctrl); 1679 1679 ··· 1683 1683 writeb(temp_byte, ctrl->hpc_reg + SLOT_SERR); 1684 1684 1685 1685 /* Wait for SOBS to be unset */ 1686 - wait_for_ctrl_irq (ctrl); 1686 + wait_for_ctrl_irq(ctrl); 1687 1687 1688 1688 mutex_unlock(&ctrl->crit_sect); 1689 1689 ··· 1755 1755 if (pushbutton_pending) 1756 1756 cpqhp_pushbutton_thread(pushbutton_pending); 1757 1757 else 1758 - for (ctrl = cpqhp_ctrl_list; ctrl; ctrl=ctrl->next) 1758 + for (ctrl = cpqhp_ctrl_list; ctrl; ctrl = ctrl->next) 1759 1759 interrupt_event_handler(ctrl); 1760 1760 } 1761 1761 dbg("event_thread signals exit\n"); ··· 1766 1766 { 1767 1767 cpqhp_event_thread = kthread_run(event_thread, NULL, "phpd_event"); 1768 1768 if (IS_ERR(cpqhp_event_thread)) { 1769 - err ("Can't start up our event thread\n"); 1769 + err("Can't start up our event thread\n"); 1770 1770 return PTR_ERR(cpqhp_event_thread); 1771 1771 } 1772 1772 ··· 1794 1794 info->latch_status = cpq_get_latch_status(ctrl, slot); 1795 1795 info->adapter_status = get_presence_status(ctrl, slot); 1796 1796 result = pci_hp_change_slot_info(slot->hotplug_slot, info); 1797 - kfree (info); 1797 + kfree(info); 1798 1798 return result; 1799 1799 } 1800 1800 ··· 1837 1837 if (p_slot->state == BLINKINGOFF_STATE) { 1838 1838 /* slot is on */ 1839 1839 dbg("turn on green LED\n"); 1840 - green_LED_on (ctrl, hp_slot); 1840 + green_LED_on(ctrl, hp_slot); 1841 1841 } else if (p_slot->state == BLINKINGON_STATE) { 1842 1842 /* slot is off */ 1843 1843 dbg("turn off green LED\n"); 1844 - green_LED_off (ctrl, hp_slot); 1844 + green_LED_off(ctrl, hp_slot); 1845 1845 } 1846 1846 1847 1847 info(msg_button_cancel, p_slot->number); 1848 1848 1849 1849 p_slot->state = STATIC_STATE; 1850 1850 1851 - amber_LED_off (ctrl, hp_slot); 1851 + amber_LED_off(ctrl, hp_slot); 1852 1852 1853 1853 set_SOGO(ctrl); 1854 1854 1855 1855 /* Wait for SOBS to be unset */ 1856 - wait_for_ctrl_irq (ctrl); 1856 + wait_for_ctrl_irq(ctrl); 1857 1857 1858 1858 mutex_unlock(&ctrl->crit_sect); 1859 1859 } ··· 1861 1861 else if (ctrl->event_queue[loop].event_type == INT_BUTTON_RELEASE) { 1862 1862 dbg("button release\n"); 1863 1863 1864 - if (is_slot_enabled (ctrl, hp_slot)) { 1864 + if (is_slot_enabled(ctrl, hp_slot)) { 1865 1865 dbg("slot is on\n"); 1866 1866 p_slot->state = BLINKINGOFF_STATE; 1867 1867 info(msg_button_off, p_slot->number); ··· 1874 1874 1875 1875 dbg("blink green LED and turn off amber\n"); 1876 1876 1877 - amber_LED_off (ctrl, hp_slot); 1878 - green_LED_blink (ctrl, hp_slot); 1877 + amber_LED_off(ctrl, hp_slot); 1878 + green_LED_blink(ctrl, hp_slot); 1879 1879 1880 1880 set_SOGO(ctrl); 1881 1881 1882 1882 /* Wait for SOBS to be unset */ 1883 - wait_for_ctrl_irq (ctrl); 1883 + wait_for_ctrl_irq(ctrl); 1884 1884 1885 1885 mutex_unlock(&ctrl->crit_sect); 1886 1886 init_timer(&p_slot->task_event); ··· 1940 1940 dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl); 1941 1941 if (!func) { 1942 1942 dbg("Error! func NULL in %s\n", __func__); 1943 - return ; 1943 + return; 1944 1944 } 1945 1945 1946 1946 if (cpqhp_process_SS(ctrl, func) != 0) { ··· 1962 1962 dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl); 1963 1963 if (!func) { 1964 1964 dbg("Error! func NULL in %s\n", __func__); 1965 - return ; 1965 + return; 1966 1966 } 1967 1967 1968 1968 if (ctrl != NULL) { ··· 1973 1973 set_SOGO(ctrl); 1974 1974 1975 1975 /* Wait for SOBS to be unset */ 1976 - wait_for_ctrl_irq (ctrl); 1976 + wait_for_ctrl_irq(ctrl); 1977 1977 } 1978 1978 } 1979 1979 ··· 2086 2086 unsigned int devfn; 2087 2087 struct slot *p_slot; 2088 2088 struct pci_bus *pci_bus = ctrl->pci_bus; 2089 - int physical_slot=0; 2089 + int physical_slot = 0; 2090 2090 2091 2091 device = func->device; 2092 2092 func = cpqhp_slot_find(ctrl->bus, device, index++); ··· 2100 2100 devfn = PCI_DEVFN(func->device, func->function); 2101 2101 2102 2102 /* Check the Class Code */ 2103 - rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); 2103 + rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); 2104 2104 if (rc) 2105 2105 return rc; 2106 2106 ··· 2109 2109 rc = REMOVE_NOT_SUPPORTED; 2110 2110 } else { 2111 2111 /* See if it's a bridge */ 2112 - rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 2112 + rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 2113 2113 if (rc) 2114 2114 return rc; 2115 2115 2116 2116 /* If it's a bridge, check the VGA Enable bit */ 2117 2117 if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { 2118 - rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); 2118 + rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR); 2119 2119 if (rc) 2120 2120 return rc; 2121 2121 ··· 2217 2217 set_SOGO(ctrl); 2218 2218 2219 2219 /* Wait for SOGO interrupt */ 2220 - wait_for_ctrl_irq (ctrl); 2220 + wait_for_ctrl_irq(ctrl); 2221 2221 2222 2222 /* Get ready for next iteration */ 2223 2223 long_delay((3*HZ)/10); ··· 2227 2227 set_SOGO(ctrl); 2228 2228 2229 2229 /* Wait for SOGO interrupt */ 2230 - wait_for_ctrl_irq (ctrl); 2230 + wait_for_ctrl_irq(ctrl); 2231 2231 2232 2232 /* Get ready for next iteration */ 2233 2233 long_delay((3*HZ)/10); ··· 2243 2243 set_SOGO(ctrl); 2244 2244 2245 2245 /* Wait for SOBS to be unset */ 2246 - wait_for_ctrl_irq (ctrl); 2246 + wait_for_ctrl_irq(ctrl); 2247 2247 break; 2248 2248 case 2: 2249 2249 /* Do other stuff here! */ ··· 2279 2279 dbg("%s\n", __func__); 2280 2280 /* Check for Multi-function device */ 2281 2281 ctrl->pci_bus->number = func->bus; 2282 - rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); 2282 + rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte); 2283 2283 if (rc) { 2284 2284 dbg("%s: rc = %d\n", __func__, rc); 2285 2285 return rc; ··· 2296 2296 rc = configure_new_function(ctrl, new_slot, behind_bridge, resources); 2297 2297 2298 2298 if (rc) { 2299 - dbg("configure_new_function failed %d\n",rc); 2299 + dbg("configure_new_function failed %d\n", rc); 2300 2300 index = 0; 2301 2301 2302 2302 while (new_slot) { ··· 2317 2317 * and creates a board structure */ 2318 2318 2319 2319 while ((function < max_functions) && (!stop_it)) { 2320 - pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); 2320 + pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); 2321 2321 2322 2322 if (ID == 0xFFFFFFFF) { 2323 2323 function++; ··· 2543 2543 2544 2544 /* set Pre Mem base and Limit registers */ 2545 2545 temp_word = p_mem_node->base >> 16; 2546 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); 2546 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); 2547 2547 2548 2548 temp_word = (p_mem_node->base + p_mem_node->length - 1) >> 16; 2549 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); 2549 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); 2550 2550 2551 2551 /* Adjust this to compensate for extra adjustment in first loop 2552 2552 */ ··· 2560 2560 2561 2561 ID = 0xFFFFFFFF; 2562 2562 pci_bus->number = hold_bus_node->base; 2563 - pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), 0x00, &ID); 2563 + pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), 0x00, &ID); 2564 2564 pci_bus->number = func->bus; 2565 2565 2566 2566 if (ID != 0xFFFFFFFF) { /* device present */ ··· 2579 2579 new_slot->status = 0; 2580 2580 2581 2581 rc = configure_new_device(ctrl, new_slot, 1, &temp_resources); 2582 - dbg("configure_new_device rc=0x%x\n",rc); 2582 + dbg("configure_new_device rc=0x%x\n", rc); 2583 2583 } /* End of IF (device in slot?) */ 2584 2584 } /* End of FOR loop */ 2585 2585 ··· 2615 2615 temp_byte = temp_resources.bus_head->base - 1; 2616 2616 2617 2617 /* set subordinate bus */ 2618 - rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte); 2618 + rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte); 2619 2619 2620 2620 if (temp_resources.bus_head->length == 0) { 2621 2621 kfree(temp_resources.bus_head); ··· 2636 2636 hold_IO_node->base = io_node->base + io_node->length; 2637 2637 2638 2638 temp_byte = (hold_IO_node->base) >> 8; 2639 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_IO_BASE, temp_byte); 2639 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_IO_BASE, temp_byte); 2640 2640 2641 2641 return_resource(&(resources->io_head), io_node); 2642 2642 } ··· 2655 2655 func->io_head = hold_IO_node; 2656 2656 2657 2657 temp_byte = (io_node->base - 1) >> 8; 2658 - rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte); 2658 + rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte); 2659 2659 2660 2660 return_resource(&(resources->io_head), io_node); 2661 2661 } else { 2662 2662 /* it doesn't need any IO */ 2663 2663 temp_word = 0x0000; 2664 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_IO_LIMIT, temp_word); 2664 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_IO_LIMIT, temp_word); 2665 2665 2666 2666 return_resource(&(resources->io_head), io_node); 2667 2667 kfree(hold_IO_node); ··· 2687 2687 hold_mem_node->base = mem_node->base + mem_node->length; 2688 2688 2689 2689 temp_word = (hold_mem_node->base) >> 16; 2690 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word); 2690 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word); 2691 2691 2692 2692 return_resource(&(resources->mem_head), mem_node); 2693 2693 } ··· 2706 2706 2707 2707 /* configure end address */ 2708 2708 temp_word = (mem_node->base - 1) >> 16; 2709 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); 2709 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); 2710 2710 2711 2711 /* Return unused resources to the pool */ 2712 2712 return_resource(&(resources->mem_head), mem_node); 2713 2713 } else { 2714 2714 /* it doesn't need any Mem */ 2715 2715 temp_word = 0x0000; 2716 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); 2716 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word); 2717 2717 2718 2718 return_resource(&(resources->mem_head), mem_node); 2719 2719 kfree(hold_mem_node); ··· 2739 2739 hold_p_mem_node->base = p_mem_node->base + p_mem_node->length; 2740 2740 2741 2741 temp_word = (hold_p_mem_node->base) >> 16; 2742 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); 2742 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word); 2743 2743 2744 2744 return_resource(&(resources->p_mem_head), p_mem_node); 2745 2745 } ··· 2758 2758 func->p_mem_head = hold_p_mem_node; 2759 2759 2760 2760 temp_word = (p_mem_node->base - 1) >> 16; 2761 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); 2761 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); 2762 2762 2763 2763 return_resource(&(resources->p_mem_head), p_mem_node); 2764 2764 } else { 2765 2765 /* it doesn't need any PMem */ 2766 2766 temp_word = 0x0000; 2767 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); 2767 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word); 2768 2768 2769 2769 return_resource(&(resources->p_mem_head), p_mem_node); 2770 2770 kfree(hold_p_mem_node); ··· 2790 2790 * PCI_COMMAND_INVALIDATE | 2791 2791 * PCI_COMMAND_PARITY | 2792 2792 * PCI_COMMAND_SERR */ 2793 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_COMMAND, command); 2793 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command); 2794 2794 2795 2795 /* set Bridge Control Register */ 2796 2796 command = 0x07; /* = PCI_BRIDGE_CTL_PARITY | 2797 2797 * PCI_BRIDGE_CTL_SERR | 2798 2798 * PCI_BRIDGE_CTL_NO_ISA */ 2799 - rc = pci_bus_write_config_word (pci_bus, devfn, PCI_BRIDGE_CONTROL, command); 2799 + rc = pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command); 2800 2800 } else if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_NORMAL) { 2801 2801 /* Standard device */ 2802 - rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); 2802 + rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); 2803 2803 2804 2804 if (class_code == PCI_BASE_CLASS_DISPLAY) { 2805 2805 /* Display (video) adapter (not supported) */ ··· 2810 2810 temp_register = 0xFFFFFFFF; 2811 2811 2812 2812 dbg("CND: bus=%d, devfn=%d, offset=%d\n", pci_bus->number, devfn, cloop); 2813 - rc = pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); 2813 + rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); 2814 2814 2815 - rc = pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp_register); 2815 + rc = pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp_register); 2816 2816 dbg("CND: base = 0x%x\n", temp_register); 2817 2817 2818 2818 if (temp_register) { /* If this register is implemented */ ··· 2891 2891 } /* End of base register loop */ 2892 2892 if (cpqhp_legacy_mode) { 2893 2893 /* Figure out which interrupt pin this function uses */ 2894 - rc = pci_bus_read_config_byte (pci_bus, devfn, 2894 + rc = pci_bus_read_config_byte(pci_bus, devfn, 2895 2895 PCI_INTERRUPT_PIN, &temp_byte); 2896 2896 2897 2897 /* If this function needs an interrupt and we are behind ··· 2905 2905 resources->irqs->barber_pole - 1) & 0x03]; 2906 2906 } else { 2907 2907 /* Program IRQ based on card type */ 2908 - rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code); 2908 + rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code); 2909 2909 2910 2910 if (class_code == PCI_BASE_CLASS_STORAGE) 2911 2911 IRQ = cpqhp_disk_irq; ··· 2914 2914 } 2915 2915 2916 2916 /* IRQ Line */ 2917 - rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ); 2917 + rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ); 2918 2918 } 2919 2919 2920 2920 if (!behind_bridge) { ··· 2950 2950 * PCI_COMMAND_INVALIDATE | 2951 2951 * PCI_COMMAND_PARITY | 2952 2952 * PCI_COMMAND_SERR */ 2953 - rc = pci_bus_write_config_word (pci_bus, devfn, 2953 + rc = pci_bus_write_config_word(pci_bus, devfn, 2954 2954 PCI_COMMAND, temp_word); 2955 2955 } else { /* End of Not-A-Bridge else */ 2956 2956 /* It's some strange type of PCI adapter (Cardbus?) */ ··· 2961 2961 2962 2962 return 0; 2963 2963 free_and_out: 2964 - cpqhp_destroy_resource_list (&temp_resources); 2964 + cpqhp_destroy_resource_list(&temp_resources); 2965 2965 2966 - return_resource(&(resources-> bus_head), hold_bus_node); 2967 - return_resource(&(resources-> io_head), hold_IO_node); 2968 - return_resource(&(resources-> mem_head), hold_mem_node); 2969 - return_resource(&(resources-> p_mem_head), hold_p_mem_node); 2966 + return_resource(&(resources->bus_head), hold_bus_node); 2967 + return_resource(&(resources->io_head), hold_IO_node); 2968 + return_resource(&(resources->mem_head), hold_mem_node); 2969 + return_resource(&(resources->p_mem_head), hold_p_mem_node); 2970 2970 return rc; 2971 2971 }
+46 -46
drivers/pci/hotplug/cpqphp_nvram.c
··· 114 114 if ((*used + 1) > *avail) 115 115 return(1); 116 116 117 - *((u8*)*p_buffer) = value; 118 - tByte = (u8**)p_buffer; 117 + *((u8 *)*p_buffer) = value; 118 + tByte = (u8 **)p_buffer; 119 119 (*tByte)++; 120 - *used+=1; 120 + *used += 1; 121 121 return(0); 122 122 } 123 123 ··· 129 129 130 130 **p_buffer = value; 131 131 (*p_buffer)++; 132 - *used+=4; 132 + *used += 4; 133 133 return(0); 134 134 } 135 135 ··· 141 141 * 142 142 * returns 0 for non-Compaq ROM, 1 for Compaq ROM 143 143 */ 144 - static int check_for_compaq_ROM (void __iomem *rom_start) 144 + static int check_for_compaq_ROM(void __iomem *rom_start) 145 145 { 146 146 u8 temp1, temp2, temp3, temp4, temp5, temp6; 147 147 int result = 0; ··· 160 160 (temp6 == 'Q')) { 161 161 result = 1; 162 162 } 163 - dbg ("%s - returned %d\n", __func__, result); 163 + dbg("%s - returned %d\n", __func__, result); 164 164 return result; 165 165 } 166 166 167 167 168 - static u32 access_EV (u16 operation, u8 *ev_name, u8 *buffer, u32 *buf_size) 168 + static u32 access_EV(u16 operation, u8 *ev_name, u8 *buffer, u32 *buf_size) 169 169 { 170 170 unsigned long flags; 171 171 int op = operation; ··· 197 197 * 198 198 * Read the hot plug Resource Table from NVRAM 199 199 */ 200 - static int load_HRT (void __iomem *rom_start) 200 + static int load_HRT(void __iomem *rom_start) 201 201 { 202 202 u32 available; 203 203 u32 temp_dword; ··· 232 232 * 233 233 * Save the hot plug Resource Table in NVRAM 234 234 */ 235 - static u32 store_HRT (void __iomem *rom_start) 235 + static u32 store_HRT(void __iomem *rom_start) 236 236 { 237 237 u32 *buffer; 238 238 u32 *pFill; ··· 252 252 if (!check_for_compaq_ROM(rom_start)) 253 253 return(1); 254 254 255 - buffer = (u32*) evbuffer; 255 + buffer = (u32 *) evbuffer; 256 256 257 257 if (!buffer) 258 258 return(1); ··· 306 306 loop = 0; 307 307 308 308 while (resNode) { 309 - loop ++; 309 + loop++; 310 310 311 311 /* base */ 312 312 rc = add_dword(&pFill, resNode->base, &usedbytes, &available); ··· 331 331 loop = 0; 332 332 333 333 while (resNode) { 334 - loop ++; 334 + loop++; 335 335 336 336 /* base */ 337 337 rc = add_dword(&pFill, resNode->base, &usedbytes, &available); ··· 356 356 loop = 0; 357 357 358 358 while (resNode) { 359 - loop ++; 359 + loop++; 360 360 361 361 /* base */ 362 362 rc = add_dword(&pFill, resNode->base, &usedbytes, &available); ··· 381 381 loop = 0; 382 382 383 383 while (resNode) { 384 - loop ++; 384 + loop++; 385 385 386 386 /* base */ 387 387 rc = add_dword(&pFill, resNode->base, &usedbytes, &available); ··· 408 408 409 409 temp_dword = usedbytes; 410 410 411 - rc = access_EV(WRITE_EV, "CQTHPS", (u8*) buffer, &temp_dword); 411 + rc = access_EV(WRITE_EV, "CQTHPS", (u8 *) buffer, &temp_dword); 412 412 413 413 dbg("usedbytes = 0x%x, length = 0x%x\n", usedbytes, temp_dword); 414 414 ··· 423 423 } 424 424 425 425 426 - void compaq_nvram_init (void __iomem *rom_start) 426 + void compaq_nvram_init(void __iomem *rom_start) 427 427 { 428 428 if (rom_start) 429 429 compaq_int15_entry_point = (rom_start + ROM_INT15_PHY_ADDR - ROM_PHY_ADDR); ··· 435 435 } 436 436 437 437 438 - int compaq_nvram_load (void __iomem *rom_start, struct controller *ctrl) 438 + int compaq_nvram_load(void __iomem *rom_start, struct controller *ctrl) 439 439 { 440 440 u8 bus, device, function; 441 441 u8 nummem, numpmem, numio, numbus; ··· 451 451 if (!evbuffer_init) { 452 452 /* Read the resource list information in from NVRAM */ 453 453 if (load_HRT(rom_start)) 454 - memset (evbuffer, 0, 1024); 454 + memset(evbuffer, 0, 1024); 455 455 456 456 evbuffer_init = 1; 457 457 } ··· 472 472 473 473 p_byte += 3; 474 474 475 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) 475 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) 476 476 return 2; 477 477 478 478 bus = p_ev_ctrl->bus; ··· 489 489 490 490 p_byte += 4; 491 491 492 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) 492 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) 493 493 return 2; 494 494 495 495 /* Skip forward to the next entry */ 496 496 p_byte += (nummem + numpmem + numio + numbus) * 8; 497 497 498 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) 498 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) 499 499 return 2; 500 500 501 501 p_ev_ctrl = (struct ev_hrt_ctrl *) p_byte; 502 502 503 503 p_byte += 3; 504 504 505 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) 505 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) 506 506 return 2; 507 507 508 508 bus = p_ev_ctrl->bus; ··· 517 517 518 518 p_byte += 4; 519 519 520 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) 520 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) 521 521 return 2; 522 522 523 523 while (nummem--) { ··· 526 526 if (!mem_node) 527 527 break; 528 528 529 - mem_node->base = *(u32*)p_byte; 530 - dbg("mem base = %8.8x\n",mem_node->base); 529 + mem_node->base = *(u32 *)p_byte; 530 + dbg("mem base = %8.8x\n", mem_node->base); 531 531 p_byte += 4; 532 532 533 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 533 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 534 534 kfree(mem_node); 535 535 return 2; 536 536 } 537 537 538 - mem_node->length = *(u32*)p_byte; 539 - dbg("mem length = %8.8x\n",mem_node->length); 538 + mem_node->length = *(u32 *)p_byte; 539 + dbg("mem length = %8.8x\n", mem_node->length); 540 540 p_byte += 4; 541 541 542 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 542 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 543 543 kfree(mem_node); 544 544 return 2; 545 545 } ··· 554 554 if (!p_mem_node) 555 555 break; 556 556 557 - p_mem_node->base = *(u32*)p_byte; 558 - dbg("pre-mem base = %8.8x\n",p_mem_node->base); 557 + p_mem_node->base = *(u32 *)p_byte; 558 + dbg("pre-mem base = %8.8x\n", p_mem_node->base); 559 559 p_byte += 4; 560 560 561 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 561 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 562 562 kfree(p_mem_node); 563 563 return 2; 564 564 } 565 565 566 - p_mem_node->length = *(u32*)p_byte; 567 - dbg("pre-mem length = %8.8x\n",p_mem_node->length); 566 + p_mem_node->length = *(u32 *)p_byte; 567 + dbg("pre-mem length = %8.8x\n", p_mem_node->length); 568 568 p_byte += 4; 569 569 570 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 570 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 571 571 kfree(p_mem_node); 572 572 return 2; 573 573 } ··· 582 582 if (!io_node) 583 583 break; 584 584 585 - io_node->base = *(u32*)p_byte; 586 - dbg("io base = %8.8x\n",io_node->base); 585 + io_node->base = *(u32 *)p_byte; 586 + dbg("io base = %8.8x\n", io_node->base); 587 587 p_byte += 4; 588 588 589 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 589 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 590 590 kfree(io_node); 591 591 return 2; 592 592 } 593 593 594 - io_node->length = *(u32*)p_byte; 595 - dbg("io length = %8.8x\n",io_node->length); 594 + io_node->length = *(u32 *)p_byte; 595 + dbg("io length = %8.8x\n", io_node->length); 596 596 p_byte += 4; 597 597 598 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 598 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 599 599 kfree(io_node); 600 600 return 2; 601 601 } ··· 610 610 if (!bus_node) 611 611 break; 612 612 613 - bus_node->base = *(u32*)p_byte; 613 + bus_node->base = *(u32 *)p_byte; 614 614 p_byte += 4; 615 615 616 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 616 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 617 617 kfree(bus_node); 618 618 return 2; 619 619 } 620 620 621 - bus_node->length = *(u32*)p_byte; 621 + bus_node->length = *(u32 *)p_byte; 622 622 p_byte += 4; 623 623 624 - if (p_byte > ((u8*)p_EV_header + evbuffer_length)) { 624 + if (p_byte > ((u8 *)p_EV_header + evbuffer_length)) { 625 625 kfree(bus_node); 626 626 return 2; 627 627 } ··· 650 650 } 651 651 652 652 653 - int compaq_nvram_store (void __iomem *rom_start) 653 + int compaq_nvram_store(void __iomem *rom_start) 654 654 { 655 655 int rc = 1; 656 656
+42 -42
drivers/pci/hotplug/cpqphp_pci.c
··· 81 81 } 82 82 83 83 84 - int cpqhp_configure_device (struct controller *ctrl, struct pci_func *func) 84 + int cpqhp_configure_device(struct controller *ctrl, struct pci_func *func) 85 85 { 86 86 struct pci_bus *child; 87 87 int num; ··· 89 89 pci_lock_rescan_remove(); 90 90 91 91 if (func->pci_dev == NULL) 92 - func->pci_dev = pci_get_bus_and_slot(func->bus,PCI_DEVFN(func->device, func->function)); 92 + func->pci_dev = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, func->function)); 93 93 94 94 /* No pci device, we need to create it then */ 95 95 if (func->pci_dev == NULL) { ··· 128 128 dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); 129 129 130 130 pci_lock_rescan_remove(); 131 - for (j=0; j<8 ; j++) { 131 + for (j = 0; j < 8 ; j++) { 132 132 struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); 133 133 if (temp) { 134 134 pci_dev_put(temp); ··· 143 143 { 144 144 u32 vendID = 0; 145 145 146 - if (pci_bus_read_config_dword (bus, devfn, PCI_VENDOR_ID, &vendID) == -1) 146 + if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &vendID) == -1) 147 147 return -1; 148 148 if (vendID == 0xffffffff) 149 149 return -1; 150 - return pci_bus_read_config_dword (bus, devfn, offset, value); 150 + return pci_bus_read_config_dword(bus, devfn, offset, value); 151 151 } 152 152 153 153 ··· 158 158 * @dev_num: device number of PCI device 159 159 * @slot: pointer to u8 where slot number will be returned 160 160 */ 161 - int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) 161 + int cpqhp_set_irq(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num) 162 162 { 163 163 int rc = 0; 164 164 ··· 230 230 dbg("Looking for bridge bus_num %d dev_num %d\n", bus_num, tdevice); 231 231 /* Yep we got one. bridge ? */ 232 232 if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { 233 - pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(tdevice, 0), PCI_SECONDARY_BUS, &tbus); 233 + pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(tdevice, 0), PCI_SECONDARY_BUS, &tbus); 234 234 /* XXX: no recursion, wtf? */ 235 235 dbg("Recurse on bus_num %d tdevice %d\n", tbus, tdevice); 236 236 return 0; ··· 257 257 *bus_num = tbus; 258 258 *dev_num = tdevice; 259 259 ctrl->pci_bus->number = tbus; 260 - pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work); 260 + pci_bus_read_config_dword(ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work); 261 261 if (!nobridge || (work == 0xffffffff)) 262 262 return 0; 263 263 264 264 dbg("bus_num %d devfn %d\n", *bus_num, *dev_num); 265 - pci_bus_read_config_dword (ctrl->pci_bus, *dev_num, PCI_CLASS_REVISION, &work); 265 + pci_bus_read_config_dword(ctrl->pci_bus, *dev_num, PCI_CLASS_REVISION, &work); 266 266 dbg("work >> 8 (%x) = BRIDGE (%x)\n", work >> 8, PCI_TO_PCI_BRIDGE_CLASS); 267 267 268 268 if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { 269 - pci_bus_read_config_byte (ctrl->pci_bus, *dev_num, PCI_SECONDARY_BUS, &tbus); 269 + pci_bus_read_config_byte(ctrl->pci_bus, *dev_num, PCI_SECONDARY_BUS, &tbus); 270 270 dbg("Scan bus for Non Bridge: bus %d\n", tbus); 271 271 if (PCI_ScanBusForNonBridge(ctrl, tbus, dev_num) == 0) { 272 272 *bus_num = tbus; ··· 280 280 } 281 281 282 282 283 - int cpqhp_get_bus_dev (struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot) 283 + int cpqhp_get_bus_dev(struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot) 284 284 { 285 285 /* plain (bridges allowed) */ 286 286 return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); ··· 419 419 new_slot->pci_dev = pci_get_bus_and_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function); 420 420 421 421 for (cloop = 0; cloop < 0x20; cloop++) { 422 - rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) & (new_slot-> config_space [cloop])); 422 + rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) &(new_slot->config_space[cloop])); 423 423 if (rc) 424 424 return rc; 425 425 } ··· 465 465 * 466 466 * returns 0 if success 467 467 */ 468 - int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) 468 + int cpqhp_save_slot_config(struct controller *ctrl, struct pci_func *new_slot) 469 469 { 470 470 long rc; 471 471 u8 class_code; ··· 481 481 ID = 0xFFFFFFFF; 482 482 483 483 ctrl->pci_bus->number = new_slot->bus; 484 - pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID); 484 + pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID); 485 485 486 486 if (ID == 0xFFFFFFFF) 487 487 return 2; ··· 497 497 while (function < max_functions) { 498 498 if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { 499 499 /* Recurse the subordinate bus */ 500 - pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_SECONDARY_BUS, &secondary_bus); 500 + pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_SECONDARY_BUS, &secondary_bus); 501 501 502 502 sub_bus = (int) secondary_bus; 503 503 ··· 514 514 new_slot->status = 0; 515 515 516 516 for (cloop = 0; cloop < 0x20; cloop++) 517 - pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), cloop << 2, (u32 *) & (new_slot-> config_space [cloop])); 517 + pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), cloop << 2, (u32 *) &(new_slot->config_space[cloop])); 518 518 519 519 function++; 520 520 ··· 571 571 devfn = PCI_DEVFN(func->device, func->function); 572 572 573 573 /* Check for Bridge */ 574 - pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 574 + pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 575 575 576 576 if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { 577 - pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); 577 + pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); 578 578 579 579 sub_bus = (int) secondary_bus; 580 580 ··· 595 595 */ 596 596 for (cloop = 0x10; cloop <= 0x14; cloop += 4) { 597 597 temp_register = 0xFFFFFFFF; 598 - pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); 599 - pci_bus_read_config_dword (pci_bus, devfn, cloop, &base); 598 + pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); 599 + pci_bus_read_config_dword(pci_bus, devfn, cloop, &base); 600 600 /* If this register is implemented */ 601 601 if (base) { 602 602 if (base & 0x01L) { ··· 631 631 /* Figure out IO and memory base lengths */ 632 632 for (cloop = 0x10; cloop <= 0x24; cloop += 4) { 633 633 temp_register = 0xFFFFFFFF; 634 - pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); 635 - pci_bus_read_config_dword (pci_bus, devfn, cloop, &base); 634 + pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); 635 + pci_bus_read_config_dword(pci_bus, devfn, cloop, &base); 636 636 637 637 /* If this register is implemented */ 638 638 if (base) { ··· 686 686 * 687 687 * returns 0 if success 688 688 */ 689 - int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func *func) 689 + int cpqhp_save_used_resources(struct controller *ctrl, struct pci_func *func) 690 690 { 691 691 u8 cloop; 692 692 u8 header_type; ··· 791 791 } 792 792 /* Figure out IO and memory base lengths */ 793 793 for (cloop = 0x10; cloop <= 0x14; cloop += 4) { 794 - pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base); 794 + pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base); 795 795 796 796 temp_register = 0xFFFFFFFF; 797 797 pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); ··· 972 972 * registers are programmed last 973 973 */ 974 974 for (cloop = 0x3C; cloop > 0; cloop -= 4) 975 - pci_bus_write_config_dword (pci_bus, devfn, cloop, func->config_space[cloop >> 2]); 975 + pci_bus_write_config_dword(pci_bus, devfn, cloop, func->config_space[cloop >> 2]); 976 976 977 - pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 977 + pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 978 978 979 979 /* If this is a bridge device, restore subordinate devices */ 980 980 if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { 981 - pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); 981 + pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus); 982 982 983 983 sub_bus = (int) secondary_bus; 984 984 ··· 998 998 */ 999 999 1000 1000 for (cloop = 16; cloop < 40; cloop += 4) { 1001 - pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp); 1001 + pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp); 1002 1002 1003 1003 if (temp != func->config_space[cloop >> 2]) { 1004 1004 dbg("Config space compare failure!!! offset = %x\n", cloop); ··· 1050 1050 pci_bus->number = func->bus; 1051 1051 devfn = PCI_DEVFN(func->device, func->function); 1052 1052 1053 - pci_bus_read_config_dword (pci_bus, devfn, PCI_VENDOR_ID, &temp_register); 1053 + pci_bus_read_config_dword(pci_bus, devfn, PCI_VENDOR_ID, &temp_register); 1054 1054 1055 1055 /* No adapter present */ 1056 1056 if (temp_register == 0xFFFFFFFF) ··· 1060 1060 return(ADAPTER_NOT_SAME); 1061 1061 1062 1062 /* Check for same revision number and class code */ 1063 - pci_bus_read_config_dword (pci_bus, devfn, PCI_CLASS_REVISION, &temp_register); 1063 + pci_bus_read_config_dword(pci_bus, devfn, PCI_CLASS_REVISION, &temp_register); 1064 1064 1065 1065 /* Adapter not the same */ 1066 1066 if (temp_register != func->config_space[0x08 >> 2]) 1067 1067 return(ADAPTER_NOT_SAME); 1068 1068 1069 1069 /* Check for Bridge */ 1070 - pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 1070 + pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type); 1071 1071 1072 1072 if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { 1073 1073 /* In order to continue checking, we must program the ··· 1076 1076 */ 1077 1077 1078 1078 temp_register = func->config_space[0x18 >> 2]; 1079 - pci_bus_write_config_dword (pci_bus, devfn, PCI_PRIMARY_BUS, temp_register); 1079 + pci_bus_write_config_dword(pci_bus, devfn, PCI_PRIMARY_BUS, temp_register); 1080 1080 1081 1081 secondary_bus = (temp_register >> 8) & 0xFF; 1082 1082 ··· 1094 1094 /* Check to see if it is a standard config header */ 1095 1095 else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) { 1096 1096 /* Check subsystem vendor and ID */ 1097 - pci_bus_read_config_dword (pci_bus, devfn, PCI_SUBSYSTEM_VENDOR_ID, &temp_register); 1097 + pci_bus_read_config_dword(pci_bus, devfn, PCI_SUBSYSTEM_VENDOR_ID, &temp_register); 1098 1098 1099 1099 if (temp_register != func->config_space[0x2C >> 2]) { 1100 1100 /* If it's a SMART-2 and the register isn't ··· 1108 1108 /* Figure out IO and memory base lengths */ 1109 1109 for (cloop = 0x10; cloop <= 0x24; cloop += 4) { 1110 1110 temp_register = 0xFFFFFFFF; 1111 - pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register); 1112 - pci_bus_read_config_dword (pci_bus, devfn, cloop, &base); 1111 + pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register); 1112 + pci_bus_read_config_dword(pci_bus, devfn, cloop, &base); 1113 1113 1114 1114 /* If this register is implemented */ 1115 1115 if (base) { ··· 1234 1234 if (rc) 1235 1235 return rc; 1236 1236 1237 - one_slot = rom_resource_table + sizeof (struct hrt); 1237 + one_slot = rom_resource_table + sizeof(struct hrt); 1238 1238 1239 1239 i = readb(rom_resource_table + NUMBER_OF_ENTRIES); 1240 1240 dbg("number_of_entries = %d\n", i); ··· 1263 1263 /* If this entry isn't for our controller's bus, ignore it */ 1264 1264 if (primary_bus != ctrl->bus) { 1265 1265 i--; 1266 - one_slot += sizeof (struct slot_rt); 1266 + one_slot += sizeof(struct slot_rt); 1267 1267 continue; 1268 1268 } 1269 1269 /* find out if this entry is for an occupied slot */ 1270 1270 ctrl->pci_bus->number = primary_bus; 1271 - pci_bus_read_config_dword (ctrl->pci_bus, dev_func, PCI_VENDOR_ID, &temp_dword); 1271 + pci_bus_read_config_dword(ctrl->pci_bus, dev_func, PCI_VENDOR_ID, &temp_dword); 1272 1272 dbg("temp_D_word = %x\n", temp_dword); 1273 1273 1274 1274 if (temp_dword != 0xFFFFFFFF) { ··· 1283 1283 /* If we can't find a match, skip this table entry */ 1284 1284 if (!func) { 1285 1285 i--; 1286 - one_slot += sizeof (struct slot_rt); 1286 + one_slot += sizeof(struct slot_rt); 1287 1287 continue; 1288 1288 } 1289 1289 /* this may not work and shouldn't be used */ ··· 1395 1395 } 1396 1396 1397 1397 i--; 1398 - one_slot += sizeof (struct slot_rt); 1398 + one_slot += sizeof(struct slot_rt); 1399 1399 } 1400 1400 1401 1401 /* If all of the following fail, we don't have any resources for ··· 1475 1475 * 1476 1476 * Puts node back in the resource list pointed to by head 1477 1477 */ 1478 - void cpqhp_destroy_resource_list (struct resource_lists *resources) 1478 + void cpqhp_destroy_resource_list(struct resource_lists *resources) 1479 1479 { 1480 1480 struct pci_resource *res, *tres; 1481 1481 ··· 1522 1522 * 1523 1523 * Puts node back in the resource list pointed to by head 1524 1524 */ 1525 - void cpqhp_destroy_board_resources (struct pci_func *func) 1525 + void cpqhp_destroy_board_resources(struct pci_func *func) 1526 1526 { 1527 1527 struct pci_resource *res, *tres; 1528 1528
+3 -3
drivers/pci/hotplug/cpqphp_sysfs.c
··· 39 39 #include "cpqphp.h" 40 40 41 41 static DEFINE_MUTEX(cpqphp_mutex); 42 - static int show_ctrl (struct controller *ctrl, char *buf) 42 + static int show_ctrl(struct controller *ctrl, char *buf) 43 43 { 44 44 char *out = buf; 45 45 int index; ··· 77 77 return out - buf; 78 78 } 79 79 80 - static int show_dev (struct controller *ctrl, char *buf) 80 + static int show_dev(struct controller *ctrl, char *buf) 81 81 { 82 82 char *out = buf; 83 83 int index; ··· 119 119 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 120 120 res = res->next; 121 121 } 122 - slot=slot->next; 122 + slot = slot->next; 123 123 } 124 124 125 125 return out - buf;
+6 -6
drivers/pci/hotplug/ibmphp.h
··· 39 39 #else 40 40 #define MY_NAME THIS_MODULE->name 41 41 #endif 42 - #define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) 43 - #define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) 44 - #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) 45 - #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) 46 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) 42 + #define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt, MY_NAME, ## arg); } while (0) 43 + #define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt, MY_NAME, ## arg); } while (0) 44 + #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 45 + #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 46 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 47 47 48 48 49 49 /* EBDA stuff */ ··· 603 603 #define SLOT_CONNECT(s) ((u8) ((s & HPC_SLOT_CONNECT) \ 604 604 ? HPC_SLOT_DISCONNECTED : HPC_SLOT_CONNECTED)) 605 605 606 - #define SLOT_ATTN(s,es) ((u8) ((es & HPC_SLOT_BLINK_ATTN) \ 606 + #define SLOT_ATTN(s, es) ((u8) ((es & HPC_SLOT_BLINK_ATTN) \ 607 607 ? HPC_SLOT_ATTN_BLINK \ 608 608 : ((s & HPC_SLOT_ATTN) ? HPC_SLOT_ATTN_ON : HPC_SLOT_ATTN_OFF))) 609 609
+15 -15
drivers/pci/hotplug/ibmphp_core.c
··· 39 39 #include <asm/io_apic.h> 40 40 #include "ibmphp.h" 41 41 42 - #define attn_on(sl) ibmphp_hpc_writeslot (sl, HPC_SLOT_ATTNON) 43 - #define attn_off(sl) ibmphp_hpc_writeslot (sl, HPC_SLOT_ATTNOFF) 44 - #define attn_LED_blink(sl) ibmphp_hpc_writeslot (sl, HPC_SLOT_BLINKLED) 45 - #define get_ctrl_revision(sl, rev) ibmphp_hpc_readslot (sl, READ_REVLEVEL, rev) 46 - #define get_hpc_options(sl, opt) ibmphp_hpc_readslot (sl, READ_HPCOPTIONS, opt) 42 + #define attn_on(sl) ibmphp_hpc_writeslot(sl, HPC_SLOT_ATTNON) 43 + #define attn_off(sl) ibmphp_hpc_writeslot(sl, HPC_SLOT_ATTNOFF) 44 + #define attn_LED_blink(sl) ibmphp_hpc_writeslot(sl, HPC_SLOT_BLINKLED) 45 + #define get_ctrl_revision(sl, rev) ibmphp_hpc_readslot(sl, READ_REVLEVEL, rev) 46 + #define get_hpc_options(sl, opt) ibmphp_hpc_readslot(sl, READ_HPCOPTIONS, opt) 47 47 48 48 #define DRIVER_VERSION "0.6" 49 49 #define DRIVER_DESC "IBM Hot Plug PCI Controller Driver" ··· 52 52 53 53 static bool debug; 54 54 module_param(debug, bool, S_IRUGO | S_IWUSR); 55 - MODULE_PARM_DESC (debug, "Debugging mode enabled or not"); 56 - MODULE_LICENSE ("GPL"); 57 - MODULE_DESCRIPTION (DRIVER_DESC); 55 + MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); 56 + MODULE_LICENSE("GPL"); 57 + MODULE_DESCRIPTION(DRIVER_DESC); 58 58 59 59 struct pci_bus *ibmphp_pci_bus; 60 60 static int max_slots; ··· 113 113 return rc; 114 114 } 115 115 116 - static int __init get_max_slots (void) 116 + static int __init get_max_slots(void) 117 117 { 118 118 struct slot *slot_cur; 119 119 struct list_head *tmp; ··· 459 459 *value = SLOT_SPEED(myslot.ext_status); 460 460 } else 461 461 *value = MAX_ADAPTER_NONE; 462 - } 462 + } 463 463 } 464 464 465 465 if (flag) ··· 620 620 info->attention_status = SLOT_ATTN(slot_cur->status, 621 621 slot_cur->ext_status); 622 622 info->latch_status = SLOT_LATCH(slot_cur->status); 623 - if (!SLOT_PRESENT(slot_cur->status)) { 624 - info->adapter_status = 0; 623 + if (!SLOT_PRESENT(slot_cur->status)) { 624 + info->adapter_status = 0; 625 625 /* info->max_adapter_speed_status = MAX_ADAPTER_NONE; */ 626 626 } else { 627 - info->adapter_status = 1; 627 + info->adapter_status = 1; 628 628 /* get_max_adapter_speed_1(slot_cur->hotplug_slot, 629 629 &info->max_adapter_speed_status, 0); */ 630 630 } ··· 866 866 int retval; 867 867 static struct pci_device_id ciobx[] = { 868 868 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, 0x0101) }, 869 - { }, 869 + { }, 870 870 }; 871 871 872 872 debug("%s - entry slot # %d\n", __func__, slot_cur->number); ··· 1182 1182 * HOT REMOVING ADAPTER CARD * 1183 1183 * INPUT: POINTER TO THE HOTPLUG SLOT STRUCTURE * 1184 1184 * OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE * 1185 - DISABLE POWER , * 1185 + * DISABLE POWER , * 1186 1186 **************************************************************/ 1187 1187 static int ibmphp_disable_slot(struct hotplug_slot *hotplug_slot) 1188 1188 {
+261 -261
drivers/pci/hotplug/ibmphp_ebda.c
··· 49 49 */ 50 50 51 51 /* Global lists */ 52 - LIST_HEAD (ibmphp_ebda_pci_rsrc_head); 53 - LIST_HEAD (ibmphp_slot_head); 52 + LIST_HEAD(ibmphp_ebda_pci_rsrc_head); 53 + LIST_HEAD(ibmphp_slot_head); 54 54 55 55 /* Local variables */ 56 56 static struct ebda_hpc_list *hpc_list_ptr; 57 57 static struct ebda_rsrc_list *rsrc_list_ptr; 58 58 static struct rio_table_hdr *rio_table_ptr = NULL; 59 - static LIST_HEAD (ebda_hpc_head); 60 - static LIST_HEAD (bus_info_head); 61 - static LIST_HEAD (rio_vg_head); 62 - static LIST_HEAD (rio_lo_head); 63 - static LIST_HEAD (opt_vg_head); 64 - static LIST_HEAD (opt_lo_head); 59 + static LIST_HEAD(ebda_hpc_head); 60 + static LIST_HEAD(bus_info_head); 61 + static LIST_HEAD(rio_vg_head); 62 + static LIST_HEAD(rio_lo_head); 63 + static LIST_HEAD(opt_vg_head); 64 + static LIST_HEAD(opt_lo_head); 65 65 static void __iomem *io_mem; 66 66 67 67 /* Local functions */ 68 - static int ebda_rsrc_controller (void); 69 - static int ebda_rsrc_rsrc (void); 70 - static int ebda_rio_table (void); 68 + static int ebda_rsrc_controller(void); 69 + static int ebda_rsrc_rsrc(void); 70 + static int ebda_rio_table(void); 71 71 72 - static struct ebda_hpc_list * __init alloc_ebda_hpc_list (void) 72 + static struct ebda_hpc_list * __init alloc_ebda_hpc_list(void) 73 73 { 74 74 return kzalloc(sizeof(struct ebda_hpc_list), GFP_KERNEL); 75 75 } 76 76 77 - static struct controller *alloc_ebda_hpc (u32 slot_count, u32 bus_count) 77 + static struct controller *alloc_ebda_hpc(u32 slot_count, u32 bus_count) 78 78 { 79 79 struct controller *controller; 80 80 struct ebda_hpc_slot *slots; ··· 103 103 return NULL; 104 104 } 105 105 106 - static void free_ebda_hpc (struct controller *controller) 106 + static void free_ebda_hpc(struct controller *controller) 107 107 { 108 - kfree (controller->slots); 109 - kfree (controller->buses); 110 - kfree (controller); 108 + kfree(controller->slots); 109 + kfree(controller->buses); 110 + kfree(controller); 111 111 } 112 112 113 - static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list (void) 113 + static struct ebda_rsrc_list * __init alloc_ebda_rsrc_list(void) 114 114 { 115 115 return kzalloc(sizeof(struct ebda_rsrc_list), GFP_KERNEL); 116 116 } 117 117 118 - static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc (void) 118 + static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc(void) 119 119 { 120 120 return kzalloc(sizeof(struct ebda_pci_rsrc), GFP_KERNEL); 121 121 } 122 122 123 - static void __init print_bus_info (void) 123 + static void __init print_bus_info(void) 124 124 { 125 125 struct bus_info *ptr; 126 126 127 127 list_for_each_entry(ptr, &bus_info_head, bus_info_list) { 128 - debug ("%s - slot_min = %x\n", __func__, ptr->slot_min); 129 - debug ("%s - slot_max = %x\n", __func__, ptr->slot_max); 130 - debug ("%s - slot_count = %x\n", __func__, ptr->slot_count); 131 - debug ("%s - bus# = %x\n", __func__, ptr->busno); 132 - debug ("%s - current_speed = %x\n", __func__, ptr->current_speed); 133 - debug ("%s - controller_id = %x\n", __func__, ptr->controller_id); 128 + debug("%s - slot_min = %x\n", __func__, ptr->slot_min); 129 + debug("%s - slot_max = %x\n", __func__, ptr->slot_max); 130 + debug("%s - slot_count = %x\n", __func__, ptr->slot_count); 131 + debug("%s - bus# = %x\n", __func__, ptr->busno); 132 + debug("%s - current_speed = %x\n", __func__, ptr->current_speed); 133 + debug("%s - controller_id = %x\n", __func__, ptr->controller_id); 134 134 135 - debug ("%s - slots_at_33_conv = %x\n", __func__, ptr->slots_at_33_conv); 136 - debug ("%s - slots_at_66_conv = %x\n", __func__, ptr->slots_at_66_conv); 137 - debug ("%s - slots_at_66_pcix = %x\n", __func__, ptr->slots_at_66_pcix); 138 - debug ("%s - slots_at_100_pcix = %x\n", __func__, ptr->slots_at_100_pcix); 139 - debug ("%s - slots_at_133_pcix = %x\n", __func__, ptr->slots_at_133_pcix); 135 + debug("%s - slots_at_33_conv = %x\n", __func__, ptr->slots_at_33_conv); 136 + debug("%s - slots_at_66_conv = %x\n", __func__, ptr->slots_at_66_conv); 137 + debug("%s - slots_at_66_pcix = %x\n", __func__, ptr->slots_at_66_pcix); 138 + debug("%s - slots_at_100_pcix = %x\n", __func__, ptr->slots_at_100_pcix); 139 + debug("%s - slots_at_133_pcix = %x\n", __func__, ptr->slots_at_133_pcix); 140 140 141 141 } 142 142 } 143 143 144 - static void print_lo_info (void) 144 + static void print_lo_info(void) 145 145 { 146 146 struct rio_detail *ptr; 147 - debug ("print_lo_info ----\n"); 147 + debug("print_lo_info ----\n"); 148 148 list_for_each_entry(ptr, &rio_lo_head, rio_detail_list) { 149 - debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); 150 - debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); 151 - debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); 152 - debug ("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); 153 - debug ("%s - wpindex = %x\n", __func__, ptr->wpindex); 154 - debug ("%s - chassis_num = %x\n", __func__, ptr->chassis_num); 149 + debug("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); 150 + debug("%s - rio_type = %x\n", __func__, ptr->rio_type); 151 + debug("%s - owner_id = %x\n", __func__, ptr->owner_id); 152 + debug("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); 153 + debug("%s - wpindex = %x\n", __func__, ptr->wpindex); 154 + debug("%s - chassis_num = %x\n", __func__, ptr->chassis_num); 155 155 156 156 } 157 157 } 158 158 159 - static void print_vg_info (void) 159 + static void print_vg_info(void) 160 160 { 161 161 struct rio_detail *ptr; 162 - debug ("%s ---\n", __func__); 162 + debug("%s ---\n", __func__); 163 163 list_for_each_entry(ptr, &rio_vg_head, rio_detail_list) { 164 - debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); 165 - debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); 166 - debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); 167 - debug ("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); 168 - debug ("%s - wpindex = %x\n", __func__, ptr->wpindex); 169 - debug ("%s - chassis_num = %x\n", __func__, ptr->chassis_num); 164 + debug("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); 165 + debug("%s - rio_type = %x\n", __func__, ptr->rio_type); 166 + debug("%s - owner_id = %x\n", __func__, ptr->owner_id); 167 + debug("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); 168 + debug("%s - wpindex = %x\n", __func__, ptr->wpindex); 169 + debug("%s - chassis_num = %x\n", __func__, ptr->chassis_num); 170 170 171 171 } 172 172 } 173 173 174 - static void __init print_ebda_pci_rsrc (void) 174 + static void __init print_ebda_pci_rsrc(void) 175 175 { 176 176 struct ebda_pci_rsrc *ptr; 177 177 178 178 list_for_each_entry(ptr, &ibmphp_ebda_pci_rsrc_head, ebda_pci_rsrc_list) { 179 - debug ("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", 180 - __func__, ptr->rsrc_type ,ptr->bus_num, ptr->dev_fun,ptr->start_addr, ptr->end_addr); 179 + debug("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", 180 + __func__, ptr->rsrc_type, ptr->bus_num, ptr->dev_fun, ptr->start_addr, ptr->end_addr); 181 181 } 182 182 } 183 183 184 - static void __init print_ibm_slot (void) 184 + static void __init print_ibm_slot(void) 185 185 { 186 186 struct slot *ptr; 187 187 188 188 list_for_each_entry(ptr, &ibmphp_slot_head, ibm_slot_list) { 189 - debug ("%s - slot_number: %x\n", __func__, ptr->number); 189 + debug("%s - slot_number: %x\n", __func__, ptr->number); 190 190 } 191 191 } 192 192 193 - static void __init print_opt_vg (void) 193 + static void __init print_opt_vg(void) 194 194 { 195 195 struct opt_rio *ptr; 196 - debug ("%s ---\n", __func__); 196 + debug("%s ---\n", __func__); 197 197 list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { 198 - debug ("%s - rio_type %x\n", __func__, ptr->rio_type); 199 - debug ("%s - chassis_num: %x\n", __func__, ptr->chassis_num); 200 - debug ("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); 201 - debug ("%s - middle_num: %x\n", __func__, ptr->middle_num); 198 + debug("%s - rio_type %x\n", __func__, ptr->rio_type); 199 + debug("%s - chassis_num: %x\n", __func__, ptr->chassis_num); 200 + debug("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); 201 + debug("%s - middle_num: %x\n", __func__, ptr->middle_num); 202 202 } 203 203 } 204 204 205 - static void __init print_ebda_hpc (void) 205 + static void __init print_ebda_hpc(void) 206 206 { 207 207 struct controller *hpc_ptr; 208 208 u16 index; 209 209 210 210 list_for_each_entry(hpc_ptr, &ebda_hpc_head, ebda_hpc_list) { 211 211 for (index = 0; index < hpc_ptr->slot_count; index++) { 212 - debug ("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); 213 - debug ("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); 214 - debug ("%s - index into ctlr addr: %x\n", __func__, hpc_ptr->slots[index].ctl_index); 215 - debug ("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); 212 + debug("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); 213 + debug("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); 214 + debug("%s - index into ctlr addr: %x\n", __func__, hpc_ptr->slots[index].ctl_index); 215 + debug("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); 216 216 } 217 217 218 218 for (index = 0; index < hpc_ptr->bus_count; index++) 219 - debug ("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num); 219 + debug("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_num); 220 220 221 - debug ("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); 221 + debug("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); 222 222 switch (hpc_ptr->ctlr_type) { 223 223 case 1: 224 - debug ("%s - bus: %x\n", __func__, hpc_ptr->u.pci_ctlr.bus); 225 - debug ("%s - dev_fun: %x\n", __func__, hpc_ptr->u.pci_ctlr.dev_fun); 226 - debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); 224 + debug("%s - bus: %x\n", __func__, hpc_ptr->u.pci_ctlr.bus); 225 + debug("%s - dev_fun: %x\n", __func__, hpc_ptr->u.pci_ctlr.dev_fun); 226 + debug("%s - irq: %x\n", __func__, hpc_ptr->irq); 227 227 break; 228 228 229 229 case 0: 230 - debug ("%s - io_start: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_start); 231 - debug ("%s - io_end: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_end); 232 - debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); 230 + debug("%s - io_start: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_start); 231 + debug("%s - io_end: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_end); 232 + debug("%s - irq: %x\n", __func__, hpc_ptr->irq); 233 233 break; 234 234 235 235 case 2: 236 236 case 4: 237 - debug ("%s - wpegbbar: %lx\n", __func__, hpc_ptr->u.wpeg_ctlr.wpegbbar); 238 - debug ("%s - i2c_addr: %x\n", __func__, hpc_ptr->u.wpeg_ctlr.i2c_addr); 239 - debug ("%s - irq: %x\n", __func__, hpc_ptr->irq); 237 + debug("%s - wpegbbar: %lx\n", __func__, hpc_ptr->u.wpeg_ctlr.wpegbbar); 238 + debug("%s - i2c_addr: %x\n", __func__, hpc_ptr->u.wpeg_ctlr.i2c_addr); 239 + debug("%s - irq: %x\n", __func__, hpc_ptr->irq); 240 240 break; 241 241 } 242 242 } 243 243 } 244 244 245 - int __init ibmphp_access_ebda (void) 245 + int __init ibmphp_access_ebda(void) 246 246 { 247 247 u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz; 248 248 u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base; ··· 252 252 rio_complete = 0; 253 253 hs_complete = 0; 254 254 255 - io_mem = ioremap ((0x40 << 4) + 0x0e, 2); 256 - if (!io_mem ) 255 + io_mem = ioremap((0x40 << 4) + 0x0e, 2); 256 + if (!io_mem) 257 257 return -ENOMEM; 258 - ebda_seg = readw (io_mem); 259 - iounmap (io_mem); 260 - debug ("returned ebda segment: %x\n", ebda_seg); 258 + ebda_seg = readw(io_mem); 259 + iounmap(io_mem); 260 + debug("returned ebda segment: %x\n", ebda_seg); 261 261 262 262 io_mem = ioremap(ebda_seg<<4, 1); 263 263 if (!io_mem) ··· 269 269 return -ENOMEM; 270 270 271 271 io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024)); 272 - if (!io_mem ) 272 + if (!io_mem) 273 273 return -ENOMEM; 274 274 next_offset = 0x180; 275 275 ··· 281 281 "ibmphp_ebda: next read is beyond ebda_sz\n")) 282 282 break; 283 283 284 - next_offset = readw (io_mem + offset); /* offset of next blk */ 284 + next_offset = readw(io_mem + offset); /* offset of next blk */ 285 285 286 286 offset += 2; 287 287 if (next_offset == 0) /* 0 indicate it's last blk */ 288 288 break; 289 - blk_id = readw (io_mem + offset); /* this blk id */ 289 + blk_id = readw(io_mem + offset); /* this blk id */ 290 290 291 291 offset += 2; 292 292 /* check if it is hot swap block or rio block */ ··· 294 294 continue; 295 295 /* found hs table */ 296 296 if (blk_id == 0x4853) { 297 - debug ("now enter hot swap block---\n"); 298 - debug ("hot blk id: %x\n", blk_id); 299 - format = readb (io_mem + offset); 297 + debug("now enter hot swap block---\n"); 298 + debug("hot blk id: %x\n", blk_id); 299 + format = readb(io_mem + offset); 300 300 301 301 offset += 1; 302 302 if (format != 4) 303 303 goto error_nodev; 304 - debug ("hot blk format: %x\n", format); 304 + debug("hot blk format: %x\n", format); 305 305 /* hot swap sub blk */ 306 306 base = offset; 307 307 308 308 sub_addr = base; 309 - re = readw (io_mem + sub_addr); /* next sub blk */ 309 + re = readw(io_mem + sub_addr); /* next sub blk */ 310 310 311 311 sub_addr += 2; 312 - rc_id = readw (io_mem + sub_addr); /* sub blk id */ 312 + rc_id = readw(io_mem + sub_addr); /* sub blk id */ 313 313 314 314 sub_addr += 2; 315 315 if (rc_id != 0x5243) 316 316 goto error_nodev; 317 317 /* rc sub blk signature */ 318 - num_ctlrs = readb (io_mem + sub_addr); 318 + num_ctlrs = readb(io_mem + sub_addr); 319 319 320 320 sub_addr += 1; 321 - hpc_list_ptr = alloc_ebda_hpc_list (); 321 + hpc_list_ptr = alloc_ebda_hpc_list(); 322 322 if (!hpc_list_ptr) { 323 323 rc = -ENOMEM; 324 324 goto out; ··· 326 326 hpc_list_ptr->format = format; 327 327 hpc_list_ptr->num_ctlrs = num_ctlrs; 328 328 hpc_list_ptr->phys_addr = sub_addr; /* offset of RSRC_CONTROLLER blk */ 329 - debug ("info about hpc descriptor---\n"); 330 - debug ("hot blk format: %x\n", format); 331 - debug ("num of controller: %x\n", num_ctlrs); 332 - debug ("offset of hpc data structure entries: %x\n ", sub_addr); 329 + debug("info about hpc descriptor---\n"); 330 + debug("hot blk format: %x\n", format); 331 + debug("num of controller: %x\n", num_ctlrs); 332 + debug("offset of hpc data structure entries: %x\n ", sub_addr); 333 333 334 334 sub_addr = base + re; /* re sub blk */ 335 335 /* FIXME: rc is never used/checked */ 336 - rc = readw (io_mem + sub_addr); /* next sub blk */ 336 + rc = readw(io_mem + sub_addr); /* next sub blk */ 337 337 338 338 sub_addr += 2; 339 - re_id = readw (io_mem + sub_addr); /* sub blk id */ 339 + re_id = readw(io_mem + sub_addr); /* sub blk id */ 340 340 341 341 sub_addr += 2; 342 342 if (re_id != 0x5245) 343 343 goto error_nodev; 344 344 345 345 /* signature of re */ 346 - num_entries = readw (io_mem + sub_addr); 346 + num_entries = readw(io_mem + sub_addr); 347 347 348 348 sub_addr += 2; /* offset of RSRC_ENTRIES blk */ 349 - rsrc_list_ptr = alloc_ebda_rsrc_list (); 350 - if (!rsrc_list_ptr ) { 349 + rsrc_list_ptr = alloc_ebda_rsrc_list(); 350 + if (!rsrc_list_ptr) { 351 351 rc = -ENOMEM; 352 352 goto out; 353 353 } ··· 355 355 rsrc_list_ptr->num_entries = num_entries; 356 356 rsrc_list_ptr->phys_addr = sub_addr; 357 357 358 - debug ("info about rsrc descriptor---\n"); 359 - debug ("format: %x\n", format); 360 - debug ("num of rsrc: %x\n", num_entries); 361 - debug ("offset of rsrc data structure entries: %x\n ", sub_addr); 358 + debug("info about rsrc descriptor---\n"); 359 + debug("format: %x\n", format); 360 + debug("num of rsrc: %x\n", num_entries); 361 + debug("offset of rsrc data structure entries: %x\n ", sub_addr); 362 362 363 363 hs_complete = 1; 364 364 } else { 365 365 /* found rio table, blk_id == 0x4752 */ 366 - debug ("now enter io table ---\n"); 367 - debug ("rio blk id: %x\n", blk_id); 366 + debug("now enter io table ---\n"); 367 + debug("rio blk id: %x\n", blk_id); 368 368 369 369 rio_table_ptr = kzalloc(sizeof(struct rio_table_hdr), GFP_KERNEL); 370 370 if (!rio_table_ptr) { 371 371 rc = -ENOMEM; 372 372 goto out; 373 373 } 374 - rio_table_ptr->ver_num = readb (io_mem + offset); 375 - rio_table_ptr->scal_count = readb (io_mem + offset + 1); 376 - rio_table_ptr->riodev_count = readb (io_mem + offset + 2); 377 - rio_table_ptr->offset = offset +3 ; 374 + rio_table_ptr->ver_num = readb(io_mem + offset); 375 + rio_table_ptr->scal_count = readb(io_mem + offset + 1); 376 + rio_table_ptr->riodev_count = readb(io_mem + offset + 2); 377 + rio_table_ptr->offset = offset + 3 ; 378 378 379 379 debug("info about rio table hdr ---\n"); 380 380 debug("ver_num: %x\nscal_count: %x\nriodev_count: %x\noffset of rio table: %x\n ", ··· 390 390 391 391 if (rio_table_ptr) { 392 392 if (rio_complete && rio_table_ptr->ver_num == 3) { 393 - rc = ebda_rio_table (); 393 + rc = ebda_rio_table(); 394 394 if (rc) 395 395 goto out; 396 396 } 397 397 } 398 - rc = ebda_rsrc_controller (); 398 + rc = ebda_rsrc_controller(); 399 399 if (rc) 400 400 goto out; 401 401 402 - rc = ebda_rsrc_rsrc (); 402 + rc = ebda_rsrc_rsrc(); 403 403 goto out; 404 404 error_nodev: 405 405 rc = -ENODEV; 406 406 out: 407 - iounmap (io_mem); 407 + iounmap(io_mem); 408 408 return rc; 409 409 } 410 410 411 411 /* 412 412 * map info of scalability details and rio details from physical address 413 413 */ 414 - static int __init ebda_rio_table (void) 414 + static int __init ebda_rio_table(void) 415 415 { 416 416 u16 offset; 417 417 u8 i; ··· 425 425 rio_detail_ptr = kzalloc(sizeof(struct rio_detail), GFP_KERNEL); 426 426 if (!rio_detail_ptr) 427 427 return -ENOMEM; 428 - rio_detail_ptr->rio_node_id = readb (io_mem + offset); 429 - rio_detail_ptr->bbar = readl (io_mem + offset + 1); 430 - rio_detail_ptr->rio_type = readb (io_mem + offset + 5); 431 - rio_detail_ptr->owner_id = readb (io_mem + offset + 6); 432 - rio_detail_ptr->port0_node_connect = readb (io_mem + offset + 7); 433 - rio_detail_ptr->port0_port_connect = readb (io_mem + offset + 8); 434 - rio_detail_ptr->port1_node_connect = readb (io_mem + offset + 9); 435 - rio_detail_ptr->port1_port_connect = readb (io_mem + offset + 10); 436 - rio_detail_ptr->first_slot_num = readb (io_mem + offset + 11); 437 - rio_detail_ptr->status = readb (io_mem + offset + 12); 438 - rio_detail_ptr->wpindex = readb (io_mem + offset + 13); 439 - rio_detail_ptr->chassis_num = readb (io_mem + offset + 14); 440 - // debug ("rio_node_id: %x\nbbar: %x\nrio_type: %x\nowner_id: %x\nport0_node: %x\nport0_port: %x\nport1_node: %x\nport1_port: %x\nfirst_slot_num: %x\nstatus: %x\n", rio_detail_ptr->rio_node_id, rio_detail_ptr->bbar, rio_detail_ptr->rio_type, rio_detail_ptr->owner_id, rio_detail_ptr->port0_node_connect, rio_detail_ptr->port0_port_connect, rio_detail_ptr->port1_node_connect, rio_detail_ptr->port1_port_connect, rio_detail_ptr->first_slot_num, rio_detail_ptr->status); 428 + rio_detail_ptr->rio_node_id = readb(io_mem + offset); 429 + rio_detail_ptr->bbar = readl(io_mem + offset + 1); 430 + rio_detail_ptr->rio_type = readb(io_mem + offset + 5); 431 + rio_detail_ptr->owner_id = readb(io_mem + offset + 6); 432 + rio_detail_ptr->port0_node_connect = readb(io_mem + offset + 7); 433 + rio_detail_ptr->port0_port_connect = readb(io_mem + offset + 8); 434 + rio_detail_ptr->port1_node_connect = readb(io_mem + offset + 9); 435 + rio_detail_ptr->port1_port_connect = readb(io_mem + offset + 10); 436 + rio_detail_ptr->first_slot_num = readb(io_mem + offset + 11); 437 + rio_detail_ptr->status = readb(io_mem + offset + 12); 438 + rio_detail_ptr->wpindex = readb(io_mem + offset + 13); 439 + rio_detail_ptr->chassis_num = readb(io_mem + offset + 14); 440 + // debug("rio_node_id: %x\nbbar: %x\nrio_type: %x\nowner_id: %x\nport0_node: %x\nport0_port: %x\nport1_node: %x\nport1_port: %x\nfirst_slot_num: %x\nstatus: %x\n", rio_detail_ptr->rio_node_id, rio_detail_ptr->bbar, rio_detail_ptr->rio_type, rio_detail_ptr->owner_id, rio_detail_ptr->port0_node_connect, rio_detail_ptr->port0_port_connect, rio_detail_ptr->port1_node_connect, rio_detail_ptr->port1_port_connect, rio_detail_ptr->first_slot_num, rio_detail_ptr->status); 441 441 //create linked list of chassis 442 442 if (rio_detail_ptr->rio_type == 4 || rio_detail_ptr->rio_type == 5) 443 - list_add (&rio_detail_ptr->rio_detail_list, &rio_vg_head); 443 + list_add(&rio_detail_ptr->rio_detail_list, &rio_vg_head); 444 444 //create linked list of expansion box 445 445 else if (rio_detail_ptr->rio_type == 6 || rio_detail_ptr->rio_type == 7) 446 - list_add (&rio_detail_ptr->rio_detail_list, &rio_lo_head); 446 + list_add(&rio_detail_ptr->rio_detail_list, &rio_lo_head); 447 447 else 448 448 // not in my concern 449 - kfree (rio_detail_ptr); 449 + kfree(rio_detail_ptr); 450 450 offset += 15; 451 451 } 452 - print_lo_info (); 453 - print_vg_info (); 452 + print_lo_info(); 453 + print_vg_info(); 454 454 return 0; 455 455 } 456 456 457 457 /* 458 458 * reorganizing linked list of chassis 459 459 */ 460 - static struct opt_rio *search_opt_vg (u8 chassis_num) 460 + static struct opt_rio *search_opt_vg(u8 chassis_num) 461 461 { 462 462 struct opt_rio *ptr; 463 463 list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { ··· 467 467 return NULL; 468 468 } 469 469 470 - static int __init combine_wpg_for_chassis (void) 470 + static int __init combine_wpg_for_chassis(void) 471 471 { 472 472 struct opt_rio *opt_rio_ptr = NULL; 473 473 struct rio_detail *rio_detail_ptr = NULL; 474 474 475 475 list_for_each_entry(rio_detail_ptr, &rio_vg_head, rio_detail_list) { 476 - opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num); 476 + opt_rio_ptr = search_opt_vg(rio_detail_ptr->chassis_num); 477 477 if (!opt_rio_ptr) { 478 478 opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL); 479 479 if (!opt_rio_ptr) ··· 482 482 opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num; 483 483 opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num; 484 484 opt_rio_ptr->middle_num = rio_detail_ptr->first_slot_num; 485 - list_add (&opt_rio_ptr->opt_rio_list, &opt_vg_head); 485 + list_add(&opt_rio_ptr->opt_rio_list, &opt_vg_head); 486 486 } else { 487 - opt_rio_ptr->first_slot_num = min (opt_rio_ptr->first_slot_num, rio_detail_ptr->first_slot_num); 488 - opt_rio_ptr->middle_num = max (opt_rio_ptr->middle_num, rio_detail_ptr->first_slot_num); 487 + opt_rio_ptr->first_slot_num = min(opt_rio_ptr->first_slot_num, rio_detail_ptr->first_slot_num); 488 + opt_rio_ptr->middle_num = max(opt_rio_ptr->middle_num, rio_detail_ptr->first_slot_num); 489 489 } 490 490 } 491 - print_opt_vg (); 491 + print_opt_vg(); 492 492 return 0; 493 493 } 494 494 495 495 /* 496 496 * reorganizing linked list of expansion box 497 497 */ 498 - static struct opt_rio_lo *search_opt_lo (u8 chassis_num) 498 + static struct opt_rio_lo *search_opt_lo(u8 chassis_num) 499 499 { 500 500 struct opt_rio_lo *ptr; 501 501 list_for_each_entry(ptr, &opt_lo_head, opt_rio_lo_list) { ··· 505 505 return NULL; 506 506 } 507 507 508 - static int combine_wpg_for_expansion (void) 508 + static int combine_wpg_for_expansion(void) 509 509 { 510 510 struct opt_rio_lo *opt_rio_lo_ptr = NULL; 511 511 struct rio_detail *rio_detail_ptr = NULL; 512 512 513 513 list_for_each_entry(rio_detail_ptr, &rio_lo_head, rio_detail_list) { 514 - opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num); 514 + opt_rio_lo_ptr = search_opt_lo(rio_detail_ptr->chassis_num); 515 515 if (!opt_rio_lo_ptr) { 516 516 opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL); 517 517 if (!opt_rio_lo_ptr) ··· 522 522 opt_rio_lo_ptr->middle_num = rio_detail_ptr->first_slot_num; 523 523 opt_rio_lo_ptr->pack_count = 1; 524 524 525 - list_add (&opt_rio_lo_ptr->opt_rio_lo_list, &opt_lo_head); 525 + list_add(&opt_rio_lo_ptr->opt_rio_lo_list, &opt_lo_head); 526 526 } else { 527 - opt_rio_lo_ptr->first_slot_num = min (opt_rio_lo_ptr->first_slot_num, rio_detail_ptr->first_slot_num); 528 - opt_rio_lo_ptr->middle_num = max (opt_rio_lo_ptr->middle_num, rio_detail_ptr->first_slot_num); 527 + opt_rio_lo_ptr->first_slot_num = min(opt_rio_lo_ptr->first_slot_num, rio_detail_ptr->first_slot_num); 528 + opt_rio_lo_ptr->middle_num = max(opt_rio_lo_ptr->middle_num, rio_detail_ptr->first_slot_num); 529 529 opt_rio_lo_ptr->pack_count = 2; 530 530 } 531 531 } ··· 538 538 * Arguments: slot_num, 1st slot number of the chassis we think we are on, 539 539 * var (0 = chassis, 1 = expansion box) 540 540 */ 541 - static int first_slot_num (u8 slot_num, u8 first_slot, u8 var) 541 + static int first_slot_num(u8 slot_num, u8 first_slot, u8 var) 542 542 { 543 543 struct opt_rio *opt_vg_ptr = NULL; 544 544 struct opt_rio_lo *opt_lo_ptr = NULL; ··· 562 562 return rc; 563 563 } 564 564 565 - static struct opt_rio_lo *find_rxe_num (u8 slot_num) 565 + static struct opt_rio_lo *find_rxe_num(u8 slot_num) 566 566 { 567 567 struct opt_rio_lo *opt_lo_ptr; 568 568 569 569 list_for_each_entry(opt_lo_ptr, &opt_lo_head, opt_rio_lo_list) { 570 570 //check to see if this slot_num belongs to expansion box 571 - if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_lo_ptr->first_slot_num, 1))) 571 + if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num(slot_num, opt_lo_ptr->first_slot_num, 1))) 572 572 return opt_lo_ptr; 573 573 } 574 574 return NULL; 575 575 } 576 576 577 - static struct opt_rio *find_chassis_num (u8 slot_num) 577 + static struct opt_rio *find_chassis_num(u8 slot_num) 578 578 { 579 579 struct opt_rio *opt_vg_ptr; 580 580 581 581 list_for_each_entry(opt_vg_ptr, &opt_vg_head, opt_rio_list) { 582 582 //check to see if this slot_num belongs to chassis 583 - if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_vg_ptr->first_slot_num, 0))) 583 + if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num(slot_num, opt_vg_ptr->first_slot_num, 0))) 584 584 return opt_vg_ptr; 585 585 } 586 586 return NULL; ··· 589 589 /* This routine will find out how many slots are in the chassis, so that 590 590 * the slot numbers for rxe100 would start from 1, and not from 7, or 6 etc 591 591 */ 592 - static u8 calculate_first_slot (u8 slot_num) 592 + static u8 calculate_first_slot(u8 slot_num) 593 593 { 594 594 u8 first_slot = 1; 595 595 struct slot *slot_cur; ··· 606 606 607 607 #define SLOT_NAME_SIZE 30 608 608 609 - static char *create_file_name (struct slot *slot_cur) 609 + static char *create_file_name(struct slot *slot_cur) 610 610 { 611 611 struct opt_rio *opt_vg_ptr = NULL; 612 612 struct opt_rio_lo *opt_lo_ptr = NULL; ··· 618 618 u8 flag = 0; 619 619 620 620 if (!slot_cur) { 621 - err ("Structure passed is empty\n"); 621 + err("Structure passed is empty\n"); 622 622 return NULL; 623 623 } 624 624 625 625 slot_num = slot_cur->number; 626 626 627 - memset (str, 0, sizeof(str)); 627 + memset(str, 0, sizeof(str)); 628 628 629 629 if (rio_table_ptr) { 630 630 if (rio_table_ptr->ver_num == 3) { 631 - opt_vg_ptr = find_chassis_num (slot_num); 632 - opt_lo_ptr = find_rxe_num (slot_num); 631 + opt_vg_ptr = find_chassis_num(slot_num); 632 + opt_lo_ptr = find_rxe_num(slot_num); 633 633 } 634 634 } 635 635 if (opt_vg_ptr) { ··· 662 662 } 663 663 if (!flag) { 664 664 if (slot_cur->ctrl->ctlr_type == 4) { 665 - first_slot = calculate_first_slot (slot_num); 665 + first_slot = calculate_first_slot(slot_num); 666 666 which = 1; 667 667 } else { 668 668 which = 0; ··· 698 698 hotplug_slot->info->latch_status = SLOT_LATCH(slot->status); 699 699 700 700 // pci board - present:1 not:0 701 - if (SLOT_PRESENT (slot->status)) 701 + if (SLOT_PRESENT(slot->status)) 702 702 hotplug_slot->info->adapter_status = 1; 703 703 else 704 704 hotplug_slot->info->adapter_status = 0; ··· 729 729 /* we don't want to actually remove the resources, since free_resources will do just that */ 730 730 ibmphp_unconfigure_card(&slot, -1); 731 731 732 - kfree (slot); 732 + kfree(slot); 733 733 } 734 734 735 735 static struct pci_driver ibmphp_driver; ··· 739 739 * each hpc from physical address to a list of hot plug controllers based on 740 740 * hpc descriptors. 741 741 */ 742 - static int __init ebda_rsrc_controller (void) 742 + static int __init ebda_rsrc_controller(void) 743 743 { 744 744 u16 addr, addr_slot, addr_bus; 745 745 u8 ctlr_id, temp, bus_index; ··· 757 757 addr = hpc_list_ptr->phys_addr; 758 758 for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { 759 759 bus_index = 1; 760 - ctlr_id = readb (io_mem + addr); 760 + ctlr_id = readb(io_mem + addr); 761 761 addr += 1; 762 - slot_num = readb (io_mem + addr); 762 + slot_num = readb(io_mem + addr); 763 763 764 764 addr += 1; 765 765 addr_slot = addr; /* offset of slot structure */ 766 766 addr += (slot_num * 4); 767 767 768 - bus_num = readb (io_mem + addr); 768 + bus_num = readb(io_mem + addr); 769 769 770 770 addr += 1; 771 771 addr_bus = addr; /* offset of bus */ 772 772 addr += (bus_num * 9); /* offset of ctlr_type */ 773 - temp = readb (io_mem + addr); 773 + temp = readb(io_mem + addr); 774 774 775 775 addr += 1; 776 776 /* init hpc structure */ 777 - hpc_ptr = alloc_ebda_hpc (slot_num, bus_num); 778 - if (!hpc_ptr ) { 777 + hpc_ptr = alloc_ebda_hpc(slot_num, bus_num); 778 + if (!hpc_ptr) { 779 779 rc = -ENOMEM; 780 780 goto error_no_hpc; 781 781 } ··· 783 783 hpc_ptr->ctlr_relative_id = ctlr; 784 784 hpc_ptr->slot_count = slot_num; 785 785 hpc_ptr->bus_count = bus_num; 786 - debug ("now enter ctlr data structure ---\n"); 787 - debug ("ctlr id: %x\n", ctlr_id); 788 - debug ("ctlr_relative_id: %x\n", hpc_ptr->ctlr_relative_id); 789 - debug ("count of slots controlled by this ctlr: %x\n", slot_num); 790 - debug ("count of buses controlled by this ctlr: %x\n", bus_num); 786 + debug("now enter ctlr data structure ---\n"); 787 + debug("ctlr id: %x\n", ctlr_id); 788 + debug("ctlr_relative_id: %x\n", hpc_ptr->ctlr_relative_id); 789 + debug("count of slots controlled by this ctlr: %x\n", slot_num); 790 + debug("count of buses controlled by this ctlr: %x\n", bus_num); 791 791 792 792 /* init slot structure, fetch slot, bus, cap... */ 793 793 slot_ptr = hpc_ptr->slots; 794 794 for (slot = 0; slot < slot_num; slot++) { 795 - slot_ptr->slot_num = readb (io_mem + addr_slot); 796 - slot_ptr->slot_bus_num = readb (io_mem + addr_slot + slot_num); 797 - slot_ptr->ctl_index = readb (io_mem + addr_slot + 2*slot_num); 798 - slot_ptr->slot_cap = readb (io_mem + addr_slot + 3*slot_num); 795 + slot_ptr->slot_num = readb(io_mem + addr_slot); 796 + slot_ptr->slot_bus_num = readb(io_mem + addr_slot + slot_num); 797 + slot_ptr->ctl_index = readb(io_mem + addr_slot + 2*slot_num); 798 + slot_ptr->slot_cap = readb(io_mem + addr_slot + 3*slot_num); 799 799 800 800 // create bus_info lined list --- if only one slot per bus: slot_min = slot_max 801 801 802 - bus_info_ptr2 = ibmphp_find_same_bus_num (slot_ptr->slot_bus_num); 802 + bus_info_ptr2 = ibmphp_find_same_bus_num(slot_ptr->slot_bus_num); 803 803 if (!bus_info_ptr2) { 804 804 bus_info_ptr1 = kzalloc(sizeof(struct bus_info), GFP_KERNEL); 805 805 if (!bus_info_ptr1) { ··· 816 816 817 817 bus_info_ptr1->controller_id = hpc_ptr->ctlr_id; 818 818 819 - list_add_tail (&bus_info_ptr1->bus_info_list, &bus_info_head); 819 + list_add_tail(&bus_info_ptr1->bus_info_list, &bus_info_head); 820 820 821 821 } else { 822 - bus_info_ptr2->slot_min = min (bus_info_ptr2->slot_min, slot_ptr->slot_num); 823 - bus_info_ptr2->slot_max = max (bus_info_ptr2->slot_max, slot_ptr->slot_num); 822 + bus_info_ptr2->slot_min = min(bus_info_ptr2->slot_min, slot_ptr->slot_num); 823 + bus_info_ptr2->slot_max = max(bus_info_ptr2->slot_max, slot_ptr->slot_num); 824 824 bus_info_ptr2->slot_count += 1; 825 825 826 826 } ··· 834 834 /* init bus structure */ 835 835 bus_ptr = hpc_ptr->buses; 836 836 for (bus = 0; bus < bus_num; bus++) { 837 - bus_ptr->bus_num = readb (io_mem + addr_bus + bus); 838 - bus_ptr->slots_at_33_conv = readb (io_mem + addr_bus + bus_num + 8 * bus); 839 - bus_ptr->slots_at_66_conv = readb (io_mem + addr_bus + bus_num + 8 * bus + 1); 837 + bus_ptr->bus_num = readb(io_mem + addr_bus + bus); 838 + bus_ptr->slots_at_33_conv = readb(io_mem + addr_bus + bus_num + 8 * bus); 839 + bus_ptr->slots_at_66_conv = readb(io_mem + addr_bus + bus_num + 8 * bus + 1); 840 840 841 - bus_ptr->slots_at_66_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 2); 841 + bus_ptr->slots_at_66_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 2); 842 842 843 - bus_ptr->slots_at_100_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 3); 843 + bus_ptr->slots_at_100_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 3); 844 844 845 - bus_ptr->slots_at_133_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 4); 845 + bus_ptr->slots_at_133_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 4); 846 846 847 - bus_info_ptr2 = ibmphp_find_same_bus_num (bus_ptr->bus_num); 847 + bus_info_ptr2 = ibmphp_find_same_bus_num(bus_ptr->bus_num); 848 848 if (bus_info_ptr2) { 849 849 bus_info_ptr2->slots_at_33_conv = bus_ptr->slots_at_33_conv; 850 850 bus_info_ptr2->slots_at_66_conv = bus_ptr->slots_at_66_conv; ··· 859 859 860 860 switch (hpc_ptr->ctlr_type) { 861 861 case 1: 862 - hpc_ptr->u.pci_ctlr.bus = readb (io_mem + addr); 863 - hpc_ptr->u.pci_ctlr.dev_fun = readb (io_mem + addr + 1); 864 - hpc_ptr->irq = readb (io_mem + addr + 2); 862 + hpc_ptr->u.pci_ctlr.bus = readb(io_mem + addr); 863 + hpc_ptr->u.pci_ctlr.dev_fun = readb(io_mem + addr + 1); 864 + hpc_ptr->irq = readb(io_mem + addr + 2); 865 865 addr += 3; 866 - debug ("ctrl bus = %x, ctlr devfun = %x, irq = %x\n", 866 + debug("ctrl bus = %x, ctlr devfun = %x, irq = %x\n", 867 867 hpc_ptr->u.pci_ctlr.bus, 868 868 hpc_ptr->u.pci_ctlr.dev_fun, hpc_ptr->irq); 869 869 break; 870 870 871 871 case 0: 872 - hpc_ptr->u.isa_ctlr.io_start = readw (io_mem + addr); 873 - hpc_ptr->u.isa_ctlr.io_end = readw (io_mem + addr + 2); 874 - if (!request_region (hpc_ptr->u.isa_ctlr.io_start, 872 + hpc_ptr->u.isa_ctlr.io_start = readw(io_mem + addr); 873 + hpc_ptr->u.isa_ctlr.io_end = readw(io_mem + addr + 2); 874 + if (!request_region(hpc_ptr->u.isa_ctlr.io_start, 875 875 (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1), 876 876 "ibmphp")) { 877 877 rc = -ENODEV; 878 878 goto error_no_hp_slot; 879 879 } 880 - hpc_ptr->irq = readb (io_mem + addr + 4); 880 + hpc_ptr->irq = readb(io_mem + addr + 4); 881 881 addr += 5; 882 882 break; 883 883 884 884 case 2: 885 885 case 4: 886 - hpc_ptr->u.wpeg_ctlr.wpegbbar = readl (io_mem + addr); 887 - hpc_ptr->u.wpeg_ctlr.i2c_addr = readb (io_mem + addr + 4); 888 - hpc_ptr->irq = readb (io_mem + addr + 5); 886 + hpc_ptr->u.wpeg_ctlr.wpegbbar = readl(io_mem + addr); 887 + hpc_ptr->u.wpeg_ctlr.i2c_addr = readb(io_mem + addr + 4); 888 + hpc_ptr->irq = readb(io_mem + addr + 5); 889 889 addr += 6; 890 890 break; 891 891 default: ··· 894 894 } 895 895 896 896 //reorganize chassis' linked list 897 - combine_wpg_for_chassis (); 898 - combine_wpg_for_expansion (); 897 + combine_wpg_for_chassis(); 898 + combine_wpg_for_expansion(); 899 899 hpc_ptr->revision = 0xff; 900 900 hpc_ptr->options = 0xff; 901 901 hpc_ptr->starting_slot_num = hpc_ptr->slots[0].slot_num; ··· 940 940 941 941 tmp_slot->bus = hpc_ptr->slots[index].slot_bus_num; 942 942 943 - bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num); 943 + bus_info_ptr1 = ibmphp_find_same_bus_num(hpc_ptr->slots[index].slot_bus_num); 944 944 if (!bus_info_ptr1) { 945 945 kfree(tmp_slot); 946 946 rc = -ENODEV; ··· 961 961 if (rc) 962 962 goto error; 963 963 964 - rc = ibmphp_init_devno ((struct slot **) &hp_slot_ptr->private); 964 + rc = ibmphp_init_devno((struct slot **) &hp_slot_ptr->private); 965 965 if (rc) 966 966 goto error; 967 967 hp_slot_ptr->ops = &ibmphp_hotplug_slot_ops; 968 968 969 969 // end of registering ibm slot with hotplug core 970 970 971 - list_add (& ((struct slot *)(hp_slot_ptr->private))->ibm_slot_list, &ibmphp_slot_head); 971 + list_add(&((struct slot *)(hp_slot_ptr->private))->ibm_slot_list, &ibmphp_slot_head); 972 972 } 973 973 974 - print_bus_info (); 975 - list_add (&hpc_ptr->ebda_hpc_list, &ebda_hpc_head ); 974 + print_bus_info(); 975 + list_add(&hpc_ptr->ebda_hpc_list, &ebda_hpc_head); 976 976 977 977 } /* each hpc */ 978 978 ··· 982 982 pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name); 983 983 } 984 984 985 - print_ebda_hpc (); 986 - print_ibm_slot (); 985 + print_ebda_hpc(); 986 + print_ibm_slot(); 987 987 return 0; 988 988 989 989 error: 990 - kfree (hp_slot_ptr->private); 990 + kfree(hp_slot_ptr->private); 991 991 error_no_slot: 992 - kfree (hp_slot_ptr->info); 992 + kfree(hp_slot_ptr->info); 993 993 error_no_hp_info: 994 - kfree (hp_slot_ptr); 994 + kfree(hp_slot_ptr); 995 995 error_no_hp_slot: 996 - free_ebda_hpc (hpc_ptr); 996 + free_ebda_hpc(hpc_ptr); 997 997 error_no_hpc: 998 - iounmap (io_mem); 998 + iounmap(io_mem); 999 999 return rc; 1000 1000 } 1001 1001 ··· 1003 1003 * map info (bus, devfun, start addr, end addr..) of i/o, memory, 1004 1004 * pfm from the physical addr to a list of resource. 1005 1005 */ 1006 - static int __init ebda_rsrc_rsrc (void) 1006 + static int __init ebda_rsrc_rsrc(void) 1007 1007 { 1008 1008 u16 addr; 1009 1009 short rsrc; ··· 1011 1011 struct ebda_pci_rsrc *rsrc_ptr; 1012 1012 1013 1013 addr = rsrc_list_ptr->phys_addr; 1014 - debug ("now entering rsrc land\n"); 1015 - debug ("offset of rsrc: %x\n", rsrc_list_ptr->phys_addr); 1014 + debug("now entering rsrc land\n"); 1015 + debug("offset of rsrc: %x\n", rsrc_list_ptr->phys_addr); 1016 1016 1017 1017 for (rsrc = 0; rsrc < rsrc_list_ptr->num_entries; rsrc++) { 1018 - type = readb (io_mem + addr); 1018 + type = readb(io_mem + addr); 1019 1019 1020 1020 addr += 1; 1021 1021 rsrc_type = type & EBDA_RSRC_TYPE_MASK; 1022 1022 1023 1023 if (rsrc_type == EBDA_IO_RSRC_TYPE) { 1024 - rsrc_ptr = alloc_ebda_pci_rsrc (); 1024 + rsrc_ptr = alloc_ebda_pci_rsrc(); 1025 1025 if (!rsrc_ptr) { 1026 - iounmap (io_mem); 1026 + iounmap(io_mem); 1027 1027 return -ENOMEM; 1028 1028 } 1029 1029 rsrc_ptr->rsrc_type = type; 1030 1030 1031 - rsrc_ptr->bus_num = readb (io_mem + addr); 1032 - rsrc_ptr->dev_fun = readb (io_mem + addr + 1); 1033 - rsrc_ptr->start_addr = readw (io_mem + addr + 2); 1034 - rsrc_ptr->end_addr = readw (io_mem + addr + 4); 1031 + rsrc_ptr->bus_num = readb(io_mem + addr); 1032 + rsrc_ptr->dev_fun = readb(io_mem + addr + 1); 1033 + rsrc_ptr->start_addr = readw(io_mem + addr + 2); 1034 + rsrc_ptr->end_addr = readw(io_mem + addr + 4); 1035 1035 addr += 6; 1036 1036 1037 - debug ("rsrc from io type ----\n"); 1038 - debug ("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", 1037 + debug("rsrc from io type ----\n"); 1038 + debug("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", 1039 1039 rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_addr); 1040 1040 1041 - list_add (&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); 1041 + list_add(&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); 1042 1042 } 1043 1043 1044 1044 if (rsrc_type == EBDA_MEM_RSRC_TYPE || rsrc_type == EBDA_PFM_RSRC_TYPE) { 1045 - rsrc_ptr = alloc_ebda_pci_rsrc (); 1046 - if (!rsrc_ptr ) { 1047 - iounmap (io_mem); 1045 + rsrc_ptr = alloc_ebda_pci_rsrc(); 1046 + if (!rsrc_ptr) { 1047 + iounmap(io_mem); 1048 1048 return -ENOMEM; 1049 1049 } 1050 1050 rsrc_ptr->rsrc_type = type; 1051 1051 1052 - rsrc_ptr->bus_num = readb (io_mem + addr); 1053 - rsrc_ptr->dev_fun = readb (io_mem + addr + 1); 1054 - rsrc_ptr->start_addr = readl (io_mem + addr + 2); 1055 - rsrc_ptr->end_addr = readl (io_mem + addr + 6); 1052 + rsrc_ptr->bus_num = readb(io_mem + addr); 1053 + rsrc_ptr->dev_fun = readb(io_mem + addr + 1); 1054 + rsrc_ptr->start_addr = readl(io_mem + addr + 2); 1055 + rsrc_ptr->end_addr = readl(io_mem + addr + 6); 1056 1056 addr += 10; 1057 1057 1058 - debug ("rsrc from mem or pfm ---\n"); 1059 - debug ("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", 1058 + debug("rsrc from mem or pfm ---\n"); 1059 + debug("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", 1060 1060 rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_addr); 1061 1061 1062 - list_add (&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); 1062 + list_add(&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); 1063 1063 } 1064 1064 } 1065 - kfree (rsrc_list_ptr); 1065 + kfree(rsrc_list_ptr); 1066 1066 rsrc_list_ptr = NULL; 1067 - print_ebda_pci_rsrc (); 1067 + print_ebda_pci_rsrc(); 1068 1068 return 0; 1069 1069 } 1070 1070 1071 - u16 ibmphp_get_total_controllers (void) 1071 + u16 ibmphp_get_total_controllers(void) 1072 1072 { 1073 1073 return hpc_list_ptr->num_ctlrs; 1074 1074 } 1075 1075 1076 - struct slot *ibmphp_get_slot_from_physical_num (u8 physical_num) 1076 + struct slot *ibmphp_get_slot_from_physical_num(u8 physical_num) 1077 1077 { 1078 1078 struct slot *slot; 1079 1079 ··· 1090 1090 * - the total number of the slots based on each bus 1091 1091 * (if only one slot per bus slot_min = slot_max ) 1092 1092 */ 1093 - struct bus_info *ibmphp_find_same_bus_num (u32 num) 1093 + struct bus_info *ibmphp_find_same_bus_num(u32 num) 1094 1094 { 1095 1095 struct bus_info *ptr; 1096 1096 ··· 1104 1104 /* Finding relative bus number, in order to map corresponding 1105 1105 * bus register 1106 1106 */ 1107 - int ibmphp_get_bus_index (u8 num) 1107 + int ibmphp_get_bus_index(u8 num) 1108 1108 { 1109 1109 struct bus_info *ptr; 1110 1110 ··· 1115 1115 return -ENODEV; 1116 1116 } 1117 1117 1118 - void ibmphp_free_bus_info_queue (void) 1118 + void ibmphp_free_bus_info_queue(void) 1119 1119 { 1120 1120 struct bus_info *bus_info; 1121 1121 struct list_head *list; 1122 1122 struct list_head *next; 1123 1123 1124 - list_for_each_safe (list, next, &bus_info_head ) { 1125 - bus_info = list_entry (list, struct bus_info, bus_info_list); 1126 - kfree (bus_info); 1124 + list_for_each_safe(list, next, &bus_info_head) { 1125 + bus_info = list_entry(list, struct bus_info, bus_info_list); 1126 + kfree(bus_info); 1127 1127 } 1128 1128 } 1129 1129 1130 - void ibmphp_free_ebda_hpc_queue (void) 1130 + void ibmphp_free_ebda_hpc_queue(void) 1131 1131 { 1132 1132 struct controller *controller = NULL; 1133 1133 struct list_head *list; 1134 1134 struct list_head *next; 1135 1135 int pci_flag = 0; 1136 1136 1137 - list_for_each_safe (list, next, &ebda_hpc_head) { 1138 - controller = list_entry (list, struct controller, ebda_hpc_list); 1137 + list_for_each_safe(list, next, &ebda_hpc_head) { 1138 + controller = list_entry(list, struct controller, ebda_hpc_list); 1139 1139 if (controller->ctlr_type == 0) 1140 - release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1)); 1140 + release_region(controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1)); 1141 1141 else if ((controller->ctlr_type == 1) && (!pci_flag)) { 1142 1142 ++pci_flag; 1143 - pci_unregister_driver (&ibmphp_driver); 1143 + pci_unregister_driver(&ibmphp_driver); 1144 1144 } 1145 - free_ebda_hpc (controller); 1145 + free_ebda_hpc(controller); 1146 1146 } 1147 1147 } 1148 1148 1149 - void ibmphp_free_ebda_pci_rsrc_queue (void) 1149 + void ibmphp_free_ebda_pci_rsrc_queue(void) 1150 1150 { 1151 1151 struct ebda_pci_rsrc *resource; 1152 1152 struct list_head *list; 1153 1153 struct list_head *next; 1154 1154 1155 - list_for_each_safe (list, next, &ibmphp_ebda_pci_rsrc_head) { 1156 - resource = list_entry (list, struct ebda_pci_rsrc, ebda_pci_rsrc_list); 1157 - kfree (resource); 1155 + list_for_each_safe(list, next, &ibmphp_ebda_pci_rsrc_head) { 1156 + resource = list_entry(list, struct ebda_pci_rsrc, ebda_pci_rsrc_list); 1157 + kfree(resource); 1158 1158 resource = NULL; 1159 1159 } 1160 1160 } ··· 1171 1171 1172 1172 MODULE_DEVICE_TABLE(pci, id_table); 1173 1173 1174 - static int ibmphp_probe (struct pci_dev *, const struct pci_device_id *); 1174 + static int ibmphp_probe(struct pci_dev *, const struct pci_device_id *); 1175 1175 static struct pci_driver ibmphp_driver = { 1176 1176 .name = "ibmphp", 1177 1177 .id_table = id_table, 1178 1178 .probe = ibmphp_probe, 1179 1179 }; 1180 1180 1181 - int ibmphp_register_pci (void) 1181 + int ibmphp_register_pci(void) 1182 1182 { 1183 1183 struct controller *ctrl; 1184 1184 int rc = 0; ··· 1191 1191 } 1192 1192 return rc; 1193 1193 } 1194 - static int ibmphp_probe (struct pci_dev *dev, const struct pci_device_id *ids) 1194 + static int ibmphp_probe(struct pci_dev *dev, const struct pci_device_id *ids) 1195 1195 { 1196 1196 struct controller *ctrl; 1197 1197 1198 - debug ("inside ibmphp_probe\n"); 1198 + debug("inside ibmphp_probe\n"); 1199 1199 1200 1200 list_for_each_entry(ctrl, &ebda_hpc_head, ebda_hpc_list) { 1201 1201 if (ctrl->ctlr_type == 1) { 1202 1202 if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) { 1203 1203 ctrl->ctrl_dev = dev; 1204 - debug ("found device!!!\n"); 1205 - debug ("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device); 1204 + debug("found device!!!\n"); 1205 + debug("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device); 1206 1206 return 0; 1207 1207 } 1208 1208 }
+192 -192
drivers/pci/hotplug/ibmphp_hpc.c
··· 40 40 #include "ibmphp.h" 41 41 42 42 static int to_debug = 0; 43 - #define debug_polling(fmt, arg...) do { if (to_debug) debug (fmt, arg); } while (0) 43 + #define debug_polling(fmt, arg...) do { if (to_debug) debug(fmt, arg); } while (0) 44 44 45 45 //---------------------------------------------------------------------------- 46 46 // timeout values ··· 110 110 //---------------------------------------------------------------------------- 111 111 // local function prototypes 112 112 //---------------------------------------------------------------------------- 113 - static u8 i2c_ctrl_read (struct controller *, void __iomem *, u8); 114 - static u8 i2c_ctrl_write (struct controller *, void __iomem *, u8, u8); 115 - static u8 hpc_writecmdtoindex (u8, u8); 116 - static u8 hpc_readcmdtoindex (u8, u8); 117 - static void get_hpc_access (void); 118 - static void free_hpc_access (void); 113 + static u8 i2c_ctrl_read(struct controller *, void __iomem *, u8); 114 + static u8 i2c_ctrl_write(struct controller *, void __iomem *, u8, u8); 115 + static u8 hpc_writecmdtoindex(u8, u8); 116 + static u8 hpc_readcmdtoindex(u8, u8); 117 + static void get_hpc_access(void); 118 + static void free_hpc_access(void); 119 119 static int poll_hpc(void *data); 120 - static int process_changeinstatus (struct slot *, struct slot *); 121 - static int process_changeinlatch (u8, u8, struct controller *); 122 - static int hpc_wait_ctlr_notworking (int, struct controller *, void __iomem *, u8 *); 120 + static int process_changeinstatus(struct slot *, struct slot *); 121 + static int process_changeinlatch(u8, u8, struct controller *); 122 + static int hpc_wait_ctlr_notworking(int, struct controller *, void __iomem *, u8 *); 123 123 //---------------------------------------------------------------------------- 124 124 125 125 ··· 128 128 * 129 129 * Action: initialize semaphores and variables 130 130 *---------------------------------------------------------------------*/ 131 - void __init ibmphp_hpc_initvars (void) 131 + void __init ibmphp_hpc_initvars(void) 132 132 { 133 - debug ("%s - Entry\n", __func__); 133 + debug("%s - Entry\n", __func__); 134 134 135 135 mutex_init(&sem_hpcaccess); 136 136 sema_init(&semOperations, 1); 137 137 sema_init(&sem_exit, 0); 138 138 to_debug = 0; 139 139 140 - debug ("%s - Exit\n", __func__); 140 + debug("%s - Exit\n", __func__); 141 141 } 142 142 143 143 /*---------------------------------------------------------------------- ··· 146 146 * Action: read from HPC over I2C 147 147 * 148 148 *---------------------------------------------------------------------*/ 149 - static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index) 149 + static u8 i2c_ctrl_read(struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index) 150 150 { 151 151 u8 status; 152 152 int i; ··· 155 155 unsigned long ultemp; 156 156 unsigned long data; // actual data HILO format 157 157 158 - debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __func__, WPGBbar, index); 158 + debug_polling("%s - Entry WPGBbar[%p] index[%x] \n", __func__, WPGBbar, index); 159 159 160 160 //-------------------------------------------------------------------- 161 161 // READ - step 1 ··· 178 178 ultemp = ultemp << 8; 179 179 data |= ultemp; 180 180 } else { 181 - err ("this controller type is not supported \n"); 181 + err("this controller type is not supported \n"); 182 182 return HPC_ERROR; 183 183 } 184 184 185 - wpg_data = swab32 (data); // swap data before writing 185 + wpg_data = swab32(data); // swap data before writing 186 186 wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; 187 - writel (wpg_data, wpg_addr); 187 + writel(wpg_data, wpg_addr); 188 188 189 189 //-------------------------------------------------------------------- 190 190 // READ - step 2 : clear the message buffer 191 191 data = 0x00000000; 192 - wpg_data = swab32 (data); 192 + wpg_data = swab32(data); 193 193 wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; 194 - writel (wpg_data, wpg_addr); 194 + writel(wpg_data, wpg_addr); 195 195 196 196 //-------------------------------------------------------------------- 197 197 // READ - step 3 : issue start operation, I2C master control bit 30:ON 198 198 // 2020 : [20] OR operation at [20] offset 0x20 199 199 data = WPG_I2CMCNTL_STARTOP_MASK; 200 - wpg_data = swab32 (data); 200 + wpg_data = swab32(data); 201 201 wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; 202 - writel (wpg_data, wpg_addr); 202 + writel(wpg_data, wpg_addr); 203 203 204 204 //-------------------------------------------------------------------- 205 205 // READ - step 4 : wait until start operation bit clears ··· 207 207 while (i) { 208 208 msleep(10); 209 209 wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; 210 - wpg_data = readl (wpg_addr); 211 - data = swab32 (wpg_data); 210 + wpg_data = readl(wpg_addr); 211 + data = swab32(wpg_data); 212 212 if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) 213 213 break; 214 214 i--; 215 215 } 216 216 if (i == 0) { 217 - debug ("%s - Error : WPG timeout\n", __func__); 217 + debug("%s - Error : WPG timeout\n", __func__); 218 218 return HPC_ERROR; 219 219 } 220 220 //-------------------------------------------------------------------- ··· 223 223 while (i) { 224 224 msleep(10); 225 225 wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; 226 - wpg_data = readl (wpg_addr); 227 - data = swab32 (wpg_data); 228 - if (HPC_I2CSTATUS_CHECK (data)) 226 + wpg_data = readl(wpg_addr); 227 + data = swab32(wpg_data); 228 + if (HPC_I2CSTATUS_CHECK(data)) 229 229 break; 230 230 i--; 231 231 } 232 232 if (i == 0) { 233 - debug ("ctrl_read - Exit Error:I2C timeout\n"); 233 + debug("ctrl_read - Exit Error:I2C timeout\n"); 234 234 return HPC_ERROR; 235 235 } 236 236 237 237 //-------------------------------------------------------------------- 238 238 // READ - step 6 : get DATA 239 239 wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; 240 - wpg_data = readl (wpg_addr); 241 - data = swab32 (wpg_data); 240 + wpg_data = readl(wpg_addr); 241 + data = swab32(wpg_data); 242 242 243 243 status = (u8) data; 244 244 245 - debug_polling ("%s - Exit index[%x] status[%x]\n", __func__, index, status); 245 + debug_polling("%s - Exit index[%x] status[%x]\n", __func__, index, status); 246 246 247 247 return (status); 248 248 } ··· 254 254 * 255 255 * Return 0 or error codes 256 256 *---------------------------------------------------------------------*/ 257 - static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index, u8 cmd) 257 + static u8 i2c_ctrl_write(struct controller *ctlr_ptr, void __iomem *WPGBbar, u8 index, u8 cmd) 258 258 { 259 259 u8 rc; 260 260 void __iomem *wpg_addr; // base addr + offset ··· 263 263 unsigned long data; // actual data HILO format 264 264 int i; 265 265 266 - debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __func__, WPGBbar, index, cmd); 266 + debug_polling("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __func__, WPGBbar, index, cmd); 267 267 268 268 rc = 0; 269 269 //-------------------------------------------------------------------- ··· 289 289 ultemp = ultemp << 8; 290 290 data |= ultemp; 291 291 } else { 292 - err ("this controller type is not supported \n"); 292 + err("this controller type is not supported \n"); 293 293 return HPC_ERROR; 294 294 } 295 295 296 - wpg_data = swab32 (data); // swap data before writing 296 + wpg_data = swab32(data); // swap data before writing 297 297 wpg_addr = WPGBbar + WPG_I2CMOSUP_OFFSET; 298 - writel (wpg_data, wpg_addr); 298 + writel(wpg_data, wpg_addr); 299 299 300 300 //-------------------------------------------------------------------- 301 301 // WRITE - step 2 : clear the message buffer 302 302 data = 0x00000000 | (unsigned long)cmd; 303 - wpg_data = swab32 (data); 303 + wpg_data = swab32(data); 304 304 wpg_addr = WPGBbar + WPG_I2CMBUFL_OFFSET; 305 - writel (wpg_data, wpg_addr); 305 + writel(wpg_data, wpg_addr); 306 306 307 307 //-------------------------------------------------------------------- 308 308 // WRITE - step 3 : issue start operation,I2C master control bit 30:ON 309 309 // 2020 : [20] OR operation at [20] offset 0x20 310 310 data = WPG_I2CMCNTL_STARTOP_MASK; 311 - wpg_data = swab32 (data); 311 + wpg_data = swab32(data); 312 312 wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET + WPG_I2C_OR; 313 - writel (wpg_data, wpg_addr); 313 + writel(wpg_data, wpg_addr); 314 314 315 315 //-------------------------------------------------------------------- 316 316 // WRITE - step 4 : wait until start operation bit clears ··· 318 318 while (i) { 319 319 msleep(10); 320 320 wpg_addr = WPGBbar + WPG_I2CMCNTL_OFFSET; 321 - wpg_data = readl (wpg_addr); 322 - data = swab32 (wpg_data); 321 + wpg_data = readl(wpg_addr); 322 + data = swab32(wpg_data); 323 323 if (!(data & WPG_I2CMCNTL_STARTOP_MASK)) 324 324 break; 325 325 i--; 326 326 } 327 327 if (i == 0) { 328 - debug ("%s - Exit Error:WPG timeout\n", __func__); 328 + debug("%s - Exit Error:WPG timeout\n", __func__); 329 329 rc = HPC_ERROR; 330 330 } 331 331 ··· 335 335 while (i) { 336 336 msleep(10); 337 337 wpg_addr = WPGBbar + WPG_I2CSTAT_OFFSET; 338 - wpg_data = readl (wpg_addr); 339 - data = swab32 (wpg_data); 340 - if (HPC_I2CSTATUS_CHECK (data)) 338 + wpg_data = readl(wpg_addr); 339 + data = swab32(wpg_data); 340 + if (HPC_I2CSTATUS_CHECK(data)) 341 341 break; 342 342 i--; 343 343 } 344 344 if (i == 0) { 345 - debug ("ctrl_read - Error : I2C timeout\n"); 345 + debug("ctrl_read - Error : I2C timeout\n"); 346 346 rc = HPC_ERROR; 347 347 } 348 348 349 - debug_polling ("%s Exit rc[%x]\n", __func__, rc); 349 + debug_polling("%s Exit rc[%x]\n", __func__, rc); 350 350 return (rc); 351 351 } 352 352 353 353 //------------------------------------------------------------ 354 354 // Read from ISA type HPC 355 355 //------------------------------------------------------------ 356 - static u8 isa_ctrl_read (struct controller *ctlr_ptr, u8 offset) 356 + static u8 isa_ctrl_read(struct controller *ctlr_ptr, u8 offset) 357 357 { 358 358 u16 start_address; 359 359 u16 end_address; ··· 361 361 362 362 start_address = ctlr_ptr->u.isa_ctlr.io_start; 363 363 end_address = ctlr_ptr->u.isa_ctlr.io_end; 364 - data = inb (start_address + offset); 364 + data = inb(start_address + offset); 365 365 return data; 366 366 } 367 367 368 368 //-------------------------------------------------------------- 369 369 // Write to ISA type HPC 370 370 //-------------------------------------------------------------- 371 - static void isa_ctrl_write (struct controller *ctlr_ptr, u8 offset, u8 data) 371 + static void isa_ctrl_write(struct controller *ctlr_ptr, u8 offset, u8 data) 372 372 { 373 373 u16 start_address; 374 374 u16 port_address; 375 375 376 376 start_address = ctlr_ptr->u.isa_ctlr.io_start; 377 377 port_address = start_address + (u16) offset; 378 - outb (data, port_address); 378 + outb(data, port_address); 379 379 } 380 380 381 - static u8 pci_ctrl_read (struct controller *ctrl, u8 offset) 381 + static u8 pci_ctrl_read(struct controller *ctrl, u8 offset) 382 382 { 383 383 u8 data = 0x00; 384 - debug ("inside pci_ctrl_read\n"); 384 + debug("inside pci_ctrl_read\n"); 385 385 if (ctrl->ctrl_dev) 386 - pci_read_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data); 386 + pci_read_config_byte(ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data); 387 387 return data; 388 388 } 389 389 390 - static u8 pci_ctrl_write (struct controller *ctrl, u8 offset, u8 data) 390 + static u8 pci_ctrl_write(struct controller *ctrl, u8 offset, u8 data) 391 391 { 392 392 u8 rc = -ENODEV; 393 - debug ("inside pci_ctrl_write\n"); 393 + debug("inside pci_ctrl_write\n"); 394 394 if (ctrl->ctrl_dev) { 395 - pci_write_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data); 395 + pci_write_config_byte(ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data); 396 396 rc = 0; 397 397 } 398 398 return rc; 399 399 } 400 400 401 - static u8 ctrl_read (struct controller *ctlr, void __iomem *base, u8 offset) 401 + static u8 ctrl_read(struct controller *ctlr, void __iomem *base, u8 offset) 402 402 { 403 403 u8 rc; 404 404 switch (ctlr->ctlr_type) { 405 405 case 0: 406 - rc = isa_ctrl_read (ctlr, offset); 406 + rc = isa_ctrl_read(ctlr, offset); 407 407 break; 408 408 case 1: 409 - rc = pci_ctrl_read (ctlr, offset); 409 + rc = pci_ctrl_read(ctlr, offset); 410 410 break; 411 411 case 2: 412 412 case 4: 413 - rc = i2c_ctrl_read (ctlr, base, offset); 413 + rc = i2c_ctrl_read(ctlr, base, offset); 414 414 break; 415 415 default: 416 416 return -ENODEV; ··· 418 418 return rc; 419 419 } 420 420 421 - static u8 ctrl_write (struct controller *ctlr, void __iomem *base, u8 offset, u8 data) 421 + static u8 ctrl_write(struct controller *ctlr, void __iomem *base, u8 offset, u8 data) 422 422 { 423 423 u8 rc = 0; 424 424 switch (ctlr->ctlr_type) { ··· 426 426 isa_ctrl_write(ctlr, offset, data); 427 427 break; 428 428 case 1: 429 - rc = pci_ctrl_write (ctlr, offset, data); 429 + rc = pci_ctrl_write(ctlr, offset, data); 430 430 break; 431 431 case 2: 432 432 case 4: ··· 444 444 * 445 445 * Return index, HPC_ERROR 446 446 *---------------------------------------------------------------------*/ 447 - static u8 hpc_writecmdtoindex (u8 cmd, u8 index) 447 + static u8 hpc_writecmdtoindex(u8 cmd, u8 index) 448 448 { 449 449 u8 rc; 450 450 ··· 476 476 break; 477 477 478 478 default: 479 - err ("hpc_writecmdtoindex - Error invalid cmd[%x]\n", cmd); 479 + err("hpc_writecmdtoindex - Error invalid cmd[%x]\n", cmd); 480 480 rc = HPC_ERROR; 481 481 } 482 482 ··· 490 490 * 491 491 * Return index, HPC_ERROR 492 492 *---------------------------------------------------------------------*/ 493 - static u8 hpc_readcmdtoindex (u8 cmd, u8 index) 493 + static u8 hpc_readcmdtoindex(u8 cmd, u8 index) 494 494 { 495 495 u8 rc; 496 496 ··· 533 533 * 534 534 * Return 0 or error codes 535 535 *---------------------------------------------------------------------*/ 536 - int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) 536 + int ibmphp_hpc_readslot(struct slot *pslot, u8 cmd, u8 *pstatus) 537 537 { 538 538 void __iomem *wpg_bbar = NULL; 539 539 struct controller *ctlr_ptr; ··· 542 542 int rc = 0; 543 543 int busindex; 544 544 545 - debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __func__, pslot, cmd, pstatus); 545 + debug_polling("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __func__, pslot, cmd, pstatus); 546 546 547 547 if ((pslot == NULL) 548 548 || ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) { 549 549 rc = -EINVAL; 550 - err ("%s - Error invalid pointer, rc[%d]\n", __func__, rc); 550 + err("%s - Error invalid pointer, rc[%d]\n", __func__, rc); 551 551 return rc; 552 552 } 553 553 554 554 if (cmd == READ_BUSSTATUS) { 555 - busindex = ibmphp_get_bus_index (pslot->bus); 555 + busindex = ibmphp_get_bus_index(pslot->bus); 556 556 if (busindex < 0) { 557 557 rc = -EINVAL; 558 - err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); 558 + err("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); 559 559 return rc; 560 560 } else 561 561 index = (u8) busindex; 562 562 } else 563 563 index = pslot->ctlr_index; 564 564 565 - index = hpc_readcmdtoindex (cmd, index); 565 + index = hpc_readcmdtoindex(cmd, index); 566 566 567 567 if (index == HPC_ERROR) { 568 568 rc = -EINVAL; 569 - err ("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc); 569 + err("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc); 570 570 return rc; 571 571 } 572 572 573 573 ctlr_ptr = pslot->ctrl; 574 574 575 - get_hpc_access (); 575 + get_hpc_access(); 576 576 577 577 //-------------------------------------------------------------------- 578 578 // map physical address to logical address 579 579 //-------------------------------------------------------------------- 580 580 if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) 581 - wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); 581 + wpg_bbar = ioremap(ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); 582 582 583 583 //-------------------------------------------------------------------- 584 584 // check controller status before reading 585 585 //-------------------------------------------------------------------- 586 - rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); 586 + rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); 587 587 if (!rc) { 588 588 switch (cmd) { 589 589 case READ_ALLSTAT: 590 590 // update the slot structure 591 591 pslot->ctrl->status = status; 592 - pslot->status = ctrl_read (ctlr_ptr, wpg_bbar, index); 593 - rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, 592 + pslot->status = ctrl_read(ctlr_ptr, wpg_bbar, index); 593 + rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, 594 594 &status); 595 595 if (!rc) 596 - pslot->ext_status = ctrl_read (ctlr_ptr, wpg_bbar, index + WPG_1ST_EXTSLOT_INDEX); 596 + pslot->ext_status = ctrl_read(ctlr_ptr, wpg_bbar, index + WPG_1ST_EXTSLOT_INDEX); 597 597 598 598 break; 599 599 600 600 case READ_SLOTSTATUS: 601 601 // DO NOT update the slot structure 602 - *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); 602 + *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); 603 603 break; 604 604 605 605 case READ_EXTSLOTSTATUS: 606 606 // DO NOT update the slot structure 607 - *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); 607 + *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); 608 608 break; 609 609 610 610 case READ_CTLRSTATUS: ··· 613 613 break; 614 614 615 615 case READ_BUSSTATUS: 616 - pslot->busstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); 616 + pslot->busstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); 617 617 break; 618 618 case READ_REVLEVEL: 619 - *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); 619 + *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); 620 620 break; 621 621 case READ_HPCOPTIONS: 622 - *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); 622 + *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); 623 623 break; 624 624 case READ_SLOTLATCHLOWREG: 625 625 // DO NOT update the slot structure 626 - *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, index); 626 + *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, index); 627 627 break; 628 628 629 629 // Not used 630 630 case READ_ALLSLOT: 631 - list_for_each (pslotlist, &ibmphp_slot_head) { 632 - pslot = list_entry (pslotlist, struct slot, ibm_slot_list); 631 + list_for_each(pslotlist, &ibmphp_slot_head) { 632 + pslot = list_entry(pslotlist, struct slot, ibm_slot_list); 633 633 index = pslot->ctlr_index; 634 - rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, 634 + rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, 635 635 wpg_bbar, &status); 636 636 if (!rc) { 637 - pslot->status = ctrl_read (ctlr_ptr, wpg_bbar, index); 638 - rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, 637 + pslot->status = ctrl_read(ctlr_ptr, wpg_bbar, index); 638 + rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, 639 639 ctlr_ptr, wpg_bbar, &status); 640 640 if (!rc) 641 641 pslot->ext_status = 642 - ctrl_read (ctlr_ptr, wpg_bbar, 642 + ctrl_read(ctlr_ptr, wpg_bbar, 643 643 index + WPG_1ST_EXTSLOT_INDEX); 644 644 } else { 645 - err ("%s - Error ctrl_read failed\n", __func__); 645 + err("%s - Error ctrl_read failed\n", __func__); 646 646 rc = -EINVAL; 647 647 break; 648 648 } ··· 659 659 660 660 // remove physical to logical address mapping 661 661 if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) 662 - iounmap (wpg_bbar); 662 + iounmap(wpg_bbar); 663 663 664 - free_hpc_access (); 664 + free_hpc_access(); 665 665 666 - debug_polling ("%s - Exit rc[%d]\n", __func__, rc); 666 + debug_polling("%s - Exit rc[%d]\n", __func__, rc); 667 667 return rc; 668 668 } 669 669 ··· 672 672 * 673 673 * Action: issue a WRITE command to HPC 674 674 *---------------------------------------------------------------------*/ 675 - int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) 675 + int ibmphp_hpc_writeslot(struct slot *pslot, u8 cmd) 676 676 { 677 677 void __iomem *wpg_bbar = NULL; 678 678 struct controller *ctlr_ptr; ··· 682 682 int rc = 0; 683 683 int timeout; 684 684 685 - debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __func__, pslot, cmd); 685 + debug_polling("%s - Entry pslot[%p] cmd[%x]\n", __func__, pslot, cmd); 686 686 if (pslot == NULL) { 687 687 rc = -EINVAL; 688 - err ("%s - Error Exit rc[%d]\n", __func__, rc); 688 + err("%s - Error Exit rc[%d]\n", __func__, rc); 689 689 return rc; 690 690 } 691 691 692 692 if ((cmd == HPC_BUS_33CONVMODE) || (cmd == HPC_BUS_66CONVMODE) || 693 693 (cmd == HPC_BUS_66PCIXMODE) || (cmd == HPC_BUS_100PCIXMODE) || 694 694 (cmd == HPC_BUS_133PCIXMODE)) { 695 - busindex = ibmphp_get_bus_index (pslot->bus); 695 + busindex = ibmphp_get_bus_index(pslot->bus); 696 696 if (busindex < 0) { 697 697 rc = -EINVAL; 698 - err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); 698 + err("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc); 699 699 return rc; 700 700 } else 701 701 index = (u8) busindex; 702 702 } else 703 703 index = pslot->ctlr_index; 704 704 705 - index = hpc_writecmdtoindex (cmd, index); 705 + index = hpc_writecmdtoindex(cmd, index); 706 706 707 707 if (index == HPC_ERROR) { 708 708 rc = -EINVAL; 709 - err ("%s - Error Exit rc[%d]\n", __func__, rc); 709 + err("%s - Error Exit rc[%d]\n", __func__, rc); 710 710 return rc; 711 711 } 712 712 713 713 ctlr_ptr = pslot->ctrl; 714 714 715 - get_hpc_access (); 715 + get_hpc_access(); 716 716 717 717 //-------------------------------------------------------------------- 718 718 // map physical address to logical address 719 719 //-------------------------------------------------------------------- 720 720 if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) { 721 - wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); 721 + wpg_bbar = ioremap(ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); 722 722 723 - debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __func__, 723 + debug("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __func__, 724 724 ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar, 725 725 ctlr_ptr->u.wpeg_ctlr.i2c_addr); 726 726 } 727 727 //-------------------------------------------------------------------- 728 728 // check controller status before writing 729 729 //-------------------------------------------------------------------- 730 - rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); 730 + rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, &status); 731 731 if (!rc) { 732 732 733 - ctrl_write (ctlr_ptr, wpg_bbar, index, cmd); 733 + ctrl_write(ctlr_ptr, wpg_bbar, index, cmd); 734 734 735 735 //-------------------------------------------------------------------- 736 736 // check controller is still not working on the command ··· 738 738 timeout = CMD_COMPLETE_TOUT_SEC; 739 739 done = 0; 740 740 while (!done) { 741 - rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, 741 + rc = hpc_wait_ctlr_notworking(HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar, 742 742 &status); 743 743 if (!rc) { 744 - if (NEEDTOCHECK_CMDSTATUS (cmd)) { 745 - if (CTLR_FINISHED (status) == HPC_CTLR_FINISHED_YES) 744 + if (NEEDTOCHECK_CMDSTATUS(cmd)) { 745 + if (CTLR_FINISHED(status) == HPC_CTLR_FINISHED_YES) 746 746 done = 1; 747 747 } else 748 748 done = 1; ··· 751 751 msleep(1000); 752 752 if (timeout < 1) { 753 753 done = 1; 754 - err ("%s - Error command complete timeout\n", __func__); 754 + err("%s - Error command complete timeout\n", __func__); 755 755 rc = -EFAULT; 756 756 } else 757 757 timeout--; ··· 763 763 764 764 // remove physical to logical address mapping 765 765 if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) 766 - iounmap (wpg_bbar); 767 - free_hpc_access (); 766 + iounmap(wpg_bbar); 767 + free_hpc_access(); 768 768 769 - debug_polling ("%s - Exit rc[%d]\n", __func__, rc); 769 + debug_polling("%s - Exit rc[%d]\n", __func__, rc); 770 770 return rc; 771 771 } 772 772 ··· 775 775 * 776 776 * Action: make sure only one process can access HPC at one time 777 777 *---------------------------------------------------------------------*/ 778 - static void get_hpc_access (void) 778 + static void get_hpc_access(void) 779 779 { 780 780 mutex_lock(&sem_hpcaccess); 781 781 } ··· 783 783 /*---------------------------------------------------------------------- 784 784 * Name: free_hpc_access() 785 785 *---------------------------------------------------------------------*/ 786 - void free_hpc_access (void) 786 + void free_hpc_access(void) 787 787 { 788 788 mutex_unlock(&sem_hpcaccess); 789 789 } ··· 793 793 * 794 794 * Action: make sure only one process can change the data structure 795 795 *---------------------------------------------------------------------*/ 796 - void ibmphp_lock_operations (void) 796 + void ibmphp_lock_operations(void) 797 797 { 798 - down (&semOperations); 798 + down(&semOperations); 799 799 to_debug = 1; 800 800 } 801 801 802 802 /*---------------------------------------------------------------------- 803 803 * Name: ibmphp_unlock_operations() 804 804 *---------------------------------------------------------------------*/ 805 - void ibmphp_unlock_operations (void) 805 + void ibmphp_unlock_operations(void) 806 806 { 807 - debug ("%s - Entry\n", __func__); 808 - up (&semOperations); 807 + debug("%s - Entry\n", __func__); 808 + up(&semOperations); 809 809 to_debug = 0; 810 - debug ("%s - Exit\n", __func__); 810 + debug("%s - Exit\n", __func__); 811 811 } 812 812 813 813 /*---------------------------------------------------------------------- ··· 828 828 int poll_count = 0; 829 829 u8 ctrl_count = 0x00; 830 830 831 - debug ("%s - Entry\n", __func__); 831 + debug("%s - Entry\n", __func__); 832 832 833 833 while (!kthread_should_stop()) { 834 834 /* try to get the lock to do some kind of hardware access */ 835 - down (&semOperations); 835 + down(&semOperations); 836 836 837 837 switch (poll_state) { 838 838 case POLL_LATCH_REGISTER: 839 839 oldlatchlow = curlatchlow; 840 840 ctrl_count = 0x00; 841 - list_for_each (pslotlist, &ibmphp_slot_head) { 841 + list_for_each(pslotlist, &ibmphp_slot_head) { 842 842 if (ctrl_count >= ibmphp_get_total_controllers()) 843 843 break; 844 - pslot = list_entry (pslotlist, struct slot, ibm_slot_list); 844 + pslot = list_entry(pslotlist, struct slot, ibm_slot_list); 845 845 if (pslot->ctrl->ctlr_relative_id == ctrl_count) { 846 846 ctrl_count++; 847 - if (READ_SLOT_LATCH (pslot->ctrl)) { 848 - rc = ibmphp_hpc_readslot (pslot, 847 + if (READ_SLOT_LATCH(pslot->ctrl)) { 848 + rc = ibmphp_hpc_readslot(pslot, 849 849 READ_SLOTLATCHLOWREG, 850 850 &curlatchlow); 851 851 if (oldlatchlow != curlatchlow) 852 - process_changeinlatch (oldlatchlow, 852 + process_changeinlatch(oldlatchlow, 853 853 curlatchlow, 854 854 pslot->ctrl); 855 855 } ··· 859 859 poll_state = POLL_SLEEP; 860 860 break; 861 861 case POLL_SLOTS: 862 - list_for_each (pslotlist, &ibmphp_slot_head) { 863 - pslot = list_entry (pslotlist, struct slot, ibm_slot_list); 862 + list_for_each(pslotlist, &ibmphp_slot_head) { 863 + pslot = list_entry(pslotlist, struct slot, ibm_slot_list); 864 864 // make a copy of the old status 865 - memcpy ((void *) &myslot, (void *) pslot, 866 - sizeof (struct slot)); 867 - rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL); 865 + memcpy((void *) &myslot, (void *) pslot, 866 + sizeof(struct slot)); 867 + rc = ibmphp_hpc_readslot(pslot, READ_ALLSTAT, NULL); 868 868 if ((myslot.status != pslot->status) 869 869 || (myslot.ext_status != pslot->ext_status)) 870 - process_changeinstatus (pslot, &myslot); 870 + process_changeinstatus(pslot, &myslot); 871 871 } 872 872 ctrl_count = 0x00; 873 - list_for_each (pslotlist, &ibmphp_slot_head) { 873 + list_for_each(pslotlist, &ibmphp_slot_head) { 874 874 if (ctrl_count >= ibmphp_get_total_controllers()) 875 875 break; 876 - pslot = list_entry (pslotlist, struct slot, ibm_slot_list); 876 + pslot = list_entry(pslotlist, struct slot, ibm_slot_list); 877 877 if (pslot->ctrl->ctlr_relative_id == ctrl_count) { 878 878 ctrl_count++; 879 - if (READ_SLOT_LATCH (pslot->ctrl)) 880 - rc = ibmphp_hpc_readslot (pslot, 879 + if (READ_SLOT_LATCH(pslot->ctrl)) 880 + rc = ibmphp_hpc_readslot(pslot, 881 881 READ_SLOTLATCHLOWREG, 882 882 &curlatchlow); 883 883 } ··· 887 887 break; 888 888 case POLL_SLEEP: 889 889 /* don't sleep with a lock on the hardware */ 890 - up (&semOperations); 890 + up(&semOperations); 891 891 msleep(POLL_INTERVAL_SEC * 1000); 892 892 893 893 if (kthread_should_stop()) 894 894 goto out_sleep; 895 895 896 - down (&semOperations); 896 + down(&semOperations); 897 897 898 898 if (poll_count >= POLL_LATCH_CNT) { 899 899 poll_count = 0; ··· 903 903 break; 904 904 } 905 905 /* give up the hardware semaphore */ 906 - up (&semOperations); 906 + up(&semOperations); 907 907 /* sleep for a short time just for good measure */ 908 908 out_sleep: 909 909 msleep(100); 910 910 } 911 - up (&sem_exit); 912 - debug ("%s - Exit\n", __func__); 911 + up(&sem_exit); 912 + debug("%s - Exit\n", __func__); 913 913 return 0; 914 914 } 915 915 ··· 929 929 * 930 930 * Notes: 931 931 *---------------------------------------------------------------------*/ 932 - static int process_changeinstatus (struct slot *pslot, struct slot *poldslot) 932 + static int process_changeinstatus(struct slot *pslot, struct slot *poldslot) 933 933 { 934 934 u8 status; 935 935 int rc = 0; 936 936 u8 disable = 0; 937 937 u8 update = 0; 938 938 939 - debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot); 939 + debug("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot); 940 940 941 941 // bit 0 - HPC_SLOT_POWER 942 942 if ((pslot->status & 0x01) != (poldslot->status & 0x01)) ··· 958 958 // bit 5 - HPC_SLOT_PWRGD 959 959 if ((pslot->status & 0x20) != (poldslot->status & 0x20)) 960 960 // OFF -> ON: ignore, ON -> OFF: disable slot 961 - if ((poldslot->status & 0x20) && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) 961 + if ((poldslot->status & 0x20) && (SLOT_CONNECT(poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT(poldslot->status))) 962 962 disable = 1; 963 963 964 964 // bit 6 - HPC_SLOT_BUS_SPEED ··· 969 969 update = 1; 970 970 // OPEN -> CLOSE 971 971 if (pslot->status & 0x80) { 972 - if (SLOT_PWRGD (pslot->status)) { 972 + if (SLOT_PWRGD(pslot->status)) { 973 973 // power goes on and off after closing latch 974 974 // check again to make sure power is still ON 975 975 msleep(1000); 976 - rc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &status); 977 - if (SLOT_PWRGD (status)) 976 + rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &status); 977 + if (SLOT_PWRGD(status)) 978 978 update = 1; 979 979 else // overwrite power in pslot to OFF 980 980 pslot->status &= ~HPC_SLOT_POWER; 981 981 } 982 982 } 983 983 // CLOSE -> OPEN 984 - else if ((SLOT_PWRGD (poldslot->status) == HPC_SLOT_PWRGD_GOOD) 985 - && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) { 984 + else if ((SLOT_PWRGD(poldslot->status) == HPC_SLOT_PWRGD_GOOD) 985 + && (SLOT_CONNECT(poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT(poldslot->status))) { 986 986 disable = 1; 987 987 } 988 988 // else - ignore ··· 992 992 update = 1; 993 993 994 994 if (disable) { 995 - debug ("process_changeinstatus - disable slot\n"); 995 + debug("process_changeinstatus - disable slot\n"); 996 996 pslot->flag = 0; 997 - rc = ibmphp_do_disable_slot (pslot); 997 + rc = ibmphp_do_disable_slot(pslot); 998 998 } 999 999 1000 1000 if (update || disable) 1001 - ibmphp_update_slot_info (pslot); 1001 + ibmphp_update_slot_info(pslot); 1002 1002 1003 - debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update); 1003 + debug("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update); 1004 1004 1005 1005 return rc; 1006 1006 } ··· 1015 1015 * Return 0 or error codes 1016 1016 * Value: 1017 1017 *---------------------------------------------------------------------*/ 1018 - static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl) 1018 + static int process_changeinlatch(u8 old, u8 new, struct controller *ctrl) 1019 1019 { 1020 1020 struct slot myslot, *pslot; 1021 1021 u8 i; 1022 1022 u8 mask; 1023 1023 int rc = 0; 1024 1024 1025 - debug ("%s - Entry old[%x], new[%x]\n", __func__, old, new); 1025 + debug("%s - Entry old[%x], new[%x]\n", __func__, old, new); 1026 1026 // bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots 1027 1027 1028 1028 for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) { 1029 1029 mask = 0x01 << i; 1030 1030 if ((mask & old) != (mask & new)) { 1031 - pslot = ibmphp_get_slot_from_physical_num (i); 1031 + pslot = ibmphp_get_slot_from_physical_num(i); 1032 1032 if (pslot) { 1033 - memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot)); 1034 - rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL); 1035 - debug ("%s - call process_changeinstatus for slot[%d]\n", __func__, i); 1036 - process_changeinstatus (pslot, &myslot); 1033 + memcpy((void *) &myslot, (void *) pslot, sizeof(struct slot)); 1034 + rc = ibmphp_hpc_readslot(pslot, READ_ALLSTAT, NULL); 1035 + debug("%s - call process_changeinstatus for slot[%d]\n", __func__, i); 1036 + process_changeinstatus(pslot, &myslot); 1037 1037 } else { 1038 1038 rc = -EINVAL; 1039 - err ("%s - Error bad pointer for slot[%d]\n", __func__, i); 1039 + err("%s - Error bad pointer for slot[%d]\n", __func__, i); 1040 1040 } 1041 1041 } 1042 1042 } 1043 - debug ("%s - Exit rc[%d]\n", __func__, rc); 1043 + debug("%s - Exit rc[%d]\n", __func__, rc); 1044 1044 return rc; 1045 1045 } 1046 1046 ··· 1049 1049 * 1050 1050 * Action: start polling thread 1051 1051 *---------------------------------------------------------------------*/ 1052 - int __init ibmphp_hpc_start_poll_thread (void) 1052 + int __init ibmphp_hpc_start_poll_thread(void) 1053 1053 { 1054 - debug ("%s - Entry\n", __func__); 1054 + debug("%s - Entry\n", __func__); 1055 1055 1056 1056 ibmphp_poll_thread = kthread_run(poll_hpc, NULL, "hpc_poll"); 1057 1057 if (IS_ERR(ibmphp_poll_thread)) { 1058 - err ("%s - Error, thread not started\n", __func__); 1058 + err("%s - Error, thread not started\n", __func__); 1059 1059 return PTR_ERR(ibmphp_poll_thread); 1060 1060 } 1061 1061 return 0; ··· 1066 1066 * 1067 1067 * Action: stop polling thread and cleanup 1068 1068 *---------------------------------------------------------------------*/ 1069 - void __exit ibmphp_hpc_stop_poll_thread (void) 1069 + void __exit ibmphp_hpc_stop_poll_thread(void) 1070 1070 { 1071 - debug ("%s - Entry\n", __func__); 1071 + debug("%s - Entry\n", __func__); 1072 1072 1073 1073 kthread_stop(ibmphp_poll_thread); 1074 - debug ("before locking operations \n"); 1075 - ibmphp_lock_operations (); 1076 - debug ("after locking operations \n"); 1074 + debug("before locking operations\n"); 1075 + ibmphp_lock_operations(); 1076 + debug("after locking operations\n"); 1077 1077 1078 1078 // wait for poll thread to exit 1079 - debug ("before sem_exit down \n"); 1080 - down (&sem_exit); 1081 - debug ("after sem_exit down \n"); 1079 + debug("before sem_exit down\n"); 1080 + down(&sem_exit); 1081 + debug("after sem_exit down\n"); 1082 1082 1083 1083 // cleanup 1084 - debug ("before free_hpc_access \n"); 1085 - free_hpc_access (); 1086 - debug ("after free_hpc_access \n"); 1087 - ibmphp_unlock_operations (); 1088 - debug ("after unlock operations \n"); 1089 - up (&sem_exit); 1090 - debug ("after sem exit up\n"); 1084 + debug("before free_hpc_access\n"); 1085 + free_hpc_access(); 1086 + debug("after free_hpc_access\n"); 1087 + ibmphp_unlock_operations(); 1088 + debug("after unlock operations\n"); 1089 + up(&sem_exit); 1090 + debug("after sem exit up\n"); 1091 1091 1092 - debug ("%s - Exit\n", __func__); 1092 + debug("%s - Exit\n", __func__); 1093 1093 } 1094 1094 1095 1095 /*---------------------------------------------------------------------- ··· 1100 1100 * Return 0, HPC_ERROR 1101 1101 * Value: 1102 1102 *---------------------------------------------------------------------*/ 1103 - static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, 1103 + static int hpc_wait_ctlr_notworking(int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, 1104 1104 u8 *pstatus) 1105 1105 { 1106 1106 int rc = 0; 1107 1107 u8 done = 0; 1108 1108 1109 - debug_polling ("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout); 1109 + debug_polling("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout); 1110 1110 1111 1111 while (!done) { 1112 - *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX); 1112 + *pstatus = ctrl_read(ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX); 1113 1113 if (*pstatus == HPC_ERROR) { 1114 1114 rc = HPC_ERROR; 1115 1115 done = 1; 1116 1116 } 1117 - if (CTLR_WORKING (*pstatus) == HPC_CTLR_WORKING_NO) 1117 + if (CTLR_WORKING(*pstatus) == HPC_CTLR_WORKING_NO) 1118 1118 done = 1; 1119 1119 if (!done) { 1120 1120 msleep(1000); 1121 1121 if (timeout < 1) { 1122 1122 done = 1; 1123 - err ("HPCreadslot - Error ctlr timeout\n"); 1123 + err("HPCreadslot - Error ctlr timeout\n"); 1124 1124 rc = HPC_ERROR; 1125 1125 } else 1126 1126 timeout--; 1127 1127 } 1128 1128 } 1129 - debug_polling ("hpc_wait_ctlr_notworking - Exit rc[%x] status[%x]\n", rc, *pstatus); 1129 + debug_polling("hpc_wait_ctlr_notworking - Exit rc[%x] status[%x]\n", rc, *pstatus); 1130 1130 return rc; 1131 1131 }
+364 -364
drivers/pci/hotplug/ibmphp_pci.c
··· 37 37 static int configure_device(struct pci_func *); 38 38 static int configure_bridge(struct pci_func **, u8); 39 39 static struct res_needed *scan_behind_bridge(struct pci_func *, u8); 40 - static int add_new_bus (struct bus_node *, struct resource_node *, struct resource_node *, struct resource_node *, u8); 41 - static u8 find_sec_number (u8 primary_busno, u8 slotno); 40 + static int add_new_bus(struct bus_node *, struct resource_node *, struct resource_node *, struct resource_node *, u8); 41 + static u8 find_sec_number(u8 primary_busno, u8 slotno); 42 42 43 43 /* 44 44 * NOTE..... If BIOS doesn't provide default routing, we assign: ··· 47 47 * We also assign the same irq numbers for multi function devices. 48 48 * These are PIC mode, so shouldn't matter n.e.ways (hopefully) 49 49 */ 50 - static void assign_alt_irq (struct pci_func *cur_func, u8 class_code) 50 + static void assign_alt_irq(struct pci_func *cur_func, u8 class_code) 51 51 { 52 52 int j; 53 53 for (j = 0; j < 4; j++) { ··· 78 78 * if there is an error, will need to go through all previous functions and 79 79 * unconfigure....or can add some code into unconfigure_card.... 80 80 */ 81 - int ibmphp_configure_card (struct pci_func *func, u8 slotno) 81 + int ibmphp_configure_card(struct pci_func *func, u8 slotno) 82 82 { 83 83 u16 vendor_id; 84 84 u32 class; ··· 92 92 u8 flag; 93 93 u8 valid_device = 0x00; /* to see if we are able to read from card any device info at all */ 94 94 95 - debug ("inside configure_card, func->busno = %x\n", func->busno); 95 + debug("inside configure_card, func->busno = %x\n", func->busno); 96 96 97 97 device = func->device; 98 98 cur_func = func; ··· 109 109 110 110 cur_func->function = function; 111 111 112 - debug ("inside the loop, cur_func->busno = %x, cur_func->device = %x, cur_func->function = %x\n", 112 + debug("inside the loop, cur_func->busno = %x, cur_func->device = %x, cur_func->function = %x\n", 113 113 cur_func->busno, cur_func->device, cur_func->function); 114 114 115 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 115 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 116 116 117 - debug ("vendor_id is %x\n", vendor_id); 117 + debug("vendor_id is %x\n", vendor_id); 118 118 if (vendor_id != PCI_VENDOR_ID_NOTVALID) { 119 119 /* found correct device!!! */ 120 - debug ("found valid device, vendor_id = %x\n", vendor_id); 120 + debug("found valid device, vendor_id = %x\n", vendor_id); 121 121 122 122 ++valid_device; 123 123 ··· 126 126 * |_=> 0 = single function device, 1 = multi-function device 127 127 */ 128 128 129 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 130 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); 129 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 130 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); 131 131 132 132 class_code = class >> 24; 133 - debug ("hrd_type = %x, class = %x, class_code %x\n", hdr_type, class, class_code); 133 + debug("hrd_type = %x, class = %x, class_code %x\n", hdr_type, class, class_code); 134 134 class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ 135 135 if (class == PCI_CLASS_NOT_DEFINED_VGA) { 136 - err ("The device %x is VGA compatible and as is not supported for hot plugging. " 136 + err("The device %x is VGA compatible and as is not supported for hot plugging. " 137 137 "Please choose another device.\n", cur_func->device); 138 138 return -ENODEV; 139 139 } else if (class == PCI_CLASS_DISPLAY_VGA) { 140 - err ("The device %x is not supported for hot plugging. Please choose another device.\n", 140 + err("The device %x is not supported for hot plugging. Please choose another device.\n", 141 141 cur_func->device); 142 142 return -ENODEV; 143 143 } 144 144 switch (hdr_type) { 145 145 case PCI_HEADER_TYPE_NORMAL: 146 - debug ("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class); 147 - assign_alt_irq (cur_func, class_code); 146 + debug("single device case.... vendor id = %x, hdr_type = %x, class = %x\n", vendor_id, hdr_type, class); 147 + assign_alt_irq(cur_func, class_code); 148 148 rc = configure_device(cur_func); 149 149 if (rc < 0) { 150 150 /* We need to do this in case some other BARs were properly inserted */ 151 - err ("was not able to configure devfunc %x on bus %x.\n", 151 + err("was not able to configure devfunc %x on bus %x.\n", 152 152 cur_func->device, cur_func->busno); 153 153 cleanup_count = 6; 154 154 goto error; ··· 157 157 function = 0x8; 158 158 break; 159 159 case PCI_HEADER_TYPE_MULTIDEVICE: 160 - assign_alt_irq (cur_func, class_code); 160 + assign_alt_irq(cur_func, class_code); 161 161 rc = configure_device(cur_func); 162 162 if (rc < 0) { 163 163 /* We need to do this in case some other BARs were properly inserted */ 164 - err ("was not able to configure devfunc %x on bus %x...bailing out\n", 164 + err("was not able to configure devfunc %x on bus %x...bailing out\n", 165 165 cur_func->device, cur_func->busno); 166 166 cleanup_count = 6; 167 167 goto error; 168 168 } 169 169 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 170 170 if (!newfunc) { 171 - err ("out of system memory\n"); 171 + err("out of system memory\n"); 172 172 return -ENOMEM; 173 173 } 174 174 newfunc->busno = cur_func->busno; ··· 181 181 case PCI_HEADER_TYPE_MULTIBRIDGE: 182 182 class >>= 8; 183 183 if (class != PCI_CLASS_BRIDGE_PCI) { 184 - err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", 184 + err("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", 185 185 cur_func->device); 186 186 return -ENODEV; 187 187 } 188 - assign_alt_irq (cur_func, class_code); 189 - rc = configure_bridge (&cur_func, slotno); 188 + assign_alt_irq(cur_func, class_code); 189 + rc = configure_bridge(&cur_func, slotno); 190 190 if (rc == -ENODEV) { 191 - err ("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); 192 - err ("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); 191 + err("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); 192 + err("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); 193 193 return rc; 194 194 } 195 195 if (rc) { 196 196 /* We need to do this in case some other BARs were properly inserted */ 197 - err ("was not able to hot-add PPB properly.\n"); 197 + err("was not able to hot-add PPB properly.\n"); 198 198 func->bus = 1; /* To indicate to the unconfigure function that this is a PPB */ 199 199 cleanup_count = 2; 200 200 goto error; 201 201 } 202 202 203 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 203 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 204 204 flag = 0; 205 205 for (i = 0; i < 32; i++) { 206 206 if (func->devices[i]) { 207 207 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 208 208 if (!newfunc) { 209 - err ("out of system memory\n"); 209 + err("out of system memory\n"); 210 210 return -ENOMEM; 211 211 } 212 212 newfunc->busno = sec_number; ··· 220 220 } else 221 221 cur_func->next = newfunc; 222 222 223 - rc = ibmphp_configure_card (newfunc, slotno); 223 + rc = ibmphp_configure_card(newfunc, slotno); 224 224 /* This could only happen if kmalloc failed */ 225 225 if (rc) { 226 226 /* We need to do this in case bridge itself got configured properly, but devices behind it failed */ ··· 234 234 235 235 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 236 236 if (!newfunc) { 237 - err ("out of system memory\n"); 237 + err("out of system memory\n"); 238 238 return -ENOMEM; 239 239 } 240 240 newfunc->busno = cur_func->busno; 241 241 newfunc->device = device; 242 242 for (j = 0; j < 4; j++) 243 243 newfunc->irq[j] = cur_func->irq[j]; 244 - for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next) ; 244 + for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next); 245 245 prev_func->next = newfunc; 246 246 cur_func = newfunc; 247 247 break; 248 248 case PCI_HEADER_TYPE_BRIDGE: 249 249 class >>= 8; 250 - debug ("class now is %x\n", class); 250 + debug("class now is %x\n", class); 251 251 if (class != PCI_CLASS_BRIDGE_PCI) { 252 - err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", 252 + err("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", 253 253 cur_func->device); 254 254 return -ENODEV; 255 255 } 256 256 257 - assign_alt_irq (cur_func, class_code); 257 + assign_alt_irq(cur_func, class_code); 258 258 259 - debug ("cur_func->busno b4 configure_bridge is %x\n", cur_func->busno); 260 - rc = configure_bridge (&cur_func, slotno); 259 + debug("cur_func->busno b4 configure_bridge is %x\n", cur_func->busno); 260 + rc = configure_bridge(&cur_func, slotno); 261 261 if (rc == -ENODEV) { 262 - err ("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); 263 - err ("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); 262 + err("You chose to insert Single Bridge, or nested bridges, this is not supported...\n"); 263 + err("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device); 264 264 return rc; 265 265 } 266 266 if (rc) { 267 267 /* We need to do this in case some other BARs were properly inserted */ 268 268 func->bus = 1; /* To indicate to the unconfigure function that this is a PPB */ 269 - err ("was not able to hot-add PPB properly.\n"); 269 + err("was not able to hot-add PPB properly.\n"); 270 270 cleanup_count = 2; 271 271 goto error; 272 272 } 273 - debug ("cur_func->busno = %x, device = %x, function = %x\n", 273 + debug("cur_func->busno = %x, device = %x, function = %x\n", 274 274 cur_func->busno, device, function); 275 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 276 - debug ("after configuring bridge..., sec_number = %x\n", sec_number); 275 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 276 + debug("after configuring bridge..., sec_number = %x\n", sec_number); 277 277 flag = 0; 278 278 for (i = 0; i < 32; i++) { 279 279 if (func->devices[i]) { 280 - debug ("inside for loop, device is %x\n", i); 280 + debug("inside for loop, device is %x\n", i); 281 281 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 282 282 if (!newfunc) { 283 - err (" out of system memory\n"); 283 + err(" out of system memory\n"); 284 284 return -ENOMEM; 285 285 } 286 286 newfunc->busno = sec_number; ··· 289 289 newfunc->irq[j] = cur_func->irq[j]; 290 290 291 291 if (flag) { 292 - for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next) ; 292 + for (prev_func = cur_func; prev_func->next; prev_func = prev_func->next); 293 293 prev_func->next = newfunc; 294 294 } else 295 295 cur_func->next = newfunc; 296 296 297 - rc = ibmphp_configure_card (newfunc, slotno); 297 + rc = ibmphp_configure_card(newfunc, slotno); 298 298 299 299 /* Again, this case should not happen... For complete paranoia, will need to call remove_bus */ 300 300 if (rc) { ··· 310 310 function = 0x8; 311 311 break; 312 312 default: 313 - err ("MAJOR PROBLEM!!!!, header type not supported? %x\n", hdr_type); 313 + err("MAJOR PROBLEM!!!!, header type not supported? %x\n", hdr_type); 314 314 return -ENXIO; 315 315 break; 316 316 } /* end of switch */ ··· 318 318 } /* end of for */ 319 319 320 320 if (!valid_device) { 321 - err ("Cannot find any valid devices on the card. Or unable to read from card.\n"); 321 + err("Cannot find any valid devices on the card. Or unable to read from card.\n"); 322 322 return -ENODEV; 323 323 } 324 324 ··· 327 327 error: 328 328 for (i = 0; i < cleanup_count; i++) { 329 329 if (cur_func->io[i]) { 330 - ibmphp_remove_resource (cur_func->io[i]); 330 + ibmphp_remove_resource(cur_func->io[i]); 331 331 cur_func->io[i] = NULL; 332 332 } else if (cur_func->pfmem[i]) { 333 - ibmphp_remove_resource (cur_func->pfmem[i]); 333 + ibmphp_remove_resource(cur_func->pfmem[i]); 334 334 cur_func->pfmem[i] = NULL; 335 335 } else if (cur_func->mem[i]) { 336 - ibmphp_remove_resource (cur_func->mem[i]); 336 + ibmphp_remove_resource(cur_func->mem[i]); 337 337 cur_func->mem[i] = NULL; 338 338 } 339 339 } ··· 345 345 * Input: pointer to the pci_func 346 346 * Output: configured PCI, 0, or error 347 347 */ 348 - static int configure_device (struct pci_func *func) 348 + static int configure_device(struct pci_func *func) 349 349 { 350 350 u32 bar[6]; 351 351 u32 address[] = { ··· 366 366 struct resource_node *pfmem[6]; 367 367 unsigned int devfn; 368 368 369 - debug ("%s - inside\n", __func__); 369 + debug("%s - inside\n", __func__); 370 370 371 371 devfn = PCI_DEVFN(func->device, func->function); 372 372 ibmphp_pci_bus->number = func->busno; ··· 386 386 pcibios_write_config_dword(cur_func->busno, cur_func->device, 387 387 PCI_BASE_ADDRESS_0 + 4 * count, 0xFFFFFFFF); 388 388 */ 389 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 390 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); 389 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 390 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); 391 391 392 392 if (!bar[count]) /* This BAR is not implemented */ 393 393 continue; 394 394 395 - debug ("Device %x BAR %d wants %x\n", func->device, count, bar[count]); 395 + debug("Device %x BAR %d wants %x\n", func->device, count, bar[count]); 396 396 397 397 if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { 398 398 /* This is IO */ 399 - debug ("inside IO SPACE\n"); 399 + debug("inside IO SPACE\n"); 400 400 401 401 len[count] = bar[count] & 0xFFFFFFFC; 402 402 len[count] = ~len[count] + 1; 403 403 404 - debug ("len[count] in IO %x, count %d\n", len[count], count); 404 + debug("len[count] in IO %x, count %d\n", len[count], count); 405 405 406 406 io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 407 407 408 408 if (!io[count]) { 409 - err ("out of system memory\n"); 409 + err("out of system memory\n"); 410 410 return -ENOMEM; 411 411 } 412 412 io[count]->type = IO; ··· 414 414 io[count]->devfunc = PCI_DEVFN(func->device, func->function); 415 415 io[count]->len = len[count]; 416 416 if (ibmphp_check_resource(io[count], 0) == 0) { 417 - ibmphp_add_resource (io[count]); 417 + ibmphp_add_resource(io[count]); 418 418 func->io[count] = io[count]; 419 419 } else { 420 - err ("cannot allocate requested io for bus %x device %x function %x len %x\n", 420 + err("cannot allocate requested io for bus %x device %x function %x len %x\n", 421 421 func->busno, func->device, func->function, len[count]); 422 - kfree (io[count]); 422 + kfree(io[count]); 423 423 return -EIO; 424 424 } 425 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->io[count]->start); 425 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->io[count]->start); 426 426 427 427 /* _______________This is for debugging purposes only_____________________ */ 428 - debug ("b4 writing, the IO address is %x\n", func->io[count]->start); 429 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); 430 - debug ("after writing.... the start address is %x\n", bar[count]); 428 + debug("b4 writing, the IO address is %x\n", func->io[count]->start); 429 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); 430 + debug("after writing.... the start address is %x\n", bar[count]); 431 431 /* _________________________________________________________________________*/ 432 432 433 433 } else { 434 434 /* This is Memory */ 435 435 if (bar[count] & PCI_BASE_ADDRESS_MEM_PREFETCH) { 436 436 /* pfmem */ 437 - debug ("PFMEM SPACE\n"); 437 + debug("PFMEM SPACE\n"); 438 438 439 439 len[count] = bar[count] & 0xFFFFFFF0; 440 440 len[count] = ~len[count] + 1; 441 441 442 - debug ("len[count] in PFMEM %x, count %d\n", len[count], count); 442 + debug("len[count] in PFMEM %x, count %d\n", len[count], count); 443 443 444 444 pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 445 445 if (!pfmem[count]) { 446 - err ("out of system memory\n"); 446 + err("out of system memory\n"); 447 447 return -ENOMEM; 448 448 } 449 449 pfmem[count]->type = PFMEM; ··· 452 452 func->function); 453 453 pfmem[count]->len = len[count]; 454 454 pfmem[count]->fromMem = 0; 455 - if (ibmphp_check_resource (pfmem[count], 0) == 0) { 456 - ibmphp_add_resource (pfmem[count]); 455 + if (ibmphp_check_resource(pfmem[count], 0) == 0) { 456 + ibmphp_add_resource(pfmem[count]); 457 457 func->pfmem[count] = pfmem[count]; 458 458 } else { 459 459 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); 460 460 if (!mem_tmp) { 461 - err ("out of system memory\n"); 462 - kfree (pfmem[count]); 461 + err("out of system memory\n"); 462 + kfree(pfmem[count]); 463 463 return -ENOMEM; 464 464 } 465 465 mem_tmp->type = MEM; 466 466 mem_tmp->busno = pfmem[count]->busno; 467 467 mem_tmp->devfunc = pfmem[count]->devfunc; 468 468 mem_tmp->len = pfmem[count]->len; 469 - debug ("there's no pfmem... going into mem.\n"); 470 - if (ibmphp_check_resource (mem_tmp, 0) == 0) { 471 - ibmphp_add_resource (mem_tmp); 469 + debug("there's no pfmem... going into mem.\n"); 470 + if (ibmphp_check_resource(mem_tmp, 0) == 0) { 471 + ibmphp_add_resource(mem_tmp); 472 472 pfmem[count]->fromMem = 1; 473 473 pfmem[count]->rangeno = mem_tmp->rangeno; 474 474 pfmem[count]->start = mem_tmp->start; 475 475 pfmem[count]->end = mem_tmp->end; 476 - ibmphp_add_pfmem_from_mem (pfmem[count]); 476 + ibmphp_add_pfmem_from_mem(pfmem[count]); 477 477 func->pfmem[count] = pfmem[count]; 478 478 } else { 479 - err ("cannot allocate requested pfmem for bus %x, device %x, len %x\n", 479 + err("cannot allocate requested pfmem for bus %x, device %x, len %x\n", 480 480 func->busno, func->device, len[count]); 481 - kfree (mem_tmp); 482 - kfree (pfmem[count]); 481 + kfree(mem_tmp); 482 + kfree(pfmem[count]); 483 483 return -EIO; 484 484 } 485 485 } 486 486 487 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); 487 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); 488 488 489 489 /*_______________This is for debugging purposes only______________________________*/ 490 - debug ("b4 writing, start address is %x\n", func->pfmem[count]->start); 491 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); 492 - debug ("after writing, start address is %x\n", bar[count]); 490 + debug("b4 writing, start address is %x\n", func->pfmem[count]->start); 491 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); 492 + debug("after writing, start address is %x\n", bar[count]); 493 493 /*_________________________________________________________________________________*/ 494 494 495 495 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ 496 - debug ("inside the mem 64 case, count %d\n", count); 496 + debug("inside the mem 64 case, count %d\n", count); 497 497 count += 1; 498 498 /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ 499 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); 499 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); 500 500 } 501 501 } else { 502 502 /* regular memory */ 503 - debug ("REGULAR MEM SPACE\n"); 503 + debug("REGULAR MEM SPACE\n"); 504 504 505 505 len[count] = bar[count] & 0xFFFFFFF0; 506 506 len[count] = ~len[count] + 1; 507 507 508 - debug ("len[count] in Mem %x, count %d\n", len[count], count); 508 + debug("len[count] in Mem %x, count %d\n", len[count], count); 509 509 510 510 mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 511 511 if (!mem[count]) { 512 - err ("out of system memory\n"); 512 + err("out of system memory\n"); 513 513 return -ENOMEM; 514 514 } 515 515 mem[count]->type = MEM; ··· 517 517 mem[count]->devfunc = PCI_DEVFN(func->device, 518 518 func->function); 519 519 mem[count]->len = len[count]; 520 - if (ibmphp_check_resource (mem[count], 0) == 0) { 521 - ibmphp_add_resource (mem[count]); 520 + if (ibmphp_check_resource(mem[count], 0) == 0) { 521 + ibmphp_add_resource(mem[count]); 522 522 func->mem[count] = mem[count]; 523 523 } else { 524 - err ("cannot allocate requested mem for bus %x, device %x, len %x\n", 524 + err("cannot allocate requested mem for bus %x, device %x, len %x\n", 525 525 func->busno, func->device, len[count]); 526 - kfree (mem[count]); 526 + kfree(mem[count]); 527 527 return -EIO; 528 528 } 529 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); 529 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); 530 530 /* _______________________This is for debugging purposes only _______________________*/ 531 - debug ("b4 writing, start address is %x\n", func->mem[count]->start); 532 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); 533 - debug ("after writing, the address is %x\n", bar[count]); 531 + debug("b4 writing, start address is %x\n", func->mem[count]->start); 532 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); 533 + debug("after writing, the address is %x\n", bar[count]); 534 534 /* __________________________________________________________________________________*/ 535 535 536 536 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { 537 537 /* takes up another dword */ 538 - debug ("inside mem 64 case, reg. mem, count %d\n", count); 538 + debug("inside mem 64 case, reg. mem, count %d\n", count); 539 539 count += 1; 540 540 /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ 541 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); 541 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); 542 542 } 543 543 } 544 544 } /* end of mem */ 545 545 } /* end of for */ 546 546 547 547 func->bus = 0; /* To indicate that this is not a PPB */ 548 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); 548 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); 549 549 if ((irq > 0x00) && (irq < 0x05)) 550 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); 550 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); 551 551 552 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); 553 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); 552 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); 553 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); 554 554 555 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, PCI_ROM_ADDRESS, 0x00L); 556 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); 555 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, PCI_ROM_ADDRESS, 0x00L); 556 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); 557 557 558 558 return 0; 559 559 } ··· 563 563 * Parameters: pci_func 564 564 * Returns: 565 565 ******************************************************************************/ 566 - static int configure_bridge (struct pci_func **func_passed, u8 slotno) 566 + static int configure_bridge(struct pci_func **func_passed, u8 slotno) 567 567 { 568 568 int count; 569 569 int i; ··· 597 597 u8 irq; 598 598 int retval; 599 599 600 - debug ("%s - enter\n", __func__); 600 + debug("%s - enter\n", __func__); 601 601 602 602 devfn = PCI_DEVFN(func->function, func->device); 603 603 ibmphp_pci_bus->number = func->busno; ··· 606 606 * behind it 607 607 */ 608 608 609 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, func->busno); 609 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, func->busno); 610 610 611 611 /* _____________________For debugging purposes only __________________________ 612 - pci_bus_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); 613 - debug ("primary # written into the bridge is %x\n", pri_number); 612 + pci_bus_config_byte(ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); 613 + debug("primary # written into the bridge is %x\n", pri_number); 614 614 ___________________________________________________________________________*/ 615 615 616 616 /* in EBDA, only get allocated 1 additional bus # per slot */ 617 - sec_number = find_sec_number (func->busno, slotno); 617 + sec_number = find_sec_number(func->busno, slotno); 618 618 if (sec_number == 0xff) { 619 - err ("cannot allocate secondary bus number for the bridged device\n"); 619 + err("cannot allocate secondary bus number for the bridged device\n"); 620 620 return -EINVAL; 621 621 } 622 622 623 - debug ("after find_sec_number, the number we got is %x\n", sec_number); 624 - debug ("AFTER FIND_SEC_NUMBER, func->busno IS %x\n", func->busno); 623 + debug("after find_sec_number, the number we got is %x\n", sec_number); 624 + debug("AFTER FIND_SEC_NUMBER, func->busno IS %x\n", func->busno); 625 625 626 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, sec_number); 626 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, sec_number); 627 627 628 628 /* __________________For debugging purposes only __________________________________ 629 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 630 - debug ("sec_number after write/read is %x\n", sec_number); 629 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 630 + debug("sec_number after write/read is %x\n", sec_number); 631 631 ________________________________________________________________________________*/ 632 632 633 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, sec_number); 633 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, sec_number); 634 634 635 635 /* __________________For debugging purposes only ____________________________________ 636 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sec_number); 637 - debug ("subordinate number after write/read is %x\n", sec_number); 636 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sec_number); 637 + debug("subordinate number after write/read is %x\n", sec_number); 638 638 __________________________________________________________________________________*/ 639 639 640 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); 641 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); 642 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SEC_LATENCY_TIMER, LATENCY); 640 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_CACHE_LINE_SIZE, CACHE); 641 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_LATENCY_TIMER, LATENCY); 642 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_SEC_LATENCY_TIMER, LATENCY); 643 643 644 - debug ("func->busno is %x\n", func->busno); 645 - debug ("sec_number after writing is %x\n", sec_number); 644 + debug("func->busno is %x\n", func->busno); 645 + debug("sec_number after writing is %x\n", sec_number); 646 646 647 647 648 648 /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ··· 652 652 653 653 /* First we need to allocate mem/io for the bridge itself in case it needs it */ 654 654 for (count = 0; address[count]; count++) { /* for 2 BARs */ 655 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 656 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); 655 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 656 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); 657 657 658 658 if (!bar[count]) { 659 659 /* This BAR is not implemented */ 660 - debug ("so we come here then, eh?, count = %d\n", count); 660 + debug("so we come here then, eh?, count = %d\n", count); 661 661 continue; 662 662 } 663 663 // tmp_bar = bar[count]; 664 664 665 - debug ("Bar %d wants %x\n", count, bar[count]); 665 + debug("Bar %d wants %x\n", count, bar[count]); 666 666 667 667 if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { 668 668 /* This is IO */ 669 669 len[count] = bar[count] & 0xFFFFFFFC; 670 670 len[count] = ~len[count] + 1; 671 671 672 - debug ("len[count] in IO = %x\n", len[count]); 672 + debug("len[count] in IO = %x\n", len[count]); 673 673 674 674 bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 675 675 676 676 if (!bus_io[count]) { 677 - err ("out of system memory\n"); 677 + err("out of system memory\n"); 678 678 retval = -ENOMEM; 679 679 goto error; 680 680 } ··· 683 683 bus_io[count]->devfunc = PCI_DEVFN(func->device, 684 684 func->function); 685 685 bus_io[count]->len = len[count]; 686 - if (ibmphp_check_resource (bus_io[count], 0) == 0) { 687 - ibmphp_add_resource (bus_io[count]); 686 + if (ibmphp_check_resource(bus_io[count], 0) == 0) { 687 + ibmphp_add_resource(bus_io[count]); 688 688 func->io[count] = bus_io[count]; 689 689 } else { 690 - err ("cannot allocate requested io for bus %x, device %x, len %x\n", 690 + err("cannot allocate requested io for bus %x, device %x, len %x\n", 691 691 func->busno, func->device, len[count]); 692 - kfree (bus_io[count]); 692 + kfree(bus_io[count]); 693 693 return -EIO; 694 694 } 695 695 696 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->io[count]->start); 696 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->io[count]->start); 697 697 698 698 } else { 699 699 /* This is Memory */ ··· 702 702 len[count] = bar[count] & 0xFFFFFFF0; 703 703 len[count] = ~len[count] + 1; 704 704 705 - debug ("len[count] in PFMEM = %x\n", len[count]); 705 + debug("len[count] in PFMEM = %x\n", len[count]); 706 706 707 707 bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 708 708 if (!bus_pfmem[count]) { 709 - err ("out of system memory\n"); 709 + err("out of system memory\n"); 710 710 retval = -ENOMEM; 711 711 goto error; 712 712 } ··· 716 716 func->function); 717 717 bus_pfmem[count]->len = len[count]; 718 718 bus_pfmem[count]->fromMem = 0; 719 - if (ibmphp_check_resource (bus_pfmem[count], 0) == 0) { 720 - ibmphp_add_resource (bus_pfmem[count]); 719 + if (ibmphp_check_resource(bus_pfmem[count], 0) == 0) { 720 + ibmphp_add_resource(bus_pfmem[count]); 721 721 func->pfmem[count] = bus_pfmem[count]; 722 722 } else { 723 723 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); 724 724 if (!mem_tmp) { 725 - err ("out of system memory\n"); 725 + err("out of system memory\n"); 726 726 retval = -ENOMEM; 727 727 goto error; 728 728 } ··· 730 730 mem_tmp->busno = bus_pfmem[count]->busno; 731 731 mem_tmp->devfunc = bus_pfmem[count]->devfunc; 732 732 mem_tmp->len = bus_pfmem[count]->len; 733 - if (ibmphp_check_resource (mem_tmp, 0) == 0) { 734 - ibmphp_add_resource (mem_tmp); 733 + if (ibmphp_check_resource(mem_tmp, 0) == 0) { 734 + ibmphp_add_resource(mem_tmp); 735 735 bus_pfmem[count]->fromMem = 1; 736 736 bus_pfmem[count]->rangeno = mem_tmp->rangeno; 737 - ibmphp_add_pfmem_from_mem (bus_pfmem[count]); 737 + ibmphp_add_pfmem_from_mem(bus_pfmem[count]); 738 738 func->pfmem[count] = bus_pfmem[count]; 739 739 } else { 740 - err ("cannot allocate requested pfmem for bus %x, device %x, len %x\n", 740 + err("cannot allocate requested pfmem for bus %x, device %x, len %x\n", 741 741 func->busno, func->device, len[count]); 742 - kfree (mem_tmp); 743 - kfree (bus_pfmem[count]); 742 + kfree(mem_tmp); 743 + kfree(bus_pfmem[count]); 744 744 return -EIO; 745 745 } 746 746 } 747 747 748 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); 748 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); 749 749 750 750 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { 751 751 /* takes up another dword */ 752 752 count += 1; 753 753 /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ 754 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); 754 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); 755 755 756 756 } 757 757 } else { ··· 759 759 len[count] = bar[count] & 0xFFFFFFF0; 760 760 len[count] = ~len[count] + 1; 761 761 762 - debug ("len[count] in Memory is %x\n", len[count]); 762 + debug("len[count] in Memory is %x\n", len[count]); 763 763 764 764 bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 765 765 if (!bus_mem[count]) { 766 - err ("out of system memory\n"); 766 + err("out of system memory\n"); 767 767 retval = -ENOMEM; 768 768 goto error; 769 769 } ··· 772 772 bus_mem[count]->devfunc = PCI_DEVFN(func->device, 773 773 func->function); 774 774 bus_mem[count]->len = len[count]; 775 - if (ibmphp_check_resource (bus_mem[count], 0) == 0) { 776 - ibmphp_add_resource (bus_mem[count]); 775 + if (ibmphp_check_resource(bus_mem[count], 0) == 0) { 776 + ibmphp_add_resource(bus_mem[count]); 777 777 func->mem[count] = bus_mem[count]; 778 778 } else { 779 - err ("cannot allocate requested mem for bus %x, device %x, len %x\n", 779 + err("cannot allocate requested mem for bus %x, device %x, len %x\n", 780 780 func->busno, func->device, len[count]); 781 - kfree (bus_mem[count]); 781 + kfree(bus_mem[count]); 782 782 return -EIO; 783 783 } 784 784 785 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); 785 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], func->mem[count]->start); 786 786 787 787 if (bar[count] & PCI_BASE_ADDRESS_MEM_TYPE_64) { 788 788 /* takes up another dword */ 789 789 count += 1; 790 790 /* on the 2nd dword, write all 0s, since we can't handle them n.e.ways */ 791 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0x00000000); 791 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0x00000000); 792 792 793 793 } 794 794 } ··· 796 796 } /* end of for */ 797 797 798 798 /* Now need to see how much space the devices behind the bridge needed */ 799 - amount_needed = scan_behind_bridge (func, sec_number); 799 + amount_needed = scan_behind_bridge(func, sec_number); 800 800 if (amount_needed == NULL) 801 801 return -ENOMEM; 802 802 803 803 ibmphp_pci_bus->number = func->busno; 804 - debug ("after coming back from scan_behind_bridge\n"); 805 - debug ("amount_needed->not_correct = %x\n", amount_needed->not_correct); 806 - debug ("amount_needed->io = %x\n", amount_needed->io); 807 - debug ("amount_needed->mem = %x\n", amount_needed->mem); 808 - debug ("amount_needed->pfmem = %x\n", amount_needed->pfmem); 804 + debug("after coming back from scan_behind_bridge\n"); 805 + debug("amount_needed->not_correct = %x\n", amount_needed->not_correct); 806 + debug("amount_needed->io = %x\n", amount_needed->io); 807 + debug("amount_needed->mem = %x\n", amount_needed->mem); 808 + debug("amount_needed->pfmem = %x\n", amount_needed->pfmem); 809 809 810 810 if (amount_needed->not_correct) { 811 - debug ("amount_needed is not correct\n"); 811 + debug("amount_needed is not correct\n"); 812 812 for (count = 0; address[count]; count++) { 813 813 /* for 2 BARs */ 814 814 if (bus_io[count]) { 815 - ibmphp_remove_resource (bus_io[count]); 815 + ibmphp_remove_resource(bus_io[count]); 816 816 func->io[count] = NULL; 817 817 } else if (bus_pfmem[count]) { 818 - ibmphp_remove_resource (bus_pfmem[count]); 818 + ibmphp_remove_resource(bus_pfmem[count]); 819 819 func->pfmem[count] = NULL; 820 820 } else if (bus_mem[count]) { 821 - ibmphp_remove_resource (bus_mem[count]); 821 + ibmphp_remove_resource(bus_mem[count]); 822 822 func->mem[count] = NULL; 823 823 } 824 824 } 825 - kfree (amount_needed); 825 + kfree(amount_needed); 826 826 return -ENODEV; 827 827 } 828 828 829 829 if (!amount_needed->io) { 830 - debug ("it doesn't want IO?\n"); 830 + debug("it doesn't want IO?\n"); 831 831 flag_io = 1; 832 832 } else { 833 - debug ("it wants %x IO behind the bridge\n", amount_needed->io); 833 + debug("it wants %x IO behind the bridge\n", amount_needed->io); 834 834 io = kzalloc(sizeof(*io), GFP_KERNEL); 835 835 836 836 if (!io) { 837 - err ("out of system memory\n"); 837 + err("out of system memory\n"); 838 838 retval = -ENOMEM; 839 839 goto error; 840 840 } ··· 842 842 io->busno = func->busno; 843 843 io->devfunc = PCI_DEVFN(func->device, func->function); 844 844 io->len = amount_needed->io; 845 - if (ibmphp_check_resource (io, 1) == 0) { 846 - debug ("were we able to add io\n"); 847 - ibmphp_add_resource (io); 845 + if (ibmphp_check_resource(io, 1) == 0) { 846 + debug("were we able to add io\n"); 847 + ibmphp_add_resource(io); 848 848 flag_io = 1; 849 849 } 850 850 } 851 851 852 852 if (!amount_needed->mem) { 853 - debug ("it doesn't want n.e.memory?\n"); 853 + debug("it doesn't want n.e.memory?\n"); 854 854 flag_mem = 1; 855 855 } else { 856 - debug ("it wants %x memory behind the bridge\n", amount_needed->mem); 856 + debug("it wants %x memory behind the bridge\n", amount_needed->mem); 857 857 mem = kzalloc(sizeof(*mem), GFP_KERNEL); 858 858 if (!mem) { 859 - err ("out of system memory\n"); 859 + err("out of system memory\n"); 860 860 retval = -ENOMEM; 861 861 goto error; 862 862 } ··· 864 864 mem->busno = func->busno; 865 865 mem->devfunc = PCI_DEVFN(func->device, func->function); 866 866 mem->len = amount_needed->mem; 867 - if (ibmphp_check_resource (mem, 1) == 0) { 868 - ibmphp_add_resource (mem); 867 + if (ibmphp_check_resource(mem, 1) == 0) { 868 + ibmphp_add_resource(mem); 869 869 flag_mem = 1; 870 - debug ("were we able to add mem\n"); 870 + debug("were we able to add mem\n"); 871 871 } 872 872 } 873 873 874 874 if (!amount_needed->pfmem) { 875 - debug ("it doesn't want n.e.pfmem mem?\n"); 875 + debug("it doesn't want n.e.pfmem mem?\n"); 876 876 flag_pfmem = 1; 877 877 } else { 878 - debug ("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); 878 + debug("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); 879 879 pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL); 880 880 if (!pfmem) { 881 - err ("out of system memory\n"); 881 + err("out of system memory\n"); 882 882 retval = -ENOMEM; 883 883 goto error; 884 884 } ··· 887 887 pfmem->devfunc = PCI_DEVFN(func->device, func->function); 888 888 pfmem->len = amount_needed->pfmem; 889 889 pfmem->fromMem = 0; 890 - if (ibmphp_check_resource (pfmem, 1) == 0) { 891 - ibmphp_add_resource (pfmem); 890 + if (ibmphp_check_resource(pfmem, 1) == 0) { 891 + ibmphp_add_resource(pfmem); 892 892 flag_pfmem = 1; 893 893 } else { 894 894 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); 895 895 if (!mem_tmp) { 896 - err ("out of system memory\n"); 896 + err("out of system memory\n"); 897 897 retval = -ENOMEM; 898 898 goto error; 899 899 } ··· 901 901 mem_tmp->busno = pfmem->busno; 902 902 mem_tmp->devfunc = pfmem->devfunc; 903 903 mem_tmp->len = pfmem->len; 904 - if (ibmphp_check_resource (mem_tmp, 1) == 0) { 905 - ibmphp_add_resource (mem_tmp); 904 + if (ibmphp_check_resource(mem_tmp, 1) == 0) { 905 + ibmphp_add_resource(mem_tmp); 906 906 pfmem->fromMem = 1; 907 907 pfmem->rangeno = mem_tmp->rangeno; 908 - ibmphp_add_pfmem_from_mem (pfmem); 908 + ibmphp_add_pfmem_from_mem(pfmem); 909 909 flag_pfmem = 1; 910 910 } 911 911 } 912 912 } 913 913 914 - debug ("b4 if (flag_io && flag_mem && flag_pfmem)\n"); 915 - debug ("flag_io = %x, flag_mem = %x, flag_pfmem = %x\n", flag_io, flag_mem, flag_pfmem); 914 + debug("b4 if (flag_io && flag_mem && flag_pfmem)\n"); 915 + debug("flag_io = %x, flag_mem = %x, flag_pfmem = %x\n", flag_io, flag_mem, flag_pfmem); 916 916 917 917 if (flag_io && flag_mem && flag_pfmem) { 918 918 /* If on bootup, there was a bridged card in this slot, ··· 920 920 * back again, there's no way for us to remove the bus 921 921 * struct, so no need to kmalloc, can use existing node 922 922 */ 923 - bus = ibmphp_find_res_bus (sec_number); 923 + bus = ibmphp_find_res_bus(sec_number); 924 924 if (!bus) { 925 925 bus = kzalloc(sizeof(*bus), GFP_KERNEL); 926 926 if (!bus) { 927 - err ("out of system memory\n"); 927 + err("out of system memory\n"); 928 928 retval = -ENOMEM; 929 929 goto error; 930 930 } 931 931 bus->busno = sec_number; 932 - debug ("b4 adding new bus\n"); 933 - rc = add_new_bus (bus, io, mem, pfmem, func->busno); 932 + debug("b4 adding new bus\n"); 933 + rc = add_new_bus(bus, io, mem, pfmem, func->busno); 934 934 } else if (!(bus->rangeIO) && !(bus->rangeMem) && !(bus->rangePFMem)) 935 - rc = add_new_bus (bus, io, mem, pfmem, 0xFF); 935 + rc = add_new_bus(bus, io, mem, pfmem, 0xFF); 936 936 else { 937 - err ("expected bus structure not empty?\n"); 937 + err("expected bus structure not empty?\n"); 938 938 retval = -EIO; 939 939 goto error; 940 940 } 941 941 if (rc) { 942 942 if (rc == -ENOMEM) { 943 - ibmphp_remove_bus (bus, func->busno); 944 - kfree (amount_needed); 943 + ibmphp_remove_bus(bus, func->busno); 944 + kfree(amount_needed); 945 945 return rc; 946 946 } 947 947 retval = rc; 948 948 goto error; 949 949 } 950 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &io_base); 951 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &pfmem_base); 950 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, &io_base); 951 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &pfmem_base); 952 952 953 953 if ((io_base & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { 954 - debug ("io 32\n"); 954 + debug("io 32\n"); 955 955 need_io_upper = 1; 956 956 } 957 957 if ((pfmem_base & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { 958 - debug ("pfmem 64\n"); 958 + debug("pfmem 64\n"); 959 959 need_pfmem_upper = 1; 960 960 } 961 961 962 962 if (bus->noIORanges) { 963 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00 | bus->rangeIO->start >> 8); 964 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00 | bus->rangeIO->end >> 8); 963 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00 | bus->rangeIO->start >> 8); 964 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00 | bus->rangeIO->end >> 8); 965 965 966 966 /* _______________This is for debugging purposes only ____________________ 967 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &temp); 968 - debug ("io_base = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); 969 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &temp); 970 - debug ("io_limit = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); 967 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, &temp); 968 + debug("io_base = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); 969 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &temp); 970 + debug("io_limit = %x\n", (temp & PCI_IO_RANGE_TYPE_MASK) << 8); 971 971 ________________________________________________________________________*/ 972 972 973 973 if (need_io_upper) { /* since can't support n.e.ways */ 974 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, 0x0000); 975 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, 0x0000); 974 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, 0x0000); 975 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, 0x0000); 976 976 } 977 977 } else { 978 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00); 979 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00); 978 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00); 979 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00); 980 980 } 981 981 982 982 if (bus->noMemRanges) { 983 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0x0000 | bus->rangeMem->start >> 16); 984 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000 | bus->rangeMem->end >> 16); 983 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0x0000 | bus->rangeMem->start >> 16); 984 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000 | bus->rangeMem->end >> 16); 985 985 986 986 /* ____________________This is for debugging purposes only ________________________ 987 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &temp); 988 - debug ("mem_base = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 989 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &temp); 990 - debug ("mem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 987 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &temp); 988 + debug("mem_base = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 989 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &temp); 990 + debug("mem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 991 991 __________________________________________________________________________________*/ 992 992 993 993 } else { 994 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0xffff); 995 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000); 994 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0xffff); 995 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000); 996 996 } 997 997 if (bus->noPFMemRanges) { 998 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0x0000 | bus->rangePFMem->start >> 16); 999 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000 | bus->rangePFMem->end >> 16); 998 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0x0000 | bus->rangePFMem->start >> 16); 999 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000 | bus->rangePFMem->end >> 16); 1000 1000 1001 1001 /* __________________________This is for debugging purposes only _______________________ 1002 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &temp); 1003 - debug ("pfmem_base = %x", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 1004 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &temp); 1005 - debug ("pfmem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 1002 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &temp); 1003 + debug("pfmem_base = %x", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 1004 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &temp); 1005 + debug("pfmem_limit = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); 1006 1006 ______________________________________________________________________________________*/ 1007 1007 1008 1008 if (need_pfmem_upper) { /* since can't support n.e.ways */ 1009 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, 0x00000000); 1010 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, 0x00000000); 1009 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, 0x00000000); 1010 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, 0x00000000); 1011 1011 } 1012 1012 } else { 1013 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0xffff); 1014 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000); 1013 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, 0xffff); 1014 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, 0x0000); 1015 1015 } 1016 1016 1017 - debug ("b4 writing control information\n"); 1017 + debug("b4 writing control information\n"); 1018 1018 1019 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); 1019 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq); 1020 1020 if ((irq > 0x00) && (irq < 0x05)) 1021 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); 1021 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); 1022 1022 /* 1023 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, ctrl); 1024 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_PARITY); 1025 - pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_SERR); 1023 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, ctrl); 1024 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_PARITY); 1025 + pci_bus_write_config_byte(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_SERR); 1026 1026 */ 1027 1027 1028 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); 1029 - pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, 0x07); 1028 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_COMMAND, DEVICEENABLE); 1029 + pci_bus_write_config_word(ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, 0x07); 1030 1030 for (i = 0; i < 32; i++) { 1031 1031 if (amount_needed->devices[i]) { 1032 - debug ("device where devices[i] is 1 = %x\n", i); 1032 + debug("device where devices[i] is 1 = %x\n", i); 1033 1033 func->devices[i] = 1; 1034 1034 } 1035 1035 } 1036 1036 func->bus = 1; /* For unconfiguring, to indicate it's PPB */ 1037 1037 func_passed = &func; 1038 - debug ("func->busno b4 returning is %x\n", func->busno); 1039 - debug ("func->busno b4 returning in the other structure is %x\n", (*func_passed)->busno); 1040 - kfree (amount_needed); 1038 + debug("func->busno b4 returning is %x\n", func->busno); 1039 + debug("func->busno b4 returning in the other structure is %x\n", (*func_passed)->busno); 1040 + kfree(amount_needed); 1041 1041 return 0; 1042 1042 } else { 1043 - err ("Configuring bridge was unsuccessful...\n"); 1043 + err("Configuring bridge was unsuccessful...\n"); 1044 1044 mem_tmp = NULL; 1045 1045 retval = -EIO; 1046 1046 goto error; ··· 1049 1049 error: 1050 1050 kfree(amount_needed); 1051 1051 if (pfmem) 1052 - ibmphp_remove_resource (pfmem); 1052 + ibmphp_remove_resource(pfmem); 1053 1053 if (io) 1054 - ibmphp_remove_resource (io); 1054 + ibmphp_remove_resource(io); 1055 1055 if (mem) 1056 - ibmphp_remove_resource (mem); 1056 + ibmphp_remove_resource(mem); 1057 1057 for (i = 0; i < 2; i++) { /* for 2 BARs */ 1058 1058 if (bus_io[i]) { 1059 - ibmphp_remove_resource (bus_io[i]); 1059 + ibmphp_remove_resource(bus_io[i]); 1060 1060 func->io[i] = NULL; 1061 1061 } else if (bus_pfmem[i]) { 1062 - ibmphp_remove_resource (bus_pfmem[i]); 1062 + ibmphp_remove_resource(bus_pfmem[i]); 1063 1063 func->pfmem[i] = NULL; 1064 1064 } else if (bus_mem[i]) { 1065 - ibmphp_remove_resource (bus_mem[i]); 1065 + ibmphp_remove_resource(bus_mem[i]); 1066 1066 func->mem[i] = NULL; 1067 1067 } 1068 1068 } ··· 1075 1075 * Input: bridge function 1076 1076 * Output: amount of resources needed 1077 1077 *****************************************************************************/ 1078 - static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) 1078 + static struct res_needed *scan_behind_bridge(struct pci_func *func, u8 busno) 1079 1079 { 1080 1080 int count, len[6]; 1081 1081 u16 vendor_id; ··· 1102 1102 1103 1103 ibmphp_pci_bus->number = busno; 1104 1104 1105 - debug ("the bus_no behind the bridge is %x\n", busno); 1106 - debug ("scanning devices behind the bridge...\n"); 1105 + debug("the bus_no behind the bridge is %x\n", busno); 1106 + debug("scanning devices behind the bridge...\n"); 1107 1107 for (device = 0; device < 32; device++) { 1108 1108 amount->devices[device] = 0; 1109 1109 for (function = 0; function < 8; function++) { 1110 1110 devfn = PCI_DEVFN(device, function); 1111 1111 1112 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 1112 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 1113 1113 1114 1114 if (vendor_id != PCI_VENDOR_ID_NOTVALID) { 1115 1115 /* found correct device!!! */ 1116 1116 howmany++; 1117 1117 1118 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 1119 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); 1118 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 1119 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); 1120 1120 1121 - debug ("hdr_type behind the bridge is %x\n", hdr_type); 1121 + debug("hdr_type behind the bridge is %x\n", hdr_type); 1122 1122 if (hdr_type & PCI_HEADER_TYPE_BRIDGE) { 1123 - err ("embedded bridges not supported for hot-plugging.\n"); 1123 + err("embedded bridges not supported for hot-plugging.\n"); 1124 1124 amount->not_correct = 1; 1125 1125 return amount; 1126 1126 } 1127 1127 1128 1128 class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ 1129 1129 if (class == PCI_CLASS_NOT_DEFINED_VGA) { 1130 - err ("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device); 1130 + err("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device); 1131 1131 amount->not_correct = 1; 1132 1132 return amount; 1133 1133 } else if (class == PCI_CLASS_DISPLAY_VGA) { 1134 - err ("The device %x is not supported for hot plugging. Please choose another device.\n", device); 1134 + err("The device %x is not supported for hot plugging. Please choose another device.\n", device); 1135 1135 amount->not_correct = 1; 1136 1136 return amount; 1137 1137 } ··· 1141 1141 for (count = 0; address[count]; count++) { 1142 1142 /* for 6 BARs */ 1143 1143 /* 1144 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, address[count], &tmp); 1144 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, address[count], &tmp); 1145 1145 if (tmp & 0x01) // IO 1146 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFD); 1146 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFD); 1147 1147 else // MEMORY 1148 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 1148 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 1149 1149 */ 1150 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 1151 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]); 1150 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 1151 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &bar[count]); 1152 1152 1153 - debug ("what is bar[count]? %x, count = %d\n", bar[count], count); 1153 + debug("what is bar[count]? %x, count = %d\n", bar[count], count); 1154 1154 1155 1155 if (!bar[count]) /* This BAR is not implemented */ 1156 1156 continue; 1157 1157 1158 1158 //tmp_bar = bar[count]; 1159 1159 1160 - debug ("count %d device %x function %x wants %x resources\n", count, device, function, bar[count]); 1160 + debug("count %d device %x function %x wants %x resources\n", count, device, function, bar[count]); 1161 1161 1162 1162 if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) { 1163 1163 /* This is IO */ ··· 1211 1211 * Change: we also call these functions even if we configured the card ourselves (i.e., not 1212 1212 * the bootup case), since it should work same way 1213 1213 */ 1214 - static int unconfigure_boot_device (u8 busno, u8 device, u8 function) 1214 + static int unconfigure_boot_device(u8 busno, u8 device, u8 function) 1215 1215 { 1216 1216 u32 start_address; 1217 1217 u32 address[] = { ··· 1234 1234 u32 tmp_address; 1235 1235 unsigned int devfn; 1236 1236 1237 - debug ("%s - enter\n", __func__); 1237 + debug("%s - enter\n", __func__); 1238 1238 1239 - bus = ibmphp_find_res_bus (busno); 1239 + bus = ibmphp_find_res_bus(busno); 1240 1240 if (!bus) { 1241 - debug ("cannot find corresponding bus.\n"); 1241 + debug("cannot find corresponding bus.\n"); 1242 1242 return -EINVAL; 1243 1243 } 1244 1244 1245 1245 devfn = PCI_DEVFN(device, function); 1246 1246 ibmphp_pci_bus->number = busno; 1247 1247 for (count = 0; address[count]; count++) { /* for 6 BARs */ 1248 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &start_address); 1248 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &start_address); 1249 1249 1250 1250 /* We can do this here, b/c by that time the device driver of the card has been stopped */ 1251 1251 1252 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 1253 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &size); 1254 - pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], start_address); 1252 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); 1253 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &size); 1254 + pci_bus_write_config_dword(ibmphp_pci_bus, devfn, address[count], start_address); 1255 1255 1256 - debug ("start_address is %x\n", start_address); 1257 - debug ("busno, device, function %x %x %x\n", busno, device, function); 1256 + debug("start_address is %x\n", start_address); 1257 + debug("busno, device, function %x %x %x\n", busno, device, function); 1258 1258 if (!size) { 1259 1259 /* This BAR is not implemented */ 1260 - debug ("is this bar no implemented?, count = %d\n", count); 1260 + debug("is this bar no implemented?, count = %d\n", count); 1261 1261 continue; 1262 1262 } 1263 1263 tmp_address = start_address; ··· 1267 1267 size = size & 0xFFFFFFFC; 1268 1268 size = ~size + 1; 1269 1269 end_address = start_address + size - 1; 1270 - if (ibmphp_find_resource (bus, start_address, &io, IO) < 0) { 1271 - err ("cannot find corresponding IO resource to remove\n"); 1270 + if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { 1271 + err("cannot find corresponding IO resource to remove\n"); 1272 1272 return -EIO; 1273 1273 } 1274 - debug ("io->start = %x\n", io->start); 1274 + debug("io->start = %x\n", io->start); 1275 1275 temp_end = io->end; 1276 1276 start_address = io->end + 1; 1277 - ibmphp_remove_resource (io); 1277 + ibmphp_remove_resource(io); 1278 1278 /* This is needed b/c of the old I/O restrictions in the BIOS */ 1279 1279 while (temp_end < end_address) { 1280 - if (ibmphp_find_resource (bus, start_address, &io, IO) < 0) { 1281 - err ("cannot find corresponding IO resource to remove\n"); 1280 + if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { 1281 + err("cannot find corresponding IO resource to remove\n"); 1282 1282 return -EIO; 1283 1283 } 1284 - debug ("io->start = %x\n", io->start); 1284 + debug("io->start = %x\n", io->start); 1285 1285 temp_end = io->end; 1286 1286 start_address = io->end + 1; 1287 - ibmphp_remove_resource (io); 1287 + ibmphp_remove_resource(io); 1288 1288 } 1289 1289 1290 1290 /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ ··· 1292 1292 /* This is Memory */ 1293 1293 if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { 1294 1294 /* pfmem */ 1295 - debug ("start address of pfmem is %x\n", start_address); 1295 + debug("start address of pfmem is %x\n", start_address); 1296 1296 start_address &= PCI_BASE_ADDRESS_MEM_MASK; 1297 1297 1298 - if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { 1299 - err ("cannot find corresponding PFMEM resource to remove\n"); 1298 + if (ibmphp_find_resource(bus, start_address, &pfmem, PFMEM) < 0) { 1299 + err("cannot find corresponding PFMEM resource to remove\n"); 1300 1300 return -EIO; 1301 1301 } 1302 1302 if (pfmem) { 1303 - debug ("pfmem->start = %x\n", pfmem->start); 1303 + debug("pfmem->start = %x\n", pfmem->start); 1304 1304 1305 1305 ibmphp_remove_resource(pfmem); 1306 1306 } 1307 1307 } else { 1308 1308 /* regular memory */ 1309 - debug ("start address of mem is %x\n", start_address); 1309 + debug("start address of mem is %x\n", start_address); 1310 1310 start_address &= PCI_BASE_ADDRESS_MEM_MASK; 1311 1311 1312 - if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { 1313 - err ("cannot find corresponding MEM resource to remove\n"); 1312 + if (ibmphp_find_resource(bus, start_address, &mem, MEM) < 0) { 1313 + err("cannot find corresponding MEM resource to remove\n"); 1314 1314 return -EIO; 1315 1315 } 1316 1316 if (mem) { 1317 - debug ("mem->start = %x\n", mem->start); 1317 + debug("mem->start = %x\n", mem->start); 1318 1318 1319 1319 ibmphp_remove_resource(mem); 1320 1320 } ··· 1329 1329 return 0; 1330 1330 } 1331 1331 1332 - static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) 1332 + static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function) 1333 1333 { 1334 1334 int count; 1335 1335 int bus_no, pri_no, sub_no, sec_no = 0; ··· 1349 1349 devfn = PCI_DEVFN(device, function); 1350 1350 ibmphp_pci_bus->number = busno; 1351 1351 bus_no = (int) busno; 1352 - debug ("busno is %x\n", busno); 1353 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); 1354 - debug ("%s - busno = %x, primary_number = %x\n", __func__, busno, pri_number); 1352 + debug("busno is %x\n", busno); 1353 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_PRIMARY_BUS, &pri_number); 1354 + debug("%s - busno = %x, primary_number = %x\n", __func__, busno, pri_number); 1355 1355 1356 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 1357 - debug ("sec_number is %x\n", sec_number); 1356 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number); 1357 + debug("sec_number is %x\n", sec_number); 1358 1358 sec_no = (int) sec_number; 1359 1359 pri_no = (int) pri_number; 1360 1360 if (pri_no != bus_no) { 1361 - err ("primary numbers in our structures and pci config space don't match.\n"); 1361 + err("primary numbers in our structures and pci config space don't match.\n"); 1362 1362 return -EINVAL; 1363 1363 } 1364 1364 1365 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sub_number); 1365 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sub_number); 1366 1366 sub_no = (int) sub_number; 1367 - debug ("sub_no is %d, sec_no is %d\n", sub_no, sec_no); 1367 + debug("sub_no is %d, sec_no is %d\n", sub_no, sec_no); 1368 1368 if (sec_no != sub_number) { 1369 - err ("there're more buses behind this bridge. Hot removal is not supported. Please choose another card\n"); 1369 + err("there're more buses behind this bridge. Hot removal is not supported. Please choose another card\n"); 1370 1370 return -ENODEV; 1371 1371 } 1372 1372 1373 - bus = ibmphp_find_res_bus (sec_number); 1373 + bus = ibmphp_find_res_bus(sec_number); 1374 1374 if (!bus) { 1375 - err ("cannot find Bus structure for the bridged device\n"); 1375 + err("cannot find Bus structure for the bridged device\n"); 1376 1376 return -EINVAL; 1377 1377 } 1378 1378 debug("bus->busno is %x\n", bus->busno); 1379 1379 debug("sec_number is %x\n", sec_number); 1380 1380 1381 - ibmphp_remove_bus (bus, busno); 1381 + ibmphp_remove_bus(bus, busno); 1382 1382 1383 1383 for (count = 0; address[count]; count++) { 1384 1384 /* for 2 BARs */ 1385 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &start_address); 1385 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, address[count], &start_address); 1386 1386 1387 1387 if (!start_address) { 1388 1388 /* This BAR is not implemented */ ··· 1394 1394 if (start_address & PCI_BASE_ADDRESS_SPACE_IO) { 1395 1395 /* This is IO */ 1396 1396 start_address &= PCI_BASE_ADDRESS_IO_MASK; 1397 - if (ibmphp_find_resource (bus, start_address, &io, IO) < 0) { 1398 - err ("cannot find corresponding IO resource to remove\n"); 1397 + if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { 1398 + err("cannot find corresponding IO resource to remove\n"); 1399 1399 return -EIO; 1400 1400 } 1401 1401 if (io) 1402 - debug ("io->start = %x\n", io->start); 1402 + debug("io->start = %x\n", io->start); 1403 1403 1404 - ibmphp_remove_resource (io); 1404 + ibmphp_remove_resource(io); 1405 1405 1406 1406 /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ 1407 1407 } else { ··· 1409 1409 if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { 1410 1410 /* pfmem */ 1411 1411 start_address &= PCI_BASE_ADDRESS_MEM_MASK; 1412 - if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { 1413 - err ("cannot find corresponding PFMEM resource to remove\n"); 1412 + if (ibmphp_find_resource(bus, start_address, &pfmem, PFMEM) < 0) { 1413 + err("cannot find corresponding PFMEM resource to remove\n"); 1414 1414 return -EINVAL; 1415 1415 } 1416 1416 if (pfmem) { 1417 - debug ("pfmem->start = %x\n", pfmem->start); 1417 + debug("pfmem->start = %x\n", pfmem->start); 1418 1418 1419 1419 ibmphp_remove_resource(pfmem); 1420 1420 } 1421 1421 } else { 1422 1422 /* regular memory */ 1423 1423 start_address &= PCI_BASE_ADDRESS_MEM_MASK; 1424 - if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { 1425 - err ("cannot find corresponding MEM resource to remove\n"); 1424 + if (ibmphp_find_resource(bus, start_address, &mem, MEM) < 0) { 1425 + err("cannot find corresponding MEM resource to remove\n"); 1426 1426 return -EINVAL; 1427 1427 } 1428 1428 if (mem) { 1429 - debug ("mem->start = %x\n", mem->start); 1429 + debug("mem->start = %x\n", mem->start); 1430 1430 1431 1431 ibmphp_remove_resource(mem); 1432 1432 } ··· 1437 1437 } 1438 1438 } /* end of mem */ 1439 1439 } /* end of for */ 1440 - debug ("%s - exiting, returning success\n", __func__); 1440 + debug("%s - exiting, returning success\n", __func__); 1441 1441 return 0; 1442 1442 } 1443 1443 1444 - static int unconfigure_boot_card (struct slot *slot_cur) 1444 + static int unconfigure_boot_card(struct slot *slot_cur) 1445 1445 { 1446 1446 u16 vendor_id; 1447 1447 u32 class; ··· 1453 1453 unsigned int devfn; 1454 1454 u8 valid_device = 0x00; /* To see if we are ever able to find valid device and read it */ 1455 1455 1456 - debug ("%s - enter\n", __func__); 1456 + debug("%s - enter\n", __func__); 1457 1457 1458 1458 device = slot_cur->device; 1459 1459 busno = slot_cur->bus; 1460 1460 1461 - debug ("b4 for loop, device is %x\n", device); 1461 + debug("b4 for loop, device is %x\n", device); 1462 1462 /* For every function on the card */ 1463 1463 for (function = 0x0; function < 0x08; function++) { 1464 1464 devfn = PCI_DEVFN(device, function); 1465 1465 ibmphp_pci_bus->number = busno; 1466 1466 1467 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 1467 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 1468 1468 1469 1469 if (vendor_id != PCI_VENDOR_ID_NOTVALID) { 1470 1470 /* found correct device!!! */ 1471 1471 ++valid_device; 1472 1472 1473 - debug ("%s - found correct device\n", __func__); 1473 + debug("%s - found correct device\n", __func__); 1474 1474 1475 1475 /* header: x x x x x x x x 1476 1476 * | |___________|=> 1=PPB bridge, 0=normal device, 2=CardBus Bridge 1477 1477 * |_=> 0 = single function device, 1 = multi-function device 1478 1478 */ 1479 1479 1480 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 1481 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); 1480 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 1481 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class); 1482 1482 1483 - debug ("hdr_type %x, class %x\n", hdr_type, class); 1483 + debug("hdr_type %x, class %x\n", hdr_type, class); 1484 1484 class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ 1485 1485 if (class == PCI_CLASS_NOT_DEFINED_VGA) { 1486 - err ("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function); 1486 + err("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function); 1487 1487 return -ENODEV; 1488 1488 } else if (class == PCI_CLASS_DISPLAY_VGA) { 1489 - err ("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function); 1489 + err("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function); 1490 1490 return -ENODEV; 1491 1491 } 1492 1492 1493 1493 switch (hdr_type) { 1494 1494 case PCI_HEADER_TYPE_NORMAL: 1495 - rc = unconfigure_boot_device (busno, device, function); 1495 + rc = unconfigure_boot_device(busno, device, function); 1496 1496 if (rc) { 1497 - err ("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", 1497 + err("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", 1498 1498 device, function, busno); 1499 1499 return rc; 1500 1500 } 1501 1501 function = 0x8; 1502 1502 break; 1503 1503 case PCI_HEADER_TYPE_MULTIDEVICE: 1504 - rc = unconfigure_boot_device (busno, device, function); 1504 + rc = unconfigure_boot_device(busno, device, function); 1505 1505 if (rc) { 1506 - err ("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", 1506 + err("was not able to unconfigure device %x func %x on bus %x. bailing out...\n", 1507 1507 device, function, busno); 1508 1508 return rc; 1509 1509 } ··· 1511 1511 case PCI_HEADER_TYPE_BRIDGE: 1512 1512 class >>= 8; 1513 1513 if (class != PCI_CLASS_BRIDGE_PCI) { 1514 - err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); 1514 + err("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); 1515 1515 return -ENODEV; 1516 1516 } 1517 - rc = unconfigure_boot_bridge (busno, device, function); 1517 + rc = unconfigure_boot_bridge(busno, device, function); 1518 1518 if (rc != 0) { 1519 - err ("was not able to hot-remove PPB properly.\n"); 1519 + err("was not able to hot-remove PPB properly.\n"); 1520 1520 return rc; 1521 1521 } 1522 1522 ··· 1525 1525 case PCI_HEADER_TYPE_MULTIBRIDGE: 1526 1526 class >>= 8; 1527 1527 if (class != PCI_CLASS_BRIDGE_PCI) { 1528 - err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); 1528 + err("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); 1529 1529 return -ENODEV; 1530 1530 } 1531 - rc = unconfigure_boot_bridge (busno, device, function); 1531 + rc = unconfigure_boot_bridge(busno, device, function); 1532 1532 if (rc != 0) { 1533 - err ("was not able to hot-remove PPB properly.\n"); 1533 + err("was not able to hot-remove PPB properly.\n"); 1534 1534 return rc; 1535 1535 } 1536 1536 break; 1537 1537 default: 1538 - err ("MAJOR PROBLEM!!!! Cannot read device's header\n"); 1538 + err("MAJOR PROBLEM!!!! Cannot read device's header\n"); 1539 1539 return -1; 1540 1540 break; 1541 1541 } /* end of switch */ ··· 1543 1543 } /* end of for */ 1544 1544 1545 1545 if (!valid_device) { 1546 - err ("Could not find device to unconfigure. Or could not read the card.\n"); 1546 + err("Could not find device to unconfigure. Or could not read the card.\n"); 1547 1547 return -1; 1548 1548 } 1549 1549 return 0; ··· 1558 1558 * !!!!!!!!!!!!!!!!!!!!!!!!!FOR BUSES!!!!!!!!!!!! 1559 1559 * Returns: 0, -1, -ENODEV 1560 1560 */ 1561 - int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) 1561 + int ibmphp_unconfigure_card(struct slot **slot_cur, int the_end) 1562 1562 { 1563 1563 int i; 1564 1564 int count; ··· 1567 1567 struct pci_func *cur_func = NULL; 1568 1568 struct pci_func *temp_func; 1569 1569 1570 - debug ("%s - enter\n", __func__); 1570 + debug("%s - enter\n", __func__); 1571 1571 1572 1572 if (!the_end) { 1573 1573 /* Need to unconfigure the card */ 1574 - rc = unconfigure_boot_card (sl); 1574 + rc = unconfigure_boot_card(sl); 1575 1575 if ((rc == -ENODEV) || (rc == -EIO) || (rc == -EINVAL)) { 1576 1576 /* In all other cases, will still need to get rid of func structure if it exists */ 1577 1577 return rc; ··· 1591 1591 1592 1592 for (i = 0; i < count; i++) { 1593 1593 if (cur_func->io[i]) { 1594 - debug ("io[%d] exists\n", i); 1594 + debug("io[%d] exists\n", i); 1595 1595 if (the_end > 0) 1596 - ibmphp_remove_resource (cur_func->io[i]); 1596 + ibmphp_remove_resource(cur_func->io[i]); 1597 1597 cur_func->io[i] = NULL; 1598 1598 } 1599 1599 if (cur_func->mem[i]) { 1600 - debug ("mem[%d] exists\n", i); 1600 + debug("mem[%d] exists\n", i); 1601 1601 if (the_end > 0) 1602 - ibmphp_remove_resource (cur_func->mem[i]); 1602 + ibmphp_remove_resource(cur_func->mem[i]); 1603 1603 cur_func->mem[i] = NULL; 1604 1604 } 1605 1605 if (cur_func->pfmem[i]) { 1606 - debug ("pfmem[%d] exists\n", i); 1606 + debug("pfmem[%d] exists\n", i); 1607 1607 if (the_end > 0) 1608 - ibmphp_remove_resource (cur_func->pfmem[i]); 1608 + ibmphp_remove_resource(cur_func->pfmem[i]); 1609 1609 cur_func->pfmem[i] = NULL; 1610 1610 } 1611 1611 } 1612 1612 1613 1613 temp_func = cur_func->next; 1614 - kfree (cur_func); 1614 + kfree(cur_func); 1615 1615 cur_func = temp_func; 1616 1616 } 1617 1617 } 1618 1618 1619 1619 sl->func = NULL; 1620 1620 *slot_cur = sl; 1621 - debug ("%s - exit\n", __func__); 1621 + debug("%s - exit\n", __func__); 1622 1622 return 0; 1623 1623 } 1624 1624 ··· 1630 1630 * Output: bus added to the correct spot 1631 1631 * 0, -1, error 1632 1632 */ 1633 - static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct resource_node *mem, struct resource_node *pfmem, u8 parent_busno) 1633 + static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct resource_node *mem, struct resource_node *pfmem, u8 parent_busno) 1634 1634 { 1635 1635 struct range_node *io_range = NULL; 1636 1636 struct range_node *mem_range = NULL; ··· 1639 1639 1640 1640 /* Trying to find the parent bus number */ 1641 1641 if (parent_busno != 0xFF) { 1642 - cur_bus = ibmphp_find_res_bus (parent_busno); 1642 + cur_bus = ibmphp_find_res_bus(parent_busno); 1643 1643 if (!cur_bus) { 1644 - err ("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n"); 1644 + err("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n"); 1645 1645 return -ENODEV; 1646 1646 } 1647 1647 1648 - list_add (&bus->bus_list, &cur_bus->bus_list); 1648 + list_add(&bus->bus_list, &cur_bus->bus_list); 1649 1649 } 1650 1650 if (io) { 1651 1651 io_range = kzalloc(sizeof(*io_range), GFP_KERNEL); 1652 1652 if (!io_range) { 1653 - err ("out of system memory\n"); 1653 + err("out of system memory\n"); 1654 1654 return -ENOMEM; 1655 1655 } 1656 1656 io_range->start = io->start; ··· 1662 1662 if (mem) { 1663 1663 mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL); 1664 1664 if (!mem_range) { 1665 - err ("out of system memory\n"); 1665 + err("out of system memory\n"); 1666 1666 return -ENOMEM; 1667 1667 } 1668 1668 mem_range->start = mem->start; ··· 1674 1674 if (pfmem) { 1675 1675 pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); 1676 1676 if (!pfmem_range) { 1677 - err ("out of system memory\n"); 1677 + err("out of system memory\n"); 1678 1678 return -ENOMEM; 1679 1679 } 1680 1680 pfmem_range->start = pfmem->start; ··· 1691 1691 * Parameters: bus_number of the primary bus 1692 1692 * Returns: bus_number of the secondary bus or 0xff in case of failure 1693 1693 */ 1694 - static u8 find_sec_number (u8 primary_busno, u8 slotno) 1694 + static u8 find_sec_number(u8 primary_busno, u8 slotno) 1695 1695 { 1696 1696 int min, max; 1697 1697 u8 busno; 1698 1698 struct bus_info *bus; 1699 1699 struct bus_node *bus_cur; 1700 1700 1701 - bus = ibmphp_find_same_bus_num (primary_busno); 1701 + bus = ibmphp_find_same_bus_num(primary_busno); 1702 1702 if (!bus) { 1703 - err ("cannot get slot range of the bus from the BIOS\n"); 1703 + err("cannot get slot range of the bus from the BIOS\n"); 1704 1704 return 0xff; 1705 1705 } 1706 1706 max = bus->slot_max; 1707 1707 min = bus->slot_min; 1708 1708 if ((slotno > max) || (slotno < min)) { 1709 - err ("got the wrong range\n"); 1709 + err("got the wrong range\n"); 1710 1710 return 0xff; 1711 1711 } 1712 1712 busno = (u8) (slotno - (u8) min); 1713 1713 busno += primary_busno + 0x01; 1714 - bus_cur = ibmphp_find_res_bus (busno); 1714 + bus_cur = ibmphp_find_res_bus(busno); 1715 1715 /* either there is no such bus number, or there are no ranges, which 1716 1716 * can only happen if we removed the bridged device in previous load 1717 1717 * of the driver, and now only have the skeleton bus struct
+259 -259
drivers/pci/hotplug/ibmphp_res.c
··· 36 36 37 37 static int flags = 0; /* for testing */ 38 38 39 - static void update_resources (struct bus_node *bus_cur, int type, int rangeno); 40 - static int once_over (void); 41 - static int remove_ranges (struct bus_node *, struct bus_node *); 42 - static int update_bridge_ranges (struct bus_node **); 43 - static int add_bus_range (int type, struct range_node *, struct bus_node *); 44 - static void fix_resources (struct bus_node *); 45 - static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8); 39 + static void update_resources(struct bus_node *bus_cur, int type, int rangeno); 40 + static int once_over(void); 41 + static int remove_ranges(struct bus_node *, struct bus_node *); 42 + static int update_bridge_ranges(struct bus_node **); 43 + static int add_bus_range(int type, struct range_node *, struct bus_node *); 44 + static void fix_resources(struct bus_node *); 45 + static struct bus_node *find_bus_wprev(u8, struct bus_node **, u8); 46 46 47 47 static LIST_HEAD(gbuses); 48 48 49 - static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc *curr, u8 busno, int flag) 49 + static struct bus_node * __init alloc_error_bus(struct ebda_pci_rsrc *curr, u8 busno, int flag) 50 50 { 51 51 struct bus_node *newbus; 52 52 53 53 if (!(curr) && !(flag)) { 54 - err ("NULL pointer passed\n"); 54 + err("NULL pointer passed\n"); 55 55 return NULL; 56 56 } 57 57 58 58 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); 59 59 if (!newbus) { 60 - err ("out of system memory\n"); 60 + err("out of system memory\n"); 61 61 return NULL; 62 62 } 63 63 ··· 65 65 newbus->busno = busno; 66 66 else 67 67 newbus->busno = curr->bus_num; 68 - list_add_tail (&newbus->bus_list, &gbuses); 68 + list_add_tail(&newbus->bus_list, &gbuses); 69 69 return newbus; 70 70 } 71 71 72 - static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc *curr) 72 + static struct resource_node * __init alloc_resources(struct ebda_pci_rsrc *curr) 73 73 { 74 74 struct resource_node *rs; 75 75 76 76 if (!curr) { 77 - err ("NULL passed to allocate\n"); 77 + err("NULL passed to allocate\n"); 78 78 return NULL; 79 79 } 80 80 81 81 rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 82 82 if (!rs) { 83 - err ("out of system memory\n"); 83 + err("out of system memory\n"); 84 84 return NULL; 85 85 } 86 86 rs->busno = curr->bus_num; ··· 91 91 return rs; 92 92 } 93 93 94 - static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) 94 + static int __init alloc_bus_range(struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) 95 95 { 96 96 struct bus_node *newbus; 97 97 struct range_node *newrange; ··· 100 100 if (first_bus) { 101 101 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); 102 102 if (!newbus) { 103 - err ("out of system memory.\n"); 103 + err("out of system memory.\n"); 104 104 return -ENOMEM; 105 105 } 106 106 newbus->busno = curr->bus_num; ··· 122 122 newrange = kzalloc(sizeof(struct range_node), GFP_KERNEL); 123 123 if (!newrange) { 124 124 if (first_bus) 125 - kfree (newbus); 126 - err ("out of system memory\n"); 125 + kfree(newbus); 126 + err("out of system memory\n"); 127 127 return -ENOMEM; 128 128 } 129 129 newrange->start = curr->start_addr; ··· 133 133 newrange->rangeno = 1; 134 134 else { 135 135 /* need to insert our range */ 136 - add_bus_range (flag, newrange, newbus); 137 - debug ("%d resource Primary Bus inserted on bus %x [%x - %x]\n", flag, newbus->busno, newrange->start, newrange->end); 136 + add_bus_range(flag, newrange, newbus); 137 + debug("%d resource Primary Bus inserted on bus %x [%x - %x]\n", flag, newbus->busno, newrange->start, newrange->end); 138 138 } 139 139 140 140 switch (flag) { ··· 143 143 if (first_bus) 144 144 newbus->noMemRanges = 1; 145 145 else { 146 - debug ("First Memory Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 146 + debug("First Memory Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 147 147 ++newbus->noMemRanges; 148 - fix_resources (newbus); 148 + fix_resources(newbus); 149 149 } 150 150 break; 151 151 case IO: ··· 153 153 if (first_bus) 154 154 newbus->noIORanges = 1; 155 155 else { 156 - debug ("First IO Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 156 + debug("First IO Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 157 157 ++newbus->noIORanges; 158 - fix_resources (newbus); 158 + fix_resources(newbus); 159 159 } 160 160 break; 161 161 case PFMEM: ··· 163 163 if (first_bus) 164 164 newbus->noPFMemRanges = 1; 165 165 else { 166 - debug ("1st PFMemory Primary on Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 166 + debug("1st PFMemory Primary on Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 167 167 ++newbus->noPFMemRanges; 168 - fix_resources (newbus); 168 + fix_resources(newbus); 169 169 } 170 170 171 171 break; ··· 183 183 * 2. If cannot allocate out of PFMem range, allocate from Mem ranges. PFmemFromMem 184 184 * are not sorted. (no need since use mem node). To not change the entire code, we 185 185 * also add mem node whenever this case happens so as not to change 186 - * ibmphp_check_mem_resource etc (and since it really is taking Mem resource) 186 + * ibmphp_check_mem_resource etc(and since it really is taking Mem resource) 187 187 */ 188 188 189 189 /***************************************************************************** ··· 196 196 * Input: ptr to the head of the resource list from EBDA 197 197 * Output: 0, -1 or error codes 198 198 ***************************************************************************/ 199 - int __init ibmphp_rsrc_init (void) 199 + int __init ibmphp_rsrc_init(void) 200 200 { 201 201 struct ebda_pci_rsrc *curr; 202 202 struct range_node *newrange = NULL; ··· 210 210 int rc; 211 211 struct list_head *tmp_ebda; 212 212 213 - list_for_each (tmp_ebda, &ibmphp_ebda_pci_rsrc_head) { 214 - curr = list_entry (tmp_ebda, struct ebda_pci_rsrc, ebda_pci_rsrc_list); 213 + list_for_each(tmp_ebda, &ibmphp_ebda_pci_rsrc_head) { 214 + curr = list_entry(tmp_ebda, struct ebda_pci_rsrc, ebda_pci_rsrc_list); 215 215 if (!(curr->rsrc_type & PCIDEVMASK)) { 216 216 /* EBDA still lists non PCI devices, so ignore... */ 217 - debug ("this is not a PCI DEVICE in rsrc_init, please take care\n"); 217 + debug("this is not a PCI DEVICE in rsrc_init, please take care\n"); 218 218 // continue; 219 219 } 220 220 ··· 223 223 /* memory */ 224 224 if ((curr->rsrc_type & RESTYPE) == MMASK) { 225 225 /* no bus structure exists in place yet */ 226 - if (list_empty (&gbuses)) { 226 + if (list_empty(&gbuses)) { 227 227 rc = alloc_bus_range(&newbus, &newrange, curr, MEM, 1); 228 228 if (rc) 229 229 return rc; 230 - list_add_tail (&newbus->bus_list, &gbuses); 231 - debug ("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 230 + list_add_tail(&newbus->bus_list, &gbuses); 231 + debug("gbuses = NULL, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 232 232 } else { 233 - bus_cur = find_bus_wprev (curr->bus_num, &bus_prev, 1); 233 + bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); 234 234 /* found our bus */ 235 235 if (bus_cur) { 236 - rc = alloc_bus_range (&bus_cur, &newrange, curr, MEM, 0); 236 + rc = alloc_bus_range(&bus_cur, &newrange, curr, MEM, 0); 237 237 if (rc) 238 238 return rc; 239 239 } else { ··· 242 242 if (rc) 243 243 return rc; 244 244 245 - list_add_tail (&newbus->bus_list, &gbuses); 246 - debug ("New Bus, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 245 + list_add_tail(&newbus->bus_list, &gbuses); 246 + debug("New Bus, Memory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 247 247 } 248 248 } 249 249 } else if ((curr->rsrc_type & RESTYPE) == PFMASK) { 250 250 /* prefetchable memory */ 251 - if (list_empty (&gbuses)) { 251 + if (list_empty(&gbuses)) { 252 252 /* no bus structure exists in place yet */ 253 253 rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); 254 254 if (rc) 255 255 return rc; 256 - list_add_tail (&newbus->bus_list, &gbuses); 257 - debug ("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 256 + list_add_tail(&newbus->bus_list, &gbuses); 257 + debug("gbuses = NULL, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 258 258 } else { 259 - bus_cur = find_bus_wprev (curr->bus_num, &bus_prev, 1); 259 + bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); 260 260 if (bus_cur) { 261 261 /* found our bus */ 262 - rc = alloc_bus_range (&bus_cur, &newrange, curr, PFMEM, 0); 262 + rc = alloc_bus_range(&bus_cur, &newrange, curr, PFMEM, 0); 263 263 if (rc) 264 264 return rc; 265 265 } else { ··· 267 267 rc = alloc_bus_range(&newbus, &newrange, curr, PFMEM, 1); 268 268 if (rc) 269 269 return rc; 270 - list_add_tail (&newbus->bus_list, &gbuses); 271 - debug ("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 270 + list_add_tail(&newbus->bus_list, &gbuses); 271 + debug("1st Bus, PFMemory Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 272 272 } 273 273 } 274 274 } else if ((curr->rsrc_type & RESTYPE) == IOMASK) { 275 275 /* IO */ 276 - if (list_empty (&gbuses)) { 276 + if (list_empty(&gbuses)) { 277 277 /* no bus structure exists in place yet */ 278 278 rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); 279 279 if (rc) 280 280 return rc; 281 - list_add_tail (&newbus->bus_list, &gbuses); 282 - debug ("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 281 + list_add_tail(&newbus->bus_list, &gbuses); 282 + debug("gbuses = NULL, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 283 283 } else { 284 - bus_cur = find_bus_wprev (curr->bus_num, &bus_prev, 1); 284 + bus_cur = find_bus_wprev(curr->bus_num, &bus_prev, 1); 285 285 if (bus_cur) { 286 - rc = alloc_bus_range (&bus_cur, &newrange, curr, IO, 0); 286 + rc = alloc_bus_range(&bus_cur, &newrange, curr, IO, 0); 287 287 if (rc) 288 288 return rc; 289 289 } else { ··· 291 291 rc = alloc_bus_range(&newbus, &newrange, curr, IO, 1); 292 292 if (rc) 293 293 return rc; 294 - list_add_tail (&newbus->bus_list, &gbuses); 295 - debug ("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 294 + list_add_tail(&newbus->bus_list, &gbuses); 295 + debug("1st Bus, IO Primary Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end); 296 296 } 297 297 } 298 298 ··· 304 304 /* regular pci device resource */ 305 305 if ((curr->rsrc_type & RESTYPE) == MMASK) { 306 306 /* Memory resource */ 307 - new_mem = alloc_resources (curr); 307 + new_mem = alloc_resources(curr); 308 308 if (!new_mem) 309 309 return -ENOMEM; 310 310 new_mem->type = MEM; ··· 315 315 * assign a -1 and then update once the range 316 316 * actually appears... 317 317 */ 318 - if (ibmphp_add_resource (new_mem) < 0) { 319 - newbus = alloc_error_bus (curr, 0, 0); 318 + if (ibmphp_add_resource(new_mem) < 0) { 319 + newbus = alloc_error_bus(curr, 0, 0); 320 320 if (!newbus) 321 321 return -ENOMEM; 322 322 newbus->firstMem = new_mem; 323 323 ++newbus->needMemUpdate; 324 324 new_mem->rangeno = -1; 325 325 } 326 - debug ("Memory resource for device %x, bus %x, [%x - %x]\n", new_mem->devfunc, new_mem->busno, new_mem->start, new_mem->end); 326 + debug("Memory resource for device %x, bus %x, [%x - %x]\n", new_mem->devfunc, new_mem->busno, new_mem->start, new_mem->end); 327 327 328 328 } else if ((curr->rsrc_type & RESTYPE) == PFMASK) { 329 329 /* PFMemory resource */ 330 - new_pfmem = alloc_resources (curr); 330 + new_pfmem = alloc_resources(curr); 331 331 if (!new_pfmem) 332 332 return -ENOMEM; 333 333 new_pfmem->type = PFMEM; 334 334 new_pfmem->fromMem = 0; 335 - if (ibmphp_add_resource (new_pfmem) < 0) { 336 - newbus = alloc_error_bus (curr, 0, 0); 335 + if (ibmphp_add_resource(new_pfmem) < 0) { 336 + newbus = alloc_error_bus(curr, 0, 0); 337 337 if (!newbus) 338 338 return -ENOMEM; 339 339 newbus->firstPFMem = new_pfmem; ··· 341 341 new_pfmem->rangeno = -1; 342 342 } 343 343 344 - debug ("PFMemory resource for device %x, bus %x, [%x - %x]\n", new_pfmem->devfunc, new_pfmem->busno, new_pfmem->start, new_pfmem->end); 344 + debug("PFMemory resource for device %x, bus %x, [%x - %x]\n", new_pfmem->devfunc, new_pfmem->busno, new_pfmem->start, new_pfmem->end); 345 345 } else if ((curr->rsrc_type & RESTYPE) == IOMASK) { 346 346 /* IO resource */ 347 - new_io = alloc_resources (curr); 347 + new_io = alloc_resources(curr); 348 348 if (!new_io) 349 349 return -ENOMEM; 350 350 new_io->type = IO; ··· 356 356 * Can assign a -1 and then update once the 357 357 * range actually appears... 358 358 */ 359 - if (ibmphp_add_resource (new_io) < 0) { 360 - newbus = alloc_error_bus (curr, 0, 0); 359 + if (ibmphp_add_resource(new_io) < 0) { 360 + newbus = alloc_error_bus(curr, 0, 0); 361 361 if (!newbus) 362 362 return -ENOMEM; 363 363 newbus->firstIO = new_io; 364 364 ++newbus->needIOUpdate; 365 365 new_io->rangeno = -1; 366 366 } 367 - debug ("IO resource for device %x, bus %x, [%x - %x]\n", new_io->devfunc, new_io->busno, new_io->start, new_io->end); 367 + debug("IO resource for device %x, bus %x, [%x - %x]\n", new_io->devfunc, new_io->busno, new_io->start, new_io->end); 368 368 } 369 369 } 370 370 } 371 371 372 - list_for_each (tmp, &gbuses) { 373 - bus_cur = list_entry (tmp, struct bus_node, bus_list); 372 + list_for_each(tmp, &gbuses) { 373 + bus_cur = list_entry(tmp, struct bus_node, bus_list); 374 374 /* This is to get info about PPB resources, since EBDA doesn't put this info into the primary bus info */ 375 - rc = update_bridge_ranges (&bus_cur); 375 + rc = update_bridge_ranges(&bus_cur); 376 376 if (rc) 377 377 return rc; 378 378 } 379 - return once_over (); /* This is to align ranges (so no -1) */ 379 + return once_over(); /* This is to align ranges (so no -1) */ 380 380 } 381 381 382 382 /******************************************************************************** ··· 387 387 * Input: type of the resource, range to add, current bus 388 388 * Output: 0 or -1, bus and range ptrs 389 389 ********************************************************************************/ 390 - static int add_bus_range (int type, struct range_node *range, struct bus_node *bus_cur) 390 + static int add_bus_range(int type, struct range_node *range, struct bus_node *bus_cur) 391 391 { 392 392 struct range_node *range_cur = NULL; 393 393 struct range_node *range_prev; ··· 452 452 range_cur = range_cur->next; 453 453 } 454 454 455 - update_resources (bus_cur, type, i_init + 1); 455 + update_resources(bus_cur, type, i_init + 1); 456 456 return 0; 457 457 } 458 458 ··· 462 462 * 463 463 * Input: bus, type of the resource, the rangeno starting from which to update 464 464 ******************************************************************************/ 465 - static void update_resources (struct bus_node *bus_cur, int type, int rangeno) 465 + static void update_resources(struct bus_node *bus_cur, int type, int rangeno) 466 466 { 467 467 struct resource_node *res = NULL; 468 468 u8 eol = 0; /* end of list indicator */ ··· 506 506 } 507 507 } 508 508 509 - static void fix_me (struct resource_node *res, struct bus_node *bus_cur, struct range_node *range) 509 + static void fix_me(struct resource_node *res, struct bus_node *bus_cur, struct range_node *range) 510 510 { 511 - char * str = ""; 511 + char *str = ""; 512 512 switch (res->type) { 513 513 case IO: 514 514 str = "io"; ··· 526 526 while (range) { 527 527 if ((res->start >= range->start) && (res->end <= range->end)) { 528 528 res->rangeno = range->rangeno; 529 - debug ("%s->rangeno in fix_resources is %d\n", str, res->rangeno); 529 + debug("%s->rangeno in fix_resources is %d\n", str, res->rangeno); 530 530 switch (res->type) { 531 531 case IO: 532 532 --bus_cur->needIOUpdate; ··· 561 561 * Input: current bus 562 562 * Output: none, list of resources for that bus are fixed if can be 563 563 *******************************************************************************/ 564 - static void fix_resources (struct bus_node *bus_cur) 564 + static void fix_resources(struct bus_node *bus_cur) 565 565 { 566 566 struct range_node *range; 567 567 struct resource_node *res; 568 568 569 - debug ("%s - bus_cur->busno = %d\n", __func__, bus_cur->busno); 569 + debug("%s - bus_cur->busno = %d\n", __func__, bus_cur->busno); 570 570 571 571 if (bus_cur->needIOUpdate) { 572 572 res = bus_cur->firstIO; 573 573 range = bus_cur->rangeIO; 574 - fix_me (res, bus_cur, range); 574 + fix_me(res, bus_cur, range); 575 575 } 576 576 if (bus_cur->needMemUpdate) { 577 577 res = bus_cur->firstMem; 578 578 range = bus_cur->rangeMem; 579 - fix_me (res, bus_cur, range); 579 + fix_me(res, bus_cur, range); 580 580 } 581 581 if (bus_cur->needPFMemUpdate) { 582 582 res = bus_cur->firstPFMem; 583 583 range = bus_cur->rangePFMem; 584 - fix_me (res, bus_cur, range); 584 + fix_me(res, bus_cur, range); 585 585 } 586 586 } 587 587 ··· 594 594 * Output: ptrs assigned (to the node) 595 595 * 0 or -1 596 596 *******************************************************************************/ 597 - int ibmphp_add_resource (struct resource_node *res) 597 + int ibmphp_add_resource(struct resource_node *res) 598 598 { 599 599 struct resource_node *res_cur; 600 600 struct resource_node *res_prev; ··· 602 602 struct range_node *range_cur = NULL; 603 603 struct resource_node *res_start = NULL; 604 604 605 - debug ("%s - enter\n", __func__); 605 + debug("%s - enter\n", __func__); 606 606 607 607 if (!res) { 608 - err ("NULL passed to add\n"); 608 + err("NULL passed to add\n"); 609 609 return -ENODEV; 610 610 } 611 611 612 - bus_cur = find_bus_wprev (res->busno, NULL, 0); 612 + bus_cur = find_bus_wprev(res->busno, NULL, 0); 613 613 614 614 if (!bus_cur) { 615 615 /* didn't find a bus, something's wrong!!! */ 616 - debug ("no bus in the system, either pci_dev's wrong or allocation failed\n"); 616 + debug("no bus in the system, either pci_dev's wrong or allocation failed\n"); 617 617 return -ENODEV; 618 618 } 619 619 ··· 632 632 res_start = bus_cur->firstPFMem; 633 633 break; 634 634 default: 635 - err ("cannot read the type of the resource to add... problem\n"); 635 + err("cannot read the type of the resource to add... problem\n"); 636 636 return -EINVAL; 637 637 } 638 638 while (range_cur) { ··· 663 663 res->rangeno = -1; 664 664 } 665 665 666 - debug ("The range is %d\n", res->rangeno); 666 + debug("The range is %d\n", res->rangeno); 667 667 if (!res_start) { 668 668 /* no first{IO,Mem,Pfmem} on the bus, 1st IO/Mem/Pfmem resource ever */ 669 669 switch (res->type) { ··· 683 683 res_cur = res_start; 684 684 res_prev = NULL; 685 685 686 - debug ("res_cur->rangeno is %d\n", res_cur->rangeno); 686 + debug("res_cur->rangeno is %d\n", res_cur->rangeno); 687 687 688 688 while (res_cur) { 689 689 if (res_cur->rangeno >= res->rangeno) ··· 697 697 698 698 if (!res_cur) { 699 699 /* at the end of the resource list */ 700 - debug ("i should be here, [%x - %x]\n", res->start, res->end); 700 + debug("i should be here, [%x - %x]\n", res->start, res->end); 701 701 res_prev->nextRange = res; 702 702 res->next = NULL; 703 703 res->nextRange = NULL; ··· 765 765 } 766 766 } 767 767 768 - debug ("%s - exit\n", __func__); 768 + debug("%s - exit\n", __func__); 769 769 return 0; 770 770 } 771 771 ··· 776 776 * Output: modified resource list 777 777 * 0 or error code 778 778 ****************************************************************************/ 779 - int ibmphp_remove_resource (struct resource_node *res) 779 + int ibmphp_remove_resource(struct resource_node *res) 780 780 { 781 781 struct bus_node *bus_cur; 782 782 struct resource_node *res_cur = NULL; 783 783 struct resource_node *res_prev; 784 784 struct resource_node *mem_cur; 785 - char * type = ""; 785 + char *type = ""; 786 786 787 787 if (!res) { 788 - err ("resource to remove is NULL\n"); 788 + err("resource to remove is NULL\n"); 789 789 return -ENODEV; 790 790 } 791 791 792 - bus_cur = find_bus_wprev (res->busno, NULL, 0); 792 + bus_cur = find_bus_wprev(res->busno, NULL, 0); 793 793 794 794 if (!bus_cur) { 795 - err ("cannot find corresponding bus of the io resource to remove bailing out...\n"); 795 + err("cannot find corresponding bus of the io resource to remove bailing out...\n"); 796 796 return -ENODEV; 797 797 } 798 798 ··· 810 810 type = "pfmem"; 811 811 break; 812 812 default: 813 - err ("unknown type for resource to remove\n"); 813 + err("unknown type for resource to remove\n"); 814 814 return -EINVAL; 815 815 } 816 816 res_prev = NULL; ··· 848 848 mem_cur = mem_cur->nextRange; 849 849 } 850 850 if (!mem_cur) { 851 - err ("cannot find corresponding mem node for pfmem...\n"); 851 + err("cannot find corresponding mem node for pfmem...\n"); 852 852 return -EINVAL; 853 853 } 854 854 855 - ibmphp_remove_resource (mem_cur); 855 + ibmphp_remove_resource(mem_cur); 856 856 if (!res_prev) 857 857 bus_cur->firstPFMemFromMem = res_cur->next; 858 858 else 859 859 res_prev->next = res_cur->next; 860 - kfree (res_cur); 860 + kfree(res_cur); 861 861 return 0; 862 862 } 863 863 res_prev = res_cur; ··· 867 867 res_cur = res_cur->nextRange; 868 868 } 869 869 if (!res_cur) { 870 - err ("cannot find pfmem to delete...\n"); 870 + err("cannot find pfmem to delete...\n"); 871 871 return -EINVAL; 872 872 } 873 873 } else { 874 - err ("the %s resource is not in the list to be deleted...\n", type); 874 + err("the %s resource is not in the list to be deleted...\n", type); 875 875 return -EINVAL; 876 876 } 877 877 } ··· 914 914 break; 915 915 } 916 916 } 917 - kfree (res_cur); 917 + kfree(res_cur); 918 918 return 0; 919 919 } else { 920 920 if (res_cur->next) { ··· 929 929 res_prev->next = NULL; 930 930 res_prev->nextRange = NULL; 931 931 } 932 - kfree (res_cur); 932 + kfree(res_cur); 933 933 return 0; 934 934 } 935 935 936 936 return 0; 937 937 } 938 938 939 - static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res) 939 + static struct range_node *find_range(struct bus_node *bus_cur, struct resource_node *res) 940 940 { 941 941 struct range_node *range = NULL; 942 942 ··· 951 951 range = bus_cur->rangePFMem; 952 952 break; 953 953 default: 954 - err ("cannot read resource type in find_range\n"); 954 + err("cannot read resource type in find_range\n"); 955 955 } 956 956 957 957 while (range) { ··· 971 971 * Output: the correct start and end address are inputted into the resource node, 972 972 * 0 or -EINVAL 973 973 *****************************************************************************/ 974 - int ibmphp_check_resource (struct resource_node *res, u8 bridge) 974 + int ibmphp_check_resource(struct resource_node *res, u8 bridge) 975 975 { 976 976 struct bus_node *bus_cur; 977 977 struct range_node *range = NULL; ··· 995 995 } else 996 996 tmp_divide = res->len; 997 997 998 - bus_cur = find_bus_wprev (res->busno, NULL, 0); 998 + bus_cur = find_bus_wprev(res->busno, NULL, 0); 999 999 1000 1000 if (!bus_cur) { 1001 1001 /* didn't find a bus, something's wrong!!! */ 1002 - debug ("no bus in the system, either pci_dev's wrong or allocation failed\n"); 1002 + debug("no bus in the system, either pci_dev's wrong or allocation failed\n"); 1003 1003 return -EINVAL; 1004 1004 } 1005 1005 1006 - debug ("%s - enter\n", __func__); 1007 - debug ("bus_cur->busno is %d\n", bus_cur->busno); 1006 + debug("%s - enter\n", __func__); 1007 + debug("bus_cur->busno is %d\n", bus_cur->busno); 1008 1008 1009 1009 /* This is a quick fix to not mess up with the code very much. i.e., 1010 1010 * 2000-2fff, len = 1000, but when we compare, we need it to be fff */ ··· 1024 1024 noranges = bus_cur->noPFMemRanges; 1025 1025 break; 1026 1026 default: 1027 - err ("wrong type of resource to check\n"); 1027 + err("wrong type of resource to check\n"); 1028 1028 return -EINVAL; 1029 1029 } 1030 1030 res_prev = NULL; 1031 1031 1032 1032 while (res_cur) { 1033 - range = find_range (bus_cur, res_cur); 1034 - debug ("%s - rangeno = %d\n", __func__, res_cur->rangeno); 1033 + range = find_range(bus_cur, res_cur); 1034 + debug("%s - rangeno = %d\n", __func__, res_cur->rangeno); 1035 1035 1036 1036 if (!range) { 1037 - err ("no range for the device exists... bailing out...\n"); 1037 + err("no range for the device exists... bailing out...\n"); 1038 1038 return -EINVAL; 1039 1039 } 1040 1040 ··· 1044 1044 len_tmp = res_cur->start - 1 - range->start; 1045 1045 1046 1046 if ((res_cur->start != range->start) && (len_tmp >= res->len)) { 1047 - debug ("len_tmp = %x\n", len_tmp); 1047 + debug("len_tmp = %x\n", len_tmp); 1048 1048 1049 1049 if ((len_tmp < len_cur) || (len_cur == 0)) { 1050 1050 ··· 1072 1072 } 1073 1073 1074 1074 if (flag && len_cur == res->len) { 1075 - debug ("but we are not here, right?\n"); 1075 + debug("but we are not here, right?\n"); 1076 1076 res->start = start_cur; 1077 1077 res->len += 1; /* To restore the balance */ 1078 1078 res->end = res->start + res->len - 1; ··· 1086 1086 len_tmp = range->end - (res_cur->end + 1); 1087 1087 1088 1088 if ((range->end != res_cur->end) && (len_tmp >= res->len)) { 1089 - debug ("len_tmp = %x\n", len_tmp); 1089 + debug("len_tmp = %x\n", len_tmp); 1090 1090 if ((len_tmp < len_cur) || (len_cur == 0)) { 1091 1091 1092 1092 if (((res_cur->end + 1) % tmp_divide) == 0) { ··· 1262 1262 1263 1263 if ((!range) && (len_cur == 0)) { 1264 1264 /* have gone through the list of devices and ranges and haven't found n.e.thing */ 1265 - err ("no appropriate range.. bailing out...\n"); 1265 + err("no appropriate range.. bailing out...\n"); 1266 1266 return -EINVAL; 1267 1267 } else if (len_cur) { 1268 1268 res->start = start_cur; ··· 1273 1273 } 1274 1274 1275 1275 if (!res_cur) { 1276 - debug ("prev->rangeno = %d, noranges = %d\n", res_prev->rangeno, noranges); 1276 + debug("prev->rangeno = %d, noranges = %d\n", res_prev->rangeno, noranges); 1277 1277 if (res_prev->rangeno < noranges) { 1278 1278 /* if there're more ranges out there to check */ 1279 1279 switch (res->type) { ··· 1328 1328 1329 1329 if ((!range) && (len_cur == 0)) { 1330 1330 /* have gone through the list of devices and ranges and haven't found n.e.thing */ 1331 - err ("no appropriate range.. bailing out...\n"); 1331 + err("no appropriate range.. bailing out...\n"); 1332 1332 return -EINVAL; 1333 1333 } else if (len_cur) { 1334 1334 res->start = start_cur; ··· 1345 1345 return 0; 1346 1346 } else { 1347 1347 /* have gone through the list of devices and haven't found n.e.thing */ 1348 - err ("no appropriate range.. bailing out...\n"); 1348 + err("no appropriate range.. bailing out...\n"); 1349 1349 return -EINVAL; 1350 1350 } 1351 1351 } ··· 1359 1359 * Input: Bus 1360 1360 * Output: 0, -ENODEV 1361 1361 ********************************************************************************/ 1362 - int ibmphp_remove_bus (struct bus_node *bus, u8 parent_busno) 1362 + int ibmphp_remove_bus(struct bus_node *bus, u8 parent_busno) 1363 1363 { 1364 1364 struct resource_node *res_cur; 1365 1365 struct resource_node *res_tmp; 1366 1366 struct bus_node *prev_bus; 1367 1367 int rc; 1368 1368 1369 - prev_bus = find_bus_wprev (parent_busno, NULL, 0); 1369 + prev_bus = find_bus_wprev(parent_busno, NULL, 0); 1370 1370 1371 1371 if (!prev_bus) { 1372 - debug ("something terribly wrong. Cannot find parent bus to the one to remove\n"); 1372 + debug("something terribly wrong. Cannot find parent bus to the one to remove\n"); 1373 1373 return -ENODEV; 1374 1374 } 1375 1375 1376 - debug ("In ibmphp_remove_bus... prev_bus->busno is %x\n", prev_bus->busno); 1376 + debug("In ibmphp_remove_bus... prev_bus->busno is %x\n", prev_bus->busno); 1377 1377 1378 - rc = remove_ranges (bus, prev_bus); 1378 + rc = remove_ranges(bus, prev_bus); 1379 1379 if (rc) 1380 1380 return rc; 1381 1381 ··· 1387 1387 res_cur = res_cur->next; 1388 1388 else 1389 1389 res_cur = res_cur->nextRange; 1390 - kfree (res_tmp); 1390 + kfree(res_tmp); 1391 1391 res_tmp = NULL; 1392 1392 } 1393 1393 bus->firstIO = NULL; ··· 1400 1400 res_cur = res_cur->next; 1401 1401 else 1402 1402 res_cur = res_cur->nextRange; 1403 - kfree (res_tmp); 1403 + kfree(res_tmp); 1404 1404 res_tmp = NULL; 1405 1405 } 1406 1406 bus->firstMem = NULL; ··· 1413 1413 res_cur = res_cur->next; 1414 1414 else 1415 1415 res_cur = res_cur->nextRange; 1416 - kfree (res_tmp); 1416 + kfree(res_tmp); 1417 1417 res_tmp = NULL; 1418 1418 } 1419 1419 bus->firstPFMem = NULL; ··· 1425 1425 res_tmp = res_cur; 1426 1426 res_cur = res_cur->next; 1427 1427 1428 - kfree (res_tmp); 1428 + kfree(res_tmp); 1429 1429 res_tmp = NULL; 1430 1430 } 1431 1431 bus->firstPFMemFromMem = NULL; 1432 1432 } 1433 1433 1434 - list_del (&bus->bus_list); 1435 - kfree (bus); 1434 + list_del(&bus->bus_list); 1435 + kfree(bus); 1436 1436 return 0; 1437 1437 } 1438 1438 ··· 1442 1442 * Input: current bus, previous bus 1443 1443 * Output: 0, -EINVAL 1444 1444 ******************************************************************************/ 1445 - static int remove_ranges (struct bus_node *bus_cur, struct bus_node *bus_prev) 1445 + static int remove_ranges(struct bus_node *bus_cur, struct bus_node *bus_prev) 1446 1446 { 1447 1447 struct range_node *range_cur; 1448 1448 struct range_node *range_tmp; ··· 1452 1452 if (bus_cur->noIORanges) { 1453 1453 range_cur = bus_cur->rangeIO; 1454 1454 for (i = 0; i < bus_cur->noIORanges; i++) { 1455 - if (ibmphp_find_resource (bus_prev, range_cur->start, &res, IO) < 0) 1455 + if (ibmphp_find_resource(bus_prev, range_cur->start, &res, IO) < 0) 1456 1456 return -EINVAL; 1457 - ibmphp_remove_resource (res); 1457 + ibmphp_remove_resource(res); 1458 1458 1459 1459 range_tmp = range_cur; 1460 1460 range_cur = range_cur->next; 1461 - kfree (range_tmp); 1461 + kfree(range_tmp); 1462 1462 range_tmp = NULL; 1463 1463 } 1464 1464 bus_cur->rangeIO = NULL; ··· 1466 1466 if (bus_cur->noMemRanges) { 1467 1467 range_cur = bus_cur->rangeMem; 1468 1468 for (i = 0; i < bus_cur->noMemRanges; i++) { 1469 - if (ibmphp_find_resource (bus_prev, range_cur->start, &res, MEM) < 0) 1469 + if (ibmphp_find_resource(bus_prev, range_cur->start, &res, MEM) < 0) 1470 1470 return -EINVAL; 1471 1471 1472 - ibmphp_remove_resource (res); 1472 + ibmphp_remove_resource(res); 1473 1473 range_tmp = range_cur; 1474 1474 range_cur = range_cur->next; 1475 - kfree (range_tmp); 1475 + kfree(range_tmp); 1476 1476 range_tmp = NULL; 1477 1477 } 1478 1478 bus_cur->rangeMem = NULL; ··· 1480 1480 if (bus_cur->noPFMemRanges) { 1481 1481 range_cur = bus_cur->rangePFMem; 1482 1482 for (i = 0; i < bus_cur->noPFMemRanges; i++) { 1483 - if (ibmphp_find_resource (bus_prev, range_cur->start, &res, PFMEM) < 0) 1483 + if (ibmphp_find_resource(bus_prev, range_cur->start, &res, PFMEM) < 0) 1484 1484 return -EINVAL; 1485 1485 1486 - ibmphp_remove_resource (res); 1486 + ibmphp_remove_resource(res); 1487 1487 range_tmp = range_cur; 1488 1488 range_cur = range_cur->next; 1489 - kfree (range_tmp); 1489 + kfree(range_tmp); 1490 1490 range_tmp = NULL; 1491 1491 } 1492 1492 bus_cur->rangePFMem = NULL; ··· 1498 1498 * find the resource node in the bus 1499 1499 * Input: Resource needed, start address of the resource, type of resource 1500 1500 */ 1501 - int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resource_node **res, int flag) 1501 + int ibmphp_find_resource(struct bus_node *bus, u32 start_address, struct resource_node **res, int flag) 1502 1502 { 1503 1503 struct resource_node *res_cur = NULL; 1504 - char * type = ""; 1504 + char *type = ""; 1505 1505 1506 1506 if (!bus) { 1507 - err ("The bus passed in NULL to find resource\n"); 1507 + err("The bus passed in NULL to find resource\n"); 1508 1508 return -ENODEV; 1509 1509 } 1510 1510 ··· 1522 1522 type = "pfmem"; 1523 1523 break; 1524 1524 default: 1525 - err ("wrong type of flag\n"); 1525 + err("wrong type of flag\n"); 1526 1526 return -EINVAL; 1527 1527 } 1528 1528 ··· 1548 1548 res_cur = res_cur->next; 1549 1549 } 1550 1550 if (!res_cur) { 1551 - debug ("SOS...cannot find %s resource in the bus.\n", type); 1551 + debug("SOS...cannot find %s resource in the bus.\n", type); 1552 1552 return -EINVAL; 1553 1553 } 1554 1554 } else { 1555 - debug ("SOS... cannot find %s resource in the bus.\n", type); 1555 + debug("SOS... cannot find %s resource in the bus.\n", type); 1556 1556 return -EINVAL; 1557 1557 } 1558 1558 } 1559 1559 1560 1560 if (*res) 1561 - debug ("*res->start = %x\n", (*res)->start); 1561 + debug("*res->start = %x\n", (*res)->start); 1562 1562 1563 1563 return 0; 1564 1564 } ··· 1569 1569 * Parameters: none 1570 1570 * Returns: none 1571 1571 ***********************************************************************/ 1572 - void ibmphp_free_resources (void) 1572 + void ibmphp_free_resources(void) 1573 1573 { 1574 1574 struct bus_node *bus_cur = NULL; 1575 1575 struct bus_node *bus_tmp; ··· 1582 1582 int i = 0; 1583 1583 flags = 1; 1584 1584 1585 - list_for_each_safe (tmp, next, &gbuses) { 1586 - bus_cur = list_entry (tmp, struct bus_node, bus_list); 1585 + list_for_each_safe(tmp, next, &gbuses) { 1586 + bus_cur = list_entry(tmp, struct bus_node, bus_list); 1587 1587 if (bus_cur->noIORanges) { 1588 1588 range_cur = bus_cur->rangeIO; 1589 1589 for (i = 0; i < bus_cur->noIORanges; i++) { ··· 1591 1591 break; 1592 1592 range_tmp = range_cur; 1593 1593 range_cur = range_cur->next; 1594 - kfree (range_tmp); 1594 + kfree(range_tmp); 1595 1595 range_tmp = NULL; 1596 1596 } 1597 1597 } ··· 1602 1602 break; 1603 1603 range_tmp = range_cur; 1604 1604 range_cur = range_cur->next; 1605 - kfree (range_tmp); 1605 + kfree(range_tmp); 1606 1606 range_tmp = NULL; 1607 1607 } 1608 1608 } ··· 1613 1613 break; 1614 1614 range_tmp = range_cur; 1615 1615 range_cur = range_cur->next; 1616 - kfree (range_tmp); 1616 + kfree(range_tmp); 1617 1617 range_tmp = NULL; 1618 1618 } 1619 1619 } ··· 1626 1626 res_cur = res_cur->next; 1627 1627 else 1628 1628 res_cur = res_cur->nextRange; 1629 - kfree (res_tmp); 1629 + kfree(res_tmp); 1630 1630 res_tmp = NULL; 1631 1631 } 1632 1632 bus_cur->firstIO = NULL; ··· 1639 1639 res_cur = res_cur->next; 1640 1640 else 1641 1641 res_cur = res_cur->nextRange; 1642 - kfree (res_tmp); 1642 + kfree(res_tmp); 1643 1643 res_tmp = NULL; 1644 1644 } 1645 1645 bus_cur->firstMem = NULL; ··· 1652 1652 res_cur = res_cur->next; 1653 1653 else 1654 1654 res_cur = res_cur->nextRange; 1655 - kfree (res_tmp); 1655 + kfree(res_tmp); 1656 1656 res_tmp = NULL; 1657 1657 } 1658 1658 bus_cur->firstPFMem = NULL; ··· 1664 1664 res_tmp = res_cur; 1665 1665 res_cur = res_cur->next; 1666 1666 1667 - kfree (res_tmp); 1667 + kfree(res_tmp); 1668 1668 res_tmp = NULL; 1669 1669 } 1670 1670 bus_cur->firstPFMemFromMem = NULL; 1671 1671 } 1672 1672 1673 1673 bus_tmp = bus_cur; 1674 - list_del (&bus_cur->bus_list); 1675 - kfree (bus_tmp); 1674 + list_del(&bus_cur->bus_list); 1675 + kfree(bus_tmp); 1676 1676 bus_tmp = NULL; 1677 1677 } 1678 1678 } ··· 1685 1685 * a new Mem node 1686 1686 * This routine is called right after initialization 1687 1687 *******************************************************************************/ 1688 - static int __init once_over (void) 1688 + static int __init once_over(void) 1689 1689 { 1690 1690 struct resource_node *pfmem_cur; 1691 1691 struct resource_node *pfmem_prev; ··· 1693 1693 struct bus_node *bus_cur; 1694 1694 struct list_head *tmp; 1695 1695 1696 - list_for_each (tmp, &gbuses) { 1697 - bus_cur = list_entry (tmp, struct bus_node, bus_list); 1696 + list_for_each(tmp, &gbuses) { 1697 + bus_cur = list_entry(tmp, struct bus_node, bus_list); 1698 1698 if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) { 1699 1699 for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_cur = pfmem_cur->next) { 1700 1700 pfmem_cur->fromMem = 1; ··· 1716 1716 1717 1717 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 1718 1718 if (!mem) { 1719 - err ("out of system memory\n"); 1719 + err("out of system memory\n"); 1720 1720 return -ENOMEM; 1721 1721 } 1722 1722 mem->type = MEM; ··· 1725 1725 mem->start = pfmem_cur->start; 1726 1726 mem->end = pfmem_cur->end; 1727 1727 mem->len = pfmem_cur->len; 1728 - if (ibmphp_add_resource (mem) < 0) 1729 - err ("Trouble...trouble... EBDA allocated pfmem from mem, but system doesn't display it has this space... unless not PCI device...\n"); 1728 + if (ibmphp_add_resource(mem) < 0) 1729 + err("Trouble...trouble... EBDA allocated pfmem from mem, but system doesn't display it has this space... unless not PCI device...\n"); 1730 1730 pfmem_cur->rangeno = mem->rangeno; 1731 1731 } /* end for pfmem */ 1732 1732 } /* end if */ ··· 1734 1734 return 0; 1735 1735 } 1736 1736 1737 - int ibmphp_add_pfmem_from_mem (struct resource_node *pfmem) 1737 + int ibmphp_add_pfmem_from_mem(struct resource_node *pfmem) 1738 1738 { 1739 - struct bus_node *bus_cur = find_bus_wprev (pfmem->busno, NULL, 0); 1739 + struct bus_node *bus_cur = find_bus_wprev(pfmem->busno, NULL, 0); 1740 1740 1741 1741 if (!bus_cur) { 1742 - err ("cannot find bus of pfmem to add...\n"); 1742 + err("cannot find bus of pfmem to add...\n"); 1743 1743 return -ENODEV; 1744 1744 } 1745 1745 ··· 1759 1759 * Parameters: bus_number 1760 1760 * Returns: Bus pointer or NULL 1761 1761 */ 1762 - struct bus_node *ibmphp_find_res_bus (u8 bus_number) 1762 + struct bus_node *ibmphp_find_res_bus(u8 bus_number) 1763 1763 { 1764 - return find_bus_wprev (bus_number, NULL, 0); 1764 + return find_bus_wprev(bus_number, NULL, 0); 1765 1765 } 1766 1766 1767 - static struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u8 flag) 1767 + static struct bus_node *find_bus_wprev(u8 bus_number, struct bus_node **prev, u8 flag) 1768 1768 { 1769 1769 struct bus_node *bus_cur; 1770 1770 struct list_head *tmp; 1771 1771 struct list_head *tmp_prev; 1772 1772 1773 - list_for_each (tmp, &gbuses) { 1773 + list_for_each(tmp, &gbuses) { 1774 1774 tmp_prev = tmp->prev; 1775 - bus_cur = list_entry (tmp, struct bus_node, bus_list); 1775 + bus_cur = list_entry(tmp, struct bus_node, bus_list); 1776 1776 if (flag) 1777 - *prev = list_entry (tmp_prev, struct bus_node, bus_list); 1777 + *prev = list_entry(tmp_prev, struct bus_node, bus_list); 1778 1778 if (bus_cur->busno == bus_number) 1779 1779 return bus_cur; 1780 1780 } ··· 1782 1782 return NULL; 1783 1783 } 1784 1784 1785 - void ibmphp_print_test (void) 1785 + void ibmphp_print_test(void) 1786 1786 { 1787 1787 int i = 0; 1788 1788 struct bus_node *bus_cur = NULL; ··· 1790 1790 struct resource_node *res; 1791 1791 struct list_head *tmp; 1792 1792 1793 - debug_pci ("*****************START**********************\n"); 1793 + debug_pci("*****************START**********************\n"); 1794 1794 1795 1795 if ((!list_empty(&gbuses)) && flags) { 1796 - err ("The GBUSES is not NULL?!?!?!?!?\n"); 1796 + err("The GBUSES is not NULL?!?!?!?!?\n"); 1797 1797 return; 1798 1798 } 1799 1799 1800 - list_for_each (tmp, &gbuses) { 1801 - bus_cur = list_entry (tmp, struct bus_node, bus_list); 1802 - debug_pci ("This is bus # %d. There are\n", bus_cur->busno); 1803 - debug_pci ("IORanges = %d\t", bus_cur->noIORanges); 1804 - debug_pci ("MemRanges = %d\t", bus_cur->noMemRanges); 1805 - debug_pci ("PFMemRanges = %d\n", bus_cur->noPFMemRanges); 1806 - debug_pci ("The IO Ranges are as follows:\n"); 1800 + list_for_each(tmp, &gbuses) { 1801 + bus_cur = list_entry(tmp, struct bus_node, bus_list); 1802 + debug_pci("This is bus # %d. There are\n", bus_cur->busno); 1803 + debug_pci("IORanges = %d\t", bus_cur->noIORanges); 1804 + debug_pci("MemRanges = %d\t", bus_cur->noMemRanges); 1805 + debug_pci("PFMemRanges = %d\n", bus_cur->noPFMemRanges); 1806 + debug_pci("The IO Ranges are as follows:\n"); 1807 1807 if (bus_cur->rangeIO) { 1808 1808 range = bus_cur->rangeIO; 1809 1809 for (i = 0; i < bus_cur->noIORanges; i++) { 1810 - debug_pci ("rangeno is %d\n", range->rangeno); 1811 - debug_pci ("[%x - %x]\n", range->start, range->end); 1810 + debug_pci("rangeno is %d\n", range->rangeno); 1811 + debug_pci("[%x - %x]\n", range->start, range->end); 1812 1812 range = range->next; 1813 1813 } 1814 1814 } 1815 1815 1816 - debug_pci ("The Mem Ranges are as follows:\n"); 1816 + debug_pci("The Mem Ranges are as follows:\n"); 1817 1817 if (bus_cur->rangeMem) { 1818 1818 range = bus_cur->rangeMem; 1819 1819 for (i = 0; i < bus_cur->noMemRanges; i++) { 1820 - debug_pci ("rangeno is %d\n", range->rangeno); 1821 - debug_pci ("[%x - %x]\n", range->start, range->end); 1820 + debug_pci("rangeno is %d\n", range->rangeno); 1821 + debug_pci("[%x - %x]\n", range->start, range->end); 1822 1822 range = range->next; 1823 1823 } 1824 1824 } 1825 1825 1826 - debug_pci ("The PFMem Ranges are as follows:\n"); 1826 + debug_pci("The PFMem Ranges are as follows:\n"); 1827 1827 1828 1828 if (bus_cur->rangePFMem) { 1829 1829 range = bus_cur->rangePFMem; 1830 1830 for (i = 0; i < bus_cur->noPFMemRanges; i++) { 1831 - debug_pci ("rangeno is %d\n", range->rangeno); 1832 - debug_pci ("[%x - %x]\n", range->start, range->end); 1831 + debug_pci("rangeno is %d\n", range->rangeno); 1832 + debug_pci("[%x - %x]\n", range->start, range->end); 1833 1833 range = range->next; 1834 1834 } 1835 1835 } 1836 1836 1837 - debug_pci ("The resources on this bus are as follows\n"); 1837 + debug_pci("The resources on this bus are as follows\n"); 1838 1838 1839 - debug_pci ("IO...\n"); 1839 + debug_pci("IO...\n"); 1840 1840 if (bus_cur->firstIO) { 1841 1841 res = bus_cur->firstIO; 1842 1842 while (res) { 1843 - debug_pci ("The range # is %d\n", res->rangeno); 1844 - debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1845 - debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); 1843 + debug_pci("The range # is %d\n", res->rangeno); 1844 + debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1845 + debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); 1846 1846 if (res->next) 1847 1847 res = res->next; 1848 1848 else if (res->nextRange) ··· 1851 1851 break; 1852 1852 } 1853 1853 } 1854 - debug_pci ("Mem...\n"); 1854 + debug_pci("Mem...\n"); 1855 1855 if (bus_cur->firstMem) { 1856 1856 res = bus_cur->firstMem; 1857 1857 while (res) { 1858 - debug_pci ("The range # is %d\n", res->rangeno); 1859 - debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1860 - debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); 1858 + debug_pci("The range # is %d\n", res->rangeno); 1859 + debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1860 + debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); 1861 1861 if (res->next) 1862 1862 res = res->next; 1863 1863 else if (res->nextRange) ··· 1866 1866 break; 1867 1867 } 1868 1868 } 1869 - debug_pci ("PFMem...\n"); 1869 + debug_pci("PFMem...\n"); 1870 1870 if (bus_cur->firstPFMem) { 1871 1871 res = bus_cur->firstPFMem; 1872 1872 while (res) { 1873 - debug_pci ("The range # is %d\n", res->rangeno); 1874 - debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1875 - debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); 1873 + debug_pci("The range # is %d\n", res->rangeno); 1874 + debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1875 + debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); 1876 1876 if (res->next) 1877 1877 res = res->next; 1878 1878 else if (res->nextRange) ··· 1882 1882 } 1883 1883 } 1884 1884 1885 - debug_pci ("PFMemFromMem...\n"); 1885 + debug_pci("PFMemFromMem...\n"); 1886 1886 if (bus_cur->firstPFMemFromMem) { 1887 1887 res = bus_cur->firstPFMemFromMem; 1888 1888 while (res) { 1889 - debug_pci ("The range # is %d\n", res->rangeno); 1890 - debug_pci ("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1891 - debug_pci ("[%x - %x], len=%x\n", res->start, res->end, res->len); 1889 + debug_pci("The range # is %d\n", res->rangeno); 1890 + debug_pci("The bus, devfnc is %d, %x\n", res->busno, res->devfunc); 1891 + debug_pci("[%x - %x], len=%x\n", res->start, res->end, res->len); 1892 1892 res = res->next; 1893 1893 } 1894 1894 } 1895 1895 } 1896 - debug_pci ("***********************END***********************\n"); 1896 + debug_pci("***********************END***********************\n"); 1897 1897 } 1898 1898 1899 - static int range_exists_already (struct range_node * range, struct bus_node * bus_cur, u8 type) 1899 + static int range_exists_already(struct range_node *range, struct bus_node *bus_cur, u8 type) 1900 1900 { 1901 - struct range_node * range_cur = NULL; 1901 + struct range_node *range_cur = NULL; 1902 1902 switch (type) { 1903 1903 case IO: 1904 1904 range_cur = bus_cur->rangeIO; ··· 1910 1910 range_cur = bus_cur->rangePFMem; 1911 1911 break; 1912 1912 default: 1913 - err ("wrong type passed to find out if range already exists\n"); 1913 + err("wrong type passed to find out if range already exists\n"); 1914 1914 return -ENODEV; 1915 1915 } 1916 1916 ··· 1937 1937 * behind them All these are TO DO. 1938 1938 * Also need to add more error checkings... (from fnc returns etc) 1939 1939 */ 1940 - static int __init update_bridge_ranges (struct bus_node **bus) 1940 + static int __init update_bridge_ranges(struct bus_node **bus) 1941 1941 { 1942 1942 u8 sec_busno, device, function, hdr_type, start_io_address, end_io_address; 1943 1943 u16 vendor_id, upper_io_start, upper_io_end, start_mem_address, end_mem_address; ··· 1955 1955 return -ENODEV; 1956 1956 ibmphp_pci_bus->number = bus_cur->busno; 1957 1957 1958 - debug ("inside %s\n", __func__); 1959 - debug ("bus_cur->busno = %x\n", bus_cur->busno); 1958 + debug("inside %s\n", __func__); 1959 + debug("bus_cur->busno = %x\n", bus_cur->busno); 1960 1960 1961 1961 for (device = 0; device < 32; device++) { 1962 1962 for (function = 0x00; function < 0x08; function++) { 1963 1963 devfn = PCI_DEVFN(device, function); 1964 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 1964 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_VENDOR_ID, &vendor_id); 1965 1965 1966 1966 if (vendor_id != PCI_VENDOR_ID_NOTVALID) { 1967 1967 /* found correct device!!! */ 1968 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 1968 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_HEADER_TYPE, &hdr_type); 1969 1969 1970 1970 switch (hdr_type) { 1971 1971 case PCI_HEADER_TYPE_NORMAL: ··· 1984 1984 temp++; 1985 1985 } 1986 1986 */ 1987 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_busno); 1988 - bus_sec = find_bus_wprev (sec_busno, NULL, 0); 1987 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_busno); 1988 + bus_sec = find_bus_wprev(sec_busno, NULL, 0); 1989 1989 /* this bus structure doesn't exist yet, PPB was configured during previous loading of ibmphp */ 1990 1990 if (!bus_sec) { 1991 - bus_sec = alloc_error_bus (NULL, sec_busno, 1); 1991 + bus_sec = alloc_error_bus(NULL, sec_busno, 1); 1992 1992 /* the rest will be populated during NVRAM call */ 1993 1993 return 0; 1994 1994 } 1995 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &start_io_address); 1996 - pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &end_io_address); 1997 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, &upper_io_start); 1998 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, &upper_io_end); 1995 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_BASE, &start_io_address); 1996 + pci_bus_read_config_byte(ibmphp_pci_bus, devfn, PCI_IO_LIMIT, &end_io_address); 1997 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_IO_BASE_UPPER16, &upper_io_start); 1998 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_IO_LIMIT_UPPER16, &upper_io_end); 1999 1999 start_address = (start_io_address & PCI_IO_RANGE_MASK) << 8; 2000 2000 start_address |= (upper_io_start << 16); 2001 2001 end_address = (end_io_address & PCI_IO_RANGE_MASK) << 8; ··· 2004 2004 if ((start_address) && (start_address <= end_address)) { 2005 2005 range = kzalloc(sizeof(struct range_node), GFP_KERNEL); 2006 2006 if (!range) { 2007 - err ("out of system memory\n"); 2007 + err("out of system memory\n"); 2008 2008 return -ENOMEM; 2009 2009 } 2010 2010 range->start = start_address; 2011 2011 range->end = end_address + 0xfff; 2012 2012 2013 2013 if (bus_sec->noIORanges > 0) { 2014 - if (!range_exists_already (range, bus_sec, IO)) { 2015 - add_bus_range (IO, range, bus_sec); 2014 + if (!range_exists_already(range, bus_sec, IO)) { 2015 + add_bus_range(IO, range, bus_sec); 2016 2016 ++bus_sec->noIORanges; 2017 2017 } else { 2018 - kfree (range); 2018 + kfree(range); 2019 2019 range = NULL; 2020 2020 } 2021 2021 } else { ··· 2024 2024 bus_sec->rangeIO = range; 2025 2025 ++bus_sec->noIORanges; 2026 2026 } 2027 - fix_resources (bus_sec); 2027 + fix_resources(bus_sec); 2028 2028 2029 - if (ibmphp_find_resource (bus_cur, start_address, &io, IO)) { 2029 + if (ibmphp_find_resource(bus_cur, start_address, &io, IO)) { 2030 2030 io = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 2031 2031 if (!io) { 2032 - kfree (range); 2033 - err ("out of system memory\n"); 2032 + kfree(range); 2033 + err("out of system memory\n"); 2034 2034 return -ENOMEM; 2035 2035 } 2036 2036 io->type = IO; ··· 2039 2039 io->start = start_address; 2040 2040 io->end = end_address + 0xfff; 2041 2041 io->len = io->end - io->start + 1; 2042 - ibmphp_add_resource (io); 2042 + ibmphp_add_resource(io); 2043 2043 } 2044 2044 } 2045 2045 2046 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &start_mem_address); 2047 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &end_mem_address); 2046 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &start_mem_address); 2047 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, &end_mem_address); 2048 2048 2049 2049 start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16; 2050 2050 end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16; ··· 2053 2053 2054 2054 range = kzalloc(sizeof(struct range_node), GFP_KERNEL); 2055 2055 if (!range) { 2056 - err ("out of system memory\n"); 2056 + err("out of system memory\n"); 2057 2057 return -ENOMEM; 2058 2058 } 2059 2059 range->start = start_address; 2060 2060 range->end = end_address + 0xfffff; 2061 2061 2062 2062 if (bus_sec->noMemRanges > 0) { 2063 - if (!range_exists_already (range, bus_sec, MEM)) { 2064 - add_bus_range (MEM, range, bus_sec); 2063 + if (!range_exists_already(range, bus_sec, MEM)) { 2064 + add_bus_range(MEM, range, bus_sec); 2065 2065 ++bus_sec->noMemRanges; 2066 2066 } else { 2067 - kfree (range); 2067 + kfree(range); 2068 2068 range = NULL; 2069 2069 } 2070 2070 } else { ··· 2074 2074 ++bus_sec->noMemRanges; 2075 2075 } 2076 2076 2077 - fix_resources (bus_sec); 2077 + fix_resources(bus_sec); 2078 2078 2079 - if (ibmphp_find_resource (bus_cur, start_address, &mem, MEM)) { 2079 + if (ibmphp_find_resource(bus_cur, start_address, &mem, MEM)) { 2080 2080 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 2081 2081 if (!mem) { 2082 - kfree (range); 2083 - err ("out of system memory\n"); 2082 + kfree(range); 2083 + err("out of system memory\n"); 2084 2084 return -ENOMEM; 2085 2085 } 2086 2086 mem->type = MEM; ··· 2089 2089 mem->start = start_address; 2090 2090 mem->end = end_address + 0xfffff; 2091 2091 mem->len = mem->end - mem->start + 1; 2092 - ibmphp_add_resource (mem); 2092 + ibmphp_add_resource(mem); 2093 2093 } 2094 2094 } 2095 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &start_mem_address); 2096 - pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &end_mem_address); 2097 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, &upper_start); 2098 - pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, &upper_end); 2095 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_BASE, &start_mem_address); 2096 + pci_bus_read_config_word(ibmphp_pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &end_mem_address); 2097 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_BASE_UPPER32, &upper_start); 2098 + pci_bus_read_config_dword(ibmphp_pci_bus, devfn, PCI_PREF_LIMIT_UPPER32, &upper_end); 2099 2099 start_address = 0x00000000 | (start_mem_address & PCI_MEMORY_RANGE_MASK) << 16; 2100 2100 end_address = 0x00000000 | (end_mem_address & PCI_MEMORY_RANGE_MASK) << 16; 2101 2101 #if BITS_PER_LONG == 64 ··· 2107 2107 2108 2108 range = kzalloc(sizeof(struct range_node), GFP_KERNEL); 2109 2109 if (!range) { 2110 - err ("out of system memory\n"); 2110 + err("out of system memory\n"); 2111 2111 return -ENOMEM; 2112 2112 } 2113 2113 range->start = start_address; 2114 2114 range->end = end_address + 0xfffff; 2115 2115 2116 2116 if (bus_sec->noPFMemRanges > 0) { 2117 - if (!range_exists_already (range, bus_sec, PFMEM)) { 2118 - add_bus_range (PFMEM, range, bus_sec); 2117 + if (!range_exists_already(range, bus_sec, PFMEM)) { 2118 + add_bus_range(PFMEM, range, bus_sec); 2119 2119 ++bus_sec->noPFMemRanges; 2120 2120 } else { 2121 - kfree (range); 2121 + kfree(range); 2122 2122 range = NULL; 2123 2123 } 2124 2124 } else { ··· 2128 2128 ++bus_sec->noPFMemRanges; 2129 2129 } 2130 2130 2131 - fix_resources (bus_sec); 2132 - if (ibmphp_find_resource (bus_cur, start_address, &pfmem, PFMEM)) { 2131 + fix_resources(bus_sec); 2132 + if (ibmphp_find_resource(bus_cur, start_address, &pfmem, PFMEM)) { 2133 2133 pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 2134 2134 if (!pfmem) { 2135 - kfree (range); 2136 - err ("out of system memory\n"); 2135 + kfree(range); 2136 + err("out of system memory\n"); 2137 2137 return -ENOMEM; 2138 2138 } 2139 2139 pfmem->type = PFMEM; ··· 2144 2144 pfmem->len = pfmem->end - pfmem->start + 1; 2145 2145 pfmem->fromMem = 0; 2146 2146 2147 - ibmphp_add_resource (pfmem); 2147 + ibmphp_add_resource(pfmem); 2148 2148 } 2149 2149 } 2150 2150 break;
+5 -5
drivers/pci/hotplug/pci_hotplug_core.c
··· 45 45 46 46 #define MY_NAME "pci_hotplug" 47 47 48 - #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0) 49 - #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) 50 - #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) 51 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) 48 + #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt, MY_NAME, __func__, ## arg); } while (0) 49 + #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 50 + #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 51 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 52 52 53 53 54 54 /* local variables */ ··· 226 226 u32 test; 227 227 int retval = 0; 228 228 229 - ltest = simple_strtoul (buf, NULL, 10); 229 + ltest = simple_strtoul(buf, NULL, 10); 230 230 test = (u32)(ltest & 0xffffffff); 231 231 dbg("test = %d\n", test); 232 232
+4 -4
drivers/pci/hotplug/pciehp.h
··· 47 47 #define dbg(format, arg...) \ 48 48 do { \ 49 49 if (pciehp_debug) \ 50 - printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); \ 50 + printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg); \ 51 51 } while (0) 52 52 #define err(format, arg...) \ 53 - printk(KERN_ERR "%s: " format, MY_NAME , ## arg) 53 + printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 54 54 #define info(format, arg...) \ 55 - printk(KERN_INFO "%s: " format, MY_NAME , ## arg) 55 + printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 56 56 #define warn(format, arg...) \ 57 - printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 57 + printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 58 58 59 59 #define ctrl_dbg(ctrl, format, arg...) \ 60 60 do { \
+8 -8
drivers/pci/hotplug/pciehp_core.c
··· 62 62 63 63 #define PCIE_MODULE_NAME "pciehp" 64 64 65 - static int set_attention_status (struct hotplug_slot *slot, u8 value); 66 - static int enable_slot (struct hotplug_slot *slot); 67 - static int disable_slot (struct hotplug_slot *slot); 68 - static int get_power_status (struct hotplug_slot *slot, u8 *value); 69 - static int get_attention_status (struct hotplug_slot *slot, u8 *value); 70 - static int get_latch_status (struct hotplug_slot *slot, u8 *value); 71 - static int get_adapter_status (struct hotplug_slot *slot, u8 *value); 72 - static int reset_slot (struct hotplug_slot *slot, int probe); 65 + static int set_attention_status(struct hotplug_slot *slot, u8 value); 66 + static int enable_slot(struct hotplug_slot *slot); 67 + static int disable_slot(struct hotplug_slot *slot); 68 + static int get_power_status(struct hotplug_slot *slot, u8 *value); 69 + static int get_attention_status(struct hotplug_slot *slot, u8 *value); 70 + static int get_latch_status(struct hotplug_slot *slot, u8 *value); 71 + static int get_adapter_status(struct hotplug_slot *slot, u8 *value); 72 + static int reset_slot(struct hotplug_slot *slot, int probe); 73 73 74 74 /** 75 75 * release_slot - free up the memory used by a slot
+12 -12
drivers/pci/hotplug/pcihp_skeleton.c
··· 52 52 do { \ 53 53 if (debug) \ 54 54 printk(KERN_DEBUG "%s: " format "\n", \ 55 - MY_NAME , ## arg); \ 55 + MY_NAME, ## arg); \ 56 56 } while (0) 57 - #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) 58 - #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) 59 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 57 + #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME, ## arg) 58 + #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME, ## arg) 59 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME, ## arg) 60 60 61 61 /* local variables */ 62 62 static bool debug; ··· 72 72 module_param(debug, bool, 0644); 73 73 MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); 74 74 75 - static int enable_slot (struct hotplug_slot *slot); 76 - static int disable_slot (struct hotplug_slot *slot); 77 - static int set_attention_status (struct hotplug_slot *slot, u8 value); 78 - static int hardware_test (struct hotplug_slot *slot, u32 value); 79 - static int get_power_status (struct hotplug_slot *slot, u8 *value); 80 - static int get_attention_status (struct hotplug_slot *slot, u8 *value); 81 - static int get_latch_status (struct hotplug_slot *slot, u8 *value); 82 - static int get_adapter_status (struct hotplug_slot *slot, u8 *value); 75 + static int enable_slot(struct hotplug_slot *slot); 76 + static int disable_slot(struct hotplug_slot *slot); 77 + static int set_attention_status(struct hotplug_slot *slot, u8 value); 78 + static int hardware_test(struct hotplug_slot *slot, u32 value); 79 + static int get_power_status(struct hotplug_slot *slot, u8 *value); 80 + static int get_attention_status(struct hotplug_slot *slot, u8 *value); 81 + static int get_latch_status(struct hotplug_slot *slot, u8 *value); 82 + static int get_adapter_status(struct hotplug_slot *slot, u8 *value); 83 83 84 84 static struct hotplug_slot_ops skel_hotplug_slot_ops = { 85 85 .enable_slot = enable_slot,
+4 -4
drivers/pci/hotplug/rpaphp.h
··· 51 51 do { \ 52 52 if (rpaphp_debug) \ 53 53 printk(KERN_DEBUG "%s: " format, \ 54 - MY_NAME , ## arg); \ 54 + MY_NAME, ## arg); \ 55 55 } while (0) 56 - #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg) 57 - #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) 58 - #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 56 + #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 57 + #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 58 + #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 59 59 60 60 /* slot states */ 61 61
+1 -1
drivers/pci/hotplug/rpaphp_core.c
··· 94 94 int retval, level; 95 95 struct slot *slot = (struct slot *)hotplug_slot->private; 96 96 97 - retval = rtas_get_power_level (slot->power_domain, &level); 97 + retval = rtas_get_power_level(slot->power_domain, &level); 98 98 if (!retval) 99 99 *value = level; 100 100 return retval;
+1 -1
drivers/pci/hotplug/rpaphp_pci.c
··· 126 126 if (rpaphp_debug) { 127 127 struct pci_dev *dev; 128 128 dbg("%s: pci_devs of slot[%s]\n", __func__, slot->dn->full_name); 129 - list_for_each_entry (dev, &bus->devices, bus_list) 129 + list_for_each_entry(dev, &bus->devices, bus_list) 130 130 dbg("\t%s\n", pci_name(dev)); 131 131 } 132 132 }
+1 -1
drivers/pci/hotplug/rpaphp_slot.c
··· 48 48 } 49 49 50 50 struct slot *alloc_slot_struct(struct device_node *dn, 51 - int drc_index, char *drc_name, int power_domain) 51 + int drc_index, char *drc_name, int power_domain) 52 52 { 53 53 struct slot *slot; 54 54
+3 -3
drivers/pci/hotplug/sgi_hotplug.c
··· 99 99 if (!slot) 100 100 return retval; 101 101 102 - retval = sprintf (buf, "%s\n", slot->physical_path); 102 + retval = sprintf(buf, "%s\n", slot->physical_path); 103 103 return retval; 104 104 } 105 105 ··· 313 313 } 314 314 315 315 if ((action == PCI_REQ_SLOT_DISABLE) && rc) { 316 - dev_dbg(&slot->pci_bus->self->dev,"remove failed rc = %d\n", rc); 316 + dev_dbg(&slot->pci_bus->self->dev, "remove failed rc = %d\n", rc); 317 317 } 318 318 319 319 return rc; ··· 488 488 489 489 /* free the ACPI resources for the slot */ 490 490 if (SN_ACPI_BASE_SUPPORT() && 491 - PCI_CONTROLLER(slot->pci_bus)->companion) { 491 + PCI_CONTROLLER(slot->pci_bus)->companion) { 492 492 unsigned long long adr; 493 493 struct acpi_device *device; 494 494 acpi_handle phandle;
+5 -5
drivers/pci/hotplug/shpchp.h
··· 50 50 #define dbg(format, arg...) \ 51 51 do { \ 52 52 if (shpchp_debug) \ 53 - printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); \ 53 + printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg); \ 54 54 } while (0) 55 55 #define err(format, arg...) \ 56 - printk(KERN_ERR "%s: " format, MY_NAME , ## arg) 56 + printk(KERN_ERR "%s: " format, MY_NAME, ## arg) 57 57 #define info(format, arg...) \ 58 - printk(KERN_INFO "%s: " format, MY_NAME , ## arg) 58 + printk(KERN_INFO "%s: " format, MY_NAME, ## arg) 59 59 #define warn(format, arg...) \ 60 - printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 60 + printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) 61 61 62 62 #define ctrl_dbg(ctrl, format, arg...) \ 63 63 do { \ ··· 295 295 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); 296 296 } 297 297 /* restore MiscII register */ 298 - pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); 298 + pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp); 299 299 300 300 if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) 301 301 pcix_misc2_temp |= SERRFATALENABLE_MASK;
+14 -14
drivers/pci/hotplug/shpchp_core.c
··· 57 57 58 58 #define SHPC_MODULE_NAME "shpchp" 59 59 60 - static int set_attention_status (struct hotplug_slot *slot, u8 value); 61 - static int enable_slot (struct hotplug_slot *slot); 62 - static int disable_slot (struct hotplug_slot *slot); 63 - static int get_power_status (struct hotplug_slot *slot, u8 *value); 64 - static int get_attention_status (struct hotplug_slot *slot, u8 *value); 65 - static int get_latch_status (struct hotplug_slot *slot, u8 *value); 66 - static int get_adapter_status (struct hotplug_slot *slot, u8 *value); 60 + static int set_attention_status(struct hotplug_slot *slot, u8 value); 61 + static int enable_slot(struct hotplug_slot *slot); 62 + static int disable_slot(struct hotplug_slot *slot); 63 + static int get_power_status(struct hotplug_slot *slot, u8 *value); 64 + static int get_attention_status(struct hotplug_slot *slot, u8 *value); 65 + static int get_latch_status(struct hotplug_slot *slot, u8 *value); 66 + static int get_adapter_status(struct hotplug_slot *slot, u8 *value); 67 67 68 68 static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { 69 69 .set_attention_status = set_attention_status, ··· 194 194 /* 195 195 * set_attention_status - Turns the Amber LED for a slot on, off or blink 196 196 */ 197 - static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) 197 + static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) 198 198 { 199 199 struct slot *slot = get_slot(hotplug_slot); 200 200 ··· 207 207 return 0; 208 208 } 209 209 210 - static int enable_slot (struct hotplug_slot *hotplug_slot) 210 + static int enable_slot(struct hotplug_slot *hotplug_slot) 211 211 { 212 212 struct slot *slot = get_slot(hotplug_slot); 213 213 ··· 217 217 return shpchp_sysfs_enable_slot(slot); 218 218 } 219 219 220 - static int disable_slot (struct hotplug_slot *hotplug_slot) 220 + static int disable_slot(struct hotplug_slot *hotplug_slot) 221 221 { 222 222 struct slot *slot = get_slot(hotplug_slot); 223 223 ··· 227 227 return shpchp_sysfs_disable_slot(slot); 228 228 } 229 229 230 - static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) 230 + static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 231 231 { 232 232 struct slot *slot = get_slot(hotplug_slot); 233 233 int retval; ··· 242 242 return 0; 243 243 } 244 244 245 - static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) 245 + static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 246 246 { 247 247 struct slot *slot = get_slot(hotplug_slot); 248 248 int retval; ··· 257 257 return 0; 258 258 } 259 259 260 - static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) 260 + static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 261 261 { 262 262 struct slot *slot = get_slot(hotplug_slot); 263 263 int retval; ··· 272 272 return 0; 273 273 } 274 274 275 - static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) 275 + static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 276 276 { 277 277 struct slot *slot = get_slot(hotplug_slot); 278 278 int retval;
+1 -1
drivers/pci/hotplug/shpchp_hpc.c
··· 542 542 u8 slot_cmd = 0; 543 543 544 544 switch (value) { 545 - case 0 : 545 + case 0: 546 546 slot_cmd = SET_ATTN_OFF; /* OFF */ 547 547 break; 548 548 case 1:
+5 -5
drivers/pci/hotplug/shpchp_sysfs.c
··· 35 35 36 36 /* A few routines that create sysfs entries for the hot plug controller */ 37 37 38 - static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) 38 + static ssize_t show_ctrl(struct device *dev, struct device_attribute *attr, char *buf) 39 39 { 40 40 struct pci_dev *pdev; 41 41 char *out = buf; ··· 43 43 struct resource *res; 44 44 struct pci_bus *bus; 45 45 46 - pdev = container_of (dev, struct pci_dev, dev); 46 + pdev = container_of(dev, struct pci_dev, dev); 47 47 bus = pdev->subordinate; 48 48 49 49 out += sprintf(buf, "Free resources: memory\n"); ··· 83 83 84 84 return out - buf; 85 85 } 86 - static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); 86 + static DEVICE_ATTR(ctrl, S_IRUGO, show_ctrl, NULL); 87 87 88 - int shpchp_create_ctrl_files (struct controller *ctrl) 88 + int shpchp_create_ctrl_files(struct controller *ctrl) 89 89 { 90 - return device_create_file (&ctrl->pci_dev->dev, &dev_attr_ctrl); 90 + return device_create_file(&ctrl->pci_dev->dev, &dev_attr_ctrl); 91 91 } 92 92 93 93 void shpchp_remove_ctrl_files(struct controller *ctrl)
+1 -1
drivers/pci/pci.c
··· 1534 1534 * is the default implementation. Architecture implementations can 1535 1535 * override this. 1536 1536 */ 1537 - void __weak pcibios_disable_device (struct pci_dev *dev) {} 1537 + void __weak pcibios_disable_device(struct pci_dev *dev) {} 1538 1538 1539 1539 /** 1540 1540 * pcibios_penalize_isa_irq - penalize an ISA IRQ
+1 -1
drivers/pci/setup-bus.c
··· 442 442 break; 443 443 } 444 444 } 445 - } 445 + } 446 446 447 447 } 448 448