Skip to content

Commit 135116f

Browse files
Saravana Kannangregkh
authored andcommitted
of: property: fw_devlink: Add support for "post-init-providers" property
Add support for this property so that dependency cycles can be broken and fw_devlink can do better probe/suspend/resume ordering between devices in a dependency cycle. Signed-off-by: Saravana Kannan <saravanak@google.com> Acked-by: "Rafael J. Wysocki" <rafael@kernel.org> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20240305050458.1400667-4-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b7e1241 commit 135116f

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

drivers/of/property.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,8 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
10661066
}
10671067

10681068
static void of_link_to_phandle(struct device_node *con_np,
1069-
struct device_node *sup_np)
1069+
struct device_node *sup_np,
1070+
u8 flags)
10701071
{
10711072
struct device_node *tmp_np = of_node_get(sup_np);
10721073

@@ -1085,7 +1086,7 @@ static void of_link_to_phandle(struct device_node *con_np,
10851086
tmp_np = of_get_next_parent(tmp_np);
10861087
}
10871088

1088-
fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), 0);
1089+
fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), flags);
10891090
}
10901091

10911092
/**
@@ -1198,6 +1199,8 @@ static struct device_node *parse_##fname(struct device_node *np, \
11981199
* to a struct device, implement this ops so fw_devlink can use it
11991200
* to find the true consumer.
12001201
* @optional: Describes whether a supplier is mandatory or not
1202+
* @fwlink_flags: Optional fwnode link flags to use when creating a fwnode link
1203+
* for this property.
12011204
*
12021205
* Returns:
12031206
* parse_prop() return values are
@@ -1210,6 +1213,7 @@ struct supplier_bindings {
12101213
const char *prop_name, int index);
12111214
struct device_node *(*get_con_dev)(struct device_node *np);
12121215
bool optional;
1216+
u8 fwlink_flags;
12131217
};
12141218

12151219
DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells")
@@ -1240,6 +1244,7 @@ DEFINE_SIMPLE_PROP(leds, "leds", NULL)
12401244
DEFINE_SIMPLE_PROP(backlight, "backlight", NULL)
12411245
DEFINE_SIMPLE_PROP(panel, "panel", NULL)
12421246
DEFINE_SIMPLE_PROP(msi_parent, "msi-parent", "#msi-cells")
1247+
DEFINE_SIMPLE_PROP(post_init_providers, "post-init-providers", NULL)
12431248
DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
12441249
DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
12451250

@@ -1349,6 +1354,10 @@ static const struct supplier_bindings of_supplier_bindings[] = {
13491354
{ .parse_prop = parse_regulators, },
13501355
{ .parse_prop = parse_gpio, },
13511356
{ .parse_prop = parse_gpios, },
1357+
{
1358+
.parse_prop = parse_post_init_providers,
1359+
.fwlink_flags = FWLINK_FLAG_IGNORE,
1360+
},
13521361
{}
13531362
};
13541363

@@ -1393,7 +1402,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
13931402
: of_node_get(con_np);
13941403
matched = true;
13951404
i++;
1396-
of_link_to_phandle(con_dev_np, phandle);
1405+
of_link_to_phandle(con_dev_np, phandle, s->fwlink_flags);
13971406
of_node_put(phandle);
13981407
of_node_put(con_dev_np);
13991408
}

0 commit comments

Comments
 (0)