Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757630AbbEEUo3 (ORCPT ); Tue, 5 May 2015 16:44:29 -0400 Received: from smtprelay0149.hostedemail.com ([216.40.44.149]:35667 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757601AbbEEUo2 (ORCPT ); Tue, 5 May 2015 16:44:28 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:968:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2691:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3871:3873:4184:4321:5007:6120:6261:6742:7901:7903:10004:10400:10848:10967:11026:11232:11473:11658:11914:12296:12438:12517:12519:12740:13069:13311:13357:14096:14097:21060:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: skirt12_60a0e6069d650 X-Filterd-Recvd-Size: 2869 Message-ID: <1430858661.9365.20.camel@perches.com> Subject: Re: [rtc-linux] [PATCH v3 2/3] rtc: mediatek: Add MT6397 RTC driver From: Joe Perches To: Alexandre Belloni Cc: Eddie Huang , Lee Jones , Alessandro Zummo , Matthias Brugger , Andrew Morton , Tomasz Figa , Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , srv_heupstream@mediatek.com, Samuel Ortiz , Greg KH , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Tianping Fang Date: Tue, 05 May 2015 13:44:21 -0700 In-Reply-To: <20150505200010.GP4276@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> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1601 Lines: 62 On Tue, 2015-05-05 at 22:00 +0200, Alexandre Belloni wrote: > Hi, > > This looks mostly good. Could you align the wrapped function parameters > to the open parenthesis (use checkpatch --strict)? > > On 28/04/2015 at 15:35:55 +0800, Eddie Huang wrote : > > +static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) > > +{ > > + unsigned long timeout = jiffies + HZ; > > + int ret; > > + u32 data; > > + > > + ret = regmap_write(rtc->regmap, rtc->addr_base + RTC_WRTGR, 1); > > + if (ret < 0) > > + return ret; > > + > > + do { > > + cpu_relax(); > > + ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU, > > + &data); > > + if (ret < 0) > > + goto exit; > > + } while ((data & RTC_BBPU_CBUSY) && time_after(timeout, jiffies)); > > + > > Shouldn't you return -ETIMEDOUT if the loop breaks because of time_after? Probably yes. I believe as written the time_after test is too much for my little brain. I would have used time_before and reversed the args. 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; } -- 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/