* [PATCH] drivers/of: Make of_io_request_and_map() "name" argument optional
@ 2018-06-12 0:01 Benjamin Herrenschmidt
2018-06-12 22:18 ` Rob Herring
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2018-06-12 0:01 UTC (permalink / raw)
To: devicetree; +Cc: linux-kernel
These days of_address_to_resource() puts a reasonable name
in the resource struct, thus make the "name" argument an
optional override.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Just something I noticed ... we should probably update the
callers to stop passing stupid names..
drivers/of/address.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 580bbf6ca2b1..cf83c05f5650 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -774,7 +774,7 @@ EXPORT_SYMBOL(of_iomap);
* for a given device_node
* @device: the device whose io range will be mapped
* @index: index of the io range
- * @name: name of the resource
+ * @name: name "override" for the memory region request or NULL
*
* Returns a pointer to the requested and mapped memory or an ERR_PTR() encoded
* error code on failure. Usage example:
@@ -784,7 +784,7 @@ EXPORT_SYMBOL(of_iomap);
* return PTR_ERR(base);
*/
void __iomem *of_io_request_and_map(struct device_node *np, int index,
- const char *name)
+ const char *name)
{
struct resource res;
void __iomem *mem;
@@ -792,6 +792,8 @@ void __iomem *of_io_request_and_map(struct device_node *np, int index,
if (of_address_to_resource(np, index, &res))
return IOMEM_ERR_PTR(-EINVAL);
+ if (!name)
+ name = res.name;
if (!request_mem_region(res.start, resource_size(&res), name))
return IOMEM_ERR_PTR(-EBUSY);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/of: Make of_io_request_and_map() "name" argument optional
2018-06-12 0:01 [PATCH] drivers/of: Make of_io_request_and_map() "name" argument optional Benjamin Herrenschmidt
@ 2018-06-12 22:18 ` Rob Herring
2018-06-12 22:53 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2018-06-12 22:18 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: devicetree, linux-kernel
On Tue, Jun 12, 2018 at 10:01:07AM +1000, Benjamin Herrenschmidt wrote:
> These days of_address_to_resource() puts a reasonable name
> in the resource struct, thus make the "name" argument an
> optional override.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> Just something I noticed ... we should probably update the
> callers to stop passing stupid names..
Sounds like a coccinelle patch.
When do we need an actual name passed in? It does get exposed to
userspace, but no one seemed to care when names changed from full path
(which is commonly used) to just the node name.
Rob
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/of: Make of_io_request_and_map() "name" argument optional
2018-06-12 22:18 ` Rob Herring
@ 2018-06-12 22:53 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2018-06-12 22:53 UTC (permalink / raw)
To: Rob Herring; +Cc: devicetree, linux-kernel
On Tue, 2018-06-12 at 16:18 -0600, Rob Herring wrote:
> On Tue, Jun 12, 2018 at 10:01:07AM +1000, Benjamin Herrenschmidt wrote:
> > These days of_address_to_resource() puts a reasonable name
> > in the resource struct, thus make the "name" argument an
> > optional override.
> >
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > ---
> >
> > Just something I noticed ... we should probably update the
> > callers to stop passing stupid names..
>
> Sounds like a coccinelle patch.
Quite possibly, though I'm absolutely not proficient with coccinelle :-)
> When do we need an actual name passed in? It does get exposed to
> userspace, but no one seemed to care when names changed from full path
> (which is commonly used) to just the node name.
Not sure, I had a look at the names looked rather random.
>
> Rob
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-12 22:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12 0:01 [PATCH] drivers/of: Make of_io_request_and_map() "name" argument optional Benjamin Herrenschmidt
2018-06-12 22:18 ` Rob Herring
2018-06-12 22:53 ` Benjamin Herrenschmidt
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).