aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/nvdimm/test/iomap.c
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2022-04-29 15:40:39 +0200
committerDan Williams <dan.j.williams@intel.com>2022-04-29 10:59:39 -0700
commitdccfbc73a9ddd2c7232696f563c39d0ca09ae905 (patch)
tree85ad695fe76ec2188dc41717e4b6a2f52d00b941 /tools/testing/nvdimm/test/iomap.c
parentnvdimm: Allow overwrite in the presence of disabled dimms (diff)
downloadlinux-dev-dccfbc73a9ddd2c7232696f563c39d0ca09ae905.tar.xz
linux-dev-dccfbc73a9ddd2c7232696f563c39d0ca09ae905.zip
testing: nvdimm: iomap: make __nfit_test_ioremap a macro
The ioremap passed as argument to __nfit_test_ioremap can be a macro so it cannot be passed as function argument. Make __nfit_test_ioremap into a macro so that ioremap can be passed as untyped macro argument. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Fixes: 6bc756193ff6 ("tools/testing/nvdimm: libnvdimm unit test infrastructure") Link: https://lore.kernel.org/r/20220429134039.18252-1-msuchanek@suse.de Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools/testing/nvdimm/test/iomap.c')
-rw-r--r--tools/testing/nvdimm/test/iomap.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c
index b752ce47ead3..ea956082e6a4 100644
--- a/tools/testing/nvdimm/test/iomap.c
+++ b/tools/testing/nvdimm/test/iomap.c
@@ -62,16 +62,14 @@ struct nfit_test_resource *get_nfit_res(resource_size_t resource)
}
EXPORT_SYMBOL(get_nfit_res);
-static void __iomem *__nfit_test_ioremap(resource_size_t offset, unsigned long size,
- void __iomem *(*fallback_fn)(resource_size_t, unsigned long))
-{
- struct nfit_test_resource *nfit_res = get_nfit_res(offset);
-
- if (nfit_res)
- return (void __iomem *) nfit_res->buf + offset
- - nfit_res->res.start;
- return fallback_fn(offset, size);
-}
+#define __nfit_test_ioremap(offset, size, fallback_fn) ({ \
+ struct nfit_test_resource *nfit_res = get_nfit_res(offset); \
+ nfit_res ? \
+ (void __iomem *) nfit_res->buf + (offset) \
+ - nfit_res->res.start \
+ : \
+ fallback_fn((offset), (size)) ; \
+})
void __iomem *__wrap_devm_ioremap(struct device *dev,
resource_size_t offset, unsigned long size)