Re: [PATCH 1/2] device property: Add optional nargs_prop for get_reference_args

Rob Herring
2025-04-08T12:55:42Z

On Tue, Apr 8, 2025 at 4:14 AM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Sean,
>
> On Mon, Apr 07, 2025 at 06:37:13PM -0400, Sean Anderson wrote:
> > get_reference_args does not permit falling back to nargs when nargs_prop
> > is missing. This makes it difficult to support older devicetrees where
> > nargs_prop may not be present. Add support for this by converting nargs
> > to a signed value. Where before nargs was ignored if nargs_prop was
> > passed, now nargs is only ignored if it is strictly negative. When it is
> > positive, nargs represents the fallback cells to use if nargs_prop is
> > absent.
>
> If you don't know either the argument count or have a property that tells
> it, there's no way to differentiate phandles from arguments. I'd say such
> DTS are broken. Where do they exist?

#msi-cells for one is optional because we added it after the initial
bindings and missing means 0.

> At the very least this needs to be documented as a workaround and moved to
> the OF framework. I wouldn't add such a workaround to swnodes either, the
> bugs should be fixed instead.

The DT API supports this already.

Rob