Hi all,
Today's linux-next merge of the driver-core tree got a conflict in:
drivers/base/core.c
between commit:
dc7c31b07ade ("drivers/base: Remove CONFIG_SRCU")
from the rcu tree and commit:
3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links")
from the driver-core tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc drivers/base/core.c
index bb36aca8d1b7,2712a1a1e959..000000000000
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@@ -181,6 -202,52 +202,51 @@@ void fw_devlink_purge_absent_suppliers(
}
EXPORT_SYMBOL_GPL(fw_devlink_purge_absent_suppliers);
+ /**
+ * __fwnode_links_move_consumers - Move consumer from @from to @to fwnode_handle
+ * @from: move consumers away from this fwnode
+ * @to: move consumers to this fwnode
+ *
+ * Move all consumer links from @from fwnode to @to fwnode.
+ */
+ static void __fwnode_links_move_consumers(struct fwnode_handle *from,
+ struct fwnode_handle *to)
+ {
+ struct fwnode_link *link, *tmp;
+
+ list_for_each_entry_safe(link, tmp, &from->consumers, s_hook) {
+ __fwnode_link_add(link->consumer, to, link->flags);
+ __fwnode_link_del(link);
+ }
+ }
+
+ /**
+ * __fw_devlink_pickup_dangling_consumers - Pick up dangling consumers
+ * @fwnode: fwnode from which to pick up dangling consumers
+ * @new_sup: fwnode of new supplier
+ *
+ * If the @fwnode has a corresponding struct device and the device supports
+ * probing (that is, added to a bus), then we want to let fw_devlink create
+ * MANAGED device links to this device, so leave @fwnode and its descendant's
+ * fwnode links alone.
+ *
+ * Otherwise, move its consumers to the new supplier @new_sup.
+ */
+ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,
+ struct fwnode_handle *new_sup)
+ {
+ struct fwnode_handle *child;
+
+ if (fwnode->dev && fwnode->dev->bus)
+ return;
+
+ fwnode->flags |= FWNODE_FLAG_NOT_DEVICE;
+ __fwnode_links_move_consumers(fwnode, new_sup);
+
+ fwnode_for_each_available_child_node(fwnode, child)
+ __fw_devlink_pickup_dangling_consumers(child, new_sup);
+ }
+
-#ifdef CONFIG_SRCU
static DEFINE_MUTEX(device_links_lock);
DEFINE_STATIC_SRCU(device_links_srcu);
On Fri, Feb 10, 2023 at 12:48:18PM +1100, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the driver-core tree got a conflict in:
>
> drivers/base/core.c
>
> between commit:
>
> dc7c31b07ade ("drivers/base: Remove CONFIG_SRCU")
>
> from the rcu tree and commit:
>
> 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links")
>
> from the driver-core tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
I have added this to my list of conflicts, thank you!
Thanx, Paul
> --
> Cheers,
> Stephen Rothwell
>
> diff --cc drivers/base/core.c
> index bb36aca8d1b7,2712a1a1e959..000000000000
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@@ -181,6 -202,52 +202,51 @@@ void fw_devlink_purge_absent_suppliers(
> }
> EXPORT_SYMBOL_GPL(fw_devlink_purge_absent_suppliers);
>
> + /**
> + * __fwnode_links_move_consumers - Move consumer from @from to @to fwnode_handle
> + * @from: move consumers away from this fwnode
> + * @to: move consumers to this fwnode
> + *
> + * Move all consumer links from @from fwnode to @to fwnode.
> + */
> + static void __fwnode_links_move_consumers(struct fwnode_handle *from,
> + struct fwnode_handle *to)
> + {
> + struct fwnode_link *link, *tmp;
> +
> + list_for_each_entry_safe(link, tmp, &from->consumers, s_hook) {
> + __fwnode_link_add(link->consumer, to, link->flags);
> + __fwnode_link_del(link);
> + }
> + }
> +
> + /**
> + * __fw_devlink_pickup_dangling_consumers - Pick up dangling consumers
> + * @fwnode: fwnode from which to pick up dangling consumers
> + * @new_sup: fwnode of new supplier
> + *
> + * If the @fwnode has a corresponding struct device and the device supports
> + * probing (that is, added to a bus), then we want to let fw_devlink create
> + * MANAGED device links to this device, so leave @fwnode and its descendant's
> + * fwnode links alone.
> + *
> + * Otherwise, move its consumers to the new supplier @new_sup.
> + */
> + static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,
> + struct fwnode_handle *new_sup)
> + {
> + struct fwnode_handle *child;
> +
> + if (fwnode->dev && fwnode->dev->bus)
> + return;
> +
> + fwnode->flags |= FWNODE_FLAG_NOT_DEVICE;
> + __fwnode_links_move_consumers(fwnode, new_sup);
> +
> + fwnode_for_each_available_child_node(fwnode, child)
> + __fw_devlink_pickup_dangling_consumers(child, new_sup);
> + }
> +
> -#ifdef CONFIG_SRCU
> static DEFINE_MUTEX(device_links_lock);
> DEFINE_STATIC_SRCU(device_links_srcu);
>
On Fri, Feb 10, 2023 at 12:48:18PM +1100, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the driver-core tree got a conflict in:
>
> drivers/base/core.c
>
> between commit:
>
> dc7c31b07ade ("drivers/base: Remove CONFIG_SRCU")
>
> from the rcu tree and commit:
>
> 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links")
>
> from the driver-core tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
Fix looks good to me, thanks!
greg k-h