Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932476AbbKRDlG (ORCPT ); Tue, 17 Nov 2015 22:41:06 -0500 Received: from mail-by2on0125.outbound.protection.outlook.com ([207.46.100.125]:36730 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932117AbbKRDlD (ORCPT ); Tue, 17 Nov 2015 22:41:03 -0500 Authentication-Results: spf=permerror (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=freescale.com; Date: Wed, 18 Nov 2015 11:38:17 +0800 From: Peter Chen To: Saurabh Sengar CC: , , , Subject: Re: [PATCH v3] usb: chipidea: removing of_find_property Message-ID: <20151118033816.GB4228@shlinux2> References: <1447761146-4599-1-git-send-email-saurabh.truth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1447761146-4599-1-git-send-email-saurabh.truth@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD014;1:65iOSyUKgitak5DL2pcH372ABIDbXIGc+UdysSjZtu0EViFu58jd0DfDpm/ylFj69w0lUBvtykPb09kiJcR7Q6TkIlhvRyzCY+C5/GVpMAGGDTaR+T6hajDxayATvAID742GJKhs2k+YY1JSiW2Wf9QzmJZ72G+dzps4Nj9GZgQOYdFe0fr/1qwO7t7iIz0He1b+hhx0BuFR+R6gD7ivn3KAsiP5EEUdZaKAeii1RZ7qhoxhvwg5+QAB3qZZJS6edcnD80JOmGM857rEuuWbPP31gS9NhIV6KMkrBCrcJZW7QkoPaDXVAIeKuPakVzlPya/29rSBz0f0F+B0jaHSGMg/c5SBs+Huh9XI/N0R4dp4mnRfpY0QpfFballqOBP/BimQTNN05v5eguIyfq/iI0beoLEczXnMaeySu8HoXG8= X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1060300003)(448002)(24454002)(199003)(189002)(97756001)(97736004)(4290100001)(4001350100001)(81156007)(19580395003)(19580405001)(104016004)(106466001)(33716001)(46406003)(87936001)(47776003)(23726002)(33656002)(86362001)(50466002)(5008740100001)(575784001)(83506001)(85326001)(5001960100002)(606003)(92566002)(5007970100001)(6806005)(110136002)(2950100001)(54356999)(76176999)(50986999)(77096005)(110436001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR03MB557;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DM2PR03MB557;2:2UPA4rz/e9Ojqydj3Y2O+lCkqst1jCKP5cMpOPDKX9+4fJkWx7lRufSDiLMgc3ydRKtaPN9EIPY2CStHrc5zbtoGZr9RHsmSF7mZ6EiUm2y98D/a67+UjipsovaWvCL4PoA1FSFJw9MJKGbQ8XSebyUIoxisqL2VXgD5gAez1qs=;3:aYnjYjOnPYlG0cQFVeKNSbI45ALmkIAiJpFEPv84vSLWYn/7AiXh15uNqOm2Ph28WYKjUuunHKJGDQCH5ZFUxm8iAsiG1bJ+O7MVNmUEej3TgmKLalCscOV4DJ0nsJEXQ+r8y9ryHanWQ9N+1hBroEMebKuOuLLu6pNpov0YdM1d8Z480rGqFp0rsWPOH+b5FpbLNhBS/Fe1OS6HU9XilQvgM5UMxi84W+JUcZfVYYQ=;25:/StqPCxdkrsza/dZ4Y6rUk9EjPx81zYZ6xngChfMO959jP2O7+ShrhLURcZy6iJHjQ6NArqMAtDqo1ChsPbFg77VWlwb+GSPE8eW8C2oX2gyIOJgRjOAA4Jgx3KnHnSPDKrJYCIyni2bsWDjUTqMNfgjJtIpp5lj1uNWIYgxwtiO251ZbGSNT19Jtlctby+I/kTKzMf36XFHjDiqSaiX6js3KZnJn+Wm2MVJEvqt4Wj8f2FfZtD6eac91IOmWHVXhI2D09zubmBHOaHHPVrWTw== X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:DM2PR03MB557; X-Microsoft-Exchange-Diagnostics: 1;DM2PR03MB557;20:3idy6GwRkqPVuYAPUGwGgnML8FyN7NmTOQT8SmmuXn9juJ7aORYFWwgtOnhl9skx6YGSC3ylUrROT6NNGFqoHTu5FIyzkWPvXbCNx50u/kjqdF2pBqDJ1gJ0nwgLCdqrwvTmdlspimSyLUtqPeNEmPsEz26a+tELvWj6izGzmjSZ3T0amusGNemVNiMy0i01giLsV+odLU1cWXw2UyVq1YMyaUjICRjvKOkMFDVUZYoYK6FpIYgTIQ6miCffLDYYnQf069LssuvLRUgs2V+++KwNR4uh4cNS8gjfDd6vd7dAGPnvU8d9iUBn9VTSZcOnj2SWb/bwjoPIUycsX5OAVJChDyo52DLppJNLf58Su2w=;4:r/Iqx3ZK8e+M1mfH/j1TSPZ0BVV5i5mWnRnMlDB8YoU1Ws8jVKa29a8UAj+IuNnBKWjuHf/3pYshL7TK9Z+9mmjnFDV69/sOJxc7p2u4vctcqC0Mu2h0NQ43UGB6wC+9j4HrtClSN9etBVXDH+Pb4drZowkTd4CuhMivxZlVykcYyyB/eo1v+zT8Ux3QdbYdl8jRDr+OAJy6QasqWyULycC8SgCgbGVJDkS2X9/F2k52duxB9+w2u1pmC4/CSeg6HMFONREg8Satguv/MkSdb+q8I4LpKXOBkAMZhaNFTwJ+PbHr5Tcw4hY34VmDF9Dsqmn8p2jRWID9rHsgTgNVEqiRFt+bQFly2tcTWHg/RiB5QPi3ul+1Y7K3f1zCfu54 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001);SRVR:DM2PR03MB557;BCL:1;PCL:0;RULEID:;SRVR:DM2PR03MB557; X-Forefront-PRV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?kA3MdLLUz6reTDH1Pu2h4sSuNzXXO5lUN+I63BK3S74AHDIgbmSEUb9K0pAG?= =?us-ascii?Q?CZPg2c1EHOkWc2AydhaLjEeN20S8ThVT3REiIq0LFc9FUBNUVoQsYwYbc/LP?= =?us-ascii?Q?OP7DgyOu7KNJUh/49gq7ZKxIirH23Z7RCOwy+OnT1jc4UWXq/O82dtZ2k2Yt?= =?us-ascii?Q?qqvMuYehmo5STaC5D26qK1FMHKIq3b0wIDvD2lf3VyQqYYJk3nWc9QwtsFys?= =?us-ascii?Q?i7amQ6qQB5FyJr1/f0HKjB8DKi?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR03MB557;5:XBe78K1+Z10TZTeo4zF3jS1UyHYJPT9CMtV0FvprkIFP6V6zSi6v+8yR/AonpNaVHqztY4uG3q+8rqDJx8COCGdkc5PLBsrz1hSOgG8T+aJn0GlAt15Re0bsJsEfy0dpNbjFtDshaJZFmZ7lXs4Y8A==;24:SAH9HELp4FcWvHr1rRQVhX5WwMRFh88aZt7LQQcl1uHVH14EUBXAEHjWwzQHJ750NNge4ec1Pwf88B3Zeb/3uhuwtfJ4QvfMnpYICQoCATA=;20:Amuv8kc1KmrozNjYcuAPvu7ApCMYE6DmOKveZPatdWiJN41UTP9uQFAb2I6g6CiJPxZeVeyMxLzfj6nir1GyTA== SpamDiagnosticOutput: 1:5 SpamDiagnosticMetadata: 00000000%2D0000%2D0000%2D0000%2D000000000000 SpamDiagnosticMetadata: 1 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2015 03:40:58.9564 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB557 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3793 Lines: 115 On Tue, Nov 17, 2015 at 05:22:26PM +0530, Saurabh Sengar wrote: > call to of_find_property() before of_property_read_u32() is unnecessary. > of_property_read_u32() anyway calls to of_find_property() only. > > Signed-off-by: Saurabh Sengar > --- > v2 : removed pval variable > v3 : removed unnecessary if condition > drivers/usb/chipidea/core.c | 59 +++++++++++++++++++-------------------------- > 1 file changed, 25 insertions(+), 34 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 965d0e2..960a925 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev, > if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) > platdata->flags |= CI_HDRC_FORCE_FULLSPEED; > > - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) > - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", > + of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", > &platdata->phy_clkgate_delay_us); > > platdata->itc_setting = 1; > - if (of_find_property(dev->of_node, "itc-setting", NULL)) { > - ret = of_property_read_u32(dev->of_node, "itc-setting", > - &platdata->itc_setting); > - if (ret) { > - dev_err(dev, > - "failed to get itc-setting\n"); > - return ret; > - } > + > + ret = of_property_read_u32(dev->of_node, "itc-setting", > + &platdata->itc_setting); > + if (ret && ret != -EINVAL) { > + dev_err(dev, "failed to get itc-setting\n"); > + return ret; > } For this one, you may not need to check return value, since platdata->itc_setting is optional, and doesn't need to set any flags if platdata->itc_setting is valid. Other changes are ok for me. Peter > > - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { > - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", > - &platdata->ahb_burst_config); > - if (ret) { > - dev_err(dev, > - "failed to get ahb-burst-config\n"); > - return ret; > - } > + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", > + &platdata->ahb_burst_config); > + if (!ret) { > platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; > + } else if (ret != -EINVAL) { > + dev_err(dev, "failed to get ahb-burst-config\n"); > + return ret; > } > > - if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { > - ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", > - &platdata->tx_burst_size); > - if (ret) { > - dev_err(dev, > - "failed to get tx-burst-size-dword\n"); > - return ret; > - } > + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", > + &platdata->tx_burst_size); > + if (!ret) { > platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; > + } else if (ret != -EINVAL) { > + dev_err(dev, "failed to get tx-burst-size-dword\n"); > + return ret; > } > > - if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { > - ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", > - &platdata->rx_burst_size); > - if (ret) { > - dev_err(dev, > - "failed to get rx-burst-size-dword\n"); > - return ret; > - } > + ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", > + &platdata->rx_burst_size); > + if (!ret) { > platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; > + } else if (ret != -EINVAL) { > + dev_err(dev, "failed to get rx-burst-size-dword\n"); > + return ret; > } > > ext_id = ERR_PTR(-ENODEV); > -- > 1.9.1 > -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/