* [PATCH v2 1/1] linux/io.h: Add cleanup defination for iounmap() and memunmap()
@ 2024-08-02 17:00 Frank Li
0 siblings, 0 replies; only message in thread
From: Frank Li @ 2024-08-02 17:00 UTC (permalink / raw)
To: arnd
Cc: Frank.li, akpm, ast, imx, jgg, kent.overstreet, linux-kernel, schnelle
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-02 17:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 17:00 [PATCH v2 1/1] linux/io.h: Add cleanup defination for iounmap() and memunmap() Frank Li
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®