Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michal Suchanek and committed by
Dan Williams
dccfbc73 bb7bf697

+8 -10
+8 -10
tools/testing/nvdimm/test/iomap.c
··· 62 62 } 63 63 EXPORT_SYMBOL(get_nfit_res); 64 64 65 - static void __iomem *__nfit_test_ioremap(resource_size_t offset, unsigned long size, 66 - void __iomem *(*fallback_fn)(resource_size_t, unsigned long)) 67 - { 68 - struct nfit_test_resource *nfit_res = get_nfit_res(offset); 69 - 70 - if (nfit_res) 71 - return (void __iomem *) nfit_res->buf + offset 72 - - nfit_res->res.start; 73 - return fallback_fn(offset, size); 74 - } 65 + #define __nfit_test_ioremap(offset, size, fallback_fn) ({ \ 66 + struct nfit_test_resource *nfit_res = get_nfit_res(offset); \ 67 + nfit_res ? \ 68 + (void __iomem *) nfit_res->buf + (offset) \ 69 + - nfit_res->res.start \ 70 + : \ 71 + fallback_fn((offset), (size)) ; \ 72 + }) 75 73 76 74 void __iomem *__wrap_devm_ioremap(struct device *dev, 77 75 resource_size_t offset, unsigned long size)