2021-07-22 04:14:26

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: manual merge of the usb tree with the usb.current tree

Hi all,

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

drivers/usb/dwc3/gadget.c

between commit:

40edb52298df ("usb: dwc3: avoid NULL access of usb_gadget_driver")

from the usb.current tree and commit:

9f607a309fbe ("usb: dwc3: Resize TX FIFOs to meet EP bursting requirements")

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/dwc3/gadget.c
index 45f2bc0807e8,e56f1a6db2de..000000000000
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@@ -2585,16 -2771,51 +2771,61 @@@ static int dwc3_gadget_vbus_draw(struc
return ret;
}

+static void dwc3_gadget_async_callbacks(struct usb_gadget *g, bool enable)
+{
+ struct dwc3 *dwc = gadget_to_dwc(g);
+ unsigned long flags;
+
+ spin_lock_irqsave(&dwc->lock, flags);
+ dwc->async_callbacks = enable;
+ spin_unlock_irqrestore(&dwc->lock, flags);
+}
+
+ /**
+ * dwc3_gadget_check_config - ensure dwc3 can support the USB configuration
+ * @g: pointer to the USB gadget
+ *
+ * Used to record the maximum number of endpoints being used in a USB composite
+ * device. (across all configurations) This is to be used in the calculation
+ * of the TXFIFO sizes when resizing internal memory for individual endpoints.
+ * It will help ensured that the resizing logic reserves enough space for at
+ * least one max packet.
+ */
+ static int dwc3_gadget_check_config(struct usb_gadget *g)
+ {
+ struct dwc3 *dwc = gadget_to_dwc(g);
+ struct usb_ep *ep;
+ int fifo_size = 0;
+ int ram1_depth;
+ int ep_num = 0;
+
+ if (!dwc->do_fifo_resize)
+ return 0;
+
+ list_for_each_entry(ep, &g->ep_list, ep_list) {
+ /* Only interested in the IN endpoints */
+ if (ep->claimed && (ep->address & USB_DIR_IN))
+ ep_num++;
+ }
+
+ if (ep_num <= dwc->max_cfg_eps)
+ return 0;
+
+ /* Update the max number of eps in the composition */
+ dwc->max_cfg_eps = ep_num;
+
+ fifo_size = dwc3_gadget_calc_tx_fifo_size(dwc, dwc->max_cfg_eps);
+ /* Based on the equation, increment by one for every ep */
+ fifo_size += dwc->max_cfg_eps;
+
+ /* Check if we can fit a single fifo per endpoint */
+ ram1_depth = DWC3_RAM1_DEPTH(dwc->hwparams.hwparams7);
+ if (fifo_size > ram1_depth)
+ return -ENOMEM;
+
+ return 0;
+ }
+
static const struct usb_gadget_ops dwc3_gadget_ops = {
.get_frame = dwc3_gadget_get_frame,
.wakeup = dwc3_gadget_wakeup,
@@@ -2606,7 -2827,7 +2837,8 @@@
.udc_set_ssp_rate = dwc3_gadget_set_ssp_rate,
.get_config_params = dwc3_gadget_config_params,
.vbus_draw = dwc3_gadget_vbus_draw,
+ .udc_async_callbacks = dwc3_gadget_async_callbacks,
+ .check_config = dwc3_gadget_check_config,
};

/* -------------------------------------------------------------------------- */


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-07-23 12:32:30

by Greg KH

[permalink] [raw]
Subject: Re: linux-next: manual merge of the usb tree with the usb.current tree

On Thu, Jul 22, 2021 at 02:12:28PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the usb tree got a conflict in:
>
> drivers/usb/dwc3/gadget.c
>
> between commit:
>
> 40edb52298df ("usb: dwc3: avoid NULL access of usb_gadget_driver")
>
> from the usb.current tree and commit:
>
> 9f607a309fbe ("usb: dwc3: Resize TX FIFOs to meet EP bursting requirements")
>
> 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.

Thanks, I'll fix this up when Linus takes my usb-linus branch soon.

greg k-h

2021-07-27 14:48:39

by Greg KH

[permalink] [raw]
Subject: Re: linux-next: manual merge of the usb tree with the usb.current tree

On Thu, Jul 22, 2021 at 02:12:28PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the usb tree got a conflict in:
>
> drivers/usb/dwc3/gadget.c
>
> between commit:
>
> 40edb52298df ("usb: dwc3: avoid NULL access of usb_gadget_driver")
>
> from the usb.current tree and commit:
>
> 9f607a309fbe ("usb: dwc3: Resize TX FIFOs to meet EP bursting requirements")
>
> 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.

This should now be resolved in my trees.

thanks,

greg k-h