c3e05bd1 | 16-Jun-2025 |
Remo Senekowitsch <remo@buenzli.dev> |
rust: device: Add property_get_reference_args
Allow Rust code to read reference args from device properties. The wrapper type `FwNodeReferenceArgs` allows callers to access the buffer of read args s
rust: device: Add property_get_reference_args
Allow Rust code to read reference args from device properties. The wrapper type `FwNodeReferenceArgs` allows callers to access the buffer of read args safely.
Signed-off-by: Remo Senekowitsch <remo@buenzli.dev> Link: https://lore.kernel.org/r/20250616154511.1862909-3-remo@buenzli.dev [ Move up NArgs; refer to FwNodeReferenceArgs in NArgs doc-comment. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
2db61137 | 11-Jun-2025 |
Remo Senekowitsch <remo@buenzli.dev> |
rust: device: Implement accessors for firmware properties
Add methods to FwNode for reading several firmware property types like strings, integers and arrays.
Most types are read with the generic `
rust: device: Implement accessors for firmware properties
Add methods to FwNode for reading several firmware property types like strings, integers and arrays.
Most types are read with the generic `property_read` method. There are two exceptions:
* `property_read_bool` cannot fail, so the fallible function signature of `property_read` would not make sense for reading booleans.
* `property_read_array_vec` can fail because of a dynamic memory allocation. This error must be handled separately, leading to a different function signature than `property_read`.
The traits `Property` and `PropertyInt` drive the generic behavior of `property_read`. `PropertyInt` is necessary to associate specific integer types with the C functions to read them. While there is a C function to read integers of generic sizes called `fwnode_property_read_int_array`, it was preferred not to make this public.
Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Co-developed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Remo Senekowitsch <remo@buenzli.dev> Link: https://lore.kernel.org/r/20250611102908.212514-7-remo@buenzli.dev [ Properly include kernel::device::private::Sealed; add explicit type annotations for core::mem::transmute(). - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
9bd791d9 | 11-Jun-2025 |
Remo Senekowitsch <remo@buenzli.dev> |
rust: device: Introduce PropertyGuard
This abstraction is a way to force users to specify whether a property is supposed to be required or not. This allows us to move error logging of missing requir
rust: device: Introduce PropertyGuard
This abstraction is a way to force users to specify whether a property is supposed to be required or not. This allows us to move error logging of missing required properties into core, preventing a lot of boilerplate in drivers.
It will be used by upcoming methods for reading device properties.
Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Remo Senekowitsch <remo@buenzli.dev> Link: https://lore.kernel.org/r/20250611102908.212514-6-remo@buenzli.dev [ Use prelude::* to avoid build failure; move PropertyGuard below Display impl of FwNode. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
ecea2459 | 11-Jun-2025 |
Remo Senekowitsch <remo@buenzli.dev> |
rust: device: Enable printing fwnode name and path
Add two new public methods `display_name` and `display_path` to `FwNode`. They can be used by driver authors for logging purposes. In addition, the
rust: device: Enable printing fwnode name and path
Add two new public methods `display_name` and `display_path` to `FwNode`. They can be used by driver authors for logging purposes. In addition, they will be used by core property abstractions for automatic logging, for example when a driver attempts to read a required but missing property.
Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Remo Senekowitsch <remo@buenzli.dev> Link: https://lore.kernel.org/r/20250611102908.212514-5-remo@buenzli.dev [ Remove #[expect(dead_code)] from FwNode::from_raw(). - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
d3393e84 | 11-Jun-2025 |
Remo Senekowitsch <remo@buenzli.dev> |
rust: device: Move property_present() to FwNode
The new FwNode abstraction will be used for accessing all device properties.
It would be possible to duplicate the methods on the device itself, but
rust: device: Move property_present() to FwNode
The new FwNode abstraction will be used for accessing all device properties.
It would be possible to duplicate the methods on the device itself, but since some of the methods on Device would have different type sigatures as the ones on FwNode, this would only lead to inconsistency and confusion. For this reason, property_present is removed from Device and existing users are updated.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Remo Senekowitsch <remo@buenzli.dev> Link: https://lore.kernel.org/r/20250611102908.212514-4-remo@buenzli.dev Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|