From patchwork Mon Mar 13 02:42:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichang Yuan X-Patchwork-Id: 9619647 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6489160417 for ; Mon, 13 Mar 2017 02:13:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A2302842C for ; Mon, 13 Mar 2017 02:13:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EC872844C; Mon, 13 Mar 2017 02:13:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 516842842C for ; Mon, 13 Mar 2017 02:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755825AbdCMCNS (ORCPT ); Sun, 12 Mar 2017 22:13:18 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4300 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755851AbdCMCNQ (ORCPT ); Sun, 12 Mar 2017 22:13:16 -0400 Received: from 172.30.72.57 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AKQ82049; Mon, 13 Mar 2017 10:11:20 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Mon, 13 Mar 2017 10:11:08 +0800 From: "zhichang.yuan" To: , , , , , , , , , CC: , , , , , , , , , , , , , , , , "zhichang.yuan" Subject: [PATCH V7 5/7] ACPI: Delay the enumeration on the devices whose dependency has not met Date: Mon, 13 Mar 2017 10:42:41 +0800 Message-ID: <1489372963-9000-6-git-send-email-yuanzhichang@hisilicon.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489372963-9000-1-git-send-email-yuanzhichang@hisilicon.com> References: <1489372963-9000-1-git-send-email-yuanzhichang@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A010205.58C5FFC8.004D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 4225626d8eebb70f09add7ea3b5ee804 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit 40e7fcb1929(ACPI: Add _DEP support to fix battery issue on Asus T100TA), the '_DEP' was supported to solve the dependency of Asus battery. But this patch is specific to Asus battery device. In the real world, there are other devices which need the dependency to play the role on the enumeration order. For example, all the Hip06 LPC periperals(IPMI-BT, uart, etc) must be scanned after the LPC host driver finished the probing. So, it makes sense to add a checking whether the ACPI device meet all the dependencies during its enumeration slot, if not, the enumeration will be delayed till all dependency master finish their work. This patch adds the dependency checking in ACPI enumeration, also the corresponding handling to retrigger the Hip06 LPC peripherals' scanning. Signed-off-by: zhichang.yuan --- drivers/acpi/battery.c | 3 --- drivers/acpi/scan.c | 3 +++ drivers/bus/hisi_lpc.c | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 4ef1e46..e8d1af1 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -1210,9 +1210,6 @@ static int acpi_battery_add(struct acpi_device *device) if (!device) return -EINVAL; - if (device->dep_unmet) - return -EPROBE_DEFER; - battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); if (!battery) return -ENOMEM; diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 1926918..97721b1 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1843,6 +1843,9 @@ static void acpi_bus_attach(struct acpi_device *device) if (device->handler) goto ok; + if (device->dep_unmet) + return; + if (!device->flags.initialized) { device->flags.power_manageable = device->power.states[ACPI_STATE_D0].flags.valid; diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 03cf19a..345ea12 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -516,8 +516,18 @@ static int hisilpc_probe(struct platform_device *pdev) /* * It is time to start the children scannings.... + * For ACPI children, the corresponding devices will be created after + * retriggering the ACPI scanning by removing the dependency blocking. */ - if (!has_acpi_companion(dev)) { + if (has_acpi_companion(dev)) { + struct acpi_device *adev; + + adev = to_acpi_device_node(dev->fwnode); + if (!adev) + ret = -ENODEV; + else + acpi_walk_dep_device_list(adev->handle); + } else { ret = of_platform_populate(dev->of_node, NULL, NULL, dev); if (ret) dev_err(dev, "OF: enumerate LPC bus fail(%d)\n", ret);