From: Jason Gunthorpe <jgg@mellanox.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>,
Bharata B Rao <bharata@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH 2/5] resource: add a not device managed request_free_mem_region variant
Date: Sun, 11 Aug 2019 22:52:58 +0000 [thread overview]
Message-ID: <20190811225252.GB15116@mellanox.com> (raw)
In-Reply-To: <20190811081247.22111-3-hch@lst.de>
On Sun, Aug 11, 2019 at 10:12:44AM +0200, Christoph Hellwig wrote:
> Just add a simple macro that passes a NULL dev argument to
> dev_request_free_mem_region, and call request_mem_region in the
> function for that particular case.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> include/linux/ioport.h | 2 ++
> kernel/resource.c | 5 ++++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 0dcc48cafa80..528ae6cbb1b4 100644
> +++ b/include/linux/ioport.h
> @@ -297,6 +297,8 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
>
> struct resource *devm_request_free_mem_region(struct device *dev,
> struct resource *base, unsigned long size, const char *name);
> +#define request_free_mem_region(base, size, name) \
> + devm_request_free_mem_region(NULL, base, size, name)
>
> #endif /* __ASSEMBLY__ */
> #endif /* _LINUX_IOPORT_H */
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 0ddc558586a7..3a826b3cc883 100644
> +++ b/kernel/resource.c
> @@ -1671,7 +1671,10 @@ struct resource *devm_request_free_mem_region(struct device *dev,
> REGION_DISJOINT)
> continue;
>
> - res = devm_request_mem_region(dev, addr, size, name);
> + if (dev)
> + res = devm_request_mem_region(dev, addr, size, name);
> + else
> + res = request_mem_region(addr, size, name);
It is a bit jarring to have something called devm_* that doesn't
actually do the devm_ part on some paths.
Maybe this function should be called __request_free_mem_region() with
another name wrapper macro?
Jason
next prev parent reply other threads:[~2019-08-11 22:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-11 8:12 add a not device managed memremap_pages Christoph Hellwig
2019-08-11 8:12 ` [PATCH 1/5] resource: pass a name argument to devm_request_free_mem_region Christoph Hellwig
2019-08-11 8:12 ` [PATCH 2/5] resource: add a not device managed request_free_mem_region variant Christoph Hellwig
2019-08-11 22:52 ` Jason Gunthorpe [this message]
2019-08-12 7:40 ` Christoph Hellwig
2019-08-11 8:12 ` [PATCH 3/5] memremap: remove the dev field in struct dev_pagemap Christoph Hellwig
2019-08-11 8:12 ` [PATCH 4/5] memremap: don't use a separate devm action for devmap_managed_enable_get Christoph Hellwig
2019-08-11 8:12 ` [PATCH 5/5] memremap: provide a not device managed memremap_pages Christoph Hellwig
2019-08-11 22:56 ` Jason Gunthorpe
2019-08-12 7:40 ` Christoph Hellwig
2019-08-12 14:50 ` Bharata B Rao
2019-08-12 15:00 ` Christoph Hellwig
2019-08-13 4:56 ` Bharata B Rao
2019-08-14 6:11 ` Christoph Hellwig
2019-08-14 8:58 ` Bharata B Rao
2019-08-14 11:25 ` Christoph Hellwig
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=20190811225252.GB15116@mellanox.com \
--to=jgg@mellanox.com \
--cc=akpm@linux-foundation.org \
--cc=bharata@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
/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).