From patchwork Tue Aug 25 17:33:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7072331 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A8D9CC05AC for ; Tue, 25 Aug 2015 17:35:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6DEE20881 for ; Tue, 25 Aug 2015 17:35:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B5492087F for ; Tue, 25 Aug 2015 17:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756011AbbHYRe6 (ORCPT ); Tue, 25 Aug 2015 13:34:58 -0400 Received: from mail-by2on0138.outbound.protection.outlook.com ([207.46.100.138]:45225 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753234AbbHYReF (ORCPT ); Tue, 25 Aug 2015 13:34:05 -0400 Received: from BN1PR02CA0039.namprd02.prod.outlook.com (10.141.56.39) by BY2PR0201MB1496.namprd02.prod.outlook.com (10.163.153.157) with Microsoft SMTP Server (TLS) id 15.1.256.15; Tue, 25 Aug 2015 17:34:02 +0000 Received: from BY2FFO11FD037.protection.gbl (2a01:111:f400:7c0c::190) by BN1PR02CA0039.outlook.office365.com (2a01:111:e400:2a::39) with Microsoft SMTP Server (TLS) id 15.1.243.23 via Frontend Transport; Tue, 25 Aug 2015 17:34:02 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by BY2FFO11FD037.mail.protection.outlook.com (10.1.14.222) with Microsoft SMTP Server id 15.1.249.14 via Frontend Transport; Tue, 25 Aug 2015 17:34:00 +0000 X-WSS-ID: 0NTNFGJ-08-23T-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 24BDBD1601A; Tue, 25 Aug 2015 13:33:54 -0400 (EDT) Received: from SATLEXDAG01.amd.com (10.181.40.3) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 25 Aug 2015 12:34:08 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server id 14.3.195.1; Tue, 25 Aug 2015 13:33:57 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , Suravee Suthikulpanit , Rob Herring , "Murali Karicheri" Subject: [PATCH V2 3/4] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure() Date: Wed, 26 Aug 2015 00:33:28 +0700 Message-ID: <1440524009-5359-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440524009-5359-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1440524009-5359-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD037; 1:ve6OcnuU22IXYQXfset87TapJY4xH1nwk6n6OXMVvaximsabCSYeBii78Ps5GtI/UcZwaN0iceO7HbjBqNV9mnzPGIAaz32qL3f4j69PyUhpZJL22w4D/ekilKRf17BR+BxHieBkXYxipGhMnV307RCa1W0SJIQQyAmLlGdjX8Ma1TXOmghtAiD1MMNObz1ngz/CcBjYS7CCBn/CTdGV9I3meqcQHo3Fd1cZ1mw1Fj9HomzrBl8o8XHbNxTD0jFtd8mRBqwbn8r/uN+3KA79GBRfunTNqg9PAnhj6Ylq7vLQOyddY4V/fMKqLnrd07yjQCc8Sx0WHzy90LHlHybmUlCeZdQlT/t436Li7PHia25SDuxC65Drfdnmiritbjle X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(428002)(3050300001)(199003)(189002)(19580395003)(48376002)(101416001)(50986999)(76176999)(575784001)(5003600100002)(86362001)(77156002)(189998001)(62966003)(36756003)(4001540100001)(5001830100001)(5001860100001)(50226001)(92566002)(97736004)(68736005)(2950100001)(77096005)(50466002)(5001770100001)(5003940100001)(87936001)(64706001)(46102003)(47776003)(2201001)(53416004)(5007970100001)(106466001)(105586002)(229853001)(19580405001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0201MB1496; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1496; 2:1Q5IoYBptwhdT3GfpcPfeGpTHvIgH/Hbjd5oc4f7HCdamWvAPFmX5GPaaUHTLXbebnvVJlA+96TUxbcbSJZhz0h4utaI0VdWCxpLgyboUjLZOW/eACMr+bisxgdnQrwBg29u4+X/HZwgAHLjbJgoXKP7mKlJiEP9D6Sgau4OCNU=; 3:21koRiwWFvbDkoomoRjqXWEmcdex+iW4L8e91DmJRDk1CCBYZGOsD28N2+jCk312d21148NgW2rlFWFd/kjhi+/z9UNuObE1aGwr3f08kHMvHvjMVhOEvpYGDEBtLG0jxtDv0oklfgre9G1EWehLN/dJlTZkCZxJdYC8KiGCP7ADFupUfmSMR8u5VEaECZaO2hID7yE0fZwyBoiXj21Rbkj3YifMOd0nLIAZwIMEVKJ6P76tG2HCXQwYVDpgtfKO; 25:k3CUBVGP/uqDZrserVr5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Y2zxYqw9C7gIfnaRwotA5DUB14+I05diPY4WwcdRtePHMXT7bfLEqS/1nQnoVINRZXD4UrhFo8slysshRYoK3ou0AYf8pUpUhxXCR7AcB/FhONG5xYiIy0isSzIq7DZRa7XZm25/FCjd0IClOEISg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(3002001); SRVR:BY2PR0201MB1496; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB1496; X-Forefront-PRVS: 06793E740F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0201MB1496; 23:Kw9F/SThUow6sis7s61XQOHUFTlbj6LHneEokf9?= =?us-ascii?Q?5LwIRo0CC0aA0CoJzTuFvv+JqOGCXetl3MJD5HQ1RysGNL5dtVWrdVEW6d8d?= =?us-ascii?Q?LaGXT/uVq2jyIpsCEEXk/08/F5pVFMTMLWoChbIPwIQA6dH94WXQG2NMJWIm?= =?us-ascii?Q?qn0USlRABWf6tEu5c8O4hfg0pd8Q15uhU9I/yG9okIPHSVqvdOPwjkQuduer?= =?us-ascii?Q?HVDok6eN7L+PpbiY9GOs7gb+18a+FWMoMEYLAHeu0NxqZrP6pW5GPJVdglhl?= =?us-ascii?Q?otHDZlU1gxSAnUC8ZfCS9bWFh10vYmXpa1zrGpcEG6nF9ggG+IaIXpnOD5Q5?= =?us-ascii?Q?tm2syG5qpmFKXWnRdc8qtfAmYUJBdtyokS7NoNc+NhD8Ds93hfHSnF4rrHFy?= =?us-ascii?Q?C+LHHGmff0gGqjz+c8dS6mpclMx4EWzRgFO1z5bTZT63zUVQtWCeSRXGEGLs?= =?us-ascii?Q?FQRkxRgAirFgpyCdclQypo8Xn9f7JTamCStQlCljQsZMQsBsDW/ohsvw6GC3?= =?us-ascii?Q?GbyCcKh/TN1NPi0Kdnyu6grUWN4zOji7o8xp7my/X29vmCRV3x6kWOxCQWSW?= =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fhiMEwDEh7XvN9Qd4fDYbRU+FtmDd16UvFR0Q== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2015 17:34:00.9238 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1496 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch move of_pci_dma_configure() to a more generic pci_dma_configure(), which can be extended by non-OF code (e.g. ACPI). This has no functional change. Signed-off-by: Suravee Suthikulpanit CC: Bjorn Helgaas CC: Catalin Marinas CC: Rob Herring CC: Will Deacon CC: Rafael J. Wysocki CC: Murali Karicheri Acked-by: Rob Herring --- drivers/of/of_pci.c | 20 -------------------- drivers/pci/probe.c | 27 +++++++++++++++++++++++++-- include/linux/of_pci.h | 3 --- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 5751dc5..b66ee4e 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -117,26 +117,6 @@ int of_get_pci_domain_nr(struct device_node *node) } EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); -/** - * of_pci_dma_configure - Setup DMA configuration - * @dev: ptr to pci_dev struct of the PCI device - * - * Function to update PCI devices's DMA configuration using the same - * info from the OF node of host bridge's parent (if any). - */ -void of_pci_dma_configure(struct pci_dev *pci_dev) -{ - struct device *dev = &pci_dev->dev; - struct device *bridge = pci_get_host_bridge_device(pci_dev); - - if (!bridge->parent) - return; - - of_dma_configure(dev, bridge->parent->of_node); - pci_put_host_bridge_device(bridge); -} -EXPORT_SYMBOL_GPL(of_pci_dma_configure); - #if defined(CONFIG_OF_ADDRESS) /** * of_pci_get_host_bridge_resources - Parse PCI host bridge resources from DT diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cefd636..4de6594 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -6,12 +6,14 @@ #include #include #include -#include +#include #include #include #include #include #include +#include +#include #include #include "pci.h" @@ -1544,6 +1546,27 @@ static void pci_init_capabilities(struct pci_dev *dev) pci_enable_acs(dev); } +/** + * pci_dma_configure - Setup DMA configuration + * @dev: ptr to pci_dev struct of the PCI device + * + * Function to update PCI devices's DMA configuration using the same + * info from the OF node of host bridge's parent (if any). + */ +static void pci_dma_configure(struct pci_dev *dev) +{ + struct device *bridge = pci_get_host_bridge_device(dev); + + if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) { + if (!bridge->parent) + return; + + of_dma_configure(&dev->dev, bridge->parent->of_node); + } + + pci_put_host_bridge_device(bridge); +} + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -1557,7 +1580,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_parms = &dev->dma_parms; dev->dev.coherent_dma_mask = 0xffffffffull; - of_pci_dma_configure(dev); + pci_dma_configure(dev); pci_set_dma_max_seg_size(dev, 65536); pci_set_dma_seg_boundary(dev, 0xffffffff); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29fd3fe..ce0e5ab 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -16,7 +16,6 @@ int of_pci_get_devfn(struct device_node *np); int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); int of_pci_parse_bus_range(struct device_node *node, struct resource *res); int of_get_pci_domain_nr(struct device_node *node); -void of_pci_dma_configure(struct pci_dev *pci_dev); #else static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) { @@ -51,8 +50,6 @@ of_get_pci_domain_nr(struct device_node *node) { return -1; } - -static inline void of_pci_dma_configure(struct pci_dev *pci_dev) { } #endif #if defined(CONFIG_OF_ADDRESS)