Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1378557
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [Question] refcount of DT node |
| Date | 2016-04-14 09:50 +0200 |
| Message-ID | <rnKch-6EY-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Hi experts.
My understanding of refcount of DT node is poor.
Please help me understand it correctly.
Sorry if I am asking stupid questions.
[1] Does this reference count exist for Overlay?
Is a node freed when its refcount becomes zero?
[2] When of_node_put() should be called,
or should not be called?
Shouldn't of_node_put() be called
when we are still referencing to any of its properties?
For example, cpu_read_enable_method()
in arch/arm64/kernel/cpu_ops.c
returns a pointer to the property value
instead of creating a copy of it.
In this case, of_node_put() should not be called
because we are still referencing the DT property
(in other words, referencing to the DT node indirectly).
Am I right?
[3] Is the following code correct?
np = of_find_compatible_node(NULL, NULL,"foo-node");
of_node_put(np);
ret = of_address_to_resource(np, 0, &res);
if (ret) {
pr_err("failed to get resource\n");
return ret;
}
Actually I wrote the code above, and it was applied.
But, the node is still referenced while of_address_to_resource() is being run.
So the correct code should be as follows?
np = of_find_compatible_node(NULL, NULL,"foo-node");
ret = of_address_to_resource(np, 0, &res);
of_node_put(np);
if (ret) {
pr_err("failed to get resource\n");
return ret;
}
--
Best Regards
Masahiro Yamada
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[Question] refcount of DT node Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-14 09:50 +0200
Re: [Question] refcount of DT node Russell King - ARM Linux <linux@arm.linux.org.uk> - 2016-04-14 10:50 +0200
Re: [Question] refcount of DT node Mark Rutland <mark.rutland@arm.com> - 2016-04-14 12:10 +0200
Re: [Question] refcount of DT node Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2016-04-14 12:10 +0200
Re: [Question] refcount of DT node Frank Rowand <frowand.list@gmail.com> - 2016-04-14 18:20 +0200
Re: [Question] refcount of DT node Rob Herring <robh@kernel.org> - 2016-04-14 19:10 +0200
Re: [Question] refcount of DT node Russell King - ARM Linux <linux@arm.linux.org.uk> - 2016-04-14 20:40 +0200
Re: [Question] refcount of DT node Mark Rutland <mark.rutland@arm.com> - 2016-04-14 12:20 +0200
Re: [Question] refcount of DT node Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2016-04-14 12:50 +0200
csiph-web