[PATCH v4 2/2] of: Align macro MAX_PHANDLE_ARGS with NR_FWNODE_REFERENCE_ARGS

Zijun Hu posted 2 patches 9 months, 3 weeks ago
[PATCH v4 2/2] of: Align macro MAX_PHANDLE_ARGS with NR_FWNODE_REFERENCE_ARGS
Posted by Zijun Hu 9 months, 3 weeks ago
From: Zijun Hu <quic_zijuhu@quicinc.com>

Macro NR_FWNODE_REFERENCE_ARGS defines the maximal argument count
for firmware node reference, and MAX_PHANDLE_ARGS defines the maximal
argument count for DT node reference, both have the same value now.

To void argument count inconsistency between firmware and DT, simply
align both macros by '#define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS'.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 include/linux/of.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index eaf0e2a2b75cbe4769a77f68965298c84d57e62c..86bf8f0731112456b3efc2e5ee00e73000c6af56 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -67,7 +67,7 @@ struct device_node {
 #endif
 };
 
-#define MAX_PHANDLE_ARGS 16
+#define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS
 struct of_phandle_args {
 	struct device_node *np;
 	int args_count;

-- 
2.34.1
Re: [PATCH v4 2/2] of: Align macro MAX_PHANDLE_ARGS with NR_FWNODE_REFERENCE_ARGS
Posted by Sakari Ailus 9 months, 3 weeks ago
On Tue, Feb 25, 2025 at 09:58:07PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
> 
> Macro NR_FWNODE_REFERENCE_ARGS defines the maximal argument count
> for firmware node reference, and MAX_PHANDLE_ARGS defines the maximal
> argument count for DT node reference, both have the same value now.
> 
> To void argument count inconsistency between firmware and DT, simply
> align both macros by '#define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS'.
> 
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
Re: [PATCH v4 2/2] of: Align macro MAX_PHANDLE_ARGS with NR_FWNODE_REFERENCE_ARGS
Posted by Andy Shevchenko 9 months, 3 weeks ago
On Tue, Feb 25, 2025 at 09:58:07PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
> 
> Macro NR_FWNODE_REFERENCE_ARGS defines the maximal argument count
> for firmware node reference, and MAX_PHANDLE_ARGS defines the maximal
> argument count for DT node reference, both have the same value now.
> 
> To void argument count inconsistency between firmware and DT, simply
> align both macros by '#define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS'.

I would add here that the of.h includes fwnode.h already, so it doesn't
add any new compile time dependency.

Both patches LGTM,
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 2/2] of: Align macro MAX_PHANDLE_ARGS with NR_FWNODE_REFERENCE_ARGS
Posted by Zijun Hu 9 months, 3 weeks ago
On 2025/2/25 22:20, Andy Shevchenko wrote:
> I would add here that the of.h includes fwnode.h already, so it doesn't
> add any new compile time dependency.
> 

thank you Andy for comments.

include/linux/of.h:
struct device_node {
...
	struct fwnode_handle fwnode; // this type is defined by fwnode.h
...
}

include/linux/fwnode.h:
struct fwnode_handle {...}

So of.h must include fwnode.h


Perhaps, of.h needs to include fwnode.h *explicitly* even if this is
another topic.

> Both patches LGTM,
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Re: [PATCH v4 2/2] of: Align macro MAX_PHANDLE_ARGS with NR_FWNODE_REFERENCE_ARGS
Posted by Sakari Ailus 9 months, 3 weeks ago
Hi Andy, Zijun,

On Tue, Feb 25, 2025 at 04:20:34PM +0200, Andy Shevchenko wrote:
> On Tue, Feb 25, 2025 at 09:58:07PM +0800, Zijun Hu wrote:
> > From: Zijun Hu <quic_zijuhu@quicinc.com>
> > 
> > Macro NR_FWNODE_REFERENCE_ARGS defines the maximal argument count
> > for firmware node reference, and MAX_PHANDLE_ARGS defines the maximal
> > argument count for DT node reference, both have the same value now.
> > 
> > To void argument count inconsistency between firmware and DT, simply
> > align both macros by '#define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS'.
> 
> I would add here that the of.h includes fwnode.h already, so it doesn't
> add any new compile time dependency.

It's included via property.h but I think that's fine.

> 
> Both patches LGTM,
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
Sakari Ailus