devfn = PCI_DEVFN(func->device, func->function);
// Save the command register
- pci_bus_read_config_word (pci_bus, devfn, PCI_COMMAND, &save_command);
+ pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &save_command);
// disable card
command = 0x00;
- pci_bus_write_config_word (pci_bus, devfn, PCI_COMMAND, command);
+ pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command);
// Check for Bridge
- pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
+ pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // PCI-PCI Bridge
// Clear Bridge Control Register
command = 0x00;
- pci_bus_write_config_word (pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
- pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
- pci_bus_read_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
+ pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
+ pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
+ pci_bus_read_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
- bus_node =(struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ bus_node = kmalloc(sizeof(*bus_node), GFP_KERNEL);
if (!bus_node)
return -ENOMEM;
func->bus_head = bus_node;
// Save IO base and Limit registers
- pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_BASE, &b_base);
- pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_LIMIT, &b_length);
+ pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_BASE, &b_base);
+ pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_LIMIT, &b_length);
if ((b_base <= b_length) && (save_command & 0x01)) {
- io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ io_node = kmalloc(sizeof(*io_node), GFP_KERNEL);
if (!io_node)
return -ENOMEM;
}
// Save memory base and Limit registers
- pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
- pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
+ pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
+ pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
if ((w_base <= w_length) && (save_command & 0x02)) {
- mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ mem_node = kmalloc(sizeof(*mem_node), GFP_KERNEL);
if (!mem_node)
return -ENOMEM;
}
// Save prefetchable memory base and Limit registers
- pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
- pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
+ pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
+ pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
if ((w_base <= w_length) && (save_command & 0x02)) {
- p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ p_mem_node = kmalloc(sizeof(*p_mem_node), GFP_KERNEL);
if (!p_mem_node)
return -ENOMEM;
pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);
temp_register = 0xFFFFFFFF;
- pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);
- pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);
+ pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register);
+ pci_bus_read_config_dword(pci_bus, devfn, cloop, &base);
temp_register = base;
temp_register = base & 0xFFFFFFFE;
temp_register = (~temp_register) + 1;
- io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ io_node = kmalloc(sizeof(*io_node),
+ GFP_KERNEL);
if (!io_node)
return -ENOMEM;
temp_register = base & 0xFFFFFFF0;
temp_register = (~temp_register) + 1;
- p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ p_mem_node = kmalloc(sizeof(*p_mem_node),
+ GFP_KERNEL);
if (!p_mem_node)
return -ENOMEM;
temp_register = base & 0xFFFFFFF0;
temp_register = (~temp_register) + 1;
- mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ mem_node = kmalloc(sizeof(*mem_node),
+ GFP_KERNEL);
if (!mem_node)
return -ENOMEM;
} else if ((header_type & 0x7F) == 0x00) { // Standard header
// Figure out IO and memory base lengths
for (cloop = 0x10; cloop <= 0x24; cloop += 4) {
- pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);
+ pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base);
temp_register = 0xFFFFFFFF;
- pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);
- pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);
+ pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register);
+ pci_bus_read_config_dword(pci_bus, devfn, cloop, &base);
temp_register = base;
temp_register = base & 0xFFFFFFFE;
temp_register = (~temp_register) + 1;
- io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ io_node = kmalloc(sizeof(*io_node),
+ GFP_KERNEL);
if (!io_node)
return -ENOMEM;
temp_register = base & 0xFFFFFFF0;
temp_register = (~temp_register) + 1;
- p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ p_mem_node = kmalloc(sizeof(*p_mem_node),
+ GFP_KERNEL);
if (!p_mem_node)
return -ENOMEM;
temp_register = base & 0xFFFFFFF0;
temp_register = (~temp_register) + 1;
- mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ mem_node = kmalloc(sizeof(*mem_node),
+ GFP_KERNEL);
if (!mem_node)
return -ENOMEM;
temp_dword = io_base + io_length;
if ((io_base) && (temp_dword < 0x10000)) {
- io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ io_node = kmalloc(sizeof(*io_node), GFP_KERNEL);
if (!io_node)
return -ENOMEM;
io_node->base = io_base;
io_node->length = io_length;
- dbg("found io_node(base, length) = %x, %x\n", io_node->base, io_node->length);
+ dbg("found io_node(base, length) = %x, %x\n",
+ io_node->base, io_node->length);
dbg("populated slot =%d \n", populated_slot);
if (!populated_slot) {
io_node->next = ctrl->io_head;
// If we've got a valid memory base, use it
temp_dword = mem_base + mem_length;
if ((mem_base) && (temp_dword < 0x10000)) {
- mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ mem_node = kmalloc(sizeof(*mem_node), GFP_KERNEL);
if (!mem_node)
return -ENOMEM;
mem_node->length = mem_length << 16;
- dbg("found mem_node(base, length) = %x, %x\n", mem_node->base, mem_node->length);
+ dbg("found mem_node(base, length) = %x, %x\n",
+ mem_node->base, mem_node->length);
dbg("populated slot =%d \n", populated_slot);
if (!populated_slot) {
mem_node->next = ctrl->mem_head;
// the base + length isn't greater than 0xFFFF
temp_dword = pre_mem_base + pre_mem_length;
if ((pre_mem_base) && (temp_dword < 0x10000)) {
- p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ p_mem_node = kmalloc(sizeof(*p_mem_node), GFP_KERNEL);
if (!p_mem_node)
return -ENOMEM;
p_mem_node->base = pre_mem_base << 16;
p_mem_node->length = pre_mem_length << 16;
- dbg("found p_mem_node(base, length) = %x, %x\n", p_mem_node->base, p_mem_node->length);
+ dbg("found p_mem_node(base, length) = %x, %x\n",
+ p_mem_node->base, p_mem_node->length);
dbg("populated slot =%d \n", populated_slot);
if (!populated_slot) {
// The second condition is to ignore bus numbers on
// populated slots that don't have PCI-PCI bridges
if (secondary_bus && (secondary_bus != primary_bus)) {
- bus_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+ bus_node = kmalloc(sizeof(*bus_node), GFP_KERNEL);
if (!bus_node)
return -ENOMEM;
bus_node->base = secondary_bus;
bus_node->length = max_bus - secondary_bus + 1;
- dbg("found bus_node(base, length) = %x, %x\n", bus_node->base, bus_node->length);
+ dbg("found bus_node(base, length) = %x, %x\n",
+ bus_node->base, bus_node->length);
dbg("populated slot =%d \n", populated_slot);
if (!populated_slot) {
bus_node->next = ctrl->bus_head;