Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756580AbbLAUX5 (ORCPT ); Tue, 1 Dec 2015 15:23:57 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36278 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754852AbbLAUX4 (ORCPT ); Tue, 1 Dec 2015 15:23:56 -0500 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: 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> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1211 Lines: 32 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 -- 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/