[rtc-linux] Re: [PATCH v3 06/10] rtc: max77686: Add max77802 support
From: Javier Martinez Canillas <javier@dowhile0.org>
Date: 2016-01-27 02:24:23
Also in:
linux-samsung-soc, lkml
Hello Krzysztof, On Tue, Jan 26, 2016 at 10:59 PM, Krzysztof Kozlowski [off-list ref] wrote:
On 27.01.2016 04:20, Javier Martinez Canillas wrote:
[snip]
quoted
data[RTC_MONTH] = tm->tm_mon + 1; - data[RTC_YEAR] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0; - if (tm->tm_year < 100) { - pr_warn("RTC cannot handle the year %d. Assume it's 2000.\n", - 1900 + tm->tm_year); - return -EINVAL; + if (!info->drv_data->alarm_enable_reg) {I don't like all these inverted checks. They are error-prone. This is why I propose different name. However since you want to stick to this name of this property, then easier to read would be: if (info->drv_data->alarm_enable_reg) { data[RTC_YEAR] = tm->tm_year; } else { max77686-stuff... } Can you reverse it here and in other places?
Fair enough, I'll reverse the logic so is more natural and also do an early return as Andi suggested.
The patch beside that is okay and works fine: Tested on Trats2 (max77686): Tested-by: Krzysztof Kozlowski <redacted> BR, Krzysztof
Best regards, Javier -- -- 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.