From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751667AbbCTVkp (ORCPT ); Fri, 20 Mar 2015 17:40:45 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:33654 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196AbbCTVkl (ORCPT ); Fri, 20 Mar 2015 17:40:41 -0400 Date: Fri, 20 Mar 2015 14:40:37 -0700 From: Dmitry Torokhov To: Arun Ramamurthy Cc: Kishon Vijay Abraham I , Tony Prisk , Alan Stern , Greg Kroah-Hartman , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Anatol Pomazau , Jonathan Richardson , Scott Branden , Ray Jui , bcm-kernel-feedback-list@broadcom.com Subject: Re: [PATCH 2/3] usb: ehci-platform: Use devm_of_phy_get_by_index Message-ID: <20150320214037.GC25405@dtor-ws> References: <1426885630-32429-1-git-send-email-arun.ramamurthy@broadcom.com> <1426885630-32429-3-git-send-email-arun.ramamurthy@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426885630-32429-3-git-send-email-arun.ramamurthy@broadcom.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arun, On Fri, Mar 20, 2015 at 02:07:09PM -0700, Arun Ramamurthy wrote: > Getting phys by index instead of phy names so that the dt > bindings phy-names remain consistent when multiple phys are present > > Reviewed-by: Ray Jui > Reviewed-by: Scott Branden > Signed-off-by: Arun Ramamurthy > --- > drivers/usb/host/ehci-platform.c | 20 ++++---------------- > 1 file changed, 4 insertions(+), 16 deletions(-) > > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index d8a75a5..8b0c7ae 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -154,7 +154,6 @@ static int ehci_platform_probe(struct platform_device *dev) > struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); > struct ehci_platform_priv *priv; > struct ehci_hcd *ehci; > - const char *phy_name; > int err, irq, phy_num, clk = 0; > > if (usb_disabled()) > @@ -212,21 +211,10 @@ static int ehci_platform_probe(struct platform_device *dev) > return -ENOMEM; > > for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { > - err = of_property_read_string_index( > - dev->dev.of_node, > - "phy-names", phy_num, > - &phy_name); > - > - if (err < 0) { > - if (priv->num_phys > 1) { > - dev_err(&dev->dev, "phy-names not provided"); > - goto err_put_hcd; > - } else > - phy_name = "usb"; > - } > - > - priv->phys[phy_num] = devm_phy_get(&dev->dev, > - phy_name); > + priv->phys[phy_num] = > + devm_of_phy_get_by_index(&dev->dev, > + dev->dev.of_node, > + phy_num); > if (IS_ERR(priv->phys[phy_num])) { > err = PTR_ERR(priv->phys[phy_num]); > if ((priv->num_phys > 1) || While you are fixing this can you please correct the wrong indentation level and clean up that whole weird business of treating "phy" not present in DT in a special way and, stuffing NULL pointer in priv->phys, and checking it for NULL elsewhere? Thanks! -- Dmitry