History log of /linux-6.15/drivers/of/base.c (Results 1 – 25 of 291)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5
# b4183831 24-Feb-2025 Zijun Hu <[email protected]>

of: Correct property name comparison in __of_add_property()

__of_add_property() compares property name by strcmp(), and that is
improper for SPARC which wants strcasecmp().

Fix by using dedicated p

of: Correct property name comparison in __of_add_property()

__of_add_property() compares property name by strcmp(), and that is
improper for SPARC which wants strcasecmp().

Fix by using dedicated property name comparison macro of_prop_cmp().

Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


# f443029c 24-Feb-2025 Zijun Hu <[email protected]>

of: Introduce and apply private is_pseudo_property()

There are several places which check if a property name is one of
'name'|'phandle'|'linux,phandle'.

Introduce and apply private is_pseudo_proper

of: Introduce and apply private is_pseudo_property()

There are several places which check if a property name is one of
'name'|'phandle'|'linux,phandle'.

Introduce and apply private is_pseudo_property() for the check.

Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


# 56d733bb 24-Feb-2025 Zijun Hu <[email protected]>

of: Compare property names by of_prop_cmp() in of_alias_scan()

For these pseudo property names 'name', 'phandle' and 'linux,phandle':

Use dedicated property name comparison macro of_prop_cmp() inst

of: Compare property names by of_prop_cmp() in of_alias_scan()

For these pseudo property names 'name', 'phandle' and 'linux,phandle':

Use dedicated property name comparison macro of_prop_cmp() instead of
strcmp() in of_alias_scan() to:

- Make property name comparison consistent.
- Prepare for introducing private is_pseudo_property() later.

Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.14-rc4, v6.14-rc3, v6.14-rc2
# 8d3bbe43 05-Feb-2025 Biju Das <[email protected]>

of: base: Add of_get_available_child_by_name()

There are lot of drivers using of_get_child_by_name() followed by
of_device_is_available() to find the available child node by name for a
given parent.

of: base: Add of_get_available_child_by_name()

There are lot of drivers using of_get_child_by_name() followed by
of_device_is_available() to find the available child node by name for a
given parent. Provide a helper for these users to simplify the code.

Suggested-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Biju Das <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

show more ...


Revision tags: v6.14-rc1, v6.13
# 8537a701 14-Jan-2025 Zijun Hu <[email protected]>

of: Correct element count for two arrays in API of_parse_phandle_with_args_map()

of_parse_phandle_with_args_map() defines array @dummy_mask and @dummy_pass
these two arrays only need @MAX_PHANDLE_AR

of: Correct element count for two arrays in API of_parse_phandle_with_args_map()

of_parse_phandle_with_args_map() defines array @dummy_mask and @dummy_pass
these two arrays only need @MAX_PHANDLE_ARGS elements separately, but they
actually have (@MAX_PHANDLE_ARGS + 1) elements, One extra element doesn't
hurt anything except for some stack usage.

Fix by using (@MAX_PHANDLE_ARGS - 1) as max element index in initializer.

Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


# 72d1c182 14-Jan-2025 Zijun Hu <[email protected]>

of: Do not expose of_alias_scan() and correct its comments

of_alias_scan() has no external callers and returns void.
Do not expose it and delete return value descriptions in its comments.

Signed-of

of: Do not expose of_alias_scan() and correct its comments

of_alias_scan() has no external callers and returns void.
Do not expose it and delete return value descriptions in its comments.

Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.13-rc7
# e4c00c9b 09-Jan-2025 Zijun Hu <[email protected]>

of: Correct child specifier used as input of the 2nd nexus node

API of_parse_phandle_with_args_map() will use wrong input for nexus node
Nexus_2 as shown below:

Node_1 Nexus_1

of: Correct child specifier used as input of the 2nd nexus node

API of_parse_phandle_with_args_map() will use wrong input for nexus node
Nexus_2 as shown below:

Node_1 Nexus_1 Nexus_2
&Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,...
map-pass-thru=<...>

Nexus_1's output arg_2 should be used as input of Nexus_2, but the API
wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru.

Fix by always making @match_array point to @initial_match_array into
which to store nexus output.

Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node")
Cc: [email protected]
Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.13-rc6, v6.13-rc5, v6.13-rc4
# 8600058b 20-Dec-2024 Rob Herring (Arm) <[email protected]>

of: Add coreboot firmware to excluded default cells list

Google Juniper and other Chromebook platforms have a very old bootloader
which populates /firmware node without proper address/size-cells lea

of: Add coreboot firmware to excluded default cells list

Google Juniper and other Chromebook platforms have a very old bootloader
which populates /firmware node without proper address/size-cells leading
to warnings:

Missing '#address-cells' in /firmware
WARNING: CPU: 0 PID: 1 at drivers/of/base.c:106 of_bus_n_addr_cells+0x90/0xf0
Modules linked in:
CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0 #1 933ab9971ff4d5dc58cb378a96f64c7f72e3454d
Hardware name: Google juniper sku16 board (DT)
...
Missing '#size-cells' in /firmware
WARNING: CPU: 0 PID: 1 at drivers/of/base.c:133 of_bus_n_size_cells+0x90/0xf0
Modules linked in:
CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G W 6.12.0 #1 933ab9971ff4d5dc58cb378a96f64c7f72e3454d
Tainted: [W]=WARN
Hardware name: Google juniper sku16 board (DT)

These platform won't receive updated bootloader/firmware, so add an
exclusion for platforms with a "coreboot" compatible node. While this is
wider than necessary, that's the easiest fix and it doesn't doesn't
matter if we miss checking other platforms using coreboot.

We may revisit this later and address with a fixup to the DT itself.

Reported-by: Sasha Levin <[email protected]>
Closes: https://lore.kernel.org/all/Z0NUdoG17EwuCigT@sashalap/
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


# b9e58c93 16-Dec-2024 Zijun Hu <[email protected]>

of: Fix of_find_node_opts_by_path() handling of alias+path+options

of_find_node_opts_by_path() fails to find OF device node when its
@path parameter have pattern below:

"alias-name/node-name-1/.../

of: Fix of_find_node_opts_by_path() handling of alias+path+options

of_find_node_opts_by_path() fails to find OF device node when its
@path parameter have pattern below:

"alias-name/node-name-1/.../node-name-N:options".

The reason is that alias name length calculated by the API is wrong, as
explained by example below:

"testcase-alias/phandle-tests/consumer-a:testaliasoption".
^ ^ ^
0 14 39

The right length of alias 'testcase-alias' is 14, but the result worked
out by the API is 39 which is obvious wrong.

Fix by using index of either '/' or ':' as the length who comes earlier.

Fixes: 75c28c09af99 ("of: add optional options parameter to of_find_node_by_path()")
Cc: [email protected]
Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.13-rc3, v6.13-rc2
# 4bc244f6 06-Dec-2024 Zijun Hu <[email protected]>

of: Simplify API of_find_node_with_property() implementation

Simplify of_find_node_with_property() implementation
by __of_find_property().

Signed-off-by: Zijun Hu <[email protected]>
Link: ht

of: Simplify API of_find_node_with_property() implementation

Simplify of_find_node_with_property() implementation
by __of_find_property().

Signed-off-by: Zijun Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


# d7dfa7fd 02-Dec-2024 Herve Codina <[email protected]>

of: Fix error path in of_parse_phandle_with_args_map()

The current code uses some 'goto put;' to cancel the parsing operation
and can lead to a return code value of 0 even on error cases.

Indeed, s

of: Fix error path in of_parse_phandle_with_args_map()

The current code uses some 'goto put;' to cancel the parsing operation
and can lead to a return code value of 0 even on error cases.

Indeed, some goto calls are done from a loop without setting the ret
value explicitly before the goto call and so the ret value can be set to
0 due to operation done in previous loop iteration. For instance match
can be set to 0 in the previous loop iteration (leading to a new
iteration) but ret can also be set to 0 it the of_property_read_u32()
call succeed. In that case if no match are found or if an error is
detected the new iteration, the return value can be wrongly 0.

Avoid those cases setting the ret value explicitly before the goto
calls.

Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node")
Cc: [email protected]
Signed-off-by: Herve Codina <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.13-rc1
# 0d40daa1 28-Nov-2024 Chen-Yu Tsai <[email protected]>

of: base: Document prefix argument for of_get_next_child_with_prefix()

When of_get_next_child_with_prefix() was added, the prefix argument was
left undocumented. This caused a new warning to be gene

of: base: Document prefix argument for of_get_next_child_with_prefix()

When of_get_next_child_with_prefix() was added, the prefix argument was
left undocumented. This caused a new warning to be generated during the
kerneldoc build process:

drivers/of/base.c:661: warning: Function parameter or struct member 'prefix'
not described in 'of_get_next_child_with_prefix'

Properly document the argument to fix this.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Fixes: 1fcc67e3a354 ("of: base: Add for_each_child_of_node_with_prefix()")
Signed-off-by: Chen-Yu Tsai <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>

show more ...


Revision tags: v6.12, v6.12-rc7
# 1fcc67e3 06-Nov-2024 Chen-Yu Tsai <[email protected]>

of: base: Add for_each_child_of_node_with_prefix()

There are cases where drivers would go through child device nodes and
operate on only the ones whose node name starts with a given prefix.

Provide

of: base: Add for_each_child_of_node_with_prefix()

There are cases where drivers would go through child device nodes and
operate on only the ones whose node name starts with a given prefix.

Provide a helper for these users. This will mainly be used in a
subsequent patch that implements a hardware component prober for I2C
busses.

Signed-off-by: Chen-Yu Tsai <[email protected]>
Reviewed-by: Rob Herring (Arm) <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>

show more ...


# 045b14ca 06-Nov-2024 Rob Herring (Arm) <[email protected]>

of: WARN on deprecated #address-cells/#size-cells handling

While OpenFirmware originally allowed walking parent nodes and default
root values for #address-cells and #size-cells, FDT has long require

of: WARN on deprecated #address-cells/#size-cells handling

While OpenFirmware originally allowed walking parent nodes and default
root values for #address-cells and #size-cells, FDT has long required
explicit values. It's been a warning in dtc for the root node since the
beginning (2005) and for any parent node since 2007. Of course, not all
FDT uses dtc, but that should be the majority by far. The various
extracted OF devicetrees I have dating back to the 1990s (various
PowerMac, OLPC, PASemi Nemo) all have explicit root node properties. The
warning is disabled for Sparc as there are known systems relying on
default root node values.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3
# 9c63fea9 10-Oct-2024 Rob Herring (Arm) <[email protected]>

of: Constify struct property pointers

Most accesses to struct property do not modify it, so constify struct
property pointers where ever possible in the DT core code.

Reviewed-by: Krzysztof Kozlows

of: Constify struct property pointers

Most accesses to struct property do not modify it, so constify struct
property pointers where ever possible in the DT core code.

Reviewed-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


# ec8c2329 10-Oct-2024 Rob Herring (Arm) <[email protected]>

of: Constify struct device_node function arguments

Functions which don't change the refcount or otherwise modify struct
device_node can make struct device_node const.

Reviewed-by: Krzysztof Kozlows

of: Constify struct device_node function arguments

Functions which don't change the refcount or otherwise modify struct
device_node can make struct device_node const.

Reviewed-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected]>

show more ...


Revision tags: v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4
# 40b0f174 09-Apr-2024 Rob Herring <[email protected]>

of: Use scope based kfree() cleanups

Use the relatively new scope based kfree() cleanup to simplify error
handling. Doing so reduces the chances of memory leaks and simplifies
error paths by avoidin

of: Use scope based kfree() cleanups

Use the relatively new scope based kfree() cleanup to simplify error
handling. Doing so reduces the chances of memory leaks and simplifies
error paths by avoiding the need for goto statements.

Reviewed-by: Saravana Kannan <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>

show more ...


Revision tags: v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6
# 1ac8205f 14-Dec-2023 Christophe Leroy <[email protected]>

of: Reimplement of_machine_is_compatible() using of_machine_compatible_match()

of_machine_compatible_match() works with a table of strings.
of_machine_is_compatible() is a simplier version with only

of: Reimplement of_machine_is_compatible() using of_machine_compatible_match()

of_machine_compatible_match() works with a table of strings.
of_machine_is_compatible() is a simplier version with only one string.

Re-implement of_machine_is_compatible() by setting a table of strings
with a single string then using of_machine_compatible_match().

Suggested-by: Rob Herring <[email protected]>
Signed-off-by: Christophe Leroy <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]

show more ...


# cefdb366 14-Dec-2023 Michael Ellerman <[email protected]>

of: Change of_machine_is_compatible() to return bool

of_machine_is_compatible() currently returns a positive integer if it
finds a match. However none of the callers ever check the value, they
all t

of: Change of_machine_is_compatible() to return bool

of_machine_is_compatible() currently returns a positive integer if it
finds a match. However none of the callers ever check the value, they
all treat it as a true/false.

So change of_machine_is_compatible() to return bool, which will allow
the implementation to be changed in a subsequent patch.

Suggested-by: Rob Herring <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]

show more ...


# c029b22f 14-Dec-2023 Michael Ellerman <[email protected]>

of: Add of_machine_compatible_match()

We have of_machine_is_compatible() to check if a machine is compatible
with a single compatible string. However some code is able to support
multiple compatible

of: Add of_machine_compatible_match()

We have of_machine_is_compatible() to check if a machine is compatible
with a single compatible string. However some code is able to support
multiple compatible boards, and so wants to check for one of many
compatible strings.

So add of_machine_compatible_match() which takes a NULL terminated
array of compatible strings to check against the root node's
compatible property.

Compared to an open coded match this is slightly more self
documenting, and also avoids the caller needing to juggle the root
node either directly or via of_find_node_by_path().

Signed-off-by: Christophe Leroy <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]

show more ...


# e7263853 05-Feb-2024 Dawei Li <[email protected]>

of: Make explicit cpu_to_be32 conversion to mute sparse warning

Kernel test robot reports sparse warning:
sparse warnings: (new ones prefixed by >>)
>> drivers/of/base.c:1337:73: sparse: sparse: inc

of: Make explicit cpu_to_be32 conversion to mute sparse warning

Kernel test robot reports sparse warning:
sparse warnings: (new ones prefixed by >>)
>> drivers/of/base.c:1337:73: sparse: sparse: incorrect type in initializer
(different base types) @@ expected restricted __be32 @@ got int @@
drivers/of/base.c:1337:73: sparse: expected restricted __be32
drivers/of/base.c:1337:73: sparse: got int

Thus, Make explicit conversions to mute warning(Although BE and LE are
exactly same in binary representation for 0/~0).

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Dawei Li <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>

show more ...


# 28c5d4e4 10-Jan-2024 Kuninori Morimoto <[email protected]>

of: Add for_each_reserved_child_of_node()

We would like to use for_each loop for status = "reserved" nodes.
Add for_each_reserved_child_of_node() for it.

Signed-off-by: Kuninori Morimoto <kuninori.

of: Add for_each_reserved_child_of_node()

We would like to use for_each loop for status = "reserved" nodes.
Add for_each_reserved_child_of_node() for it.

Signed-off-by: Kuninori Morimoto <[email protected]>
Tested-by: Yusuke Goda <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Geert Uytterhoeven <[email protected]>

show more ...


# 8918283a 10-Jan-2024 Kuninori Morimoto <[email protected]>

of: Add of_get_next_status_child() and makes more generic of_get_next

Linux Kernel has of_get_next_available_child().
Add more generic of_get_next_status_child() to enable to use same
logic for othe

of: Add of_get_next_status_child() and makes more generic of_get_next

Linux Kernel has of_get_next_available_child().
Add more generic of_get_next_status_child() to enable to use same
logic for other status.

Signed-off-by: Kuninori Morimoto <[email protected]>
Tested-by: Yusuke Goda <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Geert Uytterhoeven <[email protected]>

show more ...


# b5056ecf 10-Jan-2024 Kuninori Morimoto <[email protected]>

of: Add __of_device_is_status() and makes more generic status check

Linux Kernel has __of_device_is_available() / __of_device_is_fail(),
these are checking if the status was "okay" / "ok" / "fail" /

of: Add __of_device_is_status() and makes more generic status check

Linux Kernel has __of_device_is_available() / __of_device_is_fail(),
these are checking if the status was "okay" / "ok" / "fail" / "fail-".

Add more generic __of_device_is_status() function for these.

Signed-off-by: Kuninori Morimoto <[email protected]>
Tested-by: Yusuke Goda <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Geert Uytterhoeven <[email protected]>

show more ...


# 4dde8356 29-Dec-2023 Christian A. Ehrhardt <[email protected]>

of: Fix double free in of_parse_phandle_with_args_map

In of_parse_phandle_with_args_map() the inner loop that
iterates through the map entries calls of_node_put(new)
to free the reference acquired b

of: Fix double free in of_parse_phandle_with_args_map

In of_parse_phandle_with_args_map() the inner loop that
iterates through the map entries calls of_node_put(new)
to free the reference acquired by the previous iteration
of the inner loop. This assumes that the value of "new" is
NULL on the first iteration of the inner loop.

Make sure that this is true in all iterations of the outer
loop by setting "new" to NULL after its value is assigned to "cur".

Extend the unittest to detect the double free and add an additional
test case that actually triggers this path.

Fixes: bd6f2fd5a1 ("of: Support parsing phandle argument lists through a nexus node")
Cc: Stephen Boyd <[email protected]>
Signed-off-by: "Christian A. Ehrhardt" <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>

show more ...


12345678910>>...12