Skip to content

Commit dccfbc7

Browse files
hramrachdjbw
authored andcommitted
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: 6bc7561 ("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>
1 parent bb7bf69 commit dccfbc7

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

tools/testing/nvdimm/test/iomap.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,14 @@ struct nfit_test_resource *get_nfit_res(resource_size_t resource)
6262
}
6363
EXPORT_SYMBOL(get_nfit_res);
6464

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+
})
7573

7674
void __iomem *__wrap_devm_ioremap(struct device *dev,
7775
resource_size_t offset, unsigned long size)

0 commit comments

Comments
 (0)