lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 20 Aug 2011 02:31:34 +0300
From:	Felipe Balbi <balbi@...com>
To:	Michal Nazarewicz <mnazarewicz@...gle.com>
Cc:	Alan Stern <stern@...land.harvard.edu>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Yang Rui Rui <ruirui.r.yang@...to.com>,
	Dave Young <hidave.darkstar@...il.com>,
	Felipe Balbi <balbi@...com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCHv3 3/4] usb: gadget: rename usb_gadget_driver::speed to
 max_speed

On Sat, Aug 20, 2011 at 12:33:01AM +0200, Michal Nazarewicz wrote:
> From: Michal Nazarewicz <mina86@...a86.com>
> 
> This commit renames the “speed”	field of the usb_gadget_driver
> structure to “max_speed”.  This is so that to make it more
> apparent that the field represents the maximum speed gadget
> driver can support.
> 
> This also make the field look more like fields with the same
> name in usb_gadget and usb_composite_driver structures.  All
> of those represent the *maximal* speed given entity supports.
> 
> After this commit, there are the following fields in various
> structures:
> * usb_gadget::speed - the current connection speed,
> * usb_gadget::max_speed - maximal speed UDC supports,

this will be handled inside the UDC itself, so why do you need to expose
it ?

> * usb_gadget_driver::max_speed - maximal speed gadget driver
>   supports, and
> * usb_composite_driver::max_speed - maximal speed composite
>   gadget supports.
> 
> Signed-off-by: Michal Nazarewicz <mina86@...a86.com>
> ---
>  drivers/usb/gadget/amd5536udc.c   |    2 +-
>  drivers/usb/gadget/ci13xxx_udc.c  |    2 +-
>  drivers/usb/gadget/composite.c    |    8 ++++----
>  drivers/usb/gadget/dbgp.c         |    2 +-
>  drivers/usb/gadget/dummy_hcd.c    |   13 ++++++-------
>  drivers/usb/gadget/file_storage.c |    4 ++--
>  drivers/usb/gadget/gmidi.c        |    2 +-
>  drivers/usb/gadget/goku_udc.c     |    2 +-
>  drivers/usb/gadget/inode.c        |    6 +++---
>  drivers/usb/gadget/m66592-udc.c   |    2 +-
>  drivers/usb/gadget/net2272.c      |    2 +-
>  drivers/usb/gadget/net2280.c      |    2 +-
>  drivers/usb/gadget/pch_udc.c      |    2 +-
>  drivers/usb/gadget/printer.c      |    2 +-
>  drivers/usb/gadget/r8a66597-udc.c |    2 +-
>  include/linux/usb/gadget.h        |    4 ++--
>  16 files changed, 28 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
> index 80ae808..7b48ed2 100644
> --- a/drivers/usb/gadget/amd5536udc.c
> +++ b/drivers/usb/gadget/amd5536udc.c
> @@ -1968,7 +1968,7 @@ static int amd5536_start(struct usb_gadget_driver *driver,
>  	u32 tmp;
>  
>  	if (!driver || !bind || !driver->setup
> -			|| driver->speed != USB_SPEED_HIGH)
> +			|| driver->max_speed != USB_SPEED_HIGH)
>  		return -EINVAL;
>  	if (!dev)
>  		return -ENODEV;
> diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
> index b877464..6c13174 100644
> --- a/drivers/usb/gadget/ci13xxx_udc.c
> +++ b/drivers/usb/gadget/ci13xxx_udc.c
> @@ -798,7 +798,7 @@ static ssize_t show_driver(struct device *dev, struct device_attribute *attr,
>  	n += scnprintf(buf + n, PAGE_SIZE - n, "function  = %s\n",
>  		       (driver->function ? driver->function : ""));
>  	n += scnprintf(buf + n, PAGE_SIZE - n, "max speed = %d\n",
> -		       driver->speed);
> +		       driver->max_speed);
>  
>  	return n;
>  }
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 5a3461e..851b5da 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -1560,9 +1560,9 @@ composite_resume(struct usb_gadget *gadget)
>  
>  static struct usb_gadget_driver composite_driver = {
>  #ifdef CONFIG_USB_GADGET_SUPERSPEED
> -	.speed		= USB_SPEED_SUPER,
> +	.max_speed	= USB_SPEED_SUPER,
>  #else
> -	.speed		= USB_SPEED_HIGH,
> +	.max_speed	= USB_SPEED_HIGH,

by doing this based on what the function drivers tell you, you could
drop this ifdeferry.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (491 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ