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

Alexandre Belloni alexandre.belloni at free-electrons.com
Tue May 5 14:01:31 PDT 2015


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.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the linux-arm-kernel mailing list