summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2021-01-01 23:51:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-01-05 13:55:14 +0100
commit3124a8eb473273f712c86b0bd370d1d2279fb56b (patch)
tree9382bf4beff91cda90c6163663d1c462d7de6160
parentcada638c2f116ce79973824d3bf088799625f624 (diff)
downloadbarebox-3124a8eb473273f712c86b0bd370d1d2279fb56b.tar.gz
barebox-3124a8eb473273f712c86b0bd370d1d2279fb56b.tar.xz
driver: provide dev_request_mem_resource_by_name() helper
There are both dev_request_mem_resource() and dev_request_mem_region(), which return the struct resource and a IOMEM(.start) respectively. There is only dev_request_mem_region_by_name(), but no dev_request_mem_resource_by_name(), so add the latter for symmetry. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/base/driver.c12
-rw-r--r--include/driver.h5
2 files changed, 15 insertions, 2 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3205bbc3c3..6763bbc6f5 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -372,7 +372,7 @@ struct resource *dev_get_resource_by_name(struct device_d *dev,
return ERR_PTR(-ENOENT);
}
-void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *name)
+struct resource *dev_request_mem_resource_by_name(struct device_d *dev, const char *name)
{
struct resource *res;
@@ -380,7 +380,15 @@ void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n
if (IS_ERR(res))
return ERR_CAST(res);
- res = request_iomem_region(dev_name(dev), res->start, res->end);
+ return request_iomem_region(dev_name(dev), res->start, res->end);
+}
+EXPORT_SYMBOL(dev_request_mem_resource_by_name);
+
+void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *name)
+{
+ struct resource *res;
+
+ res = dev_request_mem_resource_by_name(dev, name);
if (IS_ERR(res))
return ERR_CAST(res);
diff --git a/include/driver.h b/include/driver.h
index e2886d051d..0d43b36148 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -215,6 +215,11 @@ void __iomem *dev_request_mem_region(struct device_d *dev, int num);
struct resource *dev_request_mem_resource(struct device_d *dev, int num);
/*
+ * exlusively request resource 'name' for a device
+ */
+struct resource *dev_request_mem_resource_by_name(struct device_d *dev, const char *name);
+
+/*
* exlusively request register base 'num' for a device
* will return NULL on error
* only used on platform like at91 where the Ressource address collision with