Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758767AbbEFDcp (ORCPT ); Tue, 5 May 2015 23:32:45 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:33701 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1757754AbbEFDcn (ORCPT ); Tue, 5 May 2015 23:32:43 -0400 X-Listener-Flag: 11101 Message-ID: <1430883151.28521.1.camel@mtksdaap41> Subject: Re: [rtc-linux] [PATCH v3 2/3] rtc: mediatek: Add MT6397 RTC driver From: Eddie Huang To: Alexandre Belloni CC: Joe Perches , Lee Jones , Alessandro Zummo , Matthias Brugger , Andrew Morton , "Tomasz Figa" , Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , , Samuel Ortiz , Greg KH , , , , , Tianping Fang Date: Wed, 6 May 2015 11:32:31 +0800 In-Reply-To: <20150505210131.GR4276@piout.net> References: <1430206556-18254-1-git-send-email-eddie.huang@mediatek.com> <1430206556-18254-3-git-send-email-eddie.huang@mediatek.com> <20150505200010.GP4276@piout.net> <1430858661.9365.20.camel@perches.com> <20150505210131.GR4276@piout.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1026 Lines: 39 Hi Joe and Alexandre, On Tue, 2015-05-05 at 23:01 +0200, Alexandre Belloni wrote: > On 05/05/2015 at 13:44:21 -0700, Joe Perches wrote : > > I suggest moving the time_after() test into the loop, > > use break; and remove the exit label too. > > > > Maybe something like: > > > > while (1) { > > ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU, > > &data); > > if (ret < 0) > > break; > > if (!(data & RTC_BBPU_CBUSY)) > > break; > > if (time_after(jiffies, timeout)) { > > ret = -ETIMEDOUT; > > break; > > } > > cpu_relax(); > > } > > > > return ret; > > That certainly looks more readable. > Thanks correct me that I put wrong paramters in time_after, and give me good example. I will adopt your suggestion in next round. Eddie -- 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/