From patchwork Thu Dec 20 01:48:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 1897981 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4F67B40276 for ; Thu, 20 Dec 2012 01:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752547Ab2LTB4Q (ORCPT ); Wed, 19 Dec 2012 20:56:16 -0500 Received: from hydra.sisk.pl ([212.160.235.94]:38320 "EHLO hydra.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752413Ab2LTBzx (ORCPT ); Wed, 19 Dec 2012 20:55:53 -0500 Received: from vostro.rjw.lan (afck23.neoplus.adsl.tpnet.pl [95.49.62.23]) by hydra.sisk.pl (Postfix) with ESMTPSA id DAC03E5313; Thu, 20 Dec 2012 02:57:09 +0100 (CET) From: "Rafael J. Wysocki" To: ACPI Devel Maling List Cc: Toshi Kani , Bjorn Helgaas , LKML , linux-pci@vger.kernel.org, Yinghai Lu , Myron Stowe , Yijing Wang , Jiang Liu Subject: [PATCH 2/16] ACPI: Change the ordering of PCI root bridge driver registrarion Date: Thu, 20 Dec 2012 02:48:35 +0100 Message-ID: <1355988503.fTzxlRPKzq@vostro.rjw.lan> User-Agent: KMail/4.9.3 (Linux/3.7.0; KDE/4.9.3; x86_64; ; ) In-Reply-To: <1855256.SyhOJGYMIh@vostro.rjw.lan> References: <8498184.VilrUmatxI@vostro.rjw.lan> <4082842.31rfDviYHK@vostro.rjw.lan> <1855256.SyhOJGYMIh@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Rafael J. Wysocki Instead of running acpi_pci_root_init() from a separate subsys initcall, call it directly from acpi_scan_init() before scanning the ACPI namespace for the first time, so that the PCI root bridge driver's .add() routine, acpi_pci_root_start(), is always run before binding ACPI drivers or attaching "companion" device objects to struct acpi_device objects below the root bridge's device node in the ACPI namespace. The first, simpler reason for doing this is that it makes the situation during boot more similar to the situation during hotplug, in which the ACPI PCI root bridge driver is always present. The second reason is that acpi_pci_root_init() causes struct pci_dev objects to be created for all PCI devices below the bridge and these objects may be necessary for whatever is done with the other ACPI device nodes in that namespace scope. For example, devices created by acpi_create_platform_device() sometimes may need to be added to the device hierarchy as children of PCI bridges. For this purpose, however, the struct pci_dev objects representing those bridges need to exist before the platform devices in question are registered. Signed-off-by: Rafael J. Wysocki Acked-by: Yinghai Lu --- drivers/acpi/internal.h | 1 + drivers/acpi/pci_root.c | 4 +--- drivers/acpi/scan.c | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) -- 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/drivers/acpi/internal.h =================================================================== --- linux.orig/drivers/acpi/internal.h +++ linux/drivers/acpi/internal.h @@ -67,6 +67,7 @@ struct acpi_ec { extern struct acpi_ec *first_ec; +int acpi_pci_root_init(void); int acpi_ec_init(void); int acpi_ec_ecdt_probe(void); int acpi_boot_ec_enable(void); Index: linux/drivers/acpi/pci_root.c =================================================================== --- linux.orig/drivers/acpi/pci_root.c +++ linux/drivers/acpi/pci_root.c @@ -674,7 +674,7 @@ static int acpi_pci_root_remove(struct a return 0; } -static int __init acpi_pci_root_init(void) +int __init acpi_pci_root_init(void) { acpi_hest_init(); @@ -687,5 +687,3 @@ static int __init acpi_pci_root_init(voi return 0; } - -subsys_initcall(acpi_pci_root_init); Index: linux/drivers/acpi/scan.c =================================================================== --- linux.orig/drivers/acpi/scan.c +++ linux/drivers/acpi/scan.c @@ -1831,6 +1831,7 @@ int __init acpi_scan_init(void) } acpi_power_init(); + acpi_pci_root_init(); /* * Enumerate devices in the ACPI namespace.