All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/12] USB: ohci-at91: change maximum number of ports
Date: Mon, 02 Apr 2012 12:21:17 +0200	[thread overview]
Message-ID: <4F797D9D.5030600@atmel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1203291100400.1417-100000@iolanthe.rowland.org>

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@atmel.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.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

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
	plagnioj@jcrosoft.com, ludovic.desroches@atmel.com,
	linux-kernel@vger.kernel.org, arnd@arndb.de, olof@lixom.net
Subject: Re: [PATCH 06/12] USB: ohci-at91: change maximum number of ports
Date: Mon, 02 Apr 2012 12:21:17 +0200	[thread overview]
Message-ID: <4F797D9D.5030600@atmel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1203291100400.1417-100000@iolanthe.rowland.org>

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@atmel.com>
>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.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

  reply	other threads:[~2012-04-02 10:21 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29 13:27 [PATCH 00/12] at91: 3.4-rc1 fixes Nicolas Ferre
2012-03-29 13:27 ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 01/12] ARM: at91/at91sam9x5: add clkdev entries for DMA controllers Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 02/12] USB: ohci-at91: fix vbus_pin_active_low handling Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 03/12] ARM: at91/USB host: specify and handle properly vbus_pin_active_low Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-31 21:51   ` Sergei Shtylyov
2012-03-31 21:51     ` Sergei Shtylyov
2012-04-02 10:19     ` Nicolas Ferre
2012-04-02 10:19       ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 04/12] ARM: at91/dts: USB host vbus is active low Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 05/12] USB: ohci-at91: rework and fix initialization Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 06/12] USB: ohci-at91: change maximum number of ports Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 15:04   ` Alan Stern
2012-03-29 15:04     ` Alan Stern
2012-04-02 10:21     ` Nicolas Ferre [this message]
2012-04-02 10:21       ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 07/12] USB: ohci-at91: coding style modifications with one-line ifs Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 08/12] USB: ohci-at91: trivial return code name change Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 09/12] ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 10/12] ARM: at91/NAND DT bindings: add comments Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 11/12] USB: ehci-atmel: add needed of.h header file Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-29 13:27 ` [PATCH 12/12] ARM: at91: fix check of valid GPIO for SPI and USB Nicolas Ferre
2012-03-29 13:27   ` Nicolas Ferre
2012-03-30 12:31 ` [PATCH] ARM: at91: include newly created system_misc.h file Nicolas Ferre
2012-03-30 12:31   ` Nicolas Ferre
2012-03-31 21:38   ` Sergei Shtylyov
2012-03-31 21:38     ` Sergei Shtylyov

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=4F797D9D.5030600@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.