linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajaram R <rajaram.officemail@gmail.com>
To: Tatyana Brokhman <tlinder@codeaurora.org>
Cc: gregkh@suse.de, linux-usb@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	David Brownell <dbrownell@users.sourceforge.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/4] usb gadget: Configure endpoint according to gadget speed.
Date: Thu, 12 Jul 2012 16:53:20 +0530	[thread overview]
Message-ID: <CAOiXhaKXfVVr8Q6UREp3zZYqpwmJxU1vEyJ_ETH0Uo0FNxm51g@mail.gmail.com> (raw)
In-Reply-To: <1290084457-26422-1-git-send-email-tlinder@codeaurora.org>

Hi


On Thu, Nov 18, 2010 at 6:17 PM, Tatyana Brokhman
<tlinder@codeaurora.org> wrote:
>
> Add config_ep_by_speed() to configure the endpoint according to the gadget
> speed. Using this function will spare the FDs from handling the endpoint
> chosen descriptor.
>
> Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
> ---
>  drivers/usb/gadget/composite.c  |   76 +++++++++++++++++++++++++++++++++++++++
>  drivers/usb/gadget/epautoconf.c |    1 +
>  include/linux/usb/composite.h   |   21 +++++++++++
>  include/linux/usb/gadget.h      |    3 ++
>  4 files changed, 101 insertions(+), 0 deletions(-)
>
---cut---

> + */
> +int config_ep_by_speed(struct usb_gadget *g,
> +                       struct usb_function *f,
> +                       struct usb_ep *_ep)
> +{
> +       struct usb_endpoint_descriptor *chosen_desc = NULL;
> +       struct usb_descriptor_header **speed_desc = NULL;
> +
> +       struct usb_descriptor_header **d_spd; /* cursor for speed desc */
> +
> +       if (!g || !f || !_ep)
> +               return -EIO;
> +
> +       /* select desired speed */
> +       switch (g->speed) {
> +       case USB_SPEED_HIGH:
> +               if (gadget_is_dualspeed(g)) {
> +                       speed_desc = f->hs_descriptors;
> +                       break;
> +               }
> +               /* else: fall through */
> +       default:
> +               speed_desc = f->descriptors;
> +       }
> +       /* find descriptors */
> +       for (d_spd = next_ep_desc(speed_desc); d_spd;
> +             d_spd = next_ep_desc(d_spd+1)) {
> +               chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;
> +               if (chosen_desc->bEndpointAddress == _ep->bEndpointAddress)
> +                       goto ep_found;
> +       }
> +       return -EIO;
> +
> +ep_found:
> +       /* commit results */
> +       _ep->maxpacket = le16_to_cpu(chosen_desc->wMaxPacketSize);
> +       _ep->desc = chosen_desc;

Could you please comment on why do we need to update gadget's ep list
with function's maxpacket ? Will this not affect when we switch
functions ?

> +
> +       return 0;
> +}

      reply	other threads:[~2012-07-12 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 12:47 [PATCH v4 2/4] usb gadget: Configure endpoint according to gadget speed Tatyana Brokhman
2012-07-12 11:23 ` Rajaram R [this message]

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=CAOiXhaKXfVVr8Q6UREp3zZYqpwmJxU1vEyJ_ETH0Uo0FNxm51g@mail.gmail.com \
    --to=rajaram.officemail@gmail.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tlinder@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).