Re: [PATCH -v12 02/15] resources: Add probe_resource()

From: Yinghai Lu
Date: Wed Aug 29 2012 - 12:02:41 EST


On Wed, Aug 29, 2012 at 3:14 AM, Ram Pai <linuxram@xxxxxxxxxx> wrote:
> @@ -718,12 +727,12 @@ void insert_resource_expand_to_fit(struct resource *root, struct resource *new)
> */
> int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size)
> {
> - struct resource *tmp, *parent = res->parent;
> + struct resource *tmp, *parent;
> resource_size_t end = start + size - 1;
> int result = -EBUSY;
>
> write_lock(&resource_lock);
> -
> + parent = res->parent;
> if (!parent)
> goto skip;

yes, in the v7 of probe_resource() patch that I sent before,
introduced _adjust_resource solved the problem.


@@ -741,14 +741,13 @@ void insert_resource_expand_to_fit(struc
* arguments. Returns 0 on success, -EBUSY if it can't fit.
* Existing children of the resource are assumed to be immutable.
*/
-int adjust_resource(struct resource *res, resource_size_t start,
resource_size_t size)
+static int __adjust_resource(struct resource *res, resource_size_t start,
+ resource_size_t size)
{
struct resource *tmp, *parent = res->parent;
resource_size_t end = start + size - 1;
int result = -EBUSY;

- write_lock(&resource_lock);
-
if (!parent)
goto skip;

@@ -776,9 +775,19 @@ skip:
result = 0;

out:
- write_unlock(&resource_lock);
return result;
}
+int adjust_resource(struct resource *res, resource_size_t start,
+ resource_size_t size)
+{
+ int ret;
+
+ write_lock(&resource_lock);
+ ret = __adjust_resource(res, start, size);
+ write_unlock(&resource_lock);
+
+ return ret;
+}
EXPORT_SYMBOL(adjust_resource);

static void __init __reserve_region_with_split(struct resource *root,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/