linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Roy Pledge <Roy.Pledge@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>, <scottwood@freescale.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 01/11] powerpc: re-add devm_ioremap_prot()
Date: Thu, 9 Jul 2015 16:21:52 -0400	[thread overview]
Message-ID: <1436473322-21247-2-git-send-email-Roy.Pledge@freescale.com> (raw)
In-Reply-To: <1436473322-21247-1-git-send-email-Roy.Pledge@freescale.com>

From: Emil Medve <Emilian.Medve@Freescale.com>

devm_ioremap_prot() was removed in commit dedd24a12,
and was introduced in commit b41e5fffe8.

This reverts commit dedd24a12fe6735898feeb06184ee346907abb5d.

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---
 arch/powerpc/include/asm/io.h |    3 +++
 arch/powerpc/lib/Makefile     |    1 +
 arch/powerpc/lib/devres.c     |   43 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 arch/powerpc/lib/devres.c

diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index a8d2ef3..9eaf301 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -855,6 +855,9 @@ static inline void * bus_to_virt(unsigned long address)
 
 #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
 
+void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
+				size_t size, unsigned long flags);
+
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_POWERPC_IO_H */
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index a47e142..7ae60f0 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -13,6 +13,7 @@ obj-y += string.o alloc.o crtsavres.o ppc_ksyms.o code-patching.o \
 	 feature-fixups.o
 
 obj-$(CONFIG_PPC32)	+= div64.o copy_32.o
+obj-$(CONFIG_HAS_IOMEM)	+= devres.o
 
 obj64-y	+= copypage_64.o copyuser_64.o usercopy_64.o mem_64.o hweight_64.o \
 	   copyuser_power7.o string_64.o copypage_power7.o memcpy_power7.o \
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c
new file mode 100644
index 0000000..8df55fc
--- /dev/null
+++ b/arch/powerpc/lib/devres.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/device.h>	/* devres_*(), devm_ioremap_release() */
+#include <linux/gfp.h>
+#include <linux/io.h>		/* ioremap_prot() */
+#include <linux/export.h>	/* EXPORT_SYMBOL() */
+
+/**
+ * devm_ioremap_prot - Managed ioremap_prot()
+ * @dev: Generic device to remap IO address for
+ * @offset: BUS offset to map
+ * @size: Size of map
+ * @flags: Page flags
+ *
+ * Managed ioremap_prot().  Map is automatically unmapped on driver
+ * detach.
+ */
+void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
+				 size_t size, unsigned long flags)
+{
+	void __iomem **ptr, *addr;
+
+	ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
+	if (!ptr)
+		return NULL;
+
+	addr = ioremap_prot(offset, size, flags);
+	if (addr) {
+		*ptr = addr;
+		devres_add(dev, ptr);
+	} else
+		devres_free(ptr);
+
+	return addr;
+}
+EXPORT_SYMBOL(devm_ioremap_prot);
-- 
1.7.9.5

  reply	other threads:[~2015-07-09 20:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 20:21 [PATCH 00/11] Freescale DPAA QBMan Drivers Roy Pledge
2015-07-09 20:21 ` Roy Pledge [this message]
2015-07-09 20:21 ` [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver Roy Pledge
2015-07-10  8:38   ` Paul Bolle
2015-07-10 17:31     ` Scott Wood
2015-07-10 18:29       ` Roy Pledge
2015-07-10 18:50         ` Scott Wood
2015-07-22 16:15           ` Horia Geantă
2015-07-10 11:36   ` Paul Bolle
2015-07-10 17:33     ` Scott Wood
2015-07-10 20:57       ` Roy Pledge
2015-07-10 21:12         ` Scott Wood
2015-07-09 20:21 ` [PATCH 03/11] soc/fsl: Introduce the DPAA BMan portal driver Roy Pledge
2015-07-10 13:32   ` Paul Bolle
2015-07-10 15:19     ` Roy Pledge
2015-07-10 16:47       ` Paul Bolle
2015-07-09 20:21 ` [PATCH 04/11] soc/fsl: Introduce drivers for the DPAA QMan Roy Pledge
2015-07-11 10:34   ` Paul Bolle
2015-07-09 20:21 ` [PATCH 05/11] soc/bman: Add self-tester for BMan driver Roy Pledge
2015-07-09 20:21 ` [PATCH 06/11] soc/qman: Add self-tester for QMan driver Roy Pledge
2015-07-09 20:21 ` [PATCH 07/11] soc/bman: Add debugfs support for the BMan driver Roy Pledge
2015-07-09 20:21 ` [PATCH 08/11] soc/qman: Add debugfs support for the QMan driver Roy Pledge
2015-07-09 20:22 ` [PATCH 09/11] soc/bman: Add HOTPLUG_CPU support to the BMan driver Roy Pledge
2015-07-09 20:22 ` [PATCH 10/11] soc/qman: Add HOTPLUG_CPU support to the QMan driver Roy Pledge
2015-07-09 20:22 ` [PATCH 11/11] soc/qman: add qman_delete_cgr_safe() Roy Pledge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436473322-21247-2-git-send-email-Roy.Pledge@freescale.com \
    --to=roy.pledge@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).