From patchwork Mon Apr 23 08:10: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: 133981 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp714633lji; Mon, 23 Apr 2018 01:14:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx48860w3IEik+H6XwjqX6tQMXfm45bAL3pM8srCpyPABUOik06S8ukxjbkJd7/OVu8keSs8z X-Received: by 10.98.246.25 with SMTP id x25mr19085397pfh.138.1524471294640; Mon, 23 Apr 2018 01:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524471294; cv=none; d=google.com; s=arc-20160816; b=QhQDVawzkgZR3A/LMX3gOfJWVymsS+R+5/4Ci/kWh3MblH4UrhjzzFRzpX6Pg8A6s4 4gOAkvJW7emUvaGoe53kLsEiuRhLciG6ZcxrrtbgENFhE796+vGt6ejeJUT8D06i4spa KpGNbG8zpoPDRICNETp4c8KllXJMHFU5XBMmcs6ueUf73jCZa0U8zvua/E7nhP0j9WzI lR4wriXDRUf4pNKMCoridz1s+iHq4yesH6ND57Sq0JpoISyGFtalnlwLb4DESyDvDjkn Br10rg4dTnUmsbsGFcaNCHUwRokbQD+9BJZlp9meIcguf8/FcgKjMKX+VWAFwNeoFZGE C9yw== 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=/vWXfyVpASXUjXV7NiNcgLyZ19NZD+c3sJYBVHFei88=; b=d6bNmDi9JYZ9CNdPXIFmedgisOBZHP0f+t3scr2gU6uPN23w3+UacDamuV3wydHUeo v3z4N9EG5vQ1FukaCnoI3ZCp0GdpDwb/KrVvuOlPl25SbN+PvIRbTLp/1n1byy8RPvYw 0fGpPuVFwdMycZq8u3Ym1dRNEEHSusoM2N6e4e/VI7lS8OG6uj/96mGWBd9uT8HFlvUb FaWSp2uiP6Iii99K6qAsFsgZu/43Q9I0qZnAcQV2bzD4IQ7qbdAaFgZADDCwL5gp66o0 lg9xkStCUJOFUSrigfO4LlvzV0GHUssV27yg0jcssz5sOgHstM6uh/BAvKsfAF334hHz 4nAA== 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 37-v6si11130148plq.288.2018.04.23.01.14.54; Mon, 23 Apr 2018 01:14:54 -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 S1754510AbeDWIOw (ORCPT + 29 others); Mon, 23 Apr 2018 04:14:52 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:59391 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754131AbeDWIOq (ORCPT ); Mon, 23 Apr 2018 04:14:46 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lcsfw-1ek1U83D6G-00iGdv; Mon, 23 Apr 2018 10:14:24 +0200 From: Arnd Bergmann To: Michael Ellerman Cc: Paul Mackerras , Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, Arnd Bergmann , Geoff Levand , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] powerpc: remove unused to_tm() helper Date: Mon, 23 Apr 2018 10:10:29 +0200 Message-Id: <20180423081114.1813726-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180423081114.1813726-1-arnd@arndb.de> References: <20180423081114.1813726-1-arnd@arndb.de> X-Provags-ID: V03:K1:ZTkperZmeZEQDDES1bMgdyE3YY2YxPIZl+DADVz4C+S3HI+7NOO HHVz6xV0yiB+d7AQcvoapf6GFelzkCdLJgaJkjnMhjlJOLpAXQAlas1KtIBxUXu84JE0Nqr mNDj+bjg7cROGqHiNT8aGbNlNWU9MwtoWh7vGiIjF9EvrtSDg2lMb9DNMGXhL5yL0qfK7wu 7EuBYh4vmKfTInlcNmR8Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:1mrS97M2bk8=:EX7plqzzHNDcAUbQCebLUN F7ZHr+WqKhxVtmX2mUv6KdnIwQAejN/AI9/VRr9LZMZYdQ/KBu/3k7+CsiqMYaoHTMEdfc430 Jfkb89j+4CeK2b+rcxRUYSnzQAMgUvB67kYAvEnb4OLanf2t+coW/EULwobKV/PDvPhFYAxl9 cPEAtEpnJQ51j+a9ApGa9hCkk102W9JCJCHIcP9eXPqCUTRXjrd/moLGHNnFuuwhakE3zJRhc T1kvG2Bim7AqbZDEN6fDpK9RoUb35TInwnJiP5SueVDAvqeFgH972W3VknXfqw96u1xvUNTi1 tt8rct+5+SH2ZI9SWM6oFh/HcxxB4yx3KjScNkeQrUfosp1Fcfruj4Uu4MshzN+p9Y7QdTTst VzZ8N6k7ouQ2c8KaUe4QxnZ+TLVvdBO+nBAjA+TWo8D0t2d9E5OVqaKsggVACC214QKD4Jwn8 Te4MRmox6HJlllAf8Zt92bGSXWstqHAkCWQu3r3nr1hFm4qpnLwD5izl2Y8GvXshnYrsoTviP 9OrVI7govrkdLLdrQAiC6EYzT6nh38O9VCRbibLig0GX3oQIQTyKW1UeZVB3MUpDO3dNk1nNI /oUyLLICsTdfQ/YmvzL64MSpHgzhT7juTQZb/pplK9GZ3qH8MTRFFNRFABWCTKrJZl1/UvMvT Cv75W2m2l+5QZegDBjpfNHlqgmlc0xUd5+z1d4EDX0bI4mtfRo7xnZlyaU48ipor6Km7p/MtF 8Il5HNw1N2TT4JjWfPgF4YBuvZidH4QNWPNeMA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org to_tm() is now completely unused, the only reference being in the _dump_time() helper that is also unused. This removes both, leaving the rest of the powerpc RTC code y2038 safe to as far as the hardware supports. Signed-off-by: Arnd Bergmann --- arch/powerpc/include/asm/time.h | 2 -- arch/powerpc/kernel/time.c | 50 --------------------------------------- arch/powerpc/platforms/ps3/time.c | 24 ------------------- 3 files changed, 76 deletions(-) -- 2.9.0 diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index db546c034905..79bc9c3e4325 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h @@ -26,8 +26,6 @@ extern unsigned long tb_ticks_per_usec; extern unsigned long tb_ticks_per_sec; extern struct clock_event_device decrementer_clockevent; -struct rtc_time; -extern void to_tm(int tim, struct rtc_time * tm); extern void tick_broadcast_ipi_handler(void); extern void generic_calibrate_decr(void); diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index f9b0baa3fa2b..79bdeea85ab4 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -1138,56 +1138,6 @@ void __init time_init(void) #endif } - -#define FEBRUARY 2 -#define STARTOFTIME 1970 -#define SECDAY 86400L -#define SECYR (SECDAY * 365) -#define leapyear(year) ((year) % 4 == 0 && \ - ((year) % 100 != 0 || (year) % 400 == 0)) -#define days_in_year(a) (leapyear(a) ? 366 : 365) -#define days_in_month(a) (month_days[(a) - 1]) - -static int month_days[12] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - -void to_tm(int tim, struct rtc_time * tm) -{ - register int i; - register long hms, day; - - day = tim / SECDAY; - hms = tim % SECDAY; - - /* Hours, minutes, seconds are easy */ - tm->tm_hour = hms / 3600; - tm->tm_min = (hms % 3600) / 60; - tm->tm_sec = (hms % 3600) % 60; - - /* Number of years in days */ - for (i = STARTOFTIME; day >= days_in_year(i); i++) - day -= days_in_year(i); - tm->tm_year = i; - - /* Number of months in days left */ - if (leapyear(tm->tm_year)) - days_in_month(FEBRUARY) = 29; - for (i = 1; day >= days_in_month(i); i++) - day -= days_in_month(i); - days_in_month(FEBRUARY) = 28; - tm->tm_mon = i; - - /* Days are what is left over (+1) from all that. */ - tm->tm_mday = day + 1; - - /* - * No-one uses the day of the week. - */ - tm->tm_wday = -1; -} -EXPORT_SYMBOL(to_tm); - /* * Divide a 128-bit dividend by a 32-bit divisor, leaving a 128 bit * result. diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c index 9dac125c997e..08ca76e23d09 100644 --- a/arch/powerpc/platforms/ps3/time.c +++ b/arch/powerpc/platforms/ps3/time.c @@ -28,30 +28,6 @@ #include "platform.h" -#define dump_tm(_a) _dump_tm(_a, __func__, __LINE__) -static void _dump_tm(const struct rtc_time *tm, const char* func, int line) -{ - pr_debug("%s:%d tm_sec %d\n", func, line, tm->tm_sec); - pr_debug("%s:%d tm_min %d\n", func, line, tm->tm_min); - pr_debug("%s:%d tm_hour %d\n", func, line, tm->tm_hour); - pr_debug("%s:%d tm_mday %d\n", func, line, tm->tm_mday); - pr_debug("%s:%d tm_mon %d\n", func, line, tm->tm_mon); - pr_debug("%s:%d tm_year %d\n", func, line, tm->tm_year); - pr_debug("%s:%d tm_wday %d\n", func, line, tm->tm_wday); -} - -#define dump_time(_a) _dump_time(_a, __func__, __LINE__) -static void __maybe_unused _dump_time(int time, const char *func, - int line) -{ - struct rtc_time tm; - - to_tm(time, &tm); - - pr_debug("%s:%d time %d\n", func, line, time); - _dump_tm(&tm, func, line); -} - void __init ps3_calibrate_decr(void) { int result;