Hi all,
Today's linux-next merge of the usb tree got a conflict in:
drivers/usb/typec/ucsi/ucsi.c
between commit:
fac4b8633fd6 ("usb: ucsi: Ensure connector delayed work items are flushed")
from the usb.current tree and commit:
b04e1747fbcc ("usb: typec: ucsi: Register USB Power Delivery Capabilities")
from the usb 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/usb/typec/ucsi/ucsi.c
index 1292241d581a,d04809476f71..000000000000
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@@ -1426,20 -1551,14 +1557,26 @@@ void ucsi_unregister(struct ucsi *ucsi
ucsi_unregister_altmodes(&ucsi->connector[i],
UCSI_RECIPIENT_CON);
ucsi_unregister_port_psy(&ucsi->connector[i]);
- if (ucsi->connector[i].wq)
+
+ if (ucsi->connector[i].wq) {
+ struct ucsi_work *uwork;
+
+ mutex_lock(&ucsi->connector[i].lock);
+ /*
+ * queue delayed items immediately so they can execute
+ * and free themselves before the wq is destroyed
+ */
+ list_for_each_entry(uwork, &ucsi->connector[i].partner_tasks, node)
+ mod_delayed_work(ucsi->connector[i].wq, &uwork->work, 0);
+ mutex_unlock(&ucsi->connector[i].lock);
destroy_workqueue(ucsi->connector[i].wq);
+ }
+ usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_sink_caps);
+ ucsi->connector[i].port_sink_caps = NULL;
+ usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_source_caps);
+ ucsi->connector[i].port_source_caps = NULL;
+ usb_power_delivery_unregister(ucsi->connector[i].pd);
+ ucsi->connector[i].pd = NULL;
typec_unregister_port(ucsi->connector[i].port);
}
On Wed, Jan 18, 2023 at 11:56:24AM +1100, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the usb tree got a conflict in: > > drivers/usb/typec/ucsi/ucsi.c > > between commit: > > fac4b8633fd6 ("usb: ucsi: Ensure connector delayed work items are flushed") > > from the usb.current tree and commit: > > b04e1747fbcc ("usb: typec: ucsi: Register USB Power Delivery Capabilities") > > from the usb 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/usb/typec/ucsi/ucsi.c > index 1292241d581a,d04809476f71..000000000000 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@@ -1426,20 -1551,14 +1557,26 @@@ void ucsi_unregister(struct ucsi *ucsi > ucsi_unregister_altmodes(&ucsi->connector[i], > UCSI_RECIPIENT_CON); > ucsi_unregister_port_psy(&ucsi->connector[i]); > - if (ucsi->connector[i].wq) > + > + if (ucsi->connector[i].wq) { > + struct ucsi_work *uwork; > + > + mutex_lock(&ucsi->connector[i].lock); > + /* > + * queue delayed items immediately so they can execute > + * and free themselves before the wq is destroyed > + */ > + list_for_each_entry(uwork, &ucsi->connector[i].partner_tasks, node) > + mod_delayed_work(ucsi->connector[i].wq, &uwork->work, 0); > + mutex_unlock(&ucsi->connector[i].lock); > destroy_workqueue(ucsi->connector[i].wq); > + } > + usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_sink_caps); > + ucsi->connector[i].port_sink_caps = NULL; > + usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_source_caps); > + ucsi->connector[i].port_source_caps = NULL; > + usb_power_delivery_unregister(ucsi->connector[i].pd); > + ucsi->connector[i].pd = NULL; > typec_unregister_port(ucsi->connector[i].port); > } > This looks good and should be resolved in my tree now, thanks! greg k-h
On Wed, Jan 18, 2023 at 11:56:24AM +1100, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the usb tree got a conflict in: > > drivers/usb/typec/ucsi/ucsi.c > > between commit: > > fac4b8633fd6 ("usb: ucsi: Ensure connector delayed work items are flushed") > > from the usb.current tree and commit: > > b04e1747fbcc ("usb: typec: ucsi: Register USB Power Delivery Capabilities") > > from the usb 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/usb/typec/ucsi/ucsi.c > index 1292241d581a,d04809476f71..000000000000 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@@ -1426,20 -1551,14 +1557,26 @@@ void ucsi_unregister(struct ucsi *ucsi > ucsi_unregister_altmodes(&ucsi->connector[i], > UCSI_RECIPIENT_CON); > ucsi_unregister_port_psy(&ucsi->connector[i]); > - if (ucsi->connector[i].wq) > + > + if (ucsi->connector[i].wq) { > + struct ucsi_work *uwork; > + > + mutex_lock(&ucsi->connector[i].lock); > + /* > + * queue delayed items immediately so they can execute > + * and free themselves before the wq is destroyed > + */ > + list_for_each_entry(uwork, &ucsi->connector[i].partner_tasks, node) > + mod_delayed_work(ucsi->connector[i].wq, &uwork->work, 0); > + mutex_unlock(&ucsi->connector[i].lock); > destroy_workqueue(ucsi->connector[i].wq); > + } > + usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_sink_caps); > + ucsi->connector[i].port_sink_caps = NULL; > + usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_source_caps); > + ucsi->connector[i].port_source_caps = NULL; > + usb_power_delivery_unregister(ucsi->connector[i].pd); > + ucsi->connector[i].pd = NULL; > typec_unregister_port(ucsi->connector[i].port); > } > Thanks, this looks correct. I'll apply it when these get merged locally in a week or so. greg k-h
© 2016 - 2025 Red Hat, Inc.