Re: [patch 2/2] PNP: don't check disabled PCI BARs for conflicts in quirk_system_pci_resources()

Linus Torvalds
2008-09-30T18:03:25Z

On Tue, 30 Sep 2008, Linus Torvalds wrote:
>
> In contrast, the PnP fixup thing is called from pnp_fixup_device, called
> from __pnp_add_device(), called from pnp_add_device() (and
> pnp_add_card(), but that should be later), and those in turn from
> pnpacpi_add_device and pnpacpi_init().
>
> And pnpacpi_init is _also_ a subsys_initcall [...]

Btw, why is that? We very much have a separate

/**
* Reserve motherboard resources after PCI claim BARs,
* but before PCI assign resources for uninitialized PCI devices
*/
fs_initcall(pnp_system_init);

which is called much later. That seems to be the _right_ point for any
quirks. It seems that the _real_ problem here is that the PnP device fixup
is simply called from the wrong point. Ie, why do we do device discovery -
and thus PnP quirks - in pnp_init (before the PCI bus is actually fully
initialized!), rather than in pnp_system_init?

Ie, maybe the proper thing to do is to simply be *consistent* in the PnP
subsystem, and always use fs_initcall (for the stated reasons!) for the
device discovery. Ie the patch would be something like the appended, and
then you really can depend on the PCI subsystem having been set up,
including having all relevant resources inserted into the tree!

Hmm? Bjorn? Everything that is true about "pnp_system_init" should be
equally true abote pnpacpi_init and pnpbios_init, no?

Linus

---
drivers/pnp/pnpacpi/core.c | 2 +-
drivers/pnp/pnpbios/core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index c1b9ea3..53561d7 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -268,7 +268,7 @@ static int __init pnpacpi_init(void)
return 0;
}

-subsys_initcall(pnpacpi_init);
+fs_initcall(pnpacpi_init);

static int __init pnpacpi_setup(char *str)
{
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 19a4be1..662dfcd 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -571,7 +571,7 @@ static int __init pnpbios_init(void)
return 0;
}

-subsys_initcall(pnpbios_init);
+fs_initcall(pnpbios_init);

static int __init pnpbios_thread_init(void)
{