From: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/1] devicetree: of_node_put() does not require holding devtree_lock
Date: Wed, 22 Feb 2017 11:29:18 +0200 [thread overview]
Message-ID: <1487755758-6066-1-git-send-email-sakari.ailus@linux.intel.com> (raw)
While holding a reference to a device_node it is allowed to put that node
without holding devtree_lock spinlock. Move of_node_put() after releasing
the spinlock.
Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/of/base.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d4bea3c..a8d7fed 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -286,8 +286,8 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
raw_spin_lock_irqsave(&devtree_lock, flags);
np = __of_find_all_nodes(prev);
of_node_get(np);
- of_node_put(prev);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(prev);
return np;
}
EXPORT_SYMBOL(of_find_all_nodes);
@@ -660,8 +660,8 @@ struct device_node *of_get_next_parent(struct device_node *node)
raw_spin_lock_irqsave(&devtree_lock, flags);
parent = of_node_get(node->parent);
- of_node_put(node);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(node);
return parent;
}
EXPORT_SYMBOL(of_get_next_parent);
@@ -732,8 +732,8 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
if (of_node_get(next))
break;
}
- of_node_put(prev);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(prev);
return next;
}
EXPORT_SYMBOL(of_get_next_available_child);
@@ -875,8 +875,8 @@ struct device_node *of_find_node_by_name(struct device_node *from,
if (np->name && (of_node_cmp(np->name, name) == 0)
&& of_node_get(np))
break;
- of_node_put(from);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(from);
return np;
}
EXPORT_SYMBOL(of_find_node_by_name);
@@ -904,8 +904,8 @@ struct device_node *of_find_node_by_type(struct device_node *from,
if (np->type && (of_node_cmp(np->type, type) == 0)
&& of_node_get(np))
break;
- of_node_put(from);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(from);
return np;
}
EXPORT_SYMBOL(of_find_node_by_type);
@@ -935,8 +935,8 @@ struct device_node *of_find_compatible_node(struct device_node *from,
if (__of_device_is_compatible(np, compatible, type, NULL) &&
of_node_get(np))
break;
- of_node_put(from);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(from);
return np;
}
EXPORT_SYMBOL(of_find_compatible_node);
@@ -970,8 +970,8 @@ struct device_node *of_find_node_with_property(struct device_node *from,
}
}
out:
- of_node_put(from);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(from);
return np;
}
EXPORT_SYMBOL(of_find_node_with_property);
@@ -1051,8 +1051,8 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
break;
}
}
- of_node_put(from);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ of_node_put(from);
return np;
}
EXPORT_SYMBOL(of_find_matching_node_and_match);
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2017-02-22 9:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-22 9:29 Sakari Ailus [this message]
2017-02-23 16:02 ` [PATCH 1/1] devicetree: of_node_put() does not require holding devtree_lock Rob Herring
[not found] ` <1487755758-6066-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-02-26 21:08 ` Frank Rowand
[not found] ` <58B343C6.9060604-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-27 10:08 ` Sakari Ailus
2017-02-27 14:54 ` Frank Rowand
[not found] ` <58B43DB6.4040009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-28 0:42 ` Rob Herring
[not found] ` <CAL_JsqJyMqaaMDU81Jes-M8jvxewJnyFD33pqd9NUCZFa0HYcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-28 6:36 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487755758-6066-1-git-send-email-sakari.ailus@linux.intel.com \
--to=sakari.ailus-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).