linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Greg KH <greg@kroah.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linyu Yuan <linyyuan@codeaurora.org>,
	Wesley Cheng <wcheng@codeaurora.org>
Subject: linux-next: manual merge of the usb tree with the usb.current tree
Date: Thu, 22 Jul 2021 14:12:28 +1000	[thread overview]
Message-ID: <20210722141228.57a92e94@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 3226 bytes --]

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,
  };
  
  /* -------------------------------------------------------------------------- */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2021-07-22  4:12 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  4:12 Stephen Rothwell [this message]
2021-07-23 12:29 ` linux-next: manual merge of the usb tree with the usb.current tree Greg KH
2021-07-27 14:45 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2024-04-12  4:25 Stephen Rothwell
2024-04-12  7:58 ` Greg KH
2024-02-20  3:39 Stephen Rothwell
2024-02-20  8:18 ` Greg KH
2024-02-26  5:55 ` Greg KH
2023-05-15  2:50 Stephen Rothwell
2023-05-28 14:28 ` Greg KH
2023-05-15  2:35 Stephen Rothwell
2023-05-15  3:50 ` Greg KH
2023-05-15  5:22 ` Krishna Kurapati PSSNV
2023-05-15 11:01 ` Roger Quadros
2023-05-15 11:36   ` Stephen Rothwell
2023-05-28 14:28   ` Greg KH
2023-05-28 15:48     ` Roger Quadros
2023-05-28 16:07       ` Greg KH
2023-03-31  3:01 Stephen Rothwell
2023-03-31  7:52 ` Greg KH
2023-04-10  6:56 ` Greg KH
2023-01-19  3:48 Stephen Rothwell
2023-01-18  0:56 Stephen Rothwell
2023-01-18  7:48 ` Greg KH
2023-01-23 14:40 ` Greg KH
2022-09-01  3:52 Stephen Rothwell
2022-09-05  6:04 ` Greg KH
2022-04-26  5:08 Stephen Rothwell
2022-04-26  9:41 ` Greg KH
2022-05-03 14:36 ` Greg KH
2022-02-21 20:39 broonie
2022-02-22  7:44 ` Greg KH
2021-01-20  2:06 Stephen Rothwell
2021-01-20  8:02 ` Greg KH
2021-01-06  0:50 Stephen Rothwell
2021-01-11  7:11 ` Greg KH
2020-06-26  3:29 Stephen Rothwell
2020-06-26 15:14 ` Greg KH
2020-06-29  6:23 ` Greg KH
2018-06-29  4:57 Stephen Rothwell
2018-07-01  8:43 ` Greg KH
2018-07-01 15:11   ` Randy Dunlap
2018-04-23  3:04 Stephen Rothwell
2018-04-23  8:30 ` Johan Hovold
2018-04-23  8:41   ` Greg KH
2018-04-30  1:34 ` Stephen Rothwell
2018-04-30 11:55   ` Sebastian Reichel
2018-04-30 12:16     ` Greg KH
2018-04-30 12:00   ` Greg KH
2017-12-20  2:09 Stephen Rothwell
2017-12-20  9:36 ` Greg KH
2018-01-03  0:56   ` Stephen Rothwell
2018-01-04 16:06     ` Greg KH
2014-11-05  4:18 Stephen Rothwell
2014-11-05  4:30 ` Greg KH
2014-11-05  8:33   ` Paul Bolle
2014-11-06  2:19     ` Greg KH
2014-11-06  5:02       ` Stephen Rothwell
2013-12-18  5:53 Stephen Rothwell
2013-03-21  4:24 Stephen Rothwell
2012-11-14  4:07 Stephen Rothwell
2012-11-16  2:14 ` Greg KH
2012-11-13  3:37 Stephen Rothwell
2012-11-13 18:49 ` Greg KH
2012-10-25  2:05 Stephen Rothwell
2012-10-25  2:17 ` Greg KH
2012-09-12  5:37 Stephen Rothwell
2012-09-12 16:14 ` Greg KH
2012-09-12  5:37 Stephen Rothwell
2012-05-03  4:44 Stephen Rothwell
2012-05-04 23:18 ` Greg KH
2012-05-07 16:05 ` Greg KH
2012-05-07 16:05 ` Greg KH
2012-04-19  5:14 Stephen Rothwell
2012-04-19 20:07 ` Greg KH
2012-04-22 22:27 ` Greg KH
2012-03-05  6:00 Stephen Rothwell
2012-03-05 16:42 ` Greg KH
2011-08-25  4:52 Stephen Rothwell
2011-08-25 15:39 ` Greg KH
2011-08-29 15:52 ` Greg KH
2010-12-20  5:28 Stephen Rothwell
2010-12-20 18:30 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210722141228.57a92e94@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=greg@kroah.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linyyuan@codeaurora.org \
    --cc=wcheng@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).