Skip to content

Commit

Permalink
Merge branches 'pci/enumeration', 'pci/virtualization' and 'pci/clean…
Browse files Browse the repository at this point in the history
…up' into next

* pci/enumeration:
  PCI: Generate uppercase hex for modalias interface class

* pci/virtualization:
  PCI: Add ACS quirk for Solarflare SFC9120 & SFC9140
  PCI: Remove unused pci_get_dma_source()
  PCI: Remove unused pci_find_upstream_pcie_bridge()

* pci/cleanup:
  PCI: Remove assignment from complicated "if" conditions
  PCI: Remove assignment from "if" conditions
  PCI: Remove unnecessary curly braces
  PCI: Add space before open parenthesis
  • Loading branch information
Bjorn Helgaas committed Sep 25, 2014
4 parents b1bf295 + 89ec3dc + 89b51cb + 2f4096e commit c0ed74e
Show file tree
Hide file tree
Showing 21 changed files with 149 additions and 206 deletions.
3 changes: 2 additions & 1 deletion drivers/pci/hotplug/acpi_pcihp.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle)
{
acpi_handle bridge_handle, parent_handle;

if (!(bridge_handle = acpi_pci_get_bridge_handle(pbus)))
bridge_handle = acpi_pci_get_bridge_handle(pbus);
if (!bridge_handle)
return 0;
if ((ACPI_FAILURE(acpi_get_parent(handle, &parent_handle))))
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/acpiphp_ibm.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static int ibm_get_table_from_acpi(char **bufp)
goto read_table_done;
}

for(size = 0, i = 0; i < package->package.count; i++) {
for (size = 0, i = 0; i < package->package.count; i++) {
if (package->package.elements[i].type != ACPI_TYPE_BUFFER) {
pr_err("%s: Invalid APCI element %d\n", __func__, i);
goto read_table_done;
Expand Down
13 changes: 8 additions & 5 deletions drivers/pci/hotplug/cpci_hotplug_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ disable_slot(struct hotplug_slot *hotplug_slot)

/* Unconfigure device */
dbg("%s - unconfiguring slot %s", __func__, slot_name(slot));
if ((retval = cpci_unconfigure_slot(slot))) {
retval = cpci_unconfigure_slot(slot);
if (retval) {
err("%s - could not unconfigure slot %s",
__func__, slot_name(slot));
goto disable_error;
Expand All @@ -141,9 +142,11 @@ disable_slot(struct hotplug_slot *hotplug_slot)
}
cpci_led_on(slot);

if (controller->ops->set_power)
if ((retval = controller->ops->set_power(slot, 0)))
if (controller->ops->set_power) {
retval = controller->ops->set_power(slot, 0);
if (retval)
goto disable_error;
}

if (update_adapter_status(slot->hotplug_slot, 0))
warn("failure to update adapter file");
Expand Down Expand Up @@ -467,9 +470,9 @@ check_slots(void)
__func__, slot_name(slot), hs_csr);

if (!slot->extracting) {
if (update_latch_status(slot->hotplug_slot, 0)) {
if (update_latch_status(slot->hotplug_slot, 0))
warn("failure to update latch file");
}

slot->extracting = 1;
atomic_inc(&extracting);
}
Expand Down
28 changes: 14 additions & 14 deletions drivers/pci/hotplug/cpcihp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if (debug) \
printk (KERN_DEBUG "%s: " format "\n", \
MY_NAME , ## arg); \
} while(0)
} while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
Expand All @@ -82,28 +82,28 @@ static int __init validate_parameters(void)
char *p;
unsigned long tmp;

if(!bridge) {
if (!bridge) {
info("not configured, disabling.");
return -EINVAL;
}
str = bridge;
if(!*str)
if (!*str)
return -EINVAL;

tmp = simple_strtoul(str, &p, 16);
if(p == str || tmp > 0xff) {
if (p == str || tmp > 0xff) {
err("Invalid hotplug bus bridge device bus number");
return -EINVAL;
}
bridge_busnr = (u8) tmp;
dbg("bridge_busnr = 0x%02x", bridge_busnr);
if(*p != ':') {
if (*p != ':') {
err("Invalid hotplug bus bridge device");
return -EINVAL;
}
str = p + 1;
tmp = simple_strtoul(str, &p, 16);
if(p == str || tmp > 0x1f) {
if (p == str || tmp > 0x1f) {
err("Invalid hotplug bus bridge device slot number");
return -EINVAL;
}
Expand All @@ -112,18 +112,18 @@ static int __init validate_parameters(void)

dbg("first_slot = 0x%02x", first_slot);
dbg("last_slot = 0x%02x", last_slot);
if(!(first_slot && last_slot)) {
if (!(first_slot && last_slot)) {
err("Need to specify first_slot and last_slot");
return -EINVAL;
}
if(last_slot < first_slot) {
if (last_slot < first_slot) {
err("first_slot must be less than last_slot");
return -EINVAL;
}

dbg("port = 0x%04x", port);
dbg("enum_bit = 0x%02x", enum_bit);
if(enum_bit > 7) {
if (enum_bit > 7) {
err("Invalid #ENUM bit");
return -EINVAL;
}
Expand Down Expand Up @@ -151,12 +151,12 @@ static int __init cpcihp_generic_init(void)
return status;

r = request_region(port, 1, "#ENUM hotswap signal register");
if(!r)
if (!r)
return -EBUSY;

dev = pci_get_domain_bus_and_slot(0, bridge_busnr,
PCI_DEVFN(bridge_slot, 0));
if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
if (!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
err("Invalid bridge device %s", bridge);
pci_dev_put(dev);
return -EINVAL;
Expand All @@ -169,21 +169,21 @@ static int __init cpcihp_generic_init(void)
generic_hpc.ops = &generic_hpc_ops;

status = cpci_hp_register_controller(&generic_hpc);
if(status != 0) {
if (status != 0) {
err("Could not register cPCI hotplug controller");
return -ENODEV;
}
dbg("registered controller");

status = cpci_hp_register_bus(bus, first_slot, last_slot);
if(status != 0) {
if (status != 0) {
err("Could not register cPCI hotplug bus");
goto init_bus_register_error;
}
dbg("registered bus");

status = cpci_hp_start();
if(status != 0) {
if (status != 0) {
err("Could not started cPCI hotplug system");
goto init_start_error;
}
Expand Down
44 changes: 22 additions & 22 deletions drivers/pci/hotplug/cpcihp_zt5550.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if (debug) \
printk (KERN_DEBUG "%s: " format "\n", \
MY_NAME , ## arg); \
} while(0)
} while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
Expand Down Expand Up @@ -82,13 +82,13 @@ static int zt5550_hc_config(struct pci_dev *pdev)
int ret;

/* Since we know that no boards exist with two HC chips, treat it as an error */
if(hc_dev) {
if (hc_dev) {
err("too many host controller devices?");
return -EBUSY;
}

ret = pci_enable_device(pdev);
if(ret) {
if (ret) {
err("cannot enable %s\n", pci_name(pdev));
return ret;
}
Expand All @@ -98,7 +98,7 @@ static int zt5550_hc_config(struct pci_dev *pdev)
dbg("pci resource start %llx", (unsigned long long)pci_resource_start(hc_dev, 1));
dbg("pci resource len %llx", (unsigned long long)pci_resource_len(hc_dev, 1));

if(!request_mem_region(pci_resource_start(hc_dev, 1),
if (!request_mem_region(pci_resource_start(hc_dev, 1),
pci_resource_len(hc_dev, 1), MY_NAME)) {
err("cannot reserve MMIO region");
ret = -ENOMEM;
Expand All @@ -107,7 +107,7 @@ static int zt5550_hc_config(struct pci_dev *pdev)

hc_registers =
ioremap(pci_resource_start(hc_dev, 1), pci_resource_len(hc_dev, 1));
if(!hc_registers) {
if (!hc_registers) {
err("cannot remap MMIO region %llx @ %llx",
(unsigned long long)pci_resource_len(hc_dev, 1),
(unsigned long long)pci_resource_start(hc_dev, 1));
Expand Down Expand Up @@ -146,7 +146,7 @@ static int zt5550_hc_config(struct pci_dev *pdev)

static int zt5550_hc_cleanup(void)
{
if(!hc_dev)
if (!hc_dev)
return -ENODEV;

iounmap(hc_registers);
Expand All @@ -170,9 +170,9 @@ static int zt5550_hc_check_irq(void *dev_id)
u8 reg;

ret = 0;
if(dev_id == zt5550_hpc.dev_id) {
if (dev_id == zt5550_hpc.dev_id) {
reg = readb(csr_int_status);
if(reg)
if (reg)
ret = 1;
}
return ret;
Expand All @@ -182,9 +182,9 @@ static int zt5550_hc_enable_irq(void)
{
u8 reg;

if(hc_dev == NULL) {
if (hc_dev == NULL)
return -ENODEV;
}

reg = readb(csr_int_mask);
reg = reg & ~ENUM_INT_MASK;
writeb(reg, csr_int_mask);
Expand All @@ -195,9 +195,8 @@ static int zt5550_hc_disable_irq(void)
{
u8 reg;

if(hc_dev == NULL) {
if (hc_dev == NULL)
return -ENODEV;
}

reg = readb(csr_int_mask);
reg = reg | ENUM_INT_MASK;
Expand All @@ -210,15 +209,15 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
int status;

status = zt5550_hc_config(pdev);
if(status != 0) {
if (status != 0)
return status;
}

dbg("returned from zt5550_hc_config");

memset(&zt5550_hpc, 0, sizeof (struct cpci_hp_controller));
zt5550_hpc_ops.query_enum = zt5550_hc_query_enum;
zt5550_hpc.ops = &zt5550_hpc_ops;
if(!poll) {
if (!poll) {
zt5550_hpc.irq = hc_dev->irq;
zt5550_hpc.irq_flags = IRQF_SHARED;
zt5550_hpc.dev_id = hc_dev;
Expand All @@ -231,30 +230,31 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id
}

status = cpci_hp_register_controller(&zt5550_hpc);
if(status != 0) {
if (status != 0) {
err("could not register cPCI hotplug controller");
goto init_hc_error;
}
dbg("registered controller");

/* Look for first device matching cPCI bus's bridge vendor and device IDs */
if(!(bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC,
PCI_DEVICE_ID_DEC_21154, NULL))) {
bus0_dev = pci_get_device(PCI_VENDOR_ID_DEC,
PCI_DEVICE_ID_DEC_21154, NULL);
if (!bus0_dev) {
status = -ENODEV;
goto init_register_error;
}
bus0 = bus0_dev->subordinate;
pci_dev_put(bus0_dev);

status = cpci_hp_register_bus(bus0, 0x0a, 0x0f);
if(status != 0) {
if (status != 0) {
err("could not register cPCI hotplug bus");
goto init_register_error;
}
dbg("registered bus");

status = cpci_hp_start();
if(status != 0) {
if (status != 0) {
err("could not started cPCI hotplug system");
cpci_hp_unregister_bus(bus0);
goto init_register_error;
Expand Down Expand Up @@ -300,11 +300,11 @@ static int __init zt5550_init(void)

info(DRIVER_DESC " version: " DRIVER_VERSION);
r = request_region(ENUM_PORT, 1, "#ENUM hotswap signal register");
if(!r)
if (!r)
return -EBUSY;

rc = pci_register_driver(&zt5550_hc_driver);
if(rc < 0)
if (rc < 0)
release_region(ENUM_PORT, 1);
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/cpqphp.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ static inline int cpq_get_latch_status(struct controller *ctrl,

status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot));

return(status == 0) ? 1 : 0;
return (status == 0) ? 1 : 0;
}


Expand Down
3 changes: 1 addition & 2 deletions drivers/pci/hotplug/cpqphp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

/* initialize our threads if they haven't already been started up */
rc = one_time_init();
if (rc) {
if (rc)
goto err_free_bus;
}

dbg("pdev = %p\n", pdev);
dbg("pci resource start %llx\n", (unsigned long long)pci_resource_start(pdev, 0));
Expand Down
Loading

0 comments on commit c0ed74e

Please sign in to comment.