Message ID | 18685640.N2BnVjDmHD@vostro.rjw.lan (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Thu, Oct 10, 2013 at 6:45 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote: > > /* Register slots for ejectable funtions only. */ > - if (acpi_pci_check_ejectable(pbus, handle) || is_dock_device(handle)) { > + if ((acpi_pci_check_ejectable(pbus, handle) || is_dock_device(handle)) > + && !(pdev && device_is_managed_by_native_pciehp(pdev))) { > unsigned long long sun; > int retval; I can't even begin to say whether this is a good solution or not, because that if-conditional makes me want to go out and kill some homeless people to let my aggressions out. Can we please agree to *never* write code like this? Ever? Use a well-named inline helper function where the name describes what the f*ck the code is trying to do, and then comment the separate issues. Because none of the above line noise makes me go "Ahh, it's the test for an ejectable function". What the heck _is_ an "ejectable function" anyway? The only comment there just makes the code even less sensible. Please? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c =================================================================== --- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c +++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c @@ -274,9 +274,6 @@ static acpi_status register_slot(acpi_ha struct pci_dev *pdev = bridge->pci_dev; u32 val; - if (pdev && device_is_managed_by_native_pciehp(pdev)) - return AE_OK; - status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); if (ACPI_FAILURE(status)) { acpi_handle_warn(handle, "can't evaluate _ADR (%#x)\n", status); @@ -326,7 +323,8 @@ static acpi_status register_slot(acpi_ha list_add_tail(&slot->node, &bridge->slots); /* Register slots for ejectable funtions only. */ - if (acpi_pci_check_ejectable(pbus, handle) || is_dock_device(handle)) { + if ((acpi_pci_check_ejectable(pbus, handle) || is_dock_device(handle)) + && !(pdev && device_is_managed_by_native_pciehp(pdev))) { unsigned long long sun; int retval;