From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailgw02.mediatek.com ([210.61.82.184]) by gmr-mx.google.com with ESMTPS id ye6si2648782pbc.2.2015.05.05.20.32.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 May 2015 20:32:44 -0700 (PDT) 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 MIME-Version: 1.0 Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , 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 -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.