From patchwork Fri Jun 10 19:55:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9170397 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 CCE726048F for ; Fri, 10 Jun 2016 19:58:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE22726E5D for ; Fri, 10 Jun 2016 19:58:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2D4C282F9; Fri, 10 Jun 2016 19:58:42 +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 6051E28325 for ; Fri, 10 Jun 2016 19:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752949AbcFJTzt (ORCPT ); Fri, 10 Jun 2016 15:55:49 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:36706 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752798AbcFJTzq (ORCPT ); Fri, 10 Jun 2016 15:55:46 -0400 Received: by mail-lf0-f41.google.com with SMTP id q132so14578858lfe.3 for ; Fri, 10 Jun 2016 12:55:46 -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=EIwinj8bHvKj6M2T6470dfJFIxwnK5Di1cnN9m/fvlw=; b=OJlxqnbmUNKBHgUvtrdDlATaWLPRfdEEtfD1cj8nzqp2KwCjXNNAAx5Gt2oMwd4efj HrsPW4RINj30koRznqPeFUyOITQo3NhPGVhVerHreNXy5LKrcPRUAlSC8r66QGqMELrt hLNdBiUpWpo/mGAQuNj/NgNIIhcSe3mr3ukgiBuS/7DIpzIq+Ju0JtFUanO1aEAyrERY bOM+gb3l88cTW+IFkRme1+K6bBnAqEIy7HLdaZ5VGQdhPBmCYKQmi78nhiOyuW9jcZl7 sIxaZTO7POVYknJTxU3Fy/Ws482ap+Fgv49ey6mV5Wzna2k5PmQcnNy0DBf6PqxgNnES kJiQ== 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=EIwinj8bHvKj6M2T6470dfJFIxwnK5Di1cnN9m/fvlw=; b=T5huZi6U14KfBhDev2HOAf/KLKHxArp4giJKRxR/v75+GWTGfNz+yjzYeUUCt6nzDO hXYFmCYBf1JP2wLj1Z0P5Srwr+5+3cwdEuSXVlKA0afeakvF2GITWxHFF8VFbw+tnew5 +8S+riQ5AiuTI8aSYLWR3wDWkCaR/OhiIylwHwznz83jHiAdu/K65peySmos4Je0r+yR QGXbYkJ/HvEDEtYtZRa0FvvBNiovNBvxoZ1OpoufItmCS0/t6JuV620a9qjoKu5qb/Nj HN4fEO+WcL6odvzl+goEIy/LO6o3mGvaonpdZ8DJTGZmkCTnT2Cp5+CSNwPxr53/8EwE 59yA== X-Gm-Message-State: ALyK8tLdNmEshazmDAQi+U2GVWggdc3Ig4Pk55nVTAwLU7o5EpMlGrRG6amIExagvPjpDg== X-Received: by 10.25.169.134 with SMTP id s128mr927414lfe.84.1465588545060; Fri, 10 Jun 2016 12:55:45 -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 a190sm1377175lfe.21.2016.06.10.12.55.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jun 2016 12:55:44 -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 V9 02/11] PCI/ECAM: Add parent device field to pci_config_window Date: Fri, 10 Jun 2016 21:55:10 +0200 Message-Id: <1465588519-11334-3-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465588519-11334-1-git-send-email-tn@semihalf.com> References: <1465588519-11334-1-git-send-email-tn@semihalf.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 the 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 */