[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwqf7kkh0dy6AhCvB87XYkQ03YUpsYEDJmnkiRe8GQfMQ@mail.gmail.com>
Date: Thu, 10 Oct 2013 18:42:56 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
LKML <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux PCI <linux-pci@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>
Subject: Re: [BUG] WARN_ON(!context) in drivers/pci/hotplug/acpiphp_glue.c
On Thu, Oct 10, 2013 at 6:45 PM, Rafael J. Wysocki <rjw@...ysocki.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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists