From patchwork Wed Oct 28 22:50:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 55729 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp213220lbr; Wed, 28 Oct 2015 15:52:46 -0700 (PDT) X-Received: by 10.107.157.71 with SMTP id g68mr13618478ioe.118.1446072766724; Wed, 28 Oct 2015 15:52:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1si23579997igl.100.2015.10.28.15.52.46; Wed, 28 Oct 2015 15:52:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964911AbbJ1Wwo (ORCPT + 28 others); Wed, 28 Oct 2015 18:52:44 -0400 Received: from mail-by2on0060.outbound.protection.outlook.com ([207.46.100.60]:33376 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754680AbbJ1Wvc (ORCPT ); Wed, 28 Oct 2015 18:51:32 -0400 Received: from SN1PR12CA0030.namprd12.prod.outlook.com (10.162.96.168) by SN1PR12MB0861.namprd12.prod.outlook.com (10.164.27.11) with Microsoft SMTP Server (TLS) id 15.1.312.18; Wed, 28 Oct 2015 22:51:30 +0000 Received: from BY2NAM03FT020.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::203) by SN1PR12CA0030.outlook.office365.com (2a01:111:e400:5174::40) with Microsoft SMTP Server (TLS) id 15.1.312.18 via Frontend Transport; Wed, 28 Oct 2015 22:51:30 +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; arm.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by BY2NAM03FT020.mail.protection.outlook.com (10.152.84.224) with Microsoft SMTP Server id 15.1.318.9 via Frontend Transport; Wed, 28 Oct 2015 22:51:29 +0000 X-WSS-ID: 0NWYCTQ-08-J8X-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 295B6D16006; Wed, 28 Oct 2015 18:51:25 -0400 (EDT) Received: from SATLEXDAG03.amd.com (10.181.40.7) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 28 Oct 2015 17:51:40 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server id 14.3.266.1; Wed, 28 Oct 2015 18:51:25 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , , , , Suravee Suthikulpanit Subject: [PATCH V5 8/9] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure() Date: Wed, 28 Oct 2015 15:50:53 -0700 Message-ID: <1446072654-5608-9-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446072654-5608-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1446072654-5608-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(189002)(199003)(77096005)(5001770100001)(2950100001)(5007970100001)(19580395003)(2201001)(48376002)(19580405001)(86362001)(575784001)(36756003)(50466002)(50226001)(5003600100002)(11100500001)(5008740100001)(97736004)(5003940100001)(76176999)(50986999)(92566002)(87936001)(106466001)(53416004)(189998001)(47776003)(101416001)(229853001)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0861; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0861; 2:aLnqslr2hTrOjrKP82JQVzKZGpbzrmypwPUoJokXvOnPZYTMUtNNpoP3X/vg8qsvUK0UOacdFA21OXLLJKgeFb4u84oUTdnZAeQ5iUBqyJwBfCIFWA0kF+2Cc0vyFZSJ5Epnv3gM/SlljuayFlEJ5Skqh+s2cM8h/Me3choRMv4=; 3:WzC5J0XEBC7KXYngdpK93+AIZrnndOisHjm8nQ9oJ5PPrN69BrRNCG+L9Lz/c+zMBLtKxHodiTJ12cymUVSE+bdRtPo2lEI063Rmg3xASp4eKRhQ+jUspy40GBssnxfMhe1BrLltNdPd7B6HTOzXChTbsus/LSAMgkvsg3dtkDybc0vZesgRbImnpK1FOxxcR8wwymJhoTFqf81jBHHsFRN0lGuU8ri4nI+qZHLgSFYMHcZ20qKybh7q2Pk3sRwh; 25:r0HDOy4C78w5DU087sGf94iQ1Q3nz32xVhqYOGDxq9+2Oh7UEDGynyE458AdeqVShXlssC0jFaN37H6zrxnefooryZY8QzjaergPbVywGg+3cFFaOgACCcSn0RmRyQ6bylI8JoWQBWLhtWEdOfTJjq9uYRJgtyLtJYL71KL+hvbX+SMTXQv7+4aRjXBoQi9WgMiYdm39AbpxphvgDDpd/PDrl2iKLjom3xcQCNdVsO9o1L5iPgXRKaoEkjupWdTqLZwTrH9hPQIqy3dt7u0MkQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0861; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0861; 20:l56Qg53je9M2cvpxwne67WkzQIcGwvlBt9T/34rq0fNhv30xZdmFLjAtOiNhEsV1blP23cc1VSfkc/XPVT8dh50NIibt+5OEmF0Kmqf+vnfi+Jm1GN/IynnU7VrtDCcteldj65Hh/sFc2PfWSm48o4EoFGgNPap8V+w3HrDzh+ctr6y3+HdtLbqeRbHtR19QookzeTsg9s7LGqMb8JVYikbt6Stv9kapUsQleAl22ID/PoGZVdw50ejhqJOHb+1EbBkPD/+2YnxPYFlgi/PunClvOFy4P7Aah3fnsEYfzpqM3LHpwdrOOMq+Wc/yXZCMr2GzTJKZAWURTbFxMZHIMQfaLD7Uy5JIFjmvJyynR4kzhddHvsNCb9YpM6kpaQ3IBPPDbeByRoOK5os9Wu7pijgWWMUvp2dXQR+KJnCMEBkzcwQDmEurEqiX2qp2mX+xwQttiFIBFT2ipicF8eznBZnahf5zErkP3Fn43WtbvZOyRK8UERPgummJ8WPS0O/c; 4:5+YeRHJRe/oMglSxv4/yDhyan3s+JBzaqKkFHS5nmimnBJ5Q3469FBkxQQFY2EGnSqVtKWDGxWjnDvzASimXuUmuqb+Obaewx/YtbUC0cOYSSKo2PhU6mMn7B3kLvXFelZKpK+/Yg8+PmBmtCTZWY2QCODWDv0RI1cMCkiNg5lMw0jLC5lQGy4X8elA41uAGUKfYenNVAwufjnV6rPrkK6rlPTsb4KHTlB4NgNmkbw2+PmLBUjFIn5CRHtJCOp3SMkD+CBNjUXWbRp+HXNRpie1nbvoNvAZ9TBWs7gndfxzTVq0r1ugZB0hz9QE77cXqgJ/Noxa5C2BbKGoa8pWuH9ESytwKuuxKlvOugjEiyNTxnSPE+9D0Iufvi2mjIdEAreOBb0xGWTep9i1prk0sug== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001)(102215026); SRVR:SN1PR12MB0861; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0861; X-Forefront-PRVS: 0743E8D0A6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0861; 23:jYALKnhYzU+JJkPWnbsGFTuTiEWPB+H5oUbgS8qTl?= =?us-ascii?Q?t9jADX0hIlOxo1QNJvLMOnX0sQpEiD2/FGThN36qCQh9dLp0Erm0hv8kzF3b?= =?us-ascii?Q?kVhJ+G5R27/WxpC21YKqI/6HveZOeI1VOtZFGI7nSk9nLWN6+7dAiao7dmSB?= =?us-ascii?Q?rF9uQXwnfhUIIK5Axm0uPtCPkw8PZuHOC168Zq07OW/N/LngoAbUGNEaDyHW?= =?us-ascii?Q?9esH+7nvMMS5obowGe/NfJ6G1HEVY9D7H6tGlROwMlBzE9f61TEjBlTtEuux?= =?us-ascii?Q?WJeP+dtmwNTM8VInu98mty2RPLfKtDR3AQrln9SoPVv54WjQEfTonFGxvA8P?= =?us-ascii?Q?59JciBfhEfxZn8hVhfCUbRvUhtIccRpdm30uMV7SABeW5qtjRZWjnRz1AKDE?= =?us-ascii?Q?h0ov6jyST66Lux5ZPZGhmxoHNe33QcNQW3lB6poAUO7Jr+Gz1pFKvSqny6jk?= =?us-ascii?Q?6ByhWLDGcDQ99zLWC7+kom1JdD4gKAt6yurngw/VvN6wwP3IqSX304UfjFom?= =?us-ascii?Q?PysrmFjU5L+gtmkAY7Kv3hc3XFefyhesP01LvLNk254+TWPbQz2k00ZDxanc?= =?us-ascii?Q?VHAin9pWUNQLKCbXmfkCyYppw5ct8jscEtbWuTrZWZc0Usu3e8H8VCrrPygH?= =?us-ascii?Q?AfiDMGCu4du64NvIGVG3h558W5LGbd01N3FQjc7FFtd23Jv6oJPlMrXvF0zI?= =?us-ascii?Q?JMLjKx/Bx0zuQ8yVOSP8ArK66Jt5IXNDzaADQezNPJJp6NECekChaF48Gd7x?= =?us-ascii?Q?BDq7warWgG1vlAjVQbglnCiSKb+dOGSxKJXjnmOZm5pb9u2e6eEWtEx2KnyY?= =?us-ascii?Q?ZsnTPT7bGyJ5UIOjt016DEd38P7uQJ7X+8HyHRmSL7bOSPmBk23RKrLTQdHA?= =?us-ascii?Q?/aZnVmH9i8EkXKsKTlqYvinoL3R660P34+s4sX7PZeGC0B+WGZPg1/myoW8b?= =?us-ascii?Q?+xCoYBXgPSFTkNouR2bZ3mlmQ9FCvfMWO8y0+aHTg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0861; 5:th6S/0AaxqoS9LEQW/SIUEghaQM6jEONO4D9iXEk4J9nrslKG9mneV/zhqy67WGmLi2uU0yZA5mFhEtQ/kZ16pCdRDFdy16tkkyMaILFw9Lc62o/bVLY3hB0oRpD9FvgkEGNk1Umiw11bKxYqEXzFQ==; 24:AanyXbInRbL50JLxa86WE9g2TUL/A2uZVqjgZhbMZvHloPVQZdHVhFykOIf6ivz7TpialTF7e+WiJblDbOLdeTjMdL0odOn4B0nFPVJ9YkM=; 20:mHDPjDCw6QzmAO1zXksArgSBQSa+lP8sjiC0NdODynq2vBp3bpNWIBijJCao95A80wbuxgUH/sh7tD+trOCTc66B5Z1kp04xITz+4W3xurJxtX+h7jJQEbhdzwdw/eLDWiHw7TiQEsgmKG61xZN0an08yniJxkFbpt/3ayyaSuxdXZix8WtgkhZP5yCHCtB8M0Zsoxbb8WqNLJ6hUfvoa6f76gu36JfGJzOWyheV0ybhTpi20VE+dC5NBZEFBRhZ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2015 22:51:29.0185 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0861 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Rob Herring Acked-by: Bjorn Helgaas Reviewed-by: Hanjun Guo CC: Rafael J. Wysocki --- drivers/of/of_pci.c | 19 ------------------- drivers/pci/probe.c | 23 +++++++++++++++++++++-- include/linux/of_pci.h | 3 --- 3 files changed, 21 insertions(+), 24 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index a2f510c..b66ee4e 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -117,25 +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) - 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 8361d27..31e3eef 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -1633,6 +1633,25 @@ static void pci_set_msi_domain(struct pci_dev *dev) dev_get_msi_domain(&dev->bus->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) + 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; @@ -1646,7 +1665,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)