[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6tBlfmTFu9916LA@smile.fi.intel.com>
Date: Tue, 11 Feb 2025 14:24:53 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
"Rob Herring (Arm)" <robh@...nel.org>,
Saravana Kannan <saravanak@...gle.com>, Len Brown <lenb@...nel.org>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-acpi@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v3] of: property: Increase NR_FWNODE_REFERENCE_ARGS
On Tue, Feb 11, 2025 at 08:20:03PM +0800, Zijun Hu wrote:
> On 2025/2/10 23:34, Andy Shevchenko wrote:
> >> It may cause firmware node reference's argument count out of range if
> >> directly assign DT node reference's argument count to firmware's.
> >>
> >> drivers/of/property.c:of_fwnode_get_reference_args() is doing the direct
> >> assignment, so may cause firmware's argument count @args->nargs got out
> >> of range, namely, in [9, 16].
> >>
> >> Fix by increasing NR_FWNODE_REFERENCE_ARGS to 16 to meet DT requirement.
...
> >> -#define NR_FWNODE_REFERENCE_ARGS 8
> >> +#define NR_FWNODE_REFERENCE_ARGS 16
> > Thinking of the case, perhaps you also want
> >
> > static_assert(NR_FWNODE_REFERENCE_ARGS == MAX_PHANDLE_ARGS);
> >
> > to be put somewhere, but I don't think we can do it in this header file.
>
> thank you Andy for code review.
>
> yes. it seems there are good location to place the static_assert().
>
> is it okay to associate two macros by
> #define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS
I was thinking about this and I don't see how it can be done without
introducing more chaos (dependency hell) into the headers. So, I won't
take this path or even consider it deeper.
> OR
> replace all MAX_PHANDLE_ARGS instances with NR_FWNODE_REFERENCE_ARGS
> ?
This sounds plausible to me, but you need a blessing from OF people as
the naming may be a bit confusing (for them) as "phandle" is well established
term in OF realm.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists