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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 02 Apr 2012 12:21:17 +0200
From:	Nicolas Ferre <nicolas.ferre@...el.com>
To:	Alan Stern <stern@...land.harvard.edu>
CC:	linux-arm-kernel@...ts.infradead.org, linux-usb@...r.kernel.org,
	plagnioj@...osoft.com, ludovic.desroches@...el.com,
	linux-kernel@...r.kernel.org, arnd@...db.de, olof@...om.net
Subject: Re: [PATCH 06/12] USB: ohci-at91: change maximum number of ports

On 03/29/2012 05:04 PM, Alan Stern :
> On Thu, 29 Mar 2012, Nicolas Ferre wrote:
> 
>> Change number of ports to 3 for newer SoCs. Modify pdata structure
>> and ohci-at91 code that was dealing with ports information and check
>> of port indexes.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@...el.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>
>> ---
>>  arch/arm/mach-at91/include/mach/board.h |   13 +++++++------
>>  drivers/usb/host/ohci-at91.c            |   22 +++++++++++++---------
>>  2 files changed, 20 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
>> index 544a5d5..49a8211 100644
>> --- a/arch/arm/mach-at91/include/mach/board.h
>> +++ b/arch/arm/mach-at91/include/mach/board.h
>> @@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
>>  extern void __init at91_add_device_eth(struct macb_platform_data *data);
>>  
>>   /* USB Host */
>> +#define AT91_MAX_USBH_PORTS	3
>>  struct at91_usbh_data {
>> -	u8		ports;		/* number of ports on root hub */
>> -	int		vbus_pin[2];	/* port power-control pin */
>> -	u8              vbus_pin_active_low[2];
>> +	int		vbus_pin[AT91_MAX_USBH_PORTS];	/* port power-control pin */
>> +	int             overcurrent_pin[AT91_MAX_USBH_PORTS];
>> +	u8		ports;				/* number of ports on root hub */
>>  	u8              overcurrent_supported;
>> -	int             overcurrent_pin[2];
>> -	u8              overcurrent_status[2];
>> -	u8              overcurrent_changed[2];
>> +	u8              vbus_pin_active_low[AT91_MAX_USBH_PORTS];
>> +	u8              overcurrent_status[AT91_MAX_USBH_PORTS];
>> +	u8              overcurrent_changed[AT91_MAX_USBH_PORTS];
>>  };
>>  extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
>>  extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
>> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
>> index 1262532..cf9707d 100644
>> --- a/drivers/usb/host/ohci-at91.c
>> +++ b/drivers/usb/host/ohci-at91.c
>> @@ -240,7 +240,7 @@ ohci_at91_start (struct usb_hcd *hcd)
>>  
>>  static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
>>  {
>> -	if (port < 0 || port >= 2)
>> +	if (port < 0 || port >= ARRAY_SIZE(pdata->vbus_pin))
> 
> Here and below, it will be a lot clearer to write AT91_MAX_USBH_PORTS 
> instead of ARRAY_SIZE(padata->...).
> 
>> @@ -301,7 +301,11 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>>  	case SetPortFeature:
>>  		if (wValue == USB_PORT_FEAT_POWER) {
>>  			dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
>> -			ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
>> +			if (wIndex && wIndex <= ARRAY_SIZE(pdata->vbus_pin)) {
>> +				ohci_at91_usb_set_power(pdata, wIndex - 1, 1);
> 
> Here and throughout the hub_control routine, things will be a lot 
> simpler if you decrement wIndex at the start of the SetPortFeature 
> case.  Same for ClearPortFeature and maybe also GetPortStatus.

Ok, I will modify it according to your sugestions in a v2 patch series.

Best regards,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ