From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E146C33CB6 for ; Thu, 16 Jan 2020 17:57:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A7672073A for ; Thu, 16 Jan 2020 17:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579197426; bh=UZIBSTqaOG0Ky34YwX3/WGdVTtTjFR9vsSrvyQpJqGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OHAHM1OE0pwHl4VOckA0yrXgf/8P/X705KbflTvBV0WOtEsK00I0WhWQOzv3C8EuX SmG7OD75rJmTAZno9Ezuq02cMelVXAHk5DjoBmhSnqzOhKBnYSLydb8eiZstAFM1B2 jzNNCT/QKDv5Ni40ZXjFCcuzGVul0wzOKkfs4qc8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393968AbgAPRnl (ORCPT ); Thu, 16 Jan 2020 12:43:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:33854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388769AbgAPRnj (ORCPT ); Thu, 16 Jan 2020 12:43:39 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66C112473E; Thu, 16 Jan 2020 17:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579196618; bh=UZIBSTqaOG0Ky34YwX3/WGdVTtTjFR9vsSrvyQpJqGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aTUMikXv41kyg83cpqz85G0o3WfZxfps2/DNFZIxAPq6u3HHS1JeyuxKh5MXaWHZP hiDovsq4HZjXdy8fwb2kc+c9NMNJMZ7CdsPI1j1ffWkKGTKPL7dEIFj7hGMt/SXT9U vTx0eIgkn6JgEZ6kYT9spAT7ipanvjwm5rE3ZLhU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Wong , Alexandre Belloni , Alessandro Zummo , Sylvain Chouleur , Patrick McDermott , linux-rtc@vger.kernel.org, Sasha Levin , linux-arch@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 035/174] rtc: cmos: ignore bogus century byte Date: Thu, 16 Jan 2020 12:40:32 -0500 Message-Id: <20200116174251.24326-35-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116174251.24326-1-sashal@kernel.org> References: <20200116174251.24326-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org From: Eric Wong [ Upstream commit 2a4daadd4d3e507138f8937926e6a4df49c6bfdc ] 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 Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- include/asm-generic/rtc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h index 4e3b6558331e..3e457ae2d571 100644 --- a/include/asm-generic/rtc.h +++ b/include/asm-generic/rtc.h @@ -106,7 +106,7 @@ static inline unsigned int __get_rtc_time(struct rtc_time *time) time->tm_year += real_year - 72; #endif - if (century) + if (century > 20) time->tm_year += (century - 19) * 100; /* -- 2.20.1