linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>,
	Greg KH <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH]  usb: gadget: USB3 support to the legacy printer driver
Date: Mon, 17 Nov 2014 18:30:28 -0600	[thread overview]
Message-ID: <20141118003028.GA11280@saruman> (raw)
In-Reply-To: <546A829A.8030106@linaro.org>

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

Hi,

On Mon, Nov 17, 2014 at 06:19:54PM -0500, Jorge Ramirez-Ortiz wrote:
> Hi,
> 
> This patch adds USB3 support to the legacy gadget printer driver.
> Applies cleanly on fc14f9c Linux 3.18-rc5.
> 
> Please could it be considered for inclusion?

sure, if you send it properly (see Documentation/SubmittingPatches),
provide logs of your tests with a recent kernel (v3.18-rc5 would be just
awesome) and Cc myself on your resubmission.

> diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
> index 6474081..625d905 100644
> --- a/drivers/usb/gadget/legacy/printer.c
> +++ b/drivers/usb/gadget/legacy/printer.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) 2003-2005 David Brownell
>   * Copyright (C) 2006 Craig W. Nadler
> + * Copyright (C) 2014 Linaro.org

I don't think the minimal change below constitutes enough to merit the
copyright. If your lawyers tell you otherwise, let me know.

Greg, what's Linux Foundation's lawyers take on this ?

> @@ -208,6 +209,43 @@ static struct usb_descriptor_header *hs_printer_function[] = {
>         NULL
>  };
>  
> +/*
> + * Added endpoint descriptors for 3.0 devices
> + */
> +
> +static struct usb_endpoint_descriptor ss_ep_in_desc = {
> +       .bLength =              USB_DT_ENDPOINT_SIZE,
> +       .bDescriptorType =      USB_DT_ENDPOINT,
> +       .bmAttributes =         USB_ENDPOINT_XFER_BULK,
> +       .wMaxPacketSize =       cpu_to_le16(1024),
> +};
> +
> +struct usb_ss_ep_comp_descriptor ss_ep_in_comp_desc = {
> +       .bLength =              sizeof(ss_ep_in_comp_desc),
> +       .bDescriptorType =      USB_DT_SS_ENDPOINT_COMP,
> +};
> +
> +static struct usb_endpoint_descriptor ss_ep_out_desc = {
> +       .bLength =              USB_DT_ENDPOINT_SIZE,
> +       .bDescriptorType =      USB_DT_ENDPOINT,
> +       .bmAttributes =         USB_ENDPOINT_XFER_BULK,
> +       .wMaxPacketSize =       cpu_to_le16(1024),
> +};
> +
> +struct usb_ss_ep_comp_descriptor ss_ep_out_comp_desc = {
> +       .bLength =              sizeof(ss_ep_out_comp_desc),
> +       .bDescriptorType =      USB_DT_SS_ENDPOINT_COMP,
> +};
> +
> +static struct usb_descriptor_header *ss_printer_function[] = {
> +       (struct usb_descriptor_header *) &intf_desc,
> +       (struct usb_descriptor_header *) &ss_ep_in_desc,
> +       (struct usb_descriptor_header *) &ss_ep_in_comp_desc,
> +       (struct usb_descriptor_header *) &ss_ep_out_desc,
> +       (struct usb_descriptor_header *) &ss_ep_out_comp_desc,
> +       NULL
> +};
> +
>  static struct usb_otg_descriptor otg_descriptor = {
>         .bLength =              sizeof otg_descriptor,
>         .bDescriptorType =      USB_DT_OTG,
> @@ -220,7 +258,20 @@ static const struct usb_descriptor_header *otg_desc[] = {
>  };
>  
>  /* maxpacket and other transfer characteristics vary by speed. */
> -#define ep_desc(g, hs, fs) (((g)->speed == USB_SPEED_HIGH)?(hs):(fs))
> +static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget,
> +                                       struct usb_endpoint_descriptor *fs,
> +                                       struct usb_endpoint_descriptor *hs,
> +                                       struct usb_endpoint_descriptor *ss)
> +{
> +       struct usb_endpoint_descriptor *d = fs;
> +
> +       if (gadget->speed == USB_SPEED_SUPER)
> +               d = ss;
> +       else if (gadget->speed == USB_SPEED_HIGH)
> +               d = hs;

what happened to good old switch ?

> +       return d;
> +}
>  
>  /*-------------------------------------------------------------------------*/
>  
> @@ -793,11 +844,12 @@ set_printer_interface(struct printer_dev *dev)
>  {
>         int                     result = 0;
>  
> -       dev->in_ep->desc = ep_desc(dev->gadget, &hs_ep_in_desc, &fs_ep_in_desc);
> +       dev->in_ep->desc = ep_desc(dev->gadget, &fs_ep_in_desc, &hs_ep_in_desc,
> +                                                               &ss_ep_in_desc);

Fix your indentation.

>         dev->in_ep->driver_data = dev;
>  
> -       dev->out_ep->desc = ep_desc(dev->gadget, &hs_ep_out_desc,
> -                                   &fs_ep_out_desc);
> +       dev->out_ep->desc = ep_desc(dev->gadget, &fs_ep_out_desc,
> +                                       &hs_ep_out_desc, &ss_ep_out_desc);
>         dev->out_ep->driver_data = dev;
>  
>         result = usb_ep_enable(dev->in_ep);
> @@ -1016,9 +1068,11 @@ autoconf_fail:
>         /* assumes that all endpoints are dual-speed */
>         hs_ep_in_desc.bEndpointAddress = fs_ep_in_desc.bEndpointAddress;
>         hs_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress;
> +       ss_ep_in_desc.bEndpointAddress = fs_ep_in_desc.bEndpointAddress;
> +       ss_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress;
>  
>         ret = usb_assign_descriptors(f, fs_printer_function,
> -                       hs_printer_function, NULL);
> +                                    hs_printer_function, ss_printer_function);

why do you change indentation when adding just one extra argument ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-11-18  0:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17 23:19 [PATCH] usb: gadget: USB3 support to the legacy printer driver Jorge Ramirez-Ortiz
2014-11-18  0:30 ` Felipe Balbi [this message]
2014-11-18  0:54   ` Greg KH
2014-11-18  1:14     ` Jorge Ramirez-Ortiz
2014-11-18 14:19   ` Jorge Ramirez-Ortiz
2014-11-18 15:17     ` Felipe Balbi
2014-11-18 17:52       ` Jorge Ramirez-Ortiz
2014-11-18 18:00         ` Felipe Balbi
2014-11-18 20:41           ` Jorge Ramirez-Ortiz
2014-11-18 20:47             ` Felipe Balbi
2014-11-18 21:33               ` Jorge Ramirez-Ortiz
2014-11-19  3:14                 ` Felipe Balbi
2014-11-18 21:45               ` Paul Zimmerman
2014-11-19  3:10                 ` Felipe Balbi

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=20141118003028.GA11280@saruman \
    --to=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jorge.ramirez-ortiz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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).