Commit e588fead authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

software node: Introduce SOFTWARE_NODE_REFERENCE() helper macro

This is useful to assign software node reference with arguments
in a common way. Moreover, we have already couple of users that
may be converted. And by the fact, one of them is moved right here
to use the helper.
Tested-by: default avatarDaniel Scally <djrscally@gmail.com>
Reviewed-by: default avatarDaniel Scally <djrscally@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210329151207.36619-5-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4a32e384
...@@ -412,15 +412,8 @@ static void pe_test_reference(struct kunit *test) ...@@ -412,15 +412,8 @@ static void pe_test_reference(struct kunit *test)
}; };
static const struct software_node_ref_args refs[] = { static const struct software_node_ref_args refs[] = {
{ SOFTWARE_NODE_REFERENCE(&nodes[0]),
.node = &nodes[0], SOFTWARE_NODE_REFERENCE(&nodes[1], 3, 4),
.nargs = 0,
},
{
.node = &nodes[1],
.nargs = 2,
.args = { 3, 4 },
},
}; };
const struct property_entry entries[] = { const struct property_entry entries[] = {
......
...@@ -254,6 +254,13 @@ struct software_node_ref_args { ...@@ -254,6 +254,13 @@ struct software_node_ref_args {
u64 args[NR_FWNODE_REFERENCE_ARGS]; u64 args[NR_FWNODE_REFERENCE_ARGS];
}; };
#define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
(const struct software_node_ref_args) { \
.node = _ref_, \
.nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \
.args = { __VA_ARGS__ }, \
}
/** /**
* struct property_entry - "Built-in" device property representation. * struct property_entry - "Built-in" device property representation.
* @name: Name of the property. * @name: Name of the property.
...@@ -362,11 +369,7 @@ struct property_entry { ...@@ -362,11 +369,7 @@ struct property_entry {
.name = _name_, \ .name = _name_, \
.length = sizeof(struct software_node_ref_args), \ .length = sizeof(struct software_node_ref_args), \
.type = DEV_PROP_REF, \ .type = DEV_PROP_REF, \
{ .pointer = &(const struct software_node_ref_args) { \ { .pointer = &SOFTWARE_NODE_REFERENCE(_ref_, ##__VA_ARGS__), }, \
.node = _ref_, \
.nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \
.args = { __VA_ARGS__ }, \
} }, \
} }
struct property_entry * struct property_entry *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment