From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-x22e.google.com (mail-pa0-x22e.google.com. [2607:f8b0:400e:c03::22e]) by gmr-mx.google.com with ESMTPS id 1si5647727pfc.0.2015.12.01.12.23.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Dec 2015 12:23:55 -0800 (PST) Received: by mail-pa0-x22e.google.com with SMTP id hx2so15637507pad.1 for ; Tue, 01 Dec 2015 12:23:55 -0800 (PST) Date: Tue, 1 Dec 2015 12:23:51 -0800 From: Joshua Clayton To: Alexandre Belloni Cc: Alessandro Zummo , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [rtc-linux] Re: [PATCH 6/9] rtc-pcf2123: avoid resetting the clock if possible Message-ID: <20151201122351.27e3f542@jclayton-pc> In-Reply-To: <20151124232512.GG3950@piout.net> References: <20151124232512.GG3950@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On Wed, 25 Nov 2015 00:25:12 +0100 Alexandre Belloni wrote: > On 04/11/2015 at 07:36:37 -0800, Joshua Clayton wrote : > > + ret = pcf2123_rtc_read_time(dev, &tm); > > + if (ret < 0) > > + return false; > > + > > + if (rtc_valid_tm(&tm) < 0) { > > + dev_err(dev, "retrieved date/time is not > > valid.\n"); > > + return false; > > + } > > + > > I would remove that test as basically, the date/time will only be > valid when OSC_HAS_STOPPED is not set. > OSC_HAS_STOPPED really only protects us in case everything else looks good, but we've lost power. There are other reasons to check for a valid time. Specifically, if there is no communication with the device, the spi operation will succeed and return all zeros or all ones. Since either of these results in an invalid time, it is a nice way to probe whether we really have a pcf2123 compatible device. I don't think I should remove this test, but I can add a comment -- -- 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.