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

From: Greg KH
Date: Sun May 28 2023 - 10:28:24 EST


On Mon, May 15, 2023 at 12:50:23PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the usb tree got a conflict in:
>
> drivers/usb/gadget/udc/core.c
>
> between commit:
>
> f22e9b67f19c ("Revert "usb: gadget: udc: core: Invoke usb_gadget_connect only when started"")
>
> from the usb.current tree and commit:
>
> d34f9bafa78d ("usb: gadget: udc: Handle gadget_connect failure during bind operation")
>
> 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/gadget/udc/core.c
> index 52e6d2e84e35,69041cca5d24..000000000000
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@@ -1078,12 -1121,17 +1078,16 @@@ EXPORT_SYMBOL_GPL(usb_gadget_set_state)
>
> /* ------------------------------------------------------------------------- */
>
> - static void usb_udc_connect_control(struct usb_udc *udc)
> -/* Acquire connect_lock before calling this function. */
> -static int usb_udc_connect_control_locked(struct usb_udc *udc) __must_hold(&udc->connect_lock)
> ++static int usb_udc_connect_control(struct usb_udc *udc)
> {
> + int ret;
> +
> - if (udc->vbus && udc->started)
> - ret = usb_gadget_connect_locked(udc->gadget);
> + if (udc->vbus)
> - usb_gadget_connect(udc->gadget);
> ++ ret = usb_gadget_connect(udc->gadget);
> else
> - usb_gadget_disconnect(udc->gadget);
> - ret = usb_gadget_disconnect_locked(udc->gadget);
> ++ ret = usb_gadget_disconnect(udc->gadget);
> +
> + return ret;
> }
>
> /**
> @@@ -1523,15 -1580,28 +1527,23 @@@ static int gadget_bind_driver(struct de
> if (ret)
> goto err_bind;
>
> - mutex_lock(&udc->connect_lock);
> - ret = usb_gadget_udc_start_locked(udc);
> - if (ret) {
> - mutex_unlock(&udc->connect_lock);
> + ret = usb_gadget_udc_start(udc);
> + if (ret)
> goto err_start;
> - }
> usb_gadget_enable_async_callbacks(udc);
> - usb_udc_connect_control(udc);
> - ret = usb_udc_connect_control_locked(udc);
> ++ ret = usb_udc_connect_control(udc);
> + if (ret)
> + goto err_connect_control;
>
> - mutex_unlock(&udc->connect_lock);
> -
> kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
> return 0;
>
> + err_connect_control:
> + usb_gadget_disable_async_callbacks(udc);
> + if (gadget->irq)
> + synchronize_irq(gadget->irq);
> - usb_gadget_udc_stop_locked(udc);
> ++ usb_gadget_udc_stop(udc);
> +
> err_start:
> driver->unbind(udc->gadget);
>



Should now be resolved in my branch.

thanks,

greg k-h