From patchwork Fri Apr 20 10:07:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 133867 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp86898ljf; Fri, 20 Apr 2018 03:08:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Nf+RY/ZfVNx/9gYpNUTV0/YQ/+0fJu4Ym8/WZpu9iswX9jN9aPQdViitHjtUc3IZTLT0A X-Received: by 10.99.56.91 with SMTP id h27mr7974966pgn.82.1524218903296; Fri, 20 Apr 2018 03:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524218903; cv=none; d=google.com; s=arc-20160816; b=d9Gu6TPiJaGZy1yUrmQDzphZMckQE7Wv7V+4OMTWcuUQSinOBYh2hMDKGOvWDEjOe0 yfkg13IZzEHwJa3zjxDmjZGR5uHBk206btZiUJYWOOGy0XO22SjC9cfSRH3rA2gEz1+q BpNEFCAQkxfQNmq/+7VVRJsGJC2Mp6o2InZsCjOwb5ExBJ5RH8m/hsjUQmsKpUbdee4b PrJwID3PIZe8RBwBr7+Ox4YBVMx7ADn6NIpAjJkte1ssxjoZ37T464ppwLifWYadhmXJ 5kJXVOhs4xQ1kytk7yt6bVwgJCnjuTh2Ktd5452AJqQQ/8K8DI74zVlywvmFRh8f0ENF ctOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=QNe/kuQtTmS0ujUSf/5ooyFVsqlIQFsoLR8xlQg9k0s=; b=x5zbF2lkWAbcZI9pmxdDyAenzpnbGLKOJZV4GD3ENCP21hUF5VRsspJans2yf2b1sX lIu/DRlmSfue0SU9zqIdaNvqU5KdwVVJ3F6rEc3t9+pO9AWkC8bXlsMrczeLYKwdW/jl k5wUmKh/ODEkHcLzik//HNi1+QuRzhBNqfNbFJGPbUtJeBo22g8BucKSthIzLrJXbWqt ZdCo4Dqu3JUFCS11cLJdPPKonw73jq1IHWwS8mwVoPBjqrjjB5UPGM95BOKGLwPrr/Zx fF15ajsMU1GTLMsjStKS65fDiGy+uKKkaEv0/uzqUDYjfCct4tDAWPXmcjCda5HYTZIO ohDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si4959429pff.13.2018.04.20.03.08.23; Fri, 20 Apr 2018 03:08:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754622AbeDTKIV (ORCPT + 8 others); Fri, 20 Apr 2018 06:08:21 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6754 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754398AbeDTKIT (ORCPT ); Fri, 20 Apr 2018 06:08:19 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 40760938A8489; Fri, 20 Apr 2018 18:08:06 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Fri, 20 Apr 2018 18:08:01 +0800 From: John Garry To: , , , , , CC: , , , , , , John Garry Subject: [RFC PATCH 1/2] ACPI / PNP: Don't add "enumeration_by_parent" devices Date: Fri, 20 Apr 2018 18:07:25 +0800 Message-ID: <1524218846-169934-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524218846-169934-1-git-send-email-john.garry@huawei.com> References: <1524218846-169934-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org For ACPI devices with the enumeration_by_parent flag set, we expect the parent device to enumerate the device after the ACPI scan. This patch does partially the same for devices which are enumerated as PNP devices. We still want PNP scan code to create the per-ACPI device PNP device, but hold off adding the device to allow the parent to do this optionally. Flag acpi_device.driver_data is used as temp store as a reference to the PNP device for the parent. Signed-off-by: John Garry --- drivers/pnp/pnpacpi/core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Signed-off-by: John Garry diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 3a4c1aa..92f9d6f 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -285,10 +285,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device) if (!dev->active) pnp_init_resources(dev); - error = pnp_add_device(dev); - if (error) { - put_device(&dev->dev); - return error; + if (!device->flags.enumeration_by_parent) { + error = pnp_add_device(dev); + if (error) { + put_device(&dev->dev); + return error; + } + } else { + device->driver_data = dev; } num++; From patchwork Fri Apr 20 10:07:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 133866 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp86882ljf; Fri, 20 Apr 2018 03:08:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/sBxgzreFNvaXJzarwVBKu05fLek5fhkgr+ZXZVr/2KEL9IWUXxC5MMnc6tf+OBxiMLZcL X-Received: by 2002:a17:902:7249:: with SMTP id c9-v6mr9670301pll.217.1524218901813; Fri, 20 Apr 2018 03:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524218901; cv=none; d=google.com; s=arc-20160816; b=b/5UX4miB/SFs7uUhnQgikVnZiBICB6Aw6fRj8x7VmD1IQS4HZ3iEe+QG3BUWIiHmF /0b5ofObvI0CyQR42OHe2+50jAfU0t86+hd/h+fGwKlXpu87AygtyWi5SK9mL8SljQaU Vys+Ynzh5+J+FjPSW+5dJ1O6k6Ec6fkyznUgf+gq5Y/80J4wrPF0Y9Oyj/K6TJbCd3hk Se25NYQxAE0faBKSORsKIUW/3+vCcqjN31p/ed8b6fk4txc9QTaYVizoEGKzyC20IIuD t5s0zfNd+IKoq5PN7Eh6cqXKFrngf+BdWeJzufzLQA4zqwK6KIiFCrwUg3Hgzjd2qzLg m1AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=IxvM7ije14ESZBeVQ+IkqOYpQRBrYC5H/zFHxVlwDPw=; b=LffnMzDsj8KWDh7LOEbl5wkQigCMOqeC73V7U/ds+QQhCqFOLQijDtiB12eSlc1hkl 3wnNaaOe1qRH4iYUD5PAvK52QIeS/W98fuBLqlKacPYc07WodZRxcua6hWQwYBU1ohcu 0aQFQ4Ktvhh3mVKBvOdxymSZ449cENfJa3w38Pk4EKY3KQnh2Ai2N5HD2mwWNVuI0KSf 0nWuX9d+Ncy4xq33IK+u3tZoMkb4IonEMTQkt2uY8Gsm8YMola2BMcAKbZvC/fcCzeZP 4Fgy6poYYzd8EaFfPR1RlxMM7hwh3Y+nYHTlsImJaWS1oCYkf57ov7uYQK3d62FG1MgH tiCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si4959429pff.13.2018.04.20.03.08.21; Fri, 20 Apr 2018 03:08:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754511AbeDTKIU (ORCPT + 8 others); Fri, 20 Apr 2018 06:08:20 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6752 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754328AbeDTKIT (ORCPT ); Fri, 20 Apr 2018 06:08:19 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 30778FF4DF2DB; Fri, 20 Apr 2018 18:08:06 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Fri, 20 Apr 2018 18:08:01 +0800 From: John Garry To: , , , , , CC: , , , , , , John Garry Subject: [RFC PATCH 2/2] HISI LPC: Add PNP device support Date: Fri, 20 Apr 2018 18:07:26 +0800 Message-ID: <1524218846-169934-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524218846-169934-1-git-send-email-john.garry@huawei.com> References: <1524218846-169934-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently the driver creates an per-ACPI device mfd_cell for child devices. This does not suit devices which are PNP-compatible, as we expect PNP-compatible devices to derive PNP devices. To add PNP device support, we continue to allow the PNP scan code to create the PNP device (which have the enumeration_by_parent flag set), but expect the PNP scan to defer adding the device to allow the host probe code to do this. In addition, no longer do we create an mfd_cell (platform_device) for PNP-compatible devices. We take this approach so that host probe code can translate the IO resources of the PNP device prior to adding the device. Signed-off-by: John Garry --- drivers/bus/hisi_lpc.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 2d4611e..d228bc5 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -17,8 +17,11 @@ #include #include #include +#include #include +#include "../pnp/base.h" + #define DRV_NAME "hisi-lpc" /* @@ -469,8 +472,11 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) struct acpi_device *child; int size, ret, count = 0, cell_num = 0; - list_for_each_entry(child, &adev->children, node) + list_for_each_entry(child, &adev->children, node) { + if (acpi_is_pnp_device(child)) + continue; cell_num++; + } /* allocate the mfd cell and companion ACPI info, one per child */ size = sizeof(*mfd_cells) + sizeof(*hisi_lpc_mfd_cells); @@ -492,6 +498,9 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) .pnpid = pnpid, }; + if (acpi_is_pnp_device(child)) + continue; + /* * For any instances of this host controller (Hip06 and Hip07 * are the only chipsets), we would not have multiple slaves @@ -523,6 +532,33 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) return ret; } + list_for_each_entry(child, &adev->children, node) { + struct pnp_resource *pnp_res; + struct pnp_dev *pnp_dev; + int rc; + + if (!acpi_is_pnp_device(child)) + continue; + + pnp_dev = child->driver_data; + + /* + * Prior to adding the device, we need to translate the + * resources to logical PIO addresses. + */ + list_for_each_entry(pnp_res, &pnp_dev->resources, list) { + struct resource *res = &pnp_res->res; + + if (res->flags | IORESOURCE_IO) + hisi_lpc_acpi_xlat_io_res(child, adev, res); + } + rc = pnp_add_device(pnp_dev); + if (rc) { + put_device(&pnp_dev->dev); + return rc; + } + } + return 0; }