diff options
| author | Rob Herring (Arm) <robh@kernel.org> | 2025-01-09 22:42:05 +0300 |
|---|---|---|
| committer | Rob Herring (Arm) <robh@kernel.org> | 2025-01-14 02:47:29 +0300 |
| commit | bb3914101f704a8282f65238d6b021d216efc608 (patch) | |
| tree | f7467e58da6cdcb3df24531da2875278af8e96db /drivers/of | |
| parent | de7323f6fc10f36307895ce604585a539d1cc89a (diff) | |
| download | linux-bb3914101f704a8282f65238d6b021d216efc608.tar.xz | |
device property: Split property reading bool and presence test ops
The fwnode/device property API currently implement
(fwnode|device)_property_read_bool() with (fwnode|device)_property_present().
That does not allow having different behavior depending on the backend.
Specifically, the usage of (fwnode|device)_property_read_bool() on
non-boolean properties is deprecated on DT. In order to add a warning
on this deprecated use, these 2 APIs need separate ops for the backend.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20250109-dt-type-warnings-v1-1-0150e32e716c@kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/property.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/of/property.c b/drivers/of/property.c index 9d8b68c72c36..2109515a3bc2 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -966,6 +966,12 @@ of_fwnode_device_get_dma_attr(const struct fwnode_handle *fwnode) static bool of_fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname) { + return of_property_present(to_of_node(fwnode), propname); +} + +static bool of_fwnode_property_read_bool(const struct fwnode_handle *fwnode, + const char *propname) +{ return of_property_read_bool(to_of_node(fwnode), propname); } @@ -1562,6 +1568,7 @@ const struct fwnode_operations of_fwnode_ops = { .device_dma_supported = of_fwnode_device_dma_supported, .device_get_dma_attr = of_fwnode_device_get_dma_attr, .property_present = of_fwnode_property_present, + .property_read_bool = of_fwnode_property_read_bool, .property_read_int_array = of_fwnode_property_read_int_array, .property_read_string_array = of_fwnode_property_read_string_array, .get_name = of_fwnode_get_name, |
