From patchwork Mon May 30 15:14:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9141697 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 B906D60777 for ; Mon, 30 May 2016 15:18:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA8F428185 for ; Mon, 30 May 2016 15:18:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F539281FE; Mon, 30 May 2016 15:18:37 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 4C1FA28185 for ; Mon, 30 May 2016 15:18:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933405AbcE3PPD (ORCPT ); Mon, 30 May 2016 11:15:03 -0400 Received: from mail-lf0-f43.google.com ([209.85.215.43]:36604 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933396AbcE3PO7 (ORCPT ); Mon, 30 May 2016 11:14:59 -0400 Received: by mail-lf0-f43.google.com with SMTP id b73so51431212lfb.3 for ; Mon, 30 May 2016 08:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xCjb+JEDZfd4rD2a9En7I3QkhCW+3IX1MSS2945WkUI=; b=C6HO17Z2wNVufYu+n9a8cXEN+wTSJ2su/vZ+xFD65TBI6Mj9pUelQE/rLeBkuNFXe0 Q2shIHrXfIQvD9x843m/lLWRQAg9dhH7PGeUg0vj14oJgpoKaEMqBnXU20uGcgMuXAR3 z6xmHD7NnzWMZHw9APt/tHcDCJFbwO2pPmu4qr34d6SErl/A3xaC6DkwFmyRxLz60uiw nYp0Ki3AenNeRRMB+E5gGgR74JiK7FM3EhbTntcRoM0RyAk7MgpX52/Rd2b8gZtG2Gzc 35jco8vEP6gRqywj8j9Z8AkMIw5VGaw2mX0YFQXFEW4zd2MHodJ6UL/kgQ+zm6RC+wg6 dz6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xCjb+JEDZfd4rD2a9En7I3QkhCW+3IX1MSS2945WkUI=; b=JT5cs75aLohycOJljnhpMovj6eLaKKj5SYCHV5Eci0G1H4ABiTvt03e64peO64omIK 0Zyq+bFTyFs1CUKtrqNVGCmmCb9LUtYakQBpfkpOIDvxSywmh9IidpamCiXMbbrCZe7b CgJDGMilJ7YetQwS/yHXYXrlK+b+CgyCjL4agQwFFSxi7yAwvP2pxDIGNO8eZyAUm5Q7 HfAew3b2QU4nEsj0SKO1n7GGR6tWNIRbpYuUvXl8xId693TyR9tnC8k39+P528njWLgw nhV9wRSD6JcAlJknjf9p4QlYUQd/t7iPjvDaaOJoq8oXnsOHy8sOSMYNcAsIxwFSDlf5 hTKw== X-Gm-Message-State: ALyK8tJHBLsuwbdP/dnqdCS55H1fSf7JO0SE+FXX1ViOA+SIN6wMpMZi+ggk4zOqiRuE/w== X-Received: by 10.25.19.101 with SMTP id j98mr8784694lfi.13.1464621297839; Mon, 30 May 2016 08:14:57 -0700 (PDT) Received: from tn-HP-4.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id n13sm1392264lfb.33.2016.05.30.08.14.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 May 2016 08:14:57 -0700 (PDT) From: Tomasz Nowicki To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jchandra@broadcom.com Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, andrea.gallo@linaro.org, dhdang@apm.com, jeremy.linton@arm.com, liudongdong3@huawei.com, cov@codeaurora.org Subject: [PATCH V8 2/9] PCI: ecam: Add parent device field to pci_config_window Date: Mon, 30 May 2016 17:14:15 +0200 Message-Id: <1464621262-26770-3-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464621262-26770-1-git-send-email-tn@semihalf.com> References: <1464621262-26770-1-git-send-email-tn@semihalf.com> 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 From: Jayachandran C Add a parent device field to struct pci_config_window. The parent is not saved now, but will be useful to save it in some cases. Specifically in case of ACPI for ARM64, it can be used to setup ACPI companion and domain. Since the parent dev is in struct pci_config_window now, we need not pass it to he init function as a separate argument. Signed-off-by: Jayachandran C Acked-by: Lorenzo Pieralisi --- drivers/pci/ecam.c | 3 ++- drivers/pci/host/pci-thunder-pem.c | 3 ++- include/linux/pci-ecam.h | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c index 820e26b..66e0d71 100644 --- a/drivers/pci/ecam.c +++ b/drivers/pci/ecam.c @@ -51,6 +51,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev, if (!cfg) return ERR_PTR(-ENOMEM); + cfg->parent = dev; cfg->ops = ops; cfg->busr.start = busr->start; cfg->busr.end = busr->end; @@ -94,7 +95,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev, } if (ops->init) { - err = ops->init(dev, cfg); + err = ops->init(cfg); if (err) goto err_exit; } diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c index 5020d3d..91f6fc6 100644 --- a/drivers/pci/host/pci-thunder-pem.c +++ b/drivers/pci/host/pci-thunder-pem.c @@ -284,8 +284,9 @@ static int thunder_pem_config_write(struct pci_bus *bus, unsigned int devfn, return pci_generic_config_write(bus, devfn, where, size, val); } -static int thunder_pem_init(struct device *dev, struct pci_config_window *cfg) +static int thunder_pem_init(struct pci_config_window *cfg) { + struct device *dev = cfg->parent; resource_size_t bar4_start; struct resource *res_pem; struct thunder_pem_pci *pem_pci; diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h index 9878beb..7adad20 100644 --- a/include/linux/pci-ecam.h +++ b/include/linux/pci-ecam.h @@ -27,8 +27,7 @@ struct pci_config_window; struct pci_ecam_ops { unsigned int bus_shift; struct pci_ops pci_ops; - int (*init)(struct device *, - struct pci_config_window *); + int (*init)(struct pci_config_window *); }; /* @@ -45,6 +44,7 @@ struct pci_config_window { void __iomem *win; /* 64-bit single mapping */ void __iomem **winp; /* 32-bit per-bus mapping */ }; + struct device *parent;/* ECAM res was from this dev */ }; /* create and free pci_config_window */