From patchwork Fri Jan 16 13:47:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 18975 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from wa-out-1516.google.com (wa-out-1516.google.com [209.85.146.160]) by ozlabs.org (Postfix) with ESMTP id DD051DE2A0 for ; Sat, 17 Jan 2009 00:47:29 +1100 (EST) Received: by wa-out-1516.google.com with SMTP id l32so962220waf.1 for ; Fri, 16 Jan 2009 05:47:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received :received:received:received:message-id:date:from:reply-to:user-agent :mime-version:content-type:to:cc:subject:references:in-reply-to :x-originalarrivaltime:x-virus-scanned:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=FCqou/45LxXVO2e2/+qHzfTqh1QP4ZXm/K+k+FstAdc=; b=onFg8NXaD74vhNGnB5nu52FavouI7gblhmCaYZyHuvostgTRtum2XmYK0B+5PP/iNA Pk8g+8nbt3VN1NpySo7eb6Nbo/0vXw3hjK0MVnrNmIGMe4XyQua55vFV1gBxLyBsi+/G KhoW5TU5Mej+P9sjtKJPCbuGxUory1hH4sx24= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results :message-id:date:from:reply-to:user-agent:mime-version:content-type :to:cc:subject:references:in-reply-to:x-originalarrivaltime :x-virus-scanned:sender:precedence:x-google-loop:mailing-list :list-id:list-post:list-help:list-unsubscribe:x-beenthere-env :x-beenthere; b=COTCQ0nC/LSS/Lrrs1DaoX4xxfsT34/Fl5irlLLgta55c1LggGHS3n9VNTdJEIAkmC QeK24mlY9AtzgAPAnUZgIGRuLEVE8S+uCvOMoCXEUCYRiXCqfsEFGjovsCP7mRsJwBVJ XKAc90q/n2DVfaxQLoOOGUaoQmN+K6Y8Etxhc= Received: by 10.141.164.4 with SMTP id r4mr212404rvo.1.1232113645428; Fri, 16 Jan 2009 05:47:25 -0800 (PST) Received: by 10.230.8.5 with SMTP id f5gr1827vbf.0; Fri, 16 Jan 2009 05:47:25 -0800 (PST) X-Sender: Yegor.Yefremov@visionsystems.de X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.102.218.6 with SMTP id q6mr60929mug.15.1232113644693; Fri, 16 Jan 2009 05:47:24 -0800 (PST) Received: from mail.visionsystems.de (ns.vscom.de [62.145.30.242]) by mx.google.com with ESMTP id 3si251369fgg.16.2009.01.16.05.47.24; Fri, 16 Jan 2009 05:47:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of Yegor.Yefremov@visionsystems.de designates 62.145.30.242 as permitted sender) client-ip=62.145.30.242; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of Yegor.Yefremov@visionsystems.de designates 62.145.30.242 as permitted sender) smtp.mail=Yegor.Yefremov@visionsystems.de Received: from localhost (localhost [127.0.0.1]) by mail.visionsystems.de (Postfix) with ESMTP id 6990D1761AC; Fri, 16 Jan 2009 14:47:23 +0100 (CET) Received: from mail.visionsystems.de ([127.0.0.1]) by localhost (mail.visionsystems.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16785-02; Fri, 16 Jan 2009 14:47:18 +0100 (CET) Received: from visionsystems.de (kallisto.visionsystems.local [192.168.1.3]) by mail.visionsystems.de (Postfix) with ESMTP id BE30717A77E; Fri, 16 Jan 2009 14:47:18 +0100 (CET) Received: from [192.168.1.38] ([192.168.1.38]) by visionsystems.de with Microsoft SMTPSVC(6.0.3790.3959); Fri, 16 Jan 2009 14:47:18 +0100 Message-ID: <49708FE6.2000903@visionsystems.de> Date: Fri, 16 Jan 2009 14:47:18 +0100 From: Yegor Yefremov Reply-To: rtc-linux@googlegroups.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.19) Gecko/20081209 Lightning/0.9 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666 Mime-Version: 1.0 To: Alessandro Zummo CC: rtc-linux@googlegroups.com, =?ISO-8859-1?Q?J=FCri_Reitel?= , David Brownell Subject: [rtc-linux] Re: rtc-ds1307: Remove rtc_valid_tm() from ds1307_get_time() References: <496F0DC8.1010704@visionsystems.de> <200901151832.25296.david-b@pacbell.net> <497041B1.5000501@visionsystems.de> <497058ED.4000400@liewenthal.ee> <49705E87.7080405@visionsystems.de> <20090116115023.7d6d9549@i1501.lan.towertech.it> In-Reply-To: <20090116115023.7d6d9549@i1501.lan.towertech.it> X-OriginalArrivalTime: 16 Jan 2009 13:47:18.0436 (UTC) FILETIME=[F2A9BE40:01C977E0] X-Virus-Scanned: amavisd-new at visionsystems.de Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.com Alessandro Zummo schrieb: > On Fri, 16 Jan 2009 11:16:39 +0100 > Yegor Yefremov wrote: > > >> The script will set the date to default value. But the problem with >> rtc_hctosys() still remains. If the value returned from the RTC driver >> (those returning rtc_valid_tm() and not 0 if there were no communication >> errors) is invalid you'll see the following error message: >> >> "hctosys: unable to read the hardware clock\n" >> > > I will probably change this message to something different. > > >> because err != 0 and you don't reach the rtc_valid_tm() in rtc_hctosys() >> itself. This is only functioning if read call returns 0, then >> rtc_valid_tm() will be called and provided the value is invalid you get >> the right message: >> >> "hctosys: invalid date/time\n" >> > > that's a fallback to cope with badly written drivers. > > >> So in the case of ds1307 you cannot rely on the error message. And if it >> is the desired behavior, that the value has to be checked by all >> drivers, why not doing so on the central place in >> drivers/rtc/interface.c->rtc_read_time()? (see interface.diff) >> > > It's done that way in order to make driver authors conscious > on what they are doing. > > Summary of this discussion: 1 .the rtc_hctosys() should give the correct information concerning what was wrong while getting the time. I've attached another patch. It just parses the return code, so the old behavior for drivers not returning rtc_valid_tm() is still the same. Please check it. 2. rtc_valid_tm() should be some day placed on some central place (drivers/rtc/interface.c) and removed from the drivers. This means a lot of work and should be confirmed/voted. Jüri, I hope I could answer your question too. Best regards, Yegor --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~--- diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c index 33c0e98..3e4c98d 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c @@ -57,9 +57,14 @@ static int __init rtc_hctosys(void) dev_err(rtc->dev.parent, "hctosys: invalid date/time\n"); } - else + else if(err == -EINVAL){ + dev_err(rtc->dev.parent, + "hctosys: invalid date/time\n"); + } + else{ dev_err(rtc->dev.parent, "hctosys: unable to read the hardware clock\n"); + } rtc_class_close(rtc);