From patchwork Fri Jun 16 14:03:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105745 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1321292qgd; Fri, 16 Jun 2017 07:05:21 -0700 (PDT) X-Received: by 10.98.194.73 with SMTP id l70mr11366773pfg.41.1497621921625; Fri, 16 Jun 2017 07:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497621921; cv=none; d=google.com; s=arc-20160816; b=DQVEmmGlQp2vTL3WrPljaZSWA4IOO6opYP9jmF5MdVzcAVmiJ0pTRoH6dI8h7yQsFx gfql2vJW5aq0FFuLr9VsUEBA8Hgj3OoudclYPKniy4/JQZoNakmrDjcvRXQcFgoF8KKe zJjvAOOePz/x0OrMS7kCwZEusDF6xlOJfv22z69HchGbZ7VJj+oE8NQvlxMQKtfFQXlB uv1OKkhxWWwLkm++HLSoYn2bgEmC1K9sKHYYynzevzPdbvntbCe4punIebrJaFOrlbWH s4TIV8j4PLx18JJ/wPyq6p4ppiEV3urpcAquJbqVCi5oYNT+9hrdaQ/1rMvpWFMG2B+Q 9H2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=eiHv0oMn0k6aIVeR4xggkXoaEeWeFZlTz3U+ZBfxpQ8=; b=Y77IsjnM+G6kYr0NSeFEPhFR4Pwv1XP3CXdSMXE4mH4m/neNx6MTZOTBNOKNS9NU+O hJIc51dBVajhcmIS7OITCpnwMFyJ1voIsYyLmSQtmfgV/sG/eNqpH7sYPWw4FMfLIvrd 3qyrzMaSCDr+rCZZOku8OSCPpDXG9lizXz4M6r88tytU/Kwixt9OH0T6wikQmrwuaGp4 tEpYUYE2G5sbO+RwAgqj6skZu9PKzVNhKI2VAbD/mUD+KiZfsQfZvJdyhbXXL+vHJaNd /QJlJwb00oCjO5QsZ1gPKK4wm/DZY2BRQ6kFH5F0TrZT16i93ompE8T1wDZkPPuTusS3 8FQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=FFacmVlI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f192si2049730pgc.179.2017.06.16.07.05.21; Fri, 16 Jun 2017 07:05:21 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.b=FFacmVlI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754022AbdFPOEw (ORCPT + 25 others); Fri, 16 Jun 2017 10:04:52 -0400 Received: from mail-wr0-f178.google.com ([209.85.128.178]:34947 "EHLO mail-wr0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753101AbdFPOEu (ORCPT ); Fri, 16 Jun 2017 10:04:50 -0400 Received: by mail-wr0-f178.google.com with SMTP id q97so38996349wrb.2 for ; Fri, 16 Jun 2017 07:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=eiHv0oMn0k6aIVeR4xggkXoaEeWeFZlTz3U+ZBfxpQ8=; b=FFacmVlIHej+eTFZ75B1kn1BwpV2P0SxT5wjAcO+9dfYzzSSphSuYHf2gLWutHISzN vbHlJiYhN3wDhfE9nppbCuaNro3OzqdE9VNzhSEHpig0cREdme3q+urSckhL32CPGOdE 7TIG0dekD6xM907Qgs/XIKaaMaBJv+cJGCulQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eiHv0oMn0k6aIVeR4xggkXoaEeWeFZlTz3U+ZBfxpQ8=; b=YA/uxvoFxOcU3xYii2V3HQWk4TegCyrjWFxQicUkcUbt2SXIEI33+g+0PkDMWELy9/ nmr0lXdFLmP7oX+3KX1PfIejplbKkdMvmHaor67KZLNLWSvquH4gO8pNVvrlGkKEewB4 MF8RBgyhBsrtzEq9OeicYl80OAwfaDoRWq3sOpwyxkBxcpdhEBzuhAYIxN2bSDlIgYFB oliYIEqGOSO7aHCtkK4LCvabodnAp7CEkFJM9lAgPO8/0unkRwpmGie7bv4l5fyHztTT 2IQ4dtVBWcNtdVVGh8Azo5EFt3mT8OB3uciu4nD5jhEFjBefx5VD94X00oKaDwt+ljcb OWIg== X-Gm-Message-State: AKS2vOwUoucxrjc/iqbfsUCI29ZbIcU0ZfuAMni1z+/0roAd61tN1ePm zrkNrdv/T32ObMLg X-Received: by 10.223.157.25 with SMTP id k25mr7981647wre.156.1497621888961; Fri, 16 Jun 2017 07:04:48 -0700 (PDT) Received: from lmenx321.st.com. ([80.214.78.131]) by smtp.gmail.com with ESMTPSA id h12sm1883277wrc.43.2017.06.16.07.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Jun 2017 07:04:48 -0700 (PDT) From: Benjamin Gaignard To: john.stultz@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, patrice.chotard@st.com, a.zummo@towertech.it, alexandre.belloni@free-electrons.com, linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com Cc: linaro-kernel@lists.linaro.org, Benjamin Gaignard Subject: [PATCH 0/3] rtc: make st-lpc robust against y2038/2106 bug Date: Fri, 16 Jun 2017 16:03:50 +0200 Message-Id: <1497621833-9942-1-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 32bits platforms "struct timeval" or "time_t" are using u32 to code the date, this cause tools like "date" or "hwclock" failed even before setting the RTC device if the date is superior to year 2038 (or 2106). To avoid this problem I add two RTC tests files which directly use RTC ioctl to set and read RTC time and alarm values. rtctest_setdate allow to set any date/time given in the command line. rtctest-2038 perform a basic test by writing 1-1-2200 in RTC time and alarm and checking that the read back values are correct. Finally that had allowed me to test and fix rtc-st-lpc driver. Benjamin Gaignard (3): tools: timer: add rtctest_setdate tools: timer: add test to check y2038/2106 bug rtc: st-lpc: make it robust against y2038/2106 bug drivers/rtc/rtc-st-lpc.c | 19 ++-- tools/testing/selftests/timers/Makefile | 4 +- tools/testing/selftests/timers/rtctest-2038.c | 135 +++++++++++++++++++++++ tools/testing/selftests/timers/rtctest_setdate.c | 86 +++++++++++++++ 4 files changed, 232 insertions(+), 12 deletions(-) create mode 100644 tools/testing/selftests/timers/rtctest-2038.c create mode 100644 tools/testing/selftests/timers/rtctest_setdate.c -- 1.9.1