Thread (12 messages) 12 messages, 5 authors, 2015-05-06

Re: [rtc-linux] [PATCH v3 2/3] rtc: mediatek: Add MT6397 RTC driver

From: Eddie Huang <eddie.huang@mediatek.com>
Date: 2015-05-06 03:32:45
Also in: linux-arm-kernel, linux-mediatek, lkml

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 :
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help