From patchwork Sun Dec 30 18:56:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Prisk X-Patchwork-Id: 208756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ob0-f184.google.com (mail-ob0-f184.google.com [209.85.214.184]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8EBDC2C00AC for ; Mon, 31 Dec 2012 05:56:34 +1100 (EST) Received: by mail-ob0-f184.google.com with SMTP id 16sf7060537obc.1 for ; Sun, 30 Dec 2012 10:56:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-received:mime-version:x-beenthere:x-received:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-google-group-id:list-post :list-help:list-archive:sender:list-subscribe:list-unsubscribe :content-type; bh=x0TZVNlJmwROJfi09koViu9qWNpVx5m2DYhbW0RncQ0=; b=bIOXfwNc53HBkmBSL8wZ+shxMRTrq8DCZTEtLP5YIpyHhza0Bo+0kEjod3gSIvazkp oRlurxHW950GXwoqhFFHANiQqNjNEuh2NXMF3eZ6PKV8KpleKNMZIlwqqzCgxoMkG03b QyU0zkx+gFkJLEq+XD9yppR0ZI4bL/vRlDAN+PidrpWAPrW2qwjHAWs/qprGF++4f44T J1z6JPj71nmbqQ+nNf4Z9j5ZKO0wX5/zK5WEOFJMPrcutS8TG2CM4o0t06GcS+GVqK24 MZ8nRNKdI0jolCWtBrjIRwqzrNf4LzJS20mSgBjn9IPe5qAoJ9s8pyTHnw9fJmh11R/R 4iJg== X-Received: by 10.50.87.165 with SMTP id az5mr13078517igb.1.1356893792005; Sun, 30 Dec 2012 10:56:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.153.194 with SMTP id vi2ls8891630igb.22.gmail; Sun, 30 Dec 2012 10:56:31 -0800 (PST) X-Received: by 10.66.84.98 with SMTP id x2mr5207976pay.10.1356893791592; Sun, 30 Dec 2012 10:56:31 -0800 (PST) X-Received: by 10.66.84.98 with SMTP id x2mr5207974pay.10.1356893791537; Sun, 30 Dec 2012 10:56:31 -0800 (PST) Received: from server.prisktech.co.nz (server.prisktech.co.nz. [115.188.14.127]) by gmr-mx.google.com with ESMTP id js4si7757021pbb.2.2012.12.30.10.56.30; Sun, 30 Dec 2012 10:56:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux@prisktech.co.nz designates 115.188.14.127 as permitted sender) client-ip=115.188.14.127; Received: from localhost.localdomain (unknown [192.168.0.102]) by server.prisktech.co.nz (Postfix) with ESMTP id BFB0CFC0753; Mon, 31 Dec 2012 07:56:28 +1300 (NZDT) From: Tony Prisk To: Alessandro Zummo Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, vt8500-wm8505-linux-kernel@googlegroups.com, rtc-linux@googlegroups.com, Tony Prisk , Edgar Toernig Subject: [rtc-linux] [PATCH] rtc: vt8500: Fix year field in vt8500_rtc_set_time Date: Mon, 31 Dec 2012 07:56:33 +1300 Message-Id: <1356893793-29537-1-git-send-email-linux@prisktech.co.nz> X-Mailer: git-send-email 1.7.9.5 X-Original-Sender: linux@prisktech.co.nz X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of linux@prisktech.co.nz designates 115.188.14.127 as permitted sender) smtp.mail=linux@prisktech.co.nz Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , year field is incorrectly masked when setting the date. If the year is beyond 2099, the year field will be incorrectly updated in hardware. This patch masks the year field correctly. Signed-off-by: Edgar Toernig Signed-off-by: Tony Prisk --- Patch based on 3.8-rc1 drivers/rtc/rtc-vt8500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index 14e2d8c..37b42a4 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c @@ -137,7 +137,7 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm) return -EINVAL; } - writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S) + writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S) | (bin2bcd(tm->tm_mon) << DATE_MONTH_S) | (bin2bcd(tm->tm_mday)), vt8500_rtc->regbase + VT8500_RTC_DS);