Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753146AbbKRGIK (ORCPT ); Wed, 18 Nov 2015 01:08:10 -0500 Received: from mail-bn1bon0117.outbound.protection.outlook.com ([157.56.111.117]:19909 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752360AbbKRGIH (ORCPT ); Wed, 18 Nov 2015 01:08:07 -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 14:05:20 +0800 From: Peter Chen To: Saurabh Sengar CC: , , , Subject: Re: [PATCH v4] usb: chipidea: removing of_find_property Message-ID: <20151118060519.GD4228@shlinux2> References: <1447819812-4543-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: <1447819812-4543-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;BN1AFFO11FD036;1:Hp4+rNMUkYpzE/HlmY5AsRTXm3uR1SZtQWEuCEfjBUItxZzthxRMy/4i8BFzYPI860fdPMijkXRa2je3DFOEhi8Ep7e/2XgPMlOYjunFEYqxwTQUxIVLhHEmtGAo2G0FTZyq24KVL0VPP/5oO4KdxPgl3FaLM1DnXVjh2SltP2k5qMTjiFc8LLbYZe8P88lMIQ1igci3zzLAbGn4E/umYiAwdY/kNjv21JMgC76QeB+vxD2MfaHOZAJIkMFEzvCeT0NPSbJWX/kFce7W+3idAqrKH0AHxS7SzLZK16gT48FQtbRN/yz2Z2yoyQuywZo5CcTEaia+yGlPPq16UNm+N7sjy2tgokMhyDFgzP8P+h392d3okHaRiAwBQKQAl3GXZSvy4+H5WN5A1eGIpmf7WdR3Yk8M6rWTIItJwYTrHAE= X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1060300003)(448002)(189002)(24454002)(199003)(85326001)(606003)(47776003)(77096005)(6806005)(83506001)(87936001)(104016004)(46406003)(23726002)(86362001)(575784001)(97756001)(5007970100001)(2950100001)(4290100001)(81156007)(11100500001)(33716001)(92566002)(76176999)(110436001)(33656002)(5008740100001)(19580405001)(4001350100001)(54356999)(106466001)(50986999)(110136002)(97736004)(5001960100002)(19580395003)(50466002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0301MB1226;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1226;2:8C6yqC9l7tmH+KBw6LGt+sccvd7H/IhdmBSagC5bBKi2EV7lv/1MPd1uIhO/0YtSL/89RtPbxNgeS8BcFHYooO5YICMjcBVGnCgnUkJFbMxa84FHps2gWXlST+AbMgS8ib4obRrW9egSGTE7O22+Ng==;3:jqXxvyHuLxhoSfw//234le8RB77FbslSFeIcidlthlNvwhPOO4MXm6cGQ00Fkbbu3T4RF+iJXlyqJyXzxu3qjOrsIX6TlFD8IGHJym8O22o2PBJEqwCzs9dLVpNe57ybwOEhHJ8UHF4yFZR5m9Bmk37xI/xuSf1vx4p0nUyiDTlTtu98KIPEjXoIFSDuiZhpwJV2nTOqFNCn4xn//fbohV+5XHWhTRdRdJvQw7gqs4Y=;25:QD3jm3Vv9HEYdYsEOwF6dE7n5u0UqjDHhN6ka9Dzd6/NKJ2RfKaqHZFQCAl4Iv3hFzEbKsxCisAmdaACRRfg/KedBbyBU8u8JlHmy2KIgo/Cr25PAlhNOva8J0Ou/x3Y6l6+2wvkonA16veWYV/yn2eEuV30srWFwcyDPxIcy+pD3D05ngAPseAAWg8R9fJ+/gQsVlPF14kH5MZSbdLHpZVxe6tMqK+05Af2B+Pqip/T4gdC/aJl51rEX3V1hYoDT3lmC1ssFuHPh5w/fXcJdA== X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:CY1PR0301MB1226; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1226;20:fP6afI4kTvc1wfublGzedQondl6Nt2oucSSoc1d4QktPwXYHwcna+1sQLE9NrYqFcNgfCVHWslmQSEuAUYWqyZUE29ZQ2nUblHvworA+66ToVbplXt0NhUb3WDlnRz/Q1J+nskZrNQUpxNUAjGAdRnLaT9AsnODBMvyP5Dy3Qwmt13brTJVORsNo8j4pub9eXp7S546SmrpjTWCL8ZMPe9z5DQeJ2aO5y3+GBXN/AgaoWwAMktc0Z74P5PQB3QuRH8J3pgkXpJzXAN9Bu4eg3XssGyOPJtWirC30Plcxvr9YDMLumg8EUH3c0ym2iPpuSYYMVNUOynjoCACgrPFuTn58Qz8k1ng8Safu/XcjDiA=;4:j/1WVZR+dvEyXuAEScN2m1oeZpvuqzEeOc/Bjs6rVWfxe6a29Epo3TNpXj840DHnQV/Y1rnxaO0g572xis+ykByO9XRho+k6wJPSB6vX+QnAA+hpJ4yQt2ZPxVzQiuGxF9h+Q3IgigZhY3KRUfdyfOWP93GdSoYPTXYKpZk3vxCmyHvq5NzkPPwutftsdehPi0FgdkZ/qCVmdOqTp1qDP+/LZCbokY0Jp/qe6zibV5PSrKD4iu/9hrBSLdheer42DR54+Qd7C6hN2ELF8qBJsiy0JIbpjVBwHwkYtTFBrxeiMY07gJsD99Q5AZhJpzL4e9GTCRZJ+tm8Y0l7Cjfcxjs6JHLX3fcQxzbHhDYjHtP6klO+dbKwWZi+SlJtFgOc1l4549G0/GmzK6p4WCH/HQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(2401047)(1201001)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:CY1PR0301MB1226;BCL:1;PCL:0;RULEID:;SRVR:CY1PR0301MB1226; X-Forefront-PRVS: 0764C4A8CD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0301MB1226;23:KCWaUlHpGKdet0sB6SAbJAT+EtCH6PxNOSxvN7Q?= =?us-ascii?Q?VIPyiJ1OafBjvaMFgg6y4nUufSUo7hvU38HBSN6l6j9OjEfNwFcHZ3fxG5F8?= =?us-ascii?Q?KXnXK/W2nmP1U1sJK3U3HCx4VpFdCNFc3mV8IYBLgRBwkNxso4gHEVQLsNy2?= =?us-ascii?Q?IE6efeDBVW6RmYuCWOuC1E7ALrAMDCK/7C1YE/bOaohd8meIKh9KQ9j4CXUN?= =?us-ascii?Q?Cr9txbSmE68xYtLhPa+otdvJyGQvnUc9rg69Iy3ogd4mgqHOX5A4ZfGO44Ik?= =?us-ascii?Q?2OOp0fSG4tZbOzSYHXMJjx4zy+TCSSrFZ9B/eykkdGYcUvLZbXje4FNVHYwe?= =?us-ascii?Q?mObCxXL1kWECaLW964EytASaBmbdZP4CfoxiCuoAfMQfQt9uF+RSQGX1rL20?= =?us-ascii?Q?igZIc4NI3DuKNrxv+dz18eSak71k79SjPyVbG/V3DPXcaGSdUgPF+icymyR6?= =?us-ascii?Q?mddKDxoYay78juKiZ4mIInesFdG4KaSbMbQaI82787C5pUXyA5ueIuYZ/u5y?= =?us-ascii?Q?FJAUkV7aY4cYgZIZ20QVAp+E1y5pWA0xYFqqBTVnxU7ihRvyU6NMhAtHgX4L?= =?us-ascii?Q?54pPBX7A5plqAuHcBNN8/b8BFsl3O3YoSeDj85p2+mtm0ibaPJuOO5RSHh22?= =?us-ascii?Q?EJ6e5jHBz0CngvDNINrIk4y7I9Dsd3tWIK61698iyHuklkRmqG+j0voD2BWP?= =?us-ascii?Q?fHzJS0MnEH0PRUm3p349bJcBYjIktCJoNBHq+AM3n6TELSFY7YNRm6eWcTDF?= =?us-ascii?Q?IsnqeQVWpauuX67iCVvgj2z2DAhaSkDzvx8bwtDYMuCFXG60yOG1qo+LifxH?= =?us-ascii?Q?TJWcnPHG/I/bAGf5NDkLKlkHk+BMTJARoLyeBu3qGqOkrMREqx+RGPiBjMSU?= =?us-ascii?Q?KfTtiMhU64gq8+jTANygPPzJjHBQUsfdp4HxShE7HPwWKnnDuvJwc+U/LQw3?= =?us-ascii?Q?yvt6aZG3W8gNbRm14L2/JkkkkgTpPX+QL6GXUyDgD6bYJn793uJXYYy0Ro3+?= =?us-ascii?Q?R4hOLS0nbvd7oPlsVRU5a2VXVVfBtUDS+tRsuEUfHqqm23KE3d2KnOtcG+we?= =?us-ascii?Q?MOs+FVVCPZNaEhPIwkVLaA+2WMuylgAMDHNZZkYWNJMxbtRoaqQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1226;5:QAHE2l4b1t//fb5ouctASZrZQQmIx6VidD1XpeLXewLkDJEZfq0m5SUtm+zBpgUN+28dTezh1LiTP5nCSyEL2++jY8WfhKoFv0FhjT14PNIB0dhhxAb4oIYy1f4GxitfSXQ1iT2Kl1yKh4qD3CzFeA==;24:li/N0eVZ4puiOhan09TcpUQ/MrYCGeI0tfDMxgujMycPXpTB6tk+BOeTZigl8BIvctPsG/Eob/NFFQxDBDXiwm89zogfgtu6sZV9JZ/E9nE= SpamDiagnosticOutput: 1:5 SpamDiagnosticMetadata: 00000000%2D0000%2D0000%2D0000%2D000000000000 SpamDiagnosticMetadata: 1 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2015 06:08:03.2769 (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: CY1PR0301MB1226 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3574 Lines: 109 On Wed, Nov 18, 2015 at 09:40:12AM +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 > --- > v4 : removed return type check for optional property 'itc-setting' > > drivers/usb/chipidea/core.c | 57 +++++++++++++++++---------------------------- > 1 file changed, 22 insertions(+), 35 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 965d0e2..3d1c3c5 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -688,52 +688,39 @@ 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; > - } > - } > > - 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; > - } > + of_property_read_u32(dev->of_node, "itc-setting", > + &platdata->itc_setting); > + > + 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; > } Sorry, one more comment, why we don't quit if the 'ret' is other error value? Peter > > - 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/