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: 9170399 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 632E16048F for ; Fri, 10 Jun 2016 19:58:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5422826E5D for ; Fri, 10 Jun 2016 19:58:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48B7A28325; Fri, 10 Jun 2016 19:58:50 +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 B7BA826E5D for ; Fri, 10 Jun 2016 19:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752853AbcFJTzs (ORCPT ); Fri, 10 Jun 2016 15:55:48 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:33004 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851AbcFJTzq (ORCPT ); Fri, 10 Jun 2016 15:55:46 -0400 Received: by mail-lf0-f47.google.com with SMTP id f6so31370323lfg.0 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=I5RXOGtA2sP9gAgYwIaVGgzkz1/q/IIXOpCza4yGTrUUkZQOL6QIVaJNEjr+M0WfPP f8vNLEuI9G8GGCvl/hNTPr8FV4HeQNzYVHdP2+su43NV4feu0kJ+TO5AupM7ndPmqOij Jtv7LVWCT2ZwEVBzyqTcJ8SnJ3mi6FHnKWs3FPZ9LhEIgeC45lLjo4R5WdGd+Otw0gOf oyJ60Fu5zC99gLeC/7TDg/0xe/J4RNEWIm43ZvTsVR6KnC6lHcOQ1QJHyiDAsT0DXMuf n3LtW8JpjNXFMC3f1iqApdHAGgLpuMWYlVOHgg3QVg6tB8YIvmXduMcdj2V+LCwOIwKx waeA== X-Gm-Message-State: ALyK8tIqeJBA5Hg0ISwTtuBHLNK/tNwFO8rAONJzPx2Zlp0WFZhCXLKoILQpLrcacSSD+w== 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-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 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 */