Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2402251imu; Sun, 6 Jan 2019 00:25:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/VIpB6yfWteqSCjc/vs0fFJQR6z/0xDMeraFHPOLecvlynU1JYZd19zQm9HWx/fpbF++JJG X-Received: by 2002:a62:2fc3:: with SMTP id v186mr59071992pfv.82.1546763109016; Sun, 06 Jan 2019 00:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546763108; cv=none; d=google.com; s=arc-20160816; b=fRsckQ082k+AclxGo94weWWLBnfhVC2J31wjQEPMU4wSCDqpwc22iEgjarAh7/ESPV cmXwMRYrr4lw/jpKP5xeJcFtaRXr6kYOl7skwEAQCgbb0ws+AuegmgFt3Nd4r0emBEM5 v8RFnviIFWC2unnHWBN5bMCi4CodQQGI2qE4Wi8y/UVVTO/xiVvNYSP4i26kVJcKtp7V h/KwLQZmmx5gJdR8HXWhfkxruH2GmUGAouWDydC0SpuHHqy3A0eBz88vcTug9n5g694C FSZVgBJ9CQ2YWQwpxRdAQcX4X8LMYnXim5YDezuHmWGy51+a7F8aStVaCwQygwc2KWHj Zumw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=wYyrIy/iQ2XDfoQ8jIjOuA03ba+YjylBmaFkxv8Tv0o=; b=kJDi3kmKeM0t6GdN7ShULLhX21+y9EjPbRkTKBYM83Y7Sdn6MYbl9drgI/O97nVGZ9 hAFAK5lGndmcLaWwKshckbvgR+BZnWWhuIAihqrvuMOLshpfSa/c2GlWksak5zFzptau KvgvAriqaDVbzXzTtIG2exVsfGYirKsj0RWbiXs+7hmBaTaOZE6pse+oKhHOewhlQPEt In8cHCropIcVXiby4ZaHH+UVXcURxk+oxeWhlWjqKPaRJ39llkk4UmV6BtZEZ6xWaUYd bGXnJpqax58e8jczxmDZLhE3qinf3XBlWrTZe/YgcNRSN5hyBogGRhSlvEuw9VHahMZn ivOw== 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 t19si13834778pgk.163.2019.01.06.00.24.54; Sun, 06 Jan 2019 00:25:08 -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 S1726438AbfAFIVE (ORCPT + 99 others); Sun, 6 Jan 2019 03:21:04 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:44860 "EHLO dcvr.yhbt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbfAFIVE (ORCPT ); Sun, 6 Jan 2019 03:21:04 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CF3AE211B4; Sun, 6 Jan 2019 08:21:03 +0000 (UTC) Date: Sun, 6 Jan 2019 08:21:03 +0000 From: Eric Wong To: Alexandre Belloni , Alessandro Zummo Cc: Sylvain Chouleur , Patrick McDermott , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rtc: cmos: ignore bogus century byte Message-ID: <20190106082103.evfgarznrskd4oxh@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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