From patchwork Mon May 9 21:41:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gerlach X-Patchwork-Id: 9050131 Return-Path: X-Original-To: patchwork-linux-omap@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 D1957BF29F for ; Mon, 9 May 2016 21:43:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2FC22012D for ; Mon, 9 May 2016 21:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F23322011E for ; Mon, 9 May 2016 21:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752987AbcEIVna (ORCPT ); Mon, 9 May 2016 17:43:30 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:43583 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753105AbcEIVm4 (ORCPT ); Mon, 9 May 2016 17:42:56 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u49Lg4V2010391; Mon, 9 May 2016 16:42:04 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u49Lg4AX013836; Mon, 9 May 2016 16:42:04 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Mon, 9 May 2016 16:42:03 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u49Lg3wa015435; Mon, 9 May 2016 16:42:03 -0500 Received: from localhost (uda0274052.am.dhcp.ti.com [128.247.83.19]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id u49Lg3304606; Mon, 9 May 2016 16:42:03 -0500 (CDT) From: Dave Gerlach To: , , CC: Russ Dill , Greg Kroah-Hartman , Arnd Bergmann , Shawn Guo , Tony Lindgren , Alexandre Belloni , Russell King , Nishanth Menon , Russ Dill , Dave Gerlach Subject: [RFC PATCH 2/3] lib: devres: Add exec and exec_nocache versions of devm_ioremap Date: Mon, 9 May 2016 16:41:50 -0500 Message-ID: <1462830111-28172-3-git-send-email-d-gerlach@ti.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1462830111-28172-1-git-send-email-d-gerlach@ti.com> References: <1462830111-28172-1-git-send-email-d-gerlach@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-9.0 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 From: Russ Dill Now that there are _exec and _exec_nocache versions of ioremap, add devm support for them. Signed-off-by: Russ Dill Signed-off-by: Dave Gerlach --- include/linux/io.h | 5 +++++ lib/devres.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/include/linux/io.h b/include/linux/io.h index e2c8419278c1..1c0442e5d72c 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -79,6 +79,11 @@ void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, resource_size_t size); void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset, resource_size_t size); +void __iomem *devm_ioremap_exec(struct device *dev, resource_size_t offset, + unsigned long size); +void __iomem *devm_ioremap_exec_nocache(struct device *dev, + resource_size_t offset, + unsigned long size); void devm_iounmap(struct device *dev, void __iomem *addr); int check_signature(const volatile void __iomem *io_addr, const unsigned char *signature, int length); diff --git a/lib/devres.c b/lib/devres.c index cb1464c411a2..1181a739fd49 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -100,6 +100,64 @@ void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset, EXPORT_SYMBOL(devm_ioremap_wc); /** + * devm_ioremap_exec - Managed ioremap_exec() + * @dev: Generic device to remap IO address for + * @offset: BUS offset to map + * @size: Size of map + * + * Managed ioremap_exec(). Map is automatically unmapped on driver detach. + */ +void __iomem *devm_ioremap_exec(struct device *dev, resource_size_t offset, + unsigned long size) +{ + void __iomem **ptr, *addr; + + ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return NULL; + + addr = ioremap_exec(offset, size); + if (addr) { + *ptr = addr; + devres_add(dev, ptr); + } else + devres_free(ptr); + + return addr; +} +EXPORT_SYMBOL(devm_ioremap_exec); + +/** + * devm_ioremap_exec_nocache - Managed ioremap_exec_nocache() + * @dev: Generic device to remap IO address for + * @offset: BUS offset to map + * @size: Size of map + * + * Managed ioremap_exec_nocache(). Map is automatically unmapped on driver + * detach. + */ +void __iomem *devm_ioremap_exec_nocache(struct device *dev, + resource_size_t offset, + unsigned long size) +{ + void __iomem **ptr, *addr; + + ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return NULL; + + addr = ioremap_exec_nocache(offset, size); + if (addr) { + *ptr = addr; + devres_add(dev, ptr); + } else + devres_free(ptr); + + return addr; +} +EXPORT_SYMBOL(devm_ioremap_exec_nocache); + +/** * devm_iounmap - Managed iounmap() * @dev: Generic device to unmap for * @addr: Address to unmap