lkml.org 
[lkml]   [2017]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 03/10 v3] usb: usb251xb: Add USB251x specific port count setting
From
Date
On 10/22/2017 10:38 PM, Serge Semin wrote:
> USB251xb as well as USB2517 datasheet states, that all these
> hubs differ by number of ports declared as the last digit in the
> model name. So USB2512 got two ports, USB2513 - three, and so on.
> Such setting must be reflected in the device specific data
> structure and corresponding dts property should be checked whether
> it doesn't get out of available ports.
>
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> ---
> drivers/usb/misc/usb251xb.c | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)

...
> @@ -422,8 +431,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> for (i = 0; i < len / sizeof(u32); i++) {
> u32 port = be32_to_cpu(cproperty_u32[i]);
>
> - if ((port >= 1) && (port <= 4))
> + if ((port >= 1) && (port <= data->port_cnt))
> hub->non_rem_dev |= BIT(port);
> + else
> + dev_warn(dev, "NRD port %u doesn't exist\n",
> + port);

Please match the alignment of the second line with the open parenthesis.

> }
> }
>
> @@ -433,8 +445,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> for (i = 0; i < len / sizeof(u32); i++) {
> u32 port = be32_to_cpu(cproperty_u32[i]);
>
> - if ((port >= 1) && (port <= 4))
> + if ((port >= 1) && (port <= data->port_cnt))
> hub->port_disable_sp |= BIT(port);
> + else
> + dev_warn(dev, "PDS port %u doesn't exist\n",
> + port);

... same here ...

> }
> }
>
> @@ -444,8 +459,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> for (i = 0; i < len / sizeof(u32); i++) {
> u32 port = be32_to_cpu(cproperty_u32[i]);
>
> - if ((port >= 1) && (port <= 4))
> + if ((port >= 1) && (port <= data->port_cnt))
> hub->port_disable_bp |= BIT(port);
> + else
> + dev_warn(dev, "PDB port %u doesn't exist\n",
> + port);

... and here.

> }
> }

Otherwise feel free to add:

Acked-by: Richard Leitner <richard.leitner@skidata.com>

regards,
Richard.L

\
 
 \ /
  Last update: 2017-10-23 23:47    [W:0.093 / U:0.920 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site