find_node_by_full_name() does the same thing as of_find_node_by_path(),
but takes no locks and doesn't work on aliases. Refactor
of_find_node_opts_by_path() into __of_find_node_by_full_path() and
replace find_node_by_full_name() with it.
Signed-off-by: Rob Herring <[email protected]>
Several places in DT code open code the equivalent of kbasename.
Replace them.
The behavior for root nodes in node_name_cmp will be slightly different.
Instead of comparing "/", "" will be compared. The comparison will be
the same.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
sparse generates the following warnings in drivers/of/:
../drivers/of/fdt.c:63:36: warning: cast to restricted __be32
../drivers/of/fdt.c:68:33: warning: cast to restricted __be32
../drivers/of/irq.c:105:88: warning: incorrect type in initializer (different base types)
../drivers/of/irq.c:105:88: expected restricted __be32
../drivers/of/irq.c:105:88: got int
../drivers/of/irq.c:526:35: warning: incorrect type in assignment (different modifiers)
../drivers/of/irq.c:526:35: expected int ( *const [usertype] irq_init_cb )( ... )
../drivers/of/irq.c:526:35: got void const *const data
../drivers/of/of_reserved_mem.c:200:50: warning: incorrect type in initializer (different modifiers)
../drivers/of/of_reserved_mem.c:200:50: expected int ( *[usertype] initfn )( ... )
../drivers/of/of_reserved_mem.c:200:50: got void const *const data
../drivers/of/resolver.c:95:42: warning: incorrect type in assignment (different base types)
../drivers/of/resolver.c:95:42: expected unsigned int [unsigned] [usertype] <noident>
../drivers/of/resolver.c:95:42: got restricted __be32 [usertype] <noident>
All these are harmless type mismatches fixed by adjusting the types.
Signed-off-by: Rob Herring <[email protected]>
No longer fall through into the error case that prints out
an error if no error (err = 0) occurred.
Fixes d9181b20a83(of: Add back an error message, restructured)
Signed-off-by: Moritz Fischer <[email protected]>
Reviewed-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Value of pointer was calculated in an earlier block than
where it was used. Move it down into the block where it
is used, immediately before where is is checked to be valid.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Add a single pr_err() to cover a range of errors that were reported
by several pr_err() that were removed earlier in this series.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Update comments to better explain what functions are doing.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Remove BUG_ON(), which is frowned upon and not needed here.
Restructure to remove some excessive complexity.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Rename variables to better reflect what their purpose is. As a side
effect, this reduces the need for some of the comments previously
removed in this series.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Remove "__of_" prefix from local function names. The pattern of
a leading "__" is used in drivers/of/ to signify a function that
must be called with a lock held. These functions do not fit
that pattern.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Some function names are misleading or do not provide a good
sense of what they do. Rename the functions to ne more
informative.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Convert comparisons to zero or NULL to logical expressions. A
small number of such comparisons remain where they provide more
clarity of the numeric nature of a variable.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Remove extra debug and error printks. A single pr_err() will
be added at the end of this series to replace many of these
error messages.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Remove comments that report what is obvious from the code.
Signed-off-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Applying overlay fails silently in case of an error. Add error prints.
Most notably the lack of symbols in the live tree is not reported.
Signed-off-by: Michal Suchanek <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Clean-up all the DT printk functions to use common pr_fmt prefix.
Some print statements such as kmalloc errors were redundant, so just
drop those.
Cc: Frank Rowand <[email protected]>
Cc: Pantelis Antoniou <[email protected]>
Reviewed-by: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
In __of_find_node_by_full_name, add an of_node_get when detecting the
desired element, to ensure that it ends up with a reference count that is
one greater than on entering the function.
Also in __of_find_node_by_full_name, add an of_node_put on breaking
out of the for_each_child_of_node loop, to ensure that the reference
count of the returned value is not double incremented. This change
was made using Coccinelle.
The semantic patch used for this is as follows:
// <smpl>
@@
expression e;
local idexpression n;
@@
for_each_child_of_node(..., n) {
... when != of_node_put(n)
when != e = n
(
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl
Finally, add an of_node_put in for_each_child_of_node in the function
__of_adjust_phandle_ref after the value returned by
__of_find_node_by_full_name is no longer useful.
Signed-off-by: Amitoj Kaur Chawla <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
The original resolver format is way too cryptic, switch
to using a tree based format that gets rid of repetitions,
is more compact and readable.
At the same time, update the selftests to using the new local fixups
format.
Signed-off-by: Pantelis Antoniou <[email protected]>
[grant.likely: Squashed in testcase changes and merged similar functions]
Signed-off-by: Grant Likely <[email protected]>
Introduce support for dynamic device tree resolution.
Using it, it is possible to prepare a device tree that's
been loaded on runtime to be modified and inserted at the kernel
live tree.
Export of of_resolve and bug fix of double free by
Guenter Roeck <[email protected]>
Signed-off-by: Pantelis Antoniou <[email protected]>
[grant.likely: Don't need to select CONFIG_OF_DYNAMIC and CONFIG_OF_DEVICE]
[grant.likely: Don't need to depend on OF or !SPARC]
[grant.likely: Factor out duplicate code blocks into single function]
Signed-off-by: Grant Likely <[email protected]>