Skip to content

Commit b7e1241

Browse files
Saravana Kannangregkh
authored andcommitted
driver core: Add FWLINK_FLAG_IGNORE to completely ignore a fwnode link
A fwnode link between specific supplier-consumer fwnodes can be added multiple times for multiple reasons. If that dependency doesn't exist, deleting the fwnode link once doesn't guarantee that it won't get created again. So, add FWLINK_FLAG_IGNORE flag to mark a fwnode link as one that needs to be completely ignored. Since a fwnode link's flags is an OR of all the flags passed to all the fwnode_link_add() calls to create that specific fwnode link, the FWLINK_FLAG_IGNORE flag is preserved and can be used to mark a fwnode link as on that need to be completely ignored until it is deleted. 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-3-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 75cde56 commit b7e1241

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/base/core.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,8 @@ static struct fwnode_handle *fwnode_links_check_suppliers(
10121012
return NULL;
10131013

10141014
list_for_each_entry(link, &fwnode->suppliers, c_hook)
1015-
if (!(link->flags & FWLINK_FLAG_CYCLE))
1015+
if (!(link->flags &
1016+
(FWLINK_FLAG_CYCLE | FWLINK_FLAG_IGNORE)))
10161017
return link->supplier;
10171018

10181019
return NULL;
@@ -2021,6 +2022,9 @@ static bool __fw_devlink_relax_cycles(struct device *con,
20212022
}
20222023

20232024
list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
2025+
if (link->flags & FWLINK_FLAG_IGNORE)
2026+
continue;
2027+
20242028
if (__fw_devlink_relax_cycles(con, link->supplier)) {
20252029
__fwnode_link_cycle(link);
20262030
ret = true;
@@ -2099,6 +2103,9 @@ static int fw_devlink_create_devlink(struct device *con,
20992103
int ret = 0;
21002104
u32 flags;
21012105

2106+
if (link->flags & FWLINK_FLAG_IGNORE)
2107+
return 0;
2108+
21022109
if (con->fwnode == link->consumer)
21032110
flags = fw_devlink_get_flags(link->flags);
21042111
else

include/linux/fwnode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ struct fwnode_handle {
5959
* fwnode link flags
6060
*
6161
* CYCLE: The fwnode link is part of a cycle. Don't defer probe.
62+
* IGNORE: Completely ignore this link, even during cycle detection.
6263
*/
6364
#define FWLINK_FLAG_CYCLE BIT(0)
65+
#define FWLINK_FLAG_IGNORE BIT(1)
6466

6567
struct fwnode_link {
6668
struct fwnode_handle *supplier;

0 commit comments

Comments
 (0)