From patchwork Tue Jun 19 14:02:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139127 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5248588lji; Tue, 19 Jun 2018 07:04:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLXLiBddm13B4FNXVhSnN155SVcUh9UJ/fXF3Oenz4kdfTGEsr+9JOpORdzQtkso+/gUiXw X-Received: by 2002:a62:444c:: with SMTP id r73-v6mr18287647pfa.255.1529417068243; Tue, 19 Jun 2018 07:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529417068; cv=none; d=google.com; s=arc-20160816; b=Ew7g2+J9dwkU4VYCGklDCUL3WLDmeZIZ3V5m5SeLPoqMQ0s43UILePgx79FqGshKNL kX0RM5dxHtkwf7vr5yP1Ifkq+k53JYffZaM7V3j1Cm4rJkm7foi0erYR5jLkRw8Xw0Qr 5vY40Q5hNlbJI5dCwWuBWWaxLbLFNJq3XrxHmb9T2wTx1XSD578CypPGJ7V6wzoZ+oR/ CkogLNtPVY4HckoVgfJ/Wzg1FuUNPo2UeGfod9TTrvAhHb3W0yKXYqSuQYClrP76d712 WKuhnLRPc/BOkxxUYK2z7ZUdtt4TbRKBUFOiQUgIufV1aWKIjZoIxKruEhuKEMQf0kgz B4ww== 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 :arc-authentication-results; bh=FwOGAXSmA7ldFlpKnMInJPxXK4LF1H0b63pTBHRv/wY=; b=B/kVQ+Vivi0Gy1GFbA0GbH/+Af3NRKOLviXBSRf3ebAz6qJQ+oqdOG7UhyVhm1t/8N v8PplVaDaL0iDM0QphK+AU0iMFVUEFZ9JOaxFmByH4st6oEJgb0CAwiK0Jr0PgcE81p/ xl2+e+gBeWhjwRWJHKKNiCvE/TMfVWoOWIwVxZRF+MzNWIzS/kxzD63mcUtjHYpjpEIB 5vQjkXfjnvsypmqKgo4hpbxJs+cUoSzUykQCJORvHAROwb4l+AT+XmycmDj5nkFLBVIf j/CmKCCyOH+SaWNNioqft3Po1a1ZpbQRGN+QWZ5C4qGujYm/k3cYtkjoh2qoJu//QcU1 TWNw== 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 f3-v6si13965945pgp.496.2018.06.19.07.04.27; Tue, 19 Jun 2018 07:04:28 -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; 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 S1756005AbeFSOEP (ORCPT + 30 others); Tue, 19 Jun 2018 10:04:15 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:39583 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965688AbeFSOEK (ORCPT ); Tue, 19 Jun 2018 10:04:10 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MVV8g-1fi2Hw1jig-00Yged; Tue, 19 Jun 2018 16:02:54 +0200 From: Arnd Bergmann To: Paul Mackerras , Michael Ellerman , Geert Uytterhoeven , Joshua Thompson Cc: Mathieu Malaterre , Benjamin Herrenschmidt , Greg Ungerer , linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Meelis Roos , Andreas Schwab , Arnd Bergmann Subject: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions Date: Tue, 19 Jun 2018 16:02:27 +0200 Message-Id: <20180619140229.3615110-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:iis7jj1S1jizfZfiIt7caPncO9M3AZTOsho/OZGf++hvGlEvt6m VM0K+Zdu6snHQVjFJPFFk6dmazQ6SaO5tz4z2WWxHi/80DmDJNT/+I5D4ZI69FkdMyvCUoK g4cBAEFB18yG93BiaEOIeN0aWeTeFHlPI1zwJ8KZwr/hG0a9Mg9onSx4mwkSBuaSbDP3Drz 7UfKE16FLEZkYj/vNDUGQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:9atu+VflZP8=:bb/gnLFmPYwVnB2YW4Navx 7S5W9W7o2YcW308+QtTg7c+gUv5dw6VZaiGQwnvMLerYB4FIvndA8kYQ3sbYXPcfYaE2Zh2tJ RSRSXSx5TqqLv5QHYmZQxqVtgLdCKK4ypli/HWLtNu9JY0holl6eiWzcL2O/j3SweD7CdRJFc OtvbeBtkfAekwsjNJmy3+BhWvuFHpmHcPvCJvibDQdavXaKSPERCg9k6R+wRCABXZqzpwCnIc oj78m4PC67RhMeMC9jTAqLVcW/BB4fS8sWM4PlvYzK6mDBde8EN/13Ntn0eIAxeWVibbcYMZV GA32ecoM/WDbQjpoTuHPitXb6olHCPMpfn65d0g+7jyvlYnv/ARttuiOkTVMqTsVDZKitF5oi W05K2pqMPRp3zLnrqMANIb0xxFL7iaqxInyICnJLvnK5bukByQvrWA5wM5cT1/+C3D1d/OM8E 4w//1e9wKtoC/jANniFLPf8D0sQDaYi29fjE1LH+7oVNIi4ABPr5LQfDYsVDd3wxLRrxIkHUO moIo9GsF3wZw+WaoHAjUa1e6UeQSMJA6/KhSNFA5FYjHN/j7dEx0A1sRaKV7ZJM7AZgKWlUYj Fdf7GSS9eOwCXlLzAShEPf9JYzCi7BEwKI8Dd4rsmW4YUvhoh1QnZMyQGqlQrUfDFcYTWieq6 N5Jm9C2yv3tOShsbud6VXLnQfOYk1SWRMpfNp+DI0yQ2oTCWM6UCRn3mi9/YSw1INrgM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As Mathieu pointed out, my conversion to time64_t was incorrect and resulted in negative times to be read from the RTC. The problem is that during the conversion from a byte array to a time64_t, the 'unsigned char' variable holding the top byte gets turned into a negative signed 32-bit integer before being assigned to the 64-bit variable for any times after 1972. This changes the logic to cast to an unsigned 32-bit number first for the Macintosh time and then convert that to the Unix time, which then gives us a time in the documented 1904..2040 year range. I decided not to use the longer 1970..2106 range that other drivers use, for consistency with the literal interpretation of the register, but that could be easily changed if we decide we want to support any Mac after 2040. Just to be on the safe side, I'm also adding a WARN_ON that will trigger if either the year 2040 has come and is observed by this driver, or we run into an RTC that got set back to a pre-1970 date for some reason (the two are indistinguishable). For the RTC write functions, Andreas found another problem: both pmu_request() and cuda_request() are varargs functions, so changing the type of the arguments passed into them from 32 bit to 64 bit breaks the API for the set_rtc_time functions. This changes it back to 32 bits. The same code exists in arch/m68k/ and is patched in an identical way now in a separate patch. Fixes: 5bfd643583b2 ("powerpc: use time64_t in read_persistent_clock") Reported-by: Mathieu Malaterre Reported-by: Andreas Schwab Signed-off-by: Arnd Bergmann --- arch/powerpc/platforms/powermac/time.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) -- 2.9.0 Tested-by: Mathieu Malaterre diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c index 7c968e46736f..12e6e4d30602 100644 --- a/arch/powerpc/platforms/powermac/time.c +++ b/arch/powerpc/platforms/powermac/time.c @@ -42,7 +42,11 @@ #define DBG(x...) #endif -/* Apparently the RTC stores seconds since 1 Jan 1904 */ +/* + * Offset between Unix time (1970-based) and Mac time (1904-based). Cuda and PMU + * times wrap in 2040. If we need to handle later times, the read_time functions + * need to be changed to interpret wrapped times as post-2040. + */ #define RTC_OFFSET 2082844800 /* @@ -97,8 +101,11 @@ static time64_t cuda_get_time(void) if (req.reply_len != 7) printk(KERN_ERR "cuda_get_time: got %d byte reply\n", req.reply_len); - now = (req.reply[3] << 24) + (req.reply[4] << 16) - + (req.reply[5] << 8) + req.reply[6]; + now = (u32)((req.reply[3] << 24) + (req.reply[4] << 16) + + (req.reply[5] << 8) + req.reply[6]); + /* it's either after year 2040, or the RTC has gone backwards */ + WARN_ON(now < RTC_OFFSET); + return now - RTC_OFFSET; } @@ -106,10 +113,10 @@ static time64_t cuda_get_time(void) static int cuda_set_rtc_time(struct rtc_time *tm) { - time64_t nowtime; + u32 nowtime; struct adb_request req; - nowtime = rtc_tm_to_time64(tm) + RTC_OFFSET; + nowtime = lower_32_bits(rtc_tm_to_time64(tm) + RTC_OFFSET); if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) @@ -140,8 +147,12 @@ static time64_t pmu_get_time(void) if (req.reply_len != 4) printk(KERN_ERR "pmu_get_time: got %d byte reply from PMU\n", req.reply_len); - now = (req.reply[0] << 24) + (req.reply[1] << 16) - + (req.reply[2] << 8) + req.reply[3]; + now = (u32)((req.reply[0] << 24) + (req.reply[1] << 16) + + (req.reply[2] << 8) + req.reply[3]); + + /* it's either after year 2040, or the RTC has gone backwards */ + WARN_ON(now < RTC_OFFSET); + return now - RTC_OFFSET; } @@ -149,10 +160,10 @@ static time64_t pmu_get_time(void) static int pmu_set_rtc_time(struct rtc_time *tm) { - time64_t nowtime; + u32 nowtime; struct adb_request req; - nowtime = rtc_tm_to_time64(tm) + RTC_OFFSET; + nowtime = lower_32_bits(rtc_tm_to_time64(tm) + RTC_OFFSET); if (pmu_request(&req, NULL, 5, PMU_SET_RTC, nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) return -ENXIO; From patchwork Tue Jun 19 14:02:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139126 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5248338lji; Tue, 19 Jun 2018 07:04:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKnV69U2Ynb4HYPpbikCQCWO7xYjucHHx27JOYlAZx+UaCp75PcHp4x5JkrwKEWk6faFUBF X-Received: by 2002:a17:902:784d:: with SMTP id e13-v6mr18717392pln.197.1529417059083; Tue, 19 Jun 2018 07:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529417059; cv=none; d=google.com; s=arc-20160816; b=H7DHrQD6lP4P9E9zgstf7nkCRurNz2rfYGGsycA5ydSCg8ZoKos3S/lOpsAWawanNw ldxX1TPTnaue/wdRgPWpASNrsaIpheJ47kIK6ijRaUvgZ+h/+Kp0E4xjXUb3zyFQv7af OKiwTacthmuNJr+mQqDuGsGJsXw9fEyV0TJxDi751mzEVhqGnyG5E93IOLXtHrpZST01 xw7jn03OXMBCz6JVOndPJ2H6YD/EhVu+Os36iQPFDfh+BEKCzuln3oF5M2zvS2wbbdwY eD+3ulssqMuIbOGxyH4OMbvmvEGcvVEDoHJneB1Yh2CimhvT4fKsCIxjXjD8hJQnI1Ku qZUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=q1+/09T+nlWGIKYqejjXalUxnWWqKIiz6GDB0ud/Jck=; b=lu9JiCmzh7kPfMN7Q8ikKKZtMB/0VXnfIz8AXCHehqQPcZHbGrwvMIaKOMoGpVc65z OOUJkhYZ5/8kdXvKlXmNVbHMB039tmpnZ3IycpAWY5HnvVrGS5NS15dUK/z/nk6Ex/TR PJUAIMIR9HMG/wUYOF20Au+ndkKeWm3K/AiQADrR1FZLtYQyGrzpPRF9+GIgVFrCrF4m UmM6H5La/PQd2arrED5/+UPdgO5cft60/pW6QVsf4psBuq5gWhQTiNyp5+Ox5Ma05+3H yZey1U23UnHJqbeuV1f6RrYbgeyFjcwg1g3kUpcqUPuNKO0TRXwGQSis/gm0ly7z1bpH zUFA== 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 f3-v6si13965945pgp.496.2018.06.19.07.04.18; Tue, 19 Jun 2018 07:04:19 -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; 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 S1756613AbeFSOEQ (ORCPT + 30 others); Tue, 19 Jun 2018 10:04:16 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:41145 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965978AbeFSOEK (ORCPT ); Tue, 19 Jun 2018 10:04:10 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MZ5db-1fisAf3cKR-00VfJS; Tue, 19 Jun 2018 16:02:54 +0200 From: Arnd Bergmann To: Paul Mackerras , Michael Ellerman , Geert Uytterhoeven , Joshua Thompson Cc: Mathieu Malaterre , Benjamin Herrenschmidt , Greg Ungerer , linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Meelis Roos , Andreas Schwab , Arnd Bergmann Subject: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling Date: Tue, 19 Jun 2018 16:02:28 +0200 Message-Id: <20180619140229.3615110-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180619140229.3615110-1-arnd@arndb.de> References: <20180619140229.3615110-1-arnd@arndb.de> X-Provags-ID: V03:K1:VHjC0uYkHauenmwHCCfCUzcKGf8oIogO8BdSZoKS4lDiBvwPOUq DmVMz9G2Yf0RmtYl2sLcdE5ZMPaYWwqFi2cKKORMeC9piq9q6ekiU01dcHTW/HbjA6hpsXf hJHKxMkQ1rw3nG7+AEOmgN33+8ab/X93cKd5VoqyhQ9/6D0ej2kcf0EQv1RRfI19wp+bYhC 5gfyqbUDpjt9yR1jCLocw== X-UI-Out-Filterresults: notjunk:1; V01:K0:zhO/DQIPP9c=:6BnvwIt5v+9XMcfO9Hqog3 QQHgp7fw2+eiVKHcxlxy1wVlsJILKIFu37yFtV3ukqKSDkH7FIBp3n27P5HkPUEf4iHdZ4u84 hgaPL7/Qas3uG6dBUTs/hyEEaaQIz5wGooRd3KtOyrSbzqFB+6R8miboHLWdNnJjUgTHJjARw Drp3Mz0IIes6DPoZhVIaIqj+rlXOu2aitKIN8kT1zMQU9uqVcb/ZCvi2WyytPTdHELQ0I/3xx b3O7CXeR7fF0Z0tBlWuwDhyrO1UoN1ZNln2wMGYoTJfFaHNNMp3zQbvtjjdNSp+swBC8N9/oo gShgNI20WpI9oqPEkfcKSvAPTP5SPjj0PZQlVBIFyuh8uhRI2vX2bF2nosDm4rdiq5JOo1Rpi wS3BnucaJOmPLboDRIbqjPePbAGbGjqhnCBbZcOhJP6crlwW34aROmtq3p8NN8xHFvxGVtpaC Vx6ZkqaRpXar6rjjDTWHrJgpARjx1V3YeNpRiaHIzowp3ZUynYRtEvswRnh5Q/ylFCYuEQV9q 0vjI6zMwF6xNmiaF63PKBob/jn9dRBH6AWVmuinuNNvW9+i1PP3zBMMqGGPIcvQjzhYUnQkK5 uDg4ASxF9kpnEH827vtAGNnZtOadiQLX6ivNBquC0aY+wtWaWIAwxCmqHmkp2f2bkc4ANxDs3 BJ1UqiPAFfFslarNjoJFeIOhLwSSTpNf5KAHMcDlAcjMo8M385eoQFuKJCdeCnb3DYNM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The real-time clock on m68k (and powerpc) mac systems uses an unsigned 32-bit value starting in 1904, which overflows in 2040, about two years later than everyone else, but this gets wrapped around in the Linux code in 2038 already because of the deprecated usage of time_t and/or long in the conversion. Getting rid of the deprecated interfaces makes it work until 2040 as documented, and it could be easily extended by reinterpreting the resulting time64_t as a positive number. For the moment, I'm adding a WARN_ON() that triggers if we encounter a time before 1970 or after 2040 (the two are indistinguishable). This brings it in line with the corresponding code that we have on powerpc macintosh. Signed-off-by: Arnd Bergmann --- v2: Fix varargs passing bug pointed out by Andreas Schwab Fix a typo that caused a build regression --- arch/m68k/mac/misc.c | 62 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 23 deletions(-) -- 2.9.0 diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index c68054361615..0a2572a6bfe5 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -26,33 +26,39 @@ #include -/* Offset between Unix time (1970-based) and Mac time (1904-based) */ +/* Offset between Unix time (1970-based) and Mac time (1904-based). Cuda and PMU + * times wrap in 2040. If we need to handle later times, the read_time functions + * need to be changed to interpret wrapped times as post-2040. */ #define RTC_OFFSET 2082844800 static void (*rom_reset)(void); #ifdef CONFIG_ADB_CUDA -static long cuda_read_time(void) +static time64_t cuda_read_time(void) { struct adb_request req; - long time; + time64_t time; if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0) return 0; while (!req.complete) cuda_poll(); - time = (req.reply[3] << 24) | (req.reply[4] << 16) | - (req.reply[5] << 8) | req.reply[6]; + time = (u32)((req.reply[3] << 24) | (req.reply[4] << 16) | + (req.reply[5] << 8) | req.reply[6]); + + /* it's either after year 2040, or the RTC has gone backwards */ + WARN_ON(time < RTC_OFFSET); + return time - RTC_OFFSET; } -static void cuda_write_time(long data) +static void cuda_write_time(time64_t time) { struct adb_request req; + u32 data = lower_32_bits(time + RTC_OFFSET); - data += RTC_OFFSET; if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, (data >> 24) & 0xFF, (data >> 16) & 0xFF, (data >> 8) & 0xFF, data & 0xFF) < 0) @@ -86,26 +92,30 @@ static void cuda_write_pram(int offset, __u8 data) #endif /* CONFIG_ADB_CUDA */ #ifdef CONFIG_ADB_PMU68K -static long pmu_read_time(void) +static time64_t pmu_read_time(void) { struct adb_request req; - long time; + time64_t time; if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0) return 0; while (!req.complete) pmu_poll(); - time = (req.reply[1] << 24) | (req.reply[2] << 16) | - (req.reply[3] << 8) | req.reply[4]; + time = (u32)((req.reply[1] << 24) | (req.reply[2] << 16) | + (req.reply[3] << 8) | req.reply[4]); + + /* it's either after year 2040, or the RTC has gone backwards */ + WARN_ON(time < RTC_OFFSET); + return time - RTC_OFFSET; } -static void pmu_write_time(long data) +static void pmu_write_time(time64_t time) { struct adb_request req; + u32 data = lower_32_bits(time + RTC_OFFSET); - data += RTC_OFFSET; if (pmu_request(&req, NULL, 5, PMU_SET_RTC, (data >> 24) & 0xFF, (data >> 16) & 0xFF, (data >> 8) & 0xFF, data & 0xFF) < 0) @@ -269,8 +279,12 @@ static long via_read_time(void) via_pram_command(0x89, &result.cdata[1]); via_pram_command(0x8D, &result.cdata[0]); - if (result.idata == last_result.idata) + if (result.idata == last_result.idata) { + if (result.idata < RTC_OFFSET) + result.idata += 0x100000000ull; + return result.idata - RTC_OFFSET; + } if (++count > 10) break; @@ -291,11 +305,11 @@ static long via_read_time(void) * is basically any machine with Mac II-style ADB. */ -static void via_write_time(long time) +static void via_write_time(time64_t time) { union { __u8 cdata[4]; - long idata; + __u32 idata; } data; __u8 temp; @@ -585,12 +599,15 @@ void mac_reset(void) * This function translates seconds since 1970 into a proper date. * * Algorithm cribbed from glibc2.1, __offtime(). + * + * This is roughly same as rtc_time64_to_tm(), which we should probably + * use here, but it's only available when CONFIG_RTC_LIB is enabled. */ #define SECS_PER_MINUTE (60) #define SECS_PER_HOUR (SECS_PER_MINUTE * 60) #define SECS_PER_DAY (SECS_PER_HOUR * 24) -static void unmktime(unsigned long time, long offset, +static void unmktime(time64_t time, long offset, int *yearp, int *monp, int *dayp, int *hourp, int *minp, int *secp) { @@ -602,11 +619,10 @@ static void unmktime(unsigned long time, long offset, /* Leap years. */ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; - long int days, rem, y, wday, yday; + int days, rem, y, wday, yday; const unsigned short int *ip; - days = time / SECS_PER_DAY; - rem = time % SECS_PER_DAY; + days = div_u64_rem(time, SECS_PER_DAY, &rem); rem += offset; while (rem < 0) { rem += SECS_PER_DAY; @@ -657,7 +673,7 @@ static void unmktime(unsigned long time, long offset, int mac_hwclk(int op, struct rtc_time *t) { - unsigned long now; + time64_t now; if (!op) { /* read */ switch (macintosh_config->adb_type) { @@ -693,8 +709,8 @@ int mac_hwclk(int op, struct rtc_time *t) __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); - now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); + now = mktime64(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); switch (macintosh_config->adb_type) { case MAC_ADB_IOP: From patchwork Tue Jun 19 14:02:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139128 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5248922lji; Tue, 19 Jun 2018 07:04:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJsBZT06avLGnAKYVKRC0XivVD1ok3gGj69vxvPbX0N6peEiwxiCKaiqsErWEkjtxfqfVli X-Received: by 2002:a65:4b82:: with SMTP id t2-v6mr14652615pgq.175.1529417081208; Tue, 19 Jun 2018 07:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529417081; cv=none; d=google.com; s=arc-20160816; b=n9hHcHD2mB13PdI2GubS844JSaZknZzkE74x9FYBG2E7xR6URFXg1hSh6t4RzUFIJX 2Q4WOMzDSpsVIv5PoBLKO782AMVpYzOyWQ0zuaA+Ei3aXL1WsyzBh38++wf+kq9Ossiq XObcYxbSzYc5v6pqlOTvsZya1b9X/ZR6nnUIjEC61/Ku0m0EIcfp+nujmd3aeJYeRHly NEUp+DSgGozeAH1ELf076ZF22I9N4sS3UCiTnbq5OFddasvQ4uv0uXQQ+LCK9D9x7BSF QEH46Ep24cltkpBs6S1qnSCbE5F/J+ZJM9kM0RdU7xoWF4pV6xwxD9U8iQF4xgkbwQRH 1DvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mk0bbg7t3rsVvUAXy/46SEr7eSiRbiVv8UtLveXkXc0=; b=k38bnXpRNeCRyL331SLM9MMSU0rg3Oa+sbUEy6HtktTdefvQFd8dlumDxRmChuHMt8 NppKHIdEMeQMSDQRG7Y2yX+2vwMHZj/cM6M2CE4Ukaa05juvkVewLjF35uxEk2sM5PzL JhRly4cb3MZSU0pqjszL/eQ0FsKQnbxj1Lb/jcliVhYoVvefGBj/5imPco//uZhpsFvA R3LHmrD0Jj+NigHiYpvTWe7qhgM74JTXUU11kzojx29N6I6sfiuEC27KJBlPXugJRlhY 34DeCec6vWt9VJcOxL9mwLql8kw0Ak0Qaw20ePXlUJWvZMQg9I6Tv6tDRbQW26KNP3ql kCsg== 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 f3-v6si13965945pgp.496.2018.06.19.07.04.40; Tue, 19 Jun 2018 07:04:41 -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; 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 S1756905AbeFSOEi (ORCPT + 30 others); Tue, 19 Jun 2018 10:04:38 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:36443 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966044AbeFSOEL (ORCPT ); Tue, 19 Jun 2018 10:04:11 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0LaOJ5-1fv0jI1M9n-00mNrC; Tue, 19 Jun 2018 16:02:55 +0200 From: Arnd Bergmann To: Paul Mackerras , Michael Ellerman , Geert Uytterhoeven , Joshua Thompson Cc: Mathieu Malaterre , Benjamin Herrenschmidt , Greg Ungerer , linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Meelis Roos , Andreas Schwab , Arnd Bergmann Subject: [PATCH 3/3] [v2] m68k: remove unused set_clock_mmss() helpers Date: Tue, 19 Jun 2018 16:02:29 +0200 Message-Id: <20180619140229.3615110-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180619140229.3615110-1-arnd@arndb.de> References: <20180619140229.3615110-1-arnd@arndb.de> X-Provags-ID: V03:K1:wJsUWwh6n33yEdmQVue12NpQBwuUugDEbajBk7+ATaOJuhiDMFB eLAdNiReVI7aRzWLtu7ks5d0W0HERICHItR0KUc1aXLH/YJ3vjvMzvKr4MxuNZFLcVDdp2R L4btZCUZF2ifHampHXBOPZuckgz5eHKHFsfEC9WxG2y2bYmUqB7srJaNk+Y+7Ff4rphl2KB ITgrCMKvjipFzSNOW1GqA== X-UI-Out-Filterresults: notjunk:1; V01:K0:E1TNYNOpmaw=:/arcP1D2r9yXNdt9PUvNCO NJVg5DIMWRC/+Vg6wcKJZVpfzId6xWj2LTkRZdO/aQFon0K7nWqlXzESJ+Yf0pKdYbFGg8b1o +wvBThSaOEikQYgDKa1Keth7gfYU+ybC0bSzw4wDvxTyxiS/cXgKbsilhccBsxJfDhAdCGOfR 9vT4hDKkqTvrMIXdhEu86193jalmpxx/OtA5A0jl+IEXBKAUx6zxgy2lYEZMpxh/FC0z6MV1v I145ZuynLt7pu2PAEaaO90BBCii7QAzrmmrz1AppMzlJxb8Cfs4jAZpTD2xVLtzj5Lq2coe+M XJxxxOL8TsEm/k/uUpZzEahGciXrEmvX+cAD6dH3p7ungc9/qbWnICdpn2vC8JiZ9jkt1mL6J YNEhvv7biKK2+4bbB7paymwaAPG2djINYhsd+YU9RIA/5bg3RM8500qjLXl/GGqNwrSmOWlBd nklxKAWtDMUyMqMWqiRGCVM077BIVWNKHeJXU626cS75UITt6a54Z0FdrW0m8HFFZ2g8G2/mh z6z2kNzuJTz6tQQRMdkw18Md34pu79hI5K9nlgadqauaBthfR9JnX8XumY9egT+CvUFqCrfIB 3Di+1qatGRbcrrUeornSsyZrh1h9c0vfNZz3ddxre4ApeS0jxu/E8jC/+jwDOph4SvwCvhDTc UB/SthGv7wGluZ9hzykntuNQFWYrzaAXcWWVOyGSWu0r+HtsRwmO+A38nuimf2+0nt/A= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 397ac99c6cef ("m68k: remove dead timer code") removed set_rtc_mmss() because it was unused in 2012. However, this was itself the only user of the mach_set_clock_mmss() callback and the many implementations of that callback, which are equally unused. This removes all of those as well. Acked-by: Greg Ungerer Signed-off-by: Arnd Bergmann --- v2: no changes --- arch/m68k/apollo/config.c | 8 ------ arch/m68k/atari/config.c | 5 ---- arch/m68k/atari/time.c | 63 ----------------------------------------- arch/m68k/bvme6000/config.c | 45 ----------------------------- arch/m68k/include/asm/machdep.h | 1 - arch/m68k/kernel/setup_mm.c | 1 - arch/m68k/kernel/setup_no.c | 1 - arch/m68k/mac/config.c | 2 -- arch/m68k/mac/misc.c | 16 ----------- arch/m68k/mvme147/config.c | 7 ----- arch/m68k/mvme16x/config.c | 8 ------ arch/m68k/q40/config.c | 30 -------------------- 12 files changed, 187 deletions(-) -- 2.9.0 diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c index b2a6bc63f8cd..aef8d42e078d 100644 --- a/arch/m68k/apollo/config.c +++ b/arch/m68k/apollo/config.c @@ -31,7 +31,6 @@ extern void dn_sched_init(irq_handler_t handler); extern void dn_init_IRQ(void); extern u32 dn_gettimeoffset(void); extern int dn_dummy_hwclk(int, struct rtc_time *); -extern int dn_dummy_set_clock_mmss(unsigned long); extern void dn_dummy_reset(void); #ifdef CONFIG_HEARTBEAT static void dn_heartbeat(int on); @@ -156,7 +155,6 @@ void __init config_apollo(void) arch_gettimeoffset = dn_gettimeoffset; mach_max_dma_address = 0xffffffff; mach_hwclk = dn_dummy_hwclk; /* */ - mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */ mach_reset = dn_dummy_reset; /* */ #ifdef CONFIG_HEARTBEAT mach_heartbeat = dn_heartbeat; @@ -240,12 +238,6 @@ int dn_dummy_hwclk(int op, struct rtc_time *t) { } -int dn_dummy_set_clock_mmss(unsigned long nowtime) -{ - pr_info("set_clock_mmss\n"); - return 0; -} - void dn_dummy_reset(void) { dn_serial_print("The end !\n"); diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index 565c6f06ab0b..bd96702a1ad0 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -81,9 +81,6 @@ extern void atari_sched_init(irq_handler_t); extern u32 atari_gettimeoffset(void); extern int atari_mste_hwclk (int, struct rtc_time *); extern int atari_tt_hwclk (int, struct rtc_time *); -extern int atari_mste_set_clock_mmss (unsigned long); -extern int atari_tt_set_clock_mmss (unsigned long); - /* ++roman: This is a more elaborate test for an SCC chip, since the plain * Medusa board generates DTACK at the SCC's standard addresses, but a SCC @@ -362,13 +359,11 @@ void __init config_atari(void) ATARIHW_SET(TT_CLK); pr_cont(" TT_CLK"); mach_hwclk = atari_tt_hwclk; - mach_set_clock_mmss = atari_tt_set_clock_mmss; } if (hwreg_present(&mste_rtc.sec_ones)) { ATARIHW_SET(MSTE_CLK); pr_cont(" MSTE_CLK"); mach_hwclk = atari_mste_hwclk; - mach_set_clock_mmss = atari_mste_set_clock_mmss; } if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) && hwreg_write(&dma_wd.fdc_speed, 0)) { diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c index c549b48174ec..9cca64286464 100644 --- a/arch/m68k/atari/time.c +++ b/arch/m68k/atari/time.c @@ -285,69 +285,6 @@ int atari_tt_hwclk( int op, struct rtc_time *t ) return( 0 ); } - -int atari_mste_set_clock_mmss (unsigned long nowtime) -{ - short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; - struct MSTE_RTC val; - unsigned char rtc_minutes; - - mste_read(&val); - rtc_minutes= val.min_ones + val.min_tens * 10; - if ((rtc_minutes < real_minutes - ? real_minutes - rtc_minutes - : rtc_minutes - real_minutes) < 30) - { - val.sec_ones = real_seconds % 10; - val.sec_tens = real_seconds / 10; - val.min_ones = real_minutes % 10; - val.min_tens = real_minutes / 10; - mste_write(&val); - } - else - return -1; - return 0; -} - -int atari_tt_set_clock_mmss (unsigned long nowtime) -{ - int retval = 0; - short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; - unsigned char save_control, save_freq_select, rtc_minutes; - - save_control = RTC_READ (RTC_CONTROL); /* tell the clock it's being set */ - RTC_WRITE (RTC_CONTROL, save_control | RTC_SET); - - save_freq_select = RTC_READ (RTC_FREQ_SELECT); /* stop and reset prescaler */ - RTC_WRITE (RTC_FREQ_SELECT, save_freq_select | RTC_DIV_RESET2); - - rtc_minutes = RTC_READ (RTC_MINUTES); - if (!(save_control & RTC_DM_BINARY)) - rtc_minutes = bcd2bin(rtc_minutes); - - /* Since we're only adjusting minutes and seconds, don't interfere - with hour overflow. This avoids messing with unknown time zones - but requires your RTC not to be off by more than 30 minutes. */ - if ((rtc_minutes < real_minutes - ? real_minutes - rtc_minutes - : rtc_minutes - real_minutes) < 30) - { - if (!(save_control & RTC_DM_BINARY)) - { - real_seconds = bin2bcd(real_seconds); - real_minutes = bin2bcd(real_minutes); - } - RTC_WRITE (RTC_SECONDS, real_seconds); - RTC_WRITE (RTC_MINUTES, real_minutes); - } - else - retval = -1; - - RTC_WRITE (RTC_FREQ_SELECT, save_freq_select); - RTC_WRITE (RTC_CONTROL, save_control); - return retval; -} - /* * Local variables: * c-indent-level: 4 diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c index 2cfff4765040..143ee9fa3893 100644 --- a/arch/m68k/bvme6000/config.c +++ b/arch/m68k/bvme6000/config.c @@ -41,7 +41,6 @@ static void bvme6000_get_model(char *model); extern void bvme6000_sched_init(irq_handler_t handler); extern u32 bvme6000_gettimeoffset(void); extern int bvme6000_hwclk (int, struct rtc_time *); -extern int bvme6000_set_clock_mmss (unsigned long); extern void bvme6000_reset (void); void bvme6000_set_vectors (void); @@ -113,7 +112,6 @@ void __init config_bvme6000(void) mach_init_IRQ = bvme6000_init_IRQ; arch_gettimeoffset = bvme6000_gettimeoffset; mach_hwclk = bvme6000_hwclk; - mach_set_clock_mmss = bvme6000_set_clock_mmss; mach_reset = bvme6000_reset; mach_get_model = bvme6000_get_model; @@ -305,46 +303,3 @@ int bvme6000_hwclk(int op, struct rtc_time *t) return 0; } - -/* - * Set the minutes and seconds from seconds value 'nowtime'. Fail if - * clock is out by > 30 minutes. Logic lifted from atari code. - * Algorithm is to wait for the 10ms register to change, and then to - * wait a short while, and then set it. - */ - -int bvme6000_set_clock_mmss (unsigned long nowtime) -{ - int retval = 0; - short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; - unsigned char rtc_minutes, rtc_tenms; - volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE; - unsigned char msr = rtc->msr & 0xc0; - unsigned long flags; - volatile int i; - - rtc->msr = 0; /* Ensure clock accessible */ - rtc_minutes = bcd2bin (rtc->bcd_min); - - if ((rtc_minutes < real_minutes - ? real_minutes - rtc_minutes - : rtc_minutes - real_minutes) < 30) - { - local_irq_save(flags); - rtc_tenms = rtc->bcd_tenms; - while (rtc_tenms == rtc->bcd_tenms) - ; - for (i = 0; i < 1000; i++) - ; - rtc->bcd_min = bin2bcd(real_minutes); - rtc->bcd_sec = bin2bcd(real_seconds); - local_irq_restore(flags); - } - else - retval = -1; - - rtc->msr = msr; - - return retval; -} - diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h index 1605da48ebf2..49bd3266b4b1 100644 --- a/arch/m68k/include/asm/machdep.h +++ b/arch/m68k/include/asm/machdep.h @@ -22,7 +22,6 @@ extern int (*mach_hwclk)(int, struct rtc_time*); extern unsigned int (*mach_get_ss)(void); extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); -extern int (*mach_set_clock_mmss)(unsigned long); extern void (*mach_reset)( void ); extern void (*mach_halt)( void ); extern void (*mach_power_off)( void ); diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index f35e3ebd6331..07244732eb41 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -88,7 +88,6 @@ void (*mach_get_hardware_list) (struct seq_file *m); /* machine dependent timer functions */ int (*mach_hwclk) (int, struct rtc_time*); EXPORT_SYMBOL(mach_hwclk); -int (*mach_set_clock_mmss) (unsigned long); unsigned int (*mach_get_ss)(void); int (*mach_get_rtc_pll)(struct rtc_pll_info *); int (*mach_set_rtc_pll)(struct rtc_pll_info *); diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index a98af1018201..3c53e4c366ac 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -51,7 +51,6 @@ char __initdata command_line[COMMAND_LINE_SIZE]; /* machine dependent timer functions */ void (*mach_sched_init)(irq_handler_t handler) __initdata = NULL; -int (*mach_set_clock_mmss)(unsigned long); int (*mach_hwclk) (int, struct rtc_time*); /* machine dependent reboot functions */ diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index e522307db47c..da1aeb966474 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -57,7 +57,6 @@ static unsigned long mac_orig_videoaddr; /* Mac specific timer functions */ extern u32 mac_gettimeoffset(void); extern int mac_hwclk(int, struct rtc_time *); -extern int mac_set_clock_mmss(unsigned long); extern void iop_preinit(void); extern void iop_init(void); extern void via_init(void); @@ -158,7 +157,6 @@ void __init config_mac(void) mach_get_model = mac_get_model; arch_gettimeoffset = mac_gettimeoffset; mach_hwclk = mac_hwclk; - mach_set_clock_mmss = mac_set_clock_mmss; mach_reset = mac_reset; mach_halt = mac_poweroff; mach_power_off = mac_poweroff; diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 0a2572a6bfe5..bf8df47a6d09 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -735,19 +735,3 @@ int mac_hwclk(int op, struct rtc_time *t) } return 0; } - -/* - * Set minutes/seconds in the hardware clock - */ - -int mac_set_clock_mmss (unsigned long nowtime) -{ - struct rtc_time now; - - mac_hwclk(0, &now); - now.tm_sec = nowtime % 60; - now.tm_min = (nowtime / 60) % 60; - mac_hwclk(1, &now); - - return 0; -} diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c index f8a710fd84cd..adea549d240e 100644 --- a/arch/m68k/mvme147/config.c +++ b/arch/m68k/mvme147/config.c @@ -40,7 +40,6 @@ static void mvme147_get_model(char *model); extern void mvme147_sched_init(irq_handler_t handler); extern u32 mvme147_gettimeoffset(void); extern int mvme147_hwclk (int, struct rtc_time *); -extern int mvme147_set_clock_mmss (unsigned long); extern void mvme147_reset (void); @@ -92,7 +91,6 @@ void __init config_mvme147(void) mach_init_IRQ = mvme147_init_IRQ; arch_gettimeoffset = mvme147_gettimeoffset; mach_hwclk = mvme147_hwclk; - mach_set_clock_mmss = mvme147_set_clock_mmss; mach_reset = mvme147_reset; mach_get_model = mvme147_get_model; @@ -164,8 +162,3 @@ int mvme147_hwclk(int op, struct rtc_time *t) } return 0; } - -int mvme147_set_clock_mmss (unsigned long nowtime) -{ - return 0; -} diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c index 4ffd9ef98de4..6ee36a5b528d 100644 --- a/arch/m68k/mvme16x/config.c +++ b/arch/m68k/mvme16x/config.c @@ -46,7 +46,6 @@ static void mvme16x_get_model(char *model); extern void mvme16x_sched_init(irq_handler_t handler); extern u32 mvme16x_gettimeoffset(void); extern int mvme16x_hwclk (int, struct rtc_time *); -extern int mvme16x_set_clock_mmss (unsigned long); extern void mvme16x_reset (void); int bcd2int (unsigned char b); @@ -280,7 +279,6 @@ void __init config_mvme16x(void) mach_init_IRQ = mvme16x_init_IRQ; arch_gettimeoffset = mvme16x_gettimeoffset; mach_hwclk = mvme16x_hwclk; - mach_set_clock_mmss = mvme16x_set_clock_mmss; mach_reset = mvme16x_reset; mach_get_model = mvme16x_get_model; mach_get_hardware_list = mvme16x_get_hardware_list; @@ -411,9 +409,3 @@ int mvme16x_hwclk(int op, struct rtc_time *t) } return 0; } - -int mvme16x_set_clock_mmss (unsigned long nowtime) -{ - return 0; -} - diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index 71c0867ecf20..96810d91da2b 100644 --- a/arch/m68k/q40/config.c +++ b/arch/m68k/q40/config.c @@ -43,7 +43,6 @@ extern void q40_sched_init(irq_handler_t handler); static u32 q40_gettimeoffset(void); static int q40_hwclk(int, struct rtc_time *); static unsigned int q40_get_ss(void); -static int q40_set_clock_mmss(unsigned long); static int q40_get_rtc_pll(struct rtc_pll_info *pll); static int q40_set_rtc_pll(struct rtc_pll_info *pll); @@ -175,7 +174,6 @@ void __init config_q40(void) mach_get_ss = q40_get_ss; mach_get_rtc_pll = q40_get_rtc_pll; mach_set_rtc_pll = q40_set_rtc_pll; - mach_set_clock_mmss = q40_set_clock_mmss; mach_reset = q40_reset; mach_get_model = q40_get_model; @@ -267,34 +265,6 @@ static unsigned int q40_get_ss(void) return bcd2bin(Q40_RTC_SECS); } -/* - * Set the minutes and seconds from seconds value 'nowtime'. Fail if - * clock is out by > 30 minutes. Logic lifted from atari code. - */ - -static int q40_set_clock_mmss(unsigned long nowtime) -{ - int retval = 0; - short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; - - int rtc_minutes; - - rtc_minutes = bcd2bin(Q40_RTC_MINS); - - if ((rtc_minutes < real_minutes ? - real_minutes - rtc_minutes : - rtc_minutes - real_minutes) < 30) { - Q40_RTC_CTRL |= Q40_RTC_WRITE; - Q40_RTC_MINS = bin2bcd(real_minutes); - Q40_RTC_SECS = bin2bcd(real_seconds); - Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); - } else - retval = -1; - - return retval; -} - - /* get and set PLL calibration of RTC clock */ #define Q40_RTC_PLL_MASK ((1<<5)-1) #define Q40_RTC_PLL_SIGN (1<<5)