Re: [PATCH 03/10] device property: Add fwnode_property_read_int_array()

Rob Herring
2025-04-03T16:36:52Z

On Thu, Apr 3, 2025 at 11:15 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Apr 03, 2025 at 11:04:32AM -0500, Rob Herring wrote:
> > On Thu, Mar 27, 2025 at 3:41 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > On Wed, Mar 26, 2025 at 06:13:42PM +0100, Remo Senekowitsch wrote:
> > > > The rust bindings for reading device properties has a single
> > > > implementation supporting differing sizes of integers. The fwnode C API
> > > > already has a similar interface, but it is not exposed with the
> > > > fwnode_property_ API. Add the fwnode_property_read_int_array() wrapper.
>
> ...
>
> > > > +EXPORT_SYMBOL_GPL(fwnode_property_read_int_array);
> > >
> > > I'm not sure about this. We have a lot of assumptions in the code that the
> > > arrays beneath are only represented by the selected number of integer types.
> > > This opens a Pandora's box, e.g., reading in u24, which is not supported by
> > > the upper layers..
> >
> > We can probably drop the export if it is just that which you object to.
>
> Yes, this is main point, but dropping it does not prevent from still using in
> the complied-in code. Is it possible to hide it better?

Don't put any declaration in the header and declare it in the rust
code? But lack of declaration generates warnings.

Also, all the backends will reject an arbitrary size. So your worry
about u24 or other odd sizes isn't really valid. But if you want to be
doubly paranoid for when we add a new firmware backend (shoot me now),
you could move this from the swnode implementation to the fwnode
implementation:

if (!is_power_of_2(elem_size) || elem_size > sizeof(u64))
return -ENXIO;

Rob