Subject: linux-next: manual merge of the usb tree with the usb.current tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 20 Feb 2024 14:39:19 +1100

Hi all,

Today's linux-next merge of the usb tree got a conflict in:

  drivers/usb/roles/class.c

between commit:

  b787a3e78175 ("usb: roles: don't get/set_role() when usb_role_switch is unregistered")

from the usb.current tree and commit:

  9a270ec7bfb0 ("usb: roles: Link the switch to its connector")

from the usb tree.

I fixed it up (I think - 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/usb/roles/class.c
index 70165dd86b5d,4ad03c93c17f..000000000000
--- a/drivers/usb/roles/class.c
+++ b/drivers/usb/roles/class.c
@@@ -361,8 -379,12 +388,14 @@@ usb_role_switch_register(struct device 
  		return ERR_PTR(ret);
  	}
  
+ 	if (dev_fwnode(&sw->dev)) {
+ 		ret = component_add(&sw->dev, &connector_ops);
+ 		if (ret)
+ 			dev_warn(&sw->dev, "failed to add component\n");
+ 	}
+ 
 +	sw->registered = true;
 +
  	/* TODO: Symlinks for the host port and the device controller. */
  
  	return sw;
@@@ -377,10 -399,11 +410,12 @@@ EXPORT_SYMBOL_GPL(usb_role_switch_regis
   */
  void usb_role_switch_unregister(struct usb_role_switch *sw)
  {
- 	if (!IS_ERR_OR_NULL(sw)) {
- 		sw->registered = false;
- 		device_unregister(&sw->dev);
- 	}
+ 	if (IS_ERR_OR_NULL(sw))
+ 		return;
++	sw->registered = false;
+ 	if (dev_fwnode(&sw->dev))
+ 		component_del(&sw->dev, &connector_ops);
+ 	device_unregister(&sw->dev);
  }
  EXPORT_SYMBOL_GPL(usb_role_switch_unregister);