Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2422422imu; Thu, 10 Jan 2019 14:04:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN6QwfKOxrDyeExM3EmNnC3DmvYjvLfLr1yKKiowbbAaazBAKlnUkSym49hgnsHiFEopXIU2 X-Received: by 2002:a62:5b44:: with SMTP id p65mr11774470pfb.47.1547157850083; Thu, 10 Jan 2019 14:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547157850; cv=none; d=google.com; s=arc-20160816; b=SWlHc+uZ8dooMXluD/CZtuC4ZqACqcqhdXE9jRzC5s45v/EzGmVrs3IiJjTUuBEmlA V/lF18d4c/yzboOS8yG0CABszdIgfF5VZckyY8m0S7/NRC5hFTQcn2Mqaisce3oOs6iD 6n1G9LB5QSC9Nc8G0p0zOX1kt3qGyN37+uAfK7LK15ZrkexHCloxdzCboIGo6ur36q8b OD0aWVfr0uowh1EkOBr2xKGX0ZQUI/2MmfE2df9mOZJsIkxfsNOJihjLeXLHkXqQkq2H +Ci4VvFn4Kf9bSod7PZH6ySLip/5sKiWTCkc900UonP2b24LRWoZQ0SF07LcIsD3O71g 8dlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LiJ7oP98Mw+OKgRPbngkUObz2Q3NunDFoqnzV+eOLi8=; b=eTFZAlQTEN9VBkbQ/vgqJ6dTr8MJs/5kz9LD5u8hLNr8tRM80eg8UwyqumyP8NLF6M +OD5n2KlbXsRmW29v/n7kqm65qWLsRNCR4Fd66sFJx//iagn+IJa+z4fvYSwBt3sBKfb kDKzcodDhmkYmth3/M8PNCiXUrS7n/9iude59C5tX56a01WnDARVNl4nsXe+Fium8oXF IMGu73j1CIXW6ydvJx1Z4CeuidDtCnWnotdLNpCC8Mm6ThnByzf55xzi26PFPLxCSYTU R6zVjeS8QodfnS+Dda9ihNn1CB8abgDZ+Q4FjEEz0iWU9W8D37lqQJlVs6q6RWEsazQN 1HbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si29615143plr.31.2019.01.10.14.03.55; Thu, 10 Jan 2019 14:04:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728976AbfAJVdq (ORCPT + 99 others); Thu, 10 Jan 2019 16:33:46 -0500 Received: from mail.bootlin.com ([62.4.15.54]:34072 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728800AbfAJVdq (ORCPT ); Thu, 10 Jan 2019 16:33:46 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 28F7D207B6; Thu, 10 Jan 2019 22:33:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (lfbn-1-17122-186.w86-248.abo.wanadoo.fr [86.248.186.186]) by mail.bootlin.com (Postfix) with ESMTPSA id E97E3206A6; Thu, 10 Jan 2019 22:33:33 +0100 (CET) Date: Thu, 10 Jan 2019 22:33:34 +0100 From: Alexandre Belloni To: Eric Wong Cc: Alessandro Zummo , Sylvain Chouleur , Patrick McDermott , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rtc: cmos: ignore bogus century byte Message-ID: <20190110213334.GE2362@piout.net> References: <20190106082103.evfgarznrskd4oxh@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190106082103.evfgarznrskd4oxh@dcvr> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2019 08:21:03+0000, Eric Wong wrote: > Older versions of Libreboot and Coreboot had an invalid value > (`3' in my case) in the century byte affecting the GM45 in > the Thinkpad X200. Not everybody's updated their firmwares, > and Linux <= 4.2 was able to read the RTC without problems, > so workaround this by ignoring invalid values. > Does this mean that it is set to an invalid value and that in is not getting updated properly in mc146818_set_time? > Fixes: 3c217e51d8a272b9 ("rtc: cmos: century support") > > Cc: Alexandre Belloni > Cc: Alessandro Zummo > Cc: Sylvain Chouleur > Cc: Patrick McDermott > Cc: linux-rtc@vger.kernel.org > Signed-off-by: Eric Wong > --- > drivers/rtc/rtc-mc146818-lib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c > index 2f1772a358ca..18a6f15e313d 100644 > --- a/drivers/rtc/rtc-mc146818-lib.c > +++ b/drivers/rtc/rtc-mc146818-lib.c > @@ -82,7 +82,7 @@ unsigned int mc146818_get_time(struct rtc_time *time) > time->tm_year += real_year - 72; > #endif > > - if (century) > + if (century > 20) > time->tm_year += (century - 19) * 100; > > /* > -- > EW -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com