All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Michal Nazarewicz <mnazarewicz@google.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Yang Rui Rui <ruirui.r.yang@tieto.com>,
	Felipe Balbi <balbi@ti.com>, Greg Kroah-Hartman <gregkh@suse.de>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: gadget: get rid of USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED
Date: Wed, 17 Aug 2011 10:20:15 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1108171016370.2100-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <aeb2d1e4eb36e6a0265ed0e6c279e81880bbfef2.1313585187.git.mina86@mina86.com>

On Wed, 17 Aug 2011, Michal Nazarewicz wrote:

> From: Michal Nazarewicz <mina86@mina86.com>
> 
> This commit removes the use of USB_GADGET_DUALSPEED and
> USB_GADGET_SUPERSPEED Kconfig options.  Those were selected
> by UDC drivers which supported respective speeds.
> 
> However, since kernel now allows multiple UDC drivers to be
> compiled, the options in question may no longer reflect the
> state of all gadgets.
> 
> For instance, if one driver that supports dual speed is selected
> and another that does not, the USB_GADGE_DUALSPEED will be set
> "for both".
> 
> This commit replaces all the #ifdefs by a run-time checks made
> by calling gadget_is_dualspeed().


> @@ -1609,8 +1603,7 @@ int usb_composite_probe(struct usb_composite_driver *driver,
>  		driver->iProduct = driver->name;
>  	composite_driver.function =  (char *) driver->name;
>  	composite_driver.driver.name = driver->name;
> -	composite_driver.speed = min((u8)composite_driver.speed,
> -				     (u8)driver->max_speed);
> +	composite_driver.speed = min(USB_SPEED_SUPER, driver->max_speed);

I wonder if the min is needed here at all.  It doesn't seem to be doing 
any good.


> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c
> @@ -3562,11 +3562,7 @@ static void fsg_resume(struct usb_gadget *gadget)
>  /*-------------------------------------------------------------------------*/
>  
>  static struct usb_gadget_driver		fsg_driver = {
> -#ifdef CONFIG_USB_GADGET_DUALSPEED
>  	.speed		= USB_SPEED_HIGH,
> -#else
> -	.speed		= USB_SPEED_FULL,
> -#endif
>  	.function	= (char *) fsg_string_product,
>  	.unbind		= fsg_unbind,
>  	.disconnect	= fsg_disconnect,

You mustn't remove the .speed field entirely.  Set it to USB_SPEED_HIGH.
The same goes for the other drivers below.


> diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
> index 1b24099..1869478 100644
> --- a/drivers/usb/gadget/inode.c
> +++ b/drivers/usb/gadget/inode.c

> @@ -1015,9 +1013,8 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
>  			if (dev->current_config) {
>  				unsigned power;
>  
> -				if (gadget_is_dualspeed(dev->gadget)
> -						&& (dev->gadget->speed
> -							== USB_SPEED_HIGH))
> +				if (gadget_is_dualspeed(dev->gadget) &&
> +				    (dev->gadget->speed == USB_SPEED_HIGH))
>  					power = dev->hs_config->bMaxPower;
>  				else
>  					power = dev->config->bMaxPower;

Please don't mix functional changes with cosmetic whitespace changes.

Alan Stern


  reply	other threads:[~2011-08-17 14:20 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E4B9D9C.2010607@linutronix.de>
2011-08-17 13:03 ` [PATCH] usb: gadget: get rid of USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED Michal Nazarewicz
2011-08-17 14:20   ` Alan Stern [this message]
2011-08-17 14:27     ` Michal Nazarewicz
2011-08-17 14:47       ` Alan Stern
2011-08-17 15:07         ` Michal Nazarewicz
2011-08-17 16:25           ` Alan Stern
2011-08-17 14:36   ` Sergei Shtylyov
2011-08-17 14:45     ` Michal Nazarewicz
2011-08-17 15:33 ` [PATCHv2] " Michal Nazarewicz
2011-08-17 21:09   ` Alan Stern
2011-08-18 13:19     ` Michal Nazarewicz
2011-08-18 14:59       ` Alan Stern
2011-08-18 17:05         ` Michal Nazarewicz
2011-08-18 17:27           ` Alan Stern
2011-08-18 20:13             ` Michal Nazarewicz
2011-08-18 20:30               ` Alan Stern
2011-08-18 20:44                 ` Michal Nazarewicz
2011-08-19 10:53                 ` Michal Nazarewicz
2011-08-19 11:13                   ` Sebastian Andrzej Siewior
2011-08-19 12:14                     ` Michal Nazarewicz
2011-08-19 14:29                       ` Alan Stern
2011-08-19 14:38                         ` Michal Nazarewicz
2011-08-19 14:57                           ` Alan Stern
2011-08-19  2:02           ` Yang Rui Rui
2011-08-19 12:17             ` Michal Nazarewicz
2011-08-18  3:01   ` Yang Rui Rui
2011-08-18 11:57     ` Michal Nazarewicz
2011-08-18 13:24       ` Dave Young
2011-08-18 13:41         ` Michal Nazarewicz
2011-08-19 22:32   ` [PATCHv3 0/4] Figuring out speed refactorisation Michal Nazarewicz
2011-08-19 22:32     ` [PATCHv3 1/4] usb: Provide usb_device_speed_name() function Michal Nazarewicz
2011-08-19 23:15       ` Felipe Balbi
2011-08-22 14:53         ` Michal Nazarewicz
2011-08-19 22:33     ` [PATCHv3 2/4] usb: gadget: replace "is_dualspeed" with "max_speed" Michal Nazarewicz
2011-08-19 23:28       ` Felipe Balbi
2011-08-23 13:48         ` Michal Nazarewicz
2011-08-23 13:58           ` Felipe Balbi
2011-08-23 14:15             ` Michal Nazarewicz
2011-08-23 14:37               ` Alan Stern
2011-08-23 14:58                 ` Felipe Balbi
2011-08-23 15:07                   ` Michal Nazarewicz
2011-08-23 15:11                     ` Felipe Balbi
2011-08-23 15:26                       ` Michal Nazarewicz
2011-08-23 17:19                         ` Felipe Balbi
2011-08-23 18:44                           ` Michal Nazarewicz
2011-08-23 15:43                   ` Alan Stern
2011-08-23 17:21                     ` Felipe Balbi
2011-08-23 18:00                       ` Alan Stern
2011-08-23 19:05                         ` Michal Nazarewicz
2011-08-23 20:49                           ` Alan Stern
2011-08-24  8:56                             ` Felipe Balbi
2011-08-24 13:10                             ` Michal Nazarewicz
2011-08-24 14:31                               ` Alan Stern
2011-08-24 14:53                                 ` Michal Nazarewicz
2011-08-24 15:15                                   ` Alan Stern
2011-08-24 15:25                                     ` Michal Nazarewicz
2011-08-24 23:04                                       ` Felipe Balbi
2011-08-25 12:46                                         ` Michal Nazarewicz
2011-08-25 12:53                                           ` Felipe Balbi
2011-08-24 22:57                                 ` Felipe Balbi
2011-08-23 15:05               ` Felipe Balbi
2011-08-23 15:30                 ` Michal Nazarewicz
2011-08-19 22:33     ` [PATCHv3 3/4] usb: gadget: rename usb_gadget_driver::speed to max_speed Michal Nazarewicz
2011-08-19 23:31       ` Felipe Balbi
2011-08-20  2:34         ` Alan Stern
2011-08-22 10:42           ` Felipe Balbi
2011-08-19 22:33     ` [PATCHv3 4/4] usb: gadget: get rid of USB_GADGET_{DUAL,SUPER}SPEED Michal Nazarewicz
2011-08-20 13:41       ` Alan Stern
2011-08-22 14:51         ` Michal Nazarewicz
2011-08-22 15:03           ` Alan Stern

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=Pine.LNX.4.44L0.1108171016370.2100-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mnazarewicz@google.com \
    --cc=ruirui.r.yang@tieto.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.