From: "Michal Suchánek" <msuchanek@suse.de>
To: nvdimm@lists.linux.dev
Cc: Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Ira Weiny <ira.weiny@intel.com>, Zou Wei <zou_wei@huawei.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] testing: nvdimm: iomap: make __nfit_test_ioremap a macro
Date: Fri, 29 Apr 2022 17:48:47 +0200 [thread overview]
Message-ID: <20220429154847.GN163591@kunlun.suse.cz> (raw)
In-Reply-To: <20220429134039.18252-1-msuchanek@suse.de>
On Fri, Apr 29, 2022 at 03:40:39PM +0200, Michal Suchanek wrote:
> 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.
Fixes: 6bc756193ff6 ("tools/testing/nvdimm: libnvdimm unit test infrastructure")
The fallback_fn was passed around to start with, and ioremap was already
a define when this was merged.
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
> tools/testing/nvdimm/test/iomap.c | 18 ++++++++----------
> 1 file 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)
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-04-29 15:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 13:40 [PATCH] testing: nvdimm: iomap: make __nfit_test_ioremap a macro Michal Suchanek
2022-04-29 15:48 ` Michal Suchánek [this message]
2022-04-29 18:56 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220429154847.GN163591@kunlun.suse.cz \
--to=msuchanek@suse.de \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
--cc=zou_wei@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).