Thread (28 messages) 28 messages, 4 authors, 2012-08-31

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

From: Yinghai Lu <yinghai@kernel.org>
Date: 2012-08-29 16:02:49
Also in: linux-pci, lkml

On Wed, Aug 29, 2012 at 3:14 AM, Ram Pai [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -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,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help