diff mbox series

[4/4] USB: gadget: f_midi: setup SuperSpeed Plus descriptors

Message ID 20201126180937.255892-4-gregkh@linuxfoundation.org (mailing list archive)
State New, archived
Headers show
Series [1/4] USB: gadget: f_rndis: fix bitrate for SuperSpeed and above | expand

Commit Message

Greg KH Nov. 26, 2020, 6:09 p.m. UTC
From: Will McVicker <willmcvicker@google.com>

Needed for SuperSpeed Plus support for f_midi.  This allows the
gadget to work properly without crashing at SuperSpeed rates.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/gadget/function/f_midi.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Peter Chen Nov. 27, 2020, 12:06 p.m. UTC | #1
On 20-11-26 19:09:37, Greg Kroah-Hartman wrote:
> From: Will McVicker <willmcvicker@google.com>
> 
> Needed for SuperSpeed Plus support for f_midi.  This allows the
> gadget to work properly without crashing at SuperSpeed rates.
> 
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/gadget/function/f_midi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
> index 85cb15734aa8..ceb67651de4f 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -1048,6 +1048,11 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
>  		f->ss_descriptors = usb_copy_descriptors(midi_function);
>  		if (!f->ss_descriptors)
>  			goto fail_f_midi;

Add one blank line, otherwise:

Reviewed-by: Peter Chen <peter.chen@nxp.com>

Peter
> +		if (gadget_is_superspeed_plus(c->cdev->gadget)) {
> +			f->ssp_descriptors = usb_copy_descriptors(midi_function);
> +			if (!f->ssp_descriptors)
> +				goto fail_f_midi;
> +		}
>  	}
>  
>  	kfree(midi_function);
> -- 
> 2.29.2
>
Greg KH Nov. 27, 2020, 1:48 p.m. UTC | #2
On Fri, Nov 27, 2020 at 12:06:50PM +0000, Peter Chen wrote:
> On 20-11-26 19:09:37, Greg Kroah-Hartman wrote:
> > From: Will McVicker <willmcvicker@google.com>
> > 
> > Needed for SuperSpeed Plus support for f_midi.  This allows the
> > gadget to work properly without crashing at SuperSpeed rates.
> > 
> > Cc: Felipe Balbi <balbi@kernel.org>
> > Cc: stable <stable@vger.kernel.org>
> > Signed-off-by: Will McVicker <willmcvicker@google.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/usb/gadget/function/f_midi.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
> > index 85cb15734aa8..ceb67651de4f 100644
> > --- a/drivers/usb/gadget/function/f_midi.c
> > +++ b/drivers/usb/gadget/function/f_midi.c
> > @@ -1048,6 +1048,11 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
> >  		f->ss_descriptors = usb_copy_descriptors(midi_function);
> >  		if (!f->ss_descriptors)
> >  			goto fail_f_midi;
> 
> Add one blank line, otherwise:

Will add it, good idea.

> Reviewed-by: Peter Chen <peter.chen@nxp.com>

Thanks for reviewing all of these, much appreciated.

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 85cb15734aa8..ceb67651de4f 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -1048,6 +1048,11 @@  static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
 		f->ss_descriptors = usb_copy_descriptors(midi_function);
 		if (!f->ss_descriptors)
 			goto fail_f_midi;
+		if (gadget_is_superspeed_plus(c->cdev->gadget)) {
+			f->ssp_descriptors = usb_copy_descriptors(midi_function);
+			if (!f->ssp_descriptors)
+				goto fail_f_midi;
+		}
 	}
 
 	kfree(midi_function);