From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751760AbdJWVqK (ORCPT ); Mon, 23 Oct 2017 17:46:10 -0400 Received: from mail2.skidata.com ([91.230.2.91]:11453 "EHLO mail2.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751623AbdJWVqJ (ORCPT ); Mon, 23 Oct 2017 17:46:09 -0400 X-Greylist: delayed 603 seconds by postgrey-1.27 at vger.kernel.org; Mon, 23 Oct 2017 17:46:08 EDT X-IronPort-AV: E=Sophos;i="5.43,424,1503352800"; d="scan'208";a="1059652" Subject: Re: [PATCH 03/10 v3] usb: usb251xb: Add USB251x specific port count setting To: Serge Semin , , , CC: , , , References: <20170916104220.3742-1-fancer.lancer@gmail.com> <20171022203812.9379-1-fancer.lancer@gmail.com> <20171022203812.9379-4-fancer.lancer@gmail.com> From: Richard Leitner Message-ID: Date: Mon, 23 Oct 2017 23:36:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171022203812.9379-4-fancer.lancer@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: de-AT Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.24.97] X-ClientProxiedBy: sdex1srv.skidata.net (172.16.10.92) To sdex2srv.skidata.net (172.16.10.93) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 regards, Richard.L