[{"id":1785410,"web_url":"http://patchwork.ozlabs.org/comment/1785410/","msgid":"<20171012122009.vqv4d3o6levhrxeo@piout.net>","list_archive_url":null,"date":"2017-10-12T12:20:09","subject":"Re: [PATCH RfC] rtc: ds1307: improve weekday handling","submitter":{"id":26276,"url":"http://patchwork.ozlabs.org/api/people/26276/","name":"Alexandre Belloni","email":"alexandre.belloni@free-electrons.com"},"content":"On 29/08/2017 at 21:52:56 +0200, Heiner Kallweit wrote:\n> The current code for checking and fixing the weekday in ds1307_probe\n> faces some issues:\n> - This check is applied to all chips even if its applicable (AFAIK)\n>   to mcp794xx only\n> - The check uses MCP794XX constants for registers and bits even though\n>   it's executed also on other chips (ok, this could be fixed easily)\n> - It relies on tm_wday being properly populated when core calls set_time\n>   and set_alarm. This is not guaranteed at all.\n> \n> First two issue we could solve by moving the check to the\n> mcp794xx-specific initialization (where also VBATEN flag is set).\n> \n> The proposed alternative is in the set_alarm path for mcp794xx only and\n> calculates the alarm weekday based on the current weekday in the RTC\n> timekeeping regs and the difference between alarm date and current date.\n> So we are fine with any weekday even if it doesn't match the date.\n> \n> Still there are cases where this could fail, e.g.:\n> - rtc date/time + weekday have power-on-reset default values\n> - alarm is set to actual date/time + x\n> - set_time is called (may change diff between rtc weekday and actual\n>   weekday)\n> \n> But similar issues we have with the current code too:\n> - rtc date/time + weekday have power-on-reset default values\n> - alarm is set to rtc date/time + x\n> - set_time is called before the alarm triggers\n> \n> Using random rtc date/time with relative alarms simply can interfere\n> with set_time. I'm not totally convinced of either option yet.\n> \n> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>\n> ---\n>  drivers/rtc/rtc-ds1307.c | 52 ++++++++++++++++++++++++------------------------\n>  1 file changed, 26 insertions(+), 26 deletions(-)\n> \n\nIt took me some time to test it (I've received an mcp79410) because at\nfirst, it seemed the regmap conversion made the IO timeout. I can't\nreproduce that anymore though.\n\nApplied, thanks.","headers":{"Return-Path":"<linux-rtc-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-rtc-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yCVL05X1Nz9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 12 Oct 2017 23:20:24 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752824AbdJLMUR (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 12 Oct 2017 08:20:17 -0400","from mail.free-electrons.com ([62.4.15.54]:36581 \"EHLO\n\tmail.free-electrons.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752133AbdJLMUM (ORCPT\n\t<rfc822; linux-rtc@vger.kernel.org>); Thu, 12 Oct 2017 08:20:12 -0400","by mail.free-electrons.com (Postfix, from userid 110)\n\tid 876CF207F4; Thu, 12 Oct 2017 14:20:10 +0200 (CEST)","from localhost (242.171.71.37.rev.sfr.net [37.71.171.242])\n\tby mail.free-electrons.com (Postfix) with ESMTPSA id D2A3C207E8;\n\tThu, 12 Oct 2017 14:20:09 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tmail.free-electrons.com","X-Spam-Level":"","X-Spam-Status":"No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT,\n\tURIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0","Date":"Thu, 12 Oct 2017 14:20:09 +0200","From":"Alexandre Belloni <alexandre.belloni@free-electrons.com>","To":"Heiner Kallweit <hkallweit1@gmail.com>","Cc":"linux-rtc@vger.kernel.org","Subject":"Re: [PATCH RfC] rtc: ds1307: improve weekday handling","Message-ID":"<20171012122009.vqv4d3o6levhrxeo@piout.net>","References":"<abf5f5ff-b406-eff0-a1ec-9486efbe8506@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<abf5f5ff-b406-eff0-a1ec-9486efbe8506@gmail.com>","User-Agent":"NeoMutt/20170609 (1.8.3)","Sender":"linux-rtc-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-rtc.vger.kernel.org>","X-Mailing-List":"linux-rtc@vger.kernel.org"}}]