[RFC 05/10] resource: add create_resource() helper function
Antony Pavlov
antonynpavlov at gmail.com
Tue Apr 15 00:38:29 PDT 2014
Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
common/resource.c | 15 +++++++++++++++
include/linux/ioport.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/common/resource.c b/common/resource.c
index fe4680e..b6c7c87 100644
--- a/common/resource.c
+++ b/common/resource.c
@@ -143,3 +143,18 @@ struct resource *request_ioport_region(const char *name,
{
return __request_region(&ioport_resource, name, start, end);
}
+
+struct resource *create_resource(const char *name,
+ resource_size_t start, resource_size_t end)
+{
+ struct resource *t;
+
+ t = xzalloc(sizeof *t);
+ INIT_LIST_HEAD(&t->children);
+ t->parent = NULL;
+ t->name = xstrdup(name);
+ t->start = start;
+ t->end = end;
+
+ return t;
+}
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index d1b2f55..bce9b62 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -145,6 +145,8 @@ struct resource *__request_region(struct resource *parent,
resource_size_t size);
int release_region(struct resource *res);
+struct resource *create_resource(const char *name,
+ resource_size_t start, resource_size_t end);
extern struct resource iomem_resource;
extern struct resource ioport_resource;
--
1.9.0
More information about the barebox
mailing list