From: Frank Li <Frank.Li@nxp.com>
To: arnd@arndb.de
Cc: Frank.li@nxp.com, akpm@linux-foundation.org, ast@kernel.org,
imx@lists.linux.dev, jgg@ziepe.ca, kent.overstreet@linux.dev,
linux-kernel@vger.kernel.org, schnelle@linux.ibm.com
Subject: [PATCH v2 1/1] linux/io.h: Add cleanup defination for iounmap() and memunmap()
Date: Fri, 2 Aug 2024 13:00:43 -0400 [thread overview]
Message-ID: <20240802170043.2809545-1-Frank.Li@nxp.com> (raw)
Add DEFINE_FREE for iounmap() and memunmap() to support scope based
cleanup.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v1 to v2
- Remove IS_ERR_OR_NULL() and just simple use !(_T)
---
include/linux/io.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/io.h b/include/linux/io.h
index 59ec5eea696c4..4cce787d52805 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -163,6 +163,9 @@ enum {
void *memremap(resource_size_t offset, size_t size, unsigned long flags);
void memunmap(void *addr);
+DEFINE_FREE(iounmap, void __iomem *, if (!(_T)) iounmap(_T))
+DEFINE_FREE(memunmap, void *, if (!(_T)) memunmap(_T))
+
/*
* On x86 PAT systems we have memory tracking that keeps track of
* the allowed mappings on memory ranges. This tracking works for
--
2.34.1
reply other threads:[~2024-08-02 17:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240802170043.2809545-1-Frank.Li@nxp.com \
--to=frank.li@nxp.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=imx@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=kent.overstreet@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=schnelle@linux.ibm.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
all inboxes | Powered by JetHome®