* [PATCH 0/2] lib: devres: Simplify both API devm_iounmap() and devm_ioport_unmap() implementation
@ 2024-09-18 14:48 Zijun Hu
2024-09-18 14:48 ` [PATCH 1/2] lib: devres: Simplify API devm_iounmap() implementation Zijun Hu
2024-09-18 14:48 ` [PATCH 2/2] lib: devres: Simplify API devm_ioport_unmap() implementation Zijun Hu
0 siblings, 2 replies; 3+ messages in thread
From: Zijun Hu @ 2024-09-18 14:48 UTC (permalink / raw)
To: Andrew Morton, Greg Kroah-Hartman; +Cc: Zijun Hu, linux-kernel, Zijun Hu
This patch series is to simplify implementation for both API
devm_iounmap() and devm_ioport_unmap().
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
Zijun Hu (2):
lib: devres: Simplify API devm_iounmap() implementation
lib: devres: Simplify API devm_ioport_unmap() implementation
lib/devres.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
base-commit: 6a36d828bdef0e02b1e6c12e2160f5b83be6aab5
change-id: 20240918-fix_lib_devres-321e311a147a
Best regards,
--
Zijun Hu <quic_zijuhu@quicinc.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/2] lib: devres: Simplify API devm_iounmap() implementation
2024-09-18 14:48 [PATCH 0/2] lib: devres: Simplify both API devm_iounmap() and devm_ioport_unmap() implementation Zijun Hu
@ 2024-09-18 14:48 ` Zijun Hu
2024-09-18 14:48 ` [PATCH 2/2] lib: devres: Simplify API devm_ioport_unmap() implementation Zijun Hu
1 sibling, 0 replies; 3+ messages in thread
From: Zijun Hu @ 2024-09-18 14:48 UTC (permalink / raw)
To: Andrew Morton, Greg Kroah-Hartman; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
Simplify devm_iounmap() implementation by dedicated API devres_release()
compared with current solution, namely, devres_destroy() + iounmap()
devres_release() has the following advantages:
- it is simpler if devm_iounmap()'s parameter @addr is valid, namely
@addr was ever returned by one of devm_ioremap() variants.
- it can avoid unnecessary iounmap(@addr) if @addr is not valid.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
lib/devres.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/devres.c b/lib/devres.c
index 4fc152de6d8b..68ffcd5d9358 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -115,9 +115,8 @@ EXPORT_SYMBOL(devm_ioremap_wc);
*/
void devm_iounmap(struct device *dev, void __iomem *addr)
{
- WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match,
+ WARN_ON(devres_release(dev, devm_ioremap_release, devm_ioremap_match,
(__force void *)addr));
- iounmap(addr);
}
EXPORT_SYMBOL(devm_iounmap);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] lib: devres: Simplify API devm_ioport_unmap() implementation
2024-09-18 14:48 [PATCH 0/2] lib: devres: Simplify both API devm_iounmap() and devm_ioport_unmap() implementation Zijun Hu
2024-09-18 14:48 ` [PATCH 1/2] lib: devres: Simplify API devm_iounmap() implementation Zijun Hu
@ 2024-09-18 14:48 ` Zijun Hu
1 sibling, 0 replies; 3+ messages in thread
From: Zijun Hu @ 2024-09-18 14:48 UTC (permalink / raw)
To: Andrew Morton, Greg Kroah-Hartman; +Cc: Zijun Hu, linux-kernel, Zijun Hu
From: Zijun Hu <quic_zijuhu@quicinc.com>
Simplify devm_ioport_unmap() implementation by dedicated API
devres_release(), compared with current solution, namely
ioport_unmap() + devres_destroy(), devres_release() has below advantages:
- it is simpler if devm_ioport_unmap()'s parameter @addr was ever
returned by devm_ioport_map().
- it can avoid unnecessary ioport_unmap(@addr) if @addr was not
ever returned by devm_ioport_map().
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
lib/devres.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/devres.c b/lib/devres.c
index 68ffcd5d9358..73901160197e 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -307,8 +307,7 @@ EXPORT_SYMBOL(devm_ioport_map);
*/
void devm_ioport_unmap(struct device *dev, void __iomem *addr)
{
- ioport_unmap(addr);
- WARN_ON(devres_destroy(dev, devm_ioport_map_release,
+ WARN_ON(devres_release(dev, devm_ioport_map_release,
devm_ioport_map_match, (__force void *)addr));
}
EXPORT_SYMBOL(devm_ioport_unmap);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-18 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-18 14:48 [PATCH 0/2] lib: devres: Simplify both API devm_iounmap() and devm_ioport_unmap() implementation Zijun Hu
2024-09-18 14:48 ` [PATCH 1/2] lib: devres: Simplify API devm_iounmap() implementation Zijun Hu
2024-09-18 14:48 ` [PATCH 2/2] lib: devres: Simplify API devm_ioport_unmap() implementation Zijun Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome