Add missing helper function to locate an already existing resource

This functionality is currently not available outside of
kernel/resource.c

It is needed in order to find the memory resource corresponding
to removable memory so that it can be cleanly removed.

Change-Id: Iedc785d0df5023c16c60bf2881e5602d45f2b809
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
(cherry picked from commit 00d3c81438b3e3f827ae720afb17a2e79a604e1e)
This commit is contained in:
Larry Bassel
2009-12-02 15:52:16 -08:00
committed by Rohit Vaswani
parent 73a13a80a6
commit ec58c4871d
2 changed files with 20 additions and 0 deletions

View File

@@ -139,6 +139,8 @@ extern struct resource iomem_resource;
extern struct resource *request_resource_conflict(struct resource *root, struct resource *new);
extern int request_resource(struct resource *root, struct resource *new);
extern struct resource *locate_resource(struct resource *root,
struct resource *search);
extern int release_resource(struct resource *new);
void release_child_resources(struct resource *new);
extern void reserve_region_with_split(struct resource *root,

View File

@@ -261,6 +261,24 @@ int request_resource(struct resource *root, struct resource *new)
EXPORT_SYMBOL(request_resource);
/**
* locate_resource - locate an already reserved I/O or memory resource
* @root: root resource descriptor
* @search: resource descriptor to be located
*
* Returns pointer to desired resource or NULL if not found.
*/
struct resource *locate_resource(struct resource *root, struct resource *search)
{
struct resource *found;
write_lock(&resource_lock);
found = __request_resource(root, search);
write_unlock(&resource_lock);
return found;
}
EXPORT_SYMBOL(locate_resource);
/**
* release_resource - release a previously reserved resource
* @old: resource pointer