Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750964AbbKRFBk (ORCPT ); Wed, 18 Nov 2015 00:01:40 -0500 Received: from mail-by2on0142.outbound.protection.outlook.com ([207.46.100.142]:55009 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750717AbbKRFBi (ORCPT ); Wed, 18 Nov 2015 00:01:38 -0500 Authentication-Results: spf=permerror (sender IP is 192.88.158.2) 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 12:44:15 +0800 From: Peter Chen To: Saurabh Sengar CC: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= , Greg KH , , Subject: Re: [PATCH v3] usb: chipidea: removing of_find_property Message-ID: <20151118044414.GC4228@shlinux2> References: <1447761146-4599-1-git-send-email-saurabh.truth@gmail.com> <20151118033816.GB4228@shlinux2> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD021;1:D4TlOJ012pmK8NQW/AXbZnQa8igsXZ++alDzSrB20/7F4yaPpwXSulT7bcXDol6B7WLMw5unvHsuL8V+bhYBL18amQDOu65jzGNmYqwOvo61hMNtq+jJZFFIHTZwtPDFoQeiNJd5+wO+oN9w2q/2c+k7Lmmf4ypD1mNpoU2Uzs62D+6EhlZx13dAyOqORrZJ04hCwftKbu68JAm8j96x4QcFGUnZN2FMS3n5ghJ7UJt6ZJ9T9XNxMV3xEqmQ51IuDY0JiOd+EUB+4xwhxsNLG6ydFEkh/gGo2R/43ADmAbQsQcdEl+/H3NCMzaLFhm7DDxnrP3j3H1UjGFPgy4Eg2TxG2iRTBarQ1O8dphiLkFSNmMuIdefYRkl0+TGKJ2eU2mnvsvSVqUURPF1eav69AhTUh/23fIXFcHcEh1MMHVE= X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1060300003)(448002)(189002)(199003)(24454002)(19580395003)(19580405001)(69596002)(97756001)(575784001)(86362001)(47776003)(87936001)(83506001)(106466001)(85326001)(5007970100001)(11100500001)(2950100001)(4290100001)(77096005)(606003)(110136002)(5001960100002)(33716001)(97736004)(81156007)(4001350100001)(5001920100001)(6806005)(92566002)(104016004)(50466002)(5008740100001)(54356999)(76176999)(50986999)(110436001)(46406003)(33656002)(93886004)(23726002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1223;H:az84smr01.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;2:XmiCymHMGqiBKNiWH6+FquhKsAYeG4wbqjLGxN7Lc3p/9n2ffRu6hf2NZybojMhD/nbvMOUmPcS730L6Xf09Lk8WpjOwFsh70uerLETvPUKkfSeIUvZljX/EMGaswh4UZiZqrgbpwdRchrDauz7VHhdt+pCtfXSfQxys2lVINIY=;3:qGu7Uqf0XqMNg44CMMgaYazsAWek8Wr78BNAFW5zD1bOAR32m6TReCuhpC3tCyXnBUF6iSntQvGkTLU8QEMrVo/H0SFr/xbd60iGSmCIrisQFcfgjsvrPTH+kkepkOIoETSTNvo5d4YuMadir0qccv+6PvUrVabY0bO1q2T5nf3sUH2nqRke16srQnsHlzqBbvll28i9MVE8k+mcezQ+ZuYKunO+RRXKMVlU3mSmWtw=;25:UUZTU1COGj5nJrhgBSMicg1/Aqf0jGBJOXS0NJ70isB5dHsoM8a2zgndwGTviMS9ci0uwjHilhdjVuFe/lpqQjAzgqU2HifBlqaATYA8p18Yhj2wzDKSXA3/T5HBz+c1h8C77cOwqbFloMs2B4zHnu4TorU2ric91IimQFoZSGPekMBI9eXqxwGnI/fLfW7Tdri5qruMkjC3ZzP33fQ7820cXqs2bz738kMNKipgv7dEXxG55DE+Q4qmUHZf+smo0zSXk5bDwXT1NcQM8vrRCw== X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;20:xB91O2BulPhe3GOdE3Om+ANcdFZH3tLslpgvNXV82FLZxbQE9XP9d7oNJV1lTctizxaEThpVgumhja2CjCG5o9A1xVKVNOKIp+xl5a8XCDmyKQdzgkA9+u7+2oKPnFXLJtHqMppbSbH78gRSc/Avu30R3bFyUx9InRLgR5ebCnMHeEKbyUuOmqvmvkgLmXa7ralcsUv5h9bXNuMngflaG6B2/d5Hoe6WDsH6O2GlTZzTGvVVOSz5wqM5qOUhnuTbgcB8MjwBzBSZKyLBEdJPa4IE+4DiE8gLR4IbVV9lgWxcrh3WJaCsx7SbU3vFoMa0FY5YparVPPAJQ67gj+Ej2xUMyBmd/3JmHpNJvazLigc=;4:wzZA7Ty/mj8O6SOnSzGjlgpyCMporBAM27TMyiZqh3WyVrfBw6wwJGvk1eUyi9LU5HVCJ6dVlKLsIAcsMnK2QyTGec1nXAvBX7CR91fvhssLIshS/5rL3AKHeC5BR4kUWLxrWf6rkUcOOtDWpfb+ZPxA0bxbAmSK/So3tk2gOc5IAp2lbb13uLDUb17J3fs4EtOjRTEVFV0Bv8cRauzDDnzfBe+3BrP6f0yP5Npa/WcbmVXMNsJNHxwHIOXVvj4v5Cm9KGBjlW/KodhUs68uRc2SllYoNM9rMScKw+Q6SLbdIMaZ2X42Ag76i3iOJe3z2ky8SZndz1tZbx3NPsGEWD8hiMUlXwk5Mvo3qhlRVA+pRKxtTOD07UtSmaOP2Zqs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001);SRVR:BY1PR0301MB1223;BCL:1;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Forefront-PRVS: 0764C4A8CD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1223;23:F3G5AffLh/iDuRy59m3qVp+zru+ZZ8RLYWBIlbw?= =?us-ascii?Q?sLyPUj0QrAUulv7SDTqvOfe1/tcPSUmArvb4uw6KSXEn7fy/CfldVq4MSGlZ?= =?us-ascii?Q?0J3AkhelpwLYraIre/Pm2iFKjL572VsxlmLZebdemAUFx7EEMXaOWaUalcCs?= =?us-ascii?Q?cctgdzRwcaZfuzFibsy5GPVMkIXvL8GWm+qcb/T2Bw/qXmaJ8S6qzNW3XGfk?= =?us-ascii?Q?1Z+jlZ9/xftEo79Y18zlyie8uJVDfz4V6W0i8DbRoHIUee4m9nVRw0YYpZOL?= =?us-ascii?Q?f//gim+D2fT7bL8og5M8lMG9Xr3AfnpV0nKVsZgvsP6W6o/UTZSF3A1eZyDP?= =?us-ascii?Q?bpv8P/rP9Dcq4L9ftIoEQK8rroabWfv7qb9Th1udPFW6nAoJUHMAL1C4apUq?= =?us-ascii?Q?QwZUZKgzOz9cC3g4qn1MPJPguBCwOTCguqEMdcRseSRBft/IMuFBNw+m5WbD?= =?us-ascii?Q?Jy4VuTKiEqQfD4URKcC1BlenhGAo30am8B+Wo0+zi5xw6o1CcYJH3mYIEjQk?= =?us-ascii?Q?SCEBd6hbo7ol3/VLdC3yNM2emIPuj4o+h/UbNmZrFdtBzuE/7ezIrnXjNoCv?= =?us-ascii?Q?/SRybL+Fzi9FmtQ2VUQjAzmmrjHcEW0zlMmY0LPTJOijLmNpRIklssEd2C1g?= =?us-ascii?Q?s0+wionwAIhye6GapO1O2VQtTWYzEYjnjiG5swnUixiKzNnL7KZjwMpFzFxT?= =?us-ascii?Q?9F+2fsFLsIy2i1WoeAd+EEnlLO20tYBPfeiYb6mYqOOLe9qafQqnVCDJIFbv?= =?us-ascii?Q?FtrL9UDUrM4NpzTd3C0aKwb9taJLec/dRoYe2pi83HCJH2Urwn3O48euMSmf?= =?us-ascii?Q?ESWCWCp4sggivBRQj8hjQpd5ElFcFytKpMg+JMxYY14NGZd2rBjBDvpJpLfv?= =?us-ascii?Q?iR10L/1MGRFutQ0shlwpsH4I6NS2G6FN6G2d9+VGQIRkNPBpSr7/fLPuBhWa?= =?us-ascii?Q?6yxzvgGL5TjN7dNiKC34Y+KVs/wFGMex2pILc3gWrEIJOpyYN4vxYe7LZRIV?= =?us-ascii?Q?PvIW21+rmPrh6Ps7Psg9bBfvZw77i0mAAPGpRfOYeM/rA9+qyCfpTVE7Yu1s?= =?us-ascii?Q?e6TjsqOvPHXkAotBZg/UhttZr7WvQODuPEnoE33LE9fwNoDdYHNBV9E2iyjw?= =?us-ascii?Q?7BGyZgRLEBbcQ2ZmtG4x5BY3BGBXVV+rcR6cls2DQrzEDVDjEnSVqyym/kPV?= =?us-ascii?Q?F51c1vbCAcfHz8kE=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;5:teenkXfNnSDrjnXsZlJqKPqeSactb/+JOOs3zYD4tkZn13ISNgwbhRzIc1uzpFcVdCaYj2B8S+WEFxZlSmW2DB3ZPmOeSH70tHqUwxX6jXG+PmVR6geb5J7eXp7iW+GT1worsHyS4s5nbLjqzHNHkA==;24:VEu4m31SNRzCVk5Mqrjmkg3ej1dUAsTKGkRF5veiz8P1g6PHJ5YCkoA2oxFGgy3jg8srIVQaSLxFejc4TY9ZXcz3Fdo8vfj3G0mzfkxqCS0=;20:XikQHkykeI9cQ9MHgfMEkuxArESV/QJHI2V9ZWnpwg9Y6Kp+Utj5+K0iRcdRN2wMDxBShE6l/t+OZKTu746oGw== SpamDiagnosticOutput: 1:5 SpamDiagnosticMetadata: 00000000%2D0000%2D0000%2D0000%2D000000000000 SpamDiagnosticMetadata: 1 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2015 04:46:57.5860 (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.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1223 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5575 Lines: 138 On Wed, Nov 18, 2015 at 09:30:39AM +0530, Saurabh Sengar wrote: > Hi Peter, > > Yes itc_setting is still optional, in case dts does not pass this > property, return type will be -EINVAL and there would be no problem. > The function will break only if there is 'No data'(-ENODATA) or > 'overflow'(-ENODATA) error for this property. If there is an error, the variable pass to of_property_read_u32 will not be changed. Peter > In case this is not OK, I will send a another patch(v4) as you have suggested. > > Regards, > Saurabh > > On 18 November 2015 at 09:08, Peter Chen wrote: > > 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 -- 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/