diff --git a/[refs] b/[refs] index e32756b506f3..9f9a3526efa0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 88efd0bbc0fe403a9948e6f94cc48b9f15ee4861 +refs/heads/master: 1c388919d89ca35741e9c4d3255adf87f76f0c06 diff --git a/trunk/include/linux/ioport.h b/trunk/include/linux/ioport.h index e9bb22cba764..63eb429ecbe6 100644 --- a/trunk/include/linux/ioport.h +++ b/trunk/include/linux/ioport.h @@ -132,6 +132,7 @@ extern int allocate_resource(struct resource *root, struct resource *new, resource_size_t, resource_size_t), void *alignf_data); +struct resource *lookup_resource(struct resource *root, resource_size_t start); int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size); resource_size_t resource_alignment(struct resource *res); diff --git a/trunk/kernel/resource.c b/trunk/kernel/resource.c index 3ff40178dce7..3b3cedc52592 100644 --- a/trunk/kernel/resource.c +++ b/trunk/kernel/resource.c @@ -553,6 +553,27 @@ int allocate_resource(struct resource *root, struct resource *new, EXPORT_SYMBOL(allocate_resource); +/** + * lookup_resource - find an existing resource by a resource start address + * @root: root resource descriptor + * @start: resource start address + * + * Returns a pointer to the resource if found, NULL otherwise + */ +struct resource *lookup_resource(struct resource *root, resource_size_t start) +{ + struct resource *res; + + read_lock(&resource_lock); + for (res = root->child; res; res = res->sibling) { + if (res->start == start) + break; + } + read_unlock(&resource_lock); + + return res; +} + /* * Insert a resource into the resource tree. If successful, return NULL, * otherwise return the conflicting resource (compare to __request_resource())