From patchwork Mon Aug 8 13:05:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9268323 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 AF94F607D6 for ; Mon, 8 Aug 2016 13:06:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2BA927E66 for ; Mon, 8 Aug 2016 13:06:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97283283EC; Mon, 8 Aug 2016 13:06:57 +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 43FB127E66 for ; Mon, 8 Aug 2016 13:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932111AbcHHNGA (ORCPT ); Mon, 8 Aug 2016 09:06:00 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35861 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752372AbcHHNFz (ORCPT ); Mon, 8 Aug 2016 09:05:55 -0400 Received: by mail-wm0-f44.google.com with SMTP id q128so118040346wma.1 for ; Mon, 08 Aug 2016 06:05:54 -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=vrTocqRf2Ze4LO1biR/NWZKnxr7ENVv12e9was444bw=; b=yHvSlrVCdcDd0kM8OVoBCbx7DWXgCZHKNR5v/oc43koEYZbEQXp+lCTGVN4ztnzUlV t57+5mkSZU/HgCetfxz8Ka9OWs8L6ZRXUqw496zoZzBuFzwTf7zIZyZYZqQjaTNqqM2y iYz0bCp1SMn/sy62Y6n86uWHtu8hLe+R8/NbE6OpawLKippg+SSIXfMXrmiqlSIUQdNc igW25mLTj/AJGQw1h+7xbto2gEoHEFSO9NvzNzG0wYY79xMhcXN+v24wp2qJ/KxvD1QX n3lIKBWhSVWTt9hEfu6jVrdbQU1vfbo9ztY3h/bTbyKewxSZFeqjsN1HlkwPV23pJXsa XKgw== 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=vrTocqRf2Ze4LO1biR/NWZKnxr7ENVv12e9was444bw=; b=NQ+v/HMsuFB37yJCrZi6sJ38lceOGZudrA0/FcjbYMbWNTQC9V1rXp6E6zoSLWlu19 GKhtal9GvivCo6oifeQp0gq9KR+rrvTIQ9hV8JbBbumgwCYob8E7Gbw4FLtSczwUr/wy yG6XsWnRCgSrN7PB94elPZAIOOw/n3TOtVTfjBGgWPz5fPitSeLHuoR1JyyBGDj3GhiV 9D5P/xCBbGdqw+qJcfcUN3qGrejumOtAeEHmQmFwPQ2RWoGyrczorRT4goG9wsu/ivzr UgrVtjlS5z72IXNoRf+DwYQSp2z/QuH3mNrnL/pSpe/XEILajd+uwrDgF9fEZ1NTo9pD NXZA== X-Gm-Message-State: AEkooutzRjFNw1oEmZvlo1EhyIUYd8JL8XYNasY0Pf6tE2C7JonqlYeeKaGL7T71hYPLOA== X-Received: by 10.25.90.83 with SMTP id o80mr24534446lfb.112.1470661553587; Mon, 08 Aug 2016 06:05:53 -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 g11sm5644098lji.25.2016.08.08.06.05.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Aug 2016 06:05:52 -0700 (PDT) From: Tomasz Nowicki To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, Lorenzo.Pieralisi@arm.com Cc: hanjun.guo@linaro.org, okaya@codeaurora.org, jchandra@broadcom.com, cov@codeaurora.org, dhdang@apm.com, ard.biesheuvel@linaro.org, robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, wangyijing@huawei.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, andrea.gallo@linaro.org, jeremy.linton@arm.com, liudongdong3@huawei.com, gabriele.paoloni@huawei.com, jhugo@codeaurora.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Tomasz Nowicki Subject: [RFC PATCH V5 1/5] PCI: Embed pci_ecam_ops in pci_config_window structure Date: Mon, 8 Aug 2016 15:05:37 +0200 Message-Id: <1470661541-26270-2-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470661541-26270-1-git-send-email-tn@semihalf.com> References: <1470661541-26270-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 pci_config_window keeps pointer to pci_ecam_ops and every time we want to deallocate pci_config_window (pci_ecam_free()) we need to make sure to free pci_ecam_ops in case it was dynamically allocated prior to pci_ecam_create() call. To avoid that extra effort, embed pci_ecam_ops in pci_config_window, instead of just a pointer. Signed-off-by: Tomasz Nowicki To: Jayachandran C --- arch/arm64/kernel/pci.c | 2 +- drivers/pci/ecam.c | 6 +++--- include/linux/pci-ecam.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index acf3872..981e828 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -183,7 +183,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return NULL; } - acpi_pci_root_ops.pci_ops = &ri->cfg->ops->pci_ops; + acpi_pci_root_ops.pci_ops = &ri->cfg->ops.pci_ops; bus = acpi_pci_root_create(root, &acpi_pci_root_ops, &ri->common, ri->cfg); if (!bus) diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c index 43ed08d..24242f0 100644 --- a/drivers/pci/ecam.c +++ b/drivers/pci/ecam.c @@ -52,7 +52,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev, return ERR_PTR(-ENOMEM); cfg->parent = dev; - cfg->ops = ops; + cfg->ops = *ops; cfg->busr.start = busr->start; cfg->busr.end = busr->end; cfg->busr.flags = IORESOURCE_BUS; @@ -138,7 +138,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn, int where) { struct pci_config_window *cfg = bus->sysdata; - unsigned int devfn_shift = cfg->ops->bus_shift - 8; + unsigned int devfn_shift = cfg->ops.bus_shift - 8; unsigned int busn = bus->number; void __iomem *base; @@ -149,7 +149,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn, if (per_bus_mapping) base = cfg->winp[busn]; else - base = cfg->win + (busn << cfg->ops->bus_shift); + base = cfg->win + (busn << cfg->ops.bus_shift); return base + (devfn << devfn_shift) + where; } diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h index 7adad20..0ce2920 100644 --- a/include/linux/pci-ecam.h +++ b/include/linux/pci-ecam.h @@ -39,7 +39,7 @@ struct pci_config_window { struct resource res; struct resource busr; void *priv; - struct pci_ecam_ops *ops; + struct pci_ecam_ops ops; union { void __iomem *win; /* 64-bit single mapping */ void __iomem **winp; /* 32-bit per-bus mapping */