From patchwork Mon Apr 23 08:36:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 133985 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp731714lji; Mon, 23 Apr 2018 01:38:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+0+gKZFdaX/dhJC0m3RoHvgGLZH5fJKOeCRRbrh6RsX32EHILUBe59AG7AacsaYLxH2Jj8 X-Received: by 2002:a17:902:be06:: with SMTP id r6-v6mr14215195pls.158.1524472703014; Mon, 23 Apr 2018 01:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524472703; cv=none; d=google.com; s=arc-20160816; b=nyImbxk9dpJngo15w/KaEYED87ArLAlUPHbA4jd6F5UuhEtr7h+dFkljwwVS7QVt9w ZVK3zeCRDimf5oYQUseGR/8E2H4tiz8EYa8cK0cVvAo6KpJBzO2tKlJXKxpGMQwZsita JbbXzQ2HpUQjDaDdn43w39/dGsQuR1Nw+aCEKWzBrkov8VmPj47BTRfRUfJ3ZKBrPHQP 3eQIhvZugNw11Y0METSKEqJSXujMaeII6XrT1YYytZvPSeMxIwNmNsufZvlkfgWfQWaS s9Ky07g6WTay14pIxRBSxE5UzeNJkIatHCykp5fDJGErt15r7Ma+QRhWZIxHlBdtekz5 T7+A== 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=NbUsZBEEl12cZi93SijOSzoFLwfSyICc9ob4xH9HDNUOc8TVRwSPpYQdarhsUNq8e6 jpd1N9ajdFMQrEYYuhBJsz1UPQ0evVsXY+agPifBOnY7RBNWh8SeQHYtUFBcZcazlyUU HA9bEBn3oCZjouW8hKOIQxqALWAZ5s1uIsdev7u40+JZCPdgl3rb8vIqXC7d8rU6/X/i AP0ANdYcKNfe0kmrkNf0qmNg0+Ri24WBh+vENc5p9FHYmmEFncanmDB2GZ/+jLmaqqa3 uoBddvfKv8mxAJJhkyJCGMMVZRpZg0zXQDbmS38s51sqs69aWts9d9CUWDEAkTFkZ8LX HTuA== 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 n71si10919505pfk.277.2018.04.23.01.38.22; Mon, 23 Apr 2018 01:38:23 -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 S1754514AbeDWIiU (ORCPT + 29 others); Mon, 23 Apr 2018 04:38:20 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:58587 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754597AbeDWIhQ (ORCPT ); Mon, 23 Apr 2018 04:37:16 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MNeGY-1f4SA41j5u-007CcQ; Mon, 23 Apr 2018 10:36:58 +0200 From: Arnd Bergmann To: Michael Ellerman Cc: Paul Mackerras , Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, arnd@arndb.de Subject: [PATCH 5/5] powerpc: remove unused to_tm() helper Date: Mon, 23 Apr 2018 10:36:42 +0200 Message-Id: <20180423083642.2608886-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180423083642.2608886-1-arnd@arndb.de> References: <20180423083642.2608886-1-arnd@arndb.de> X-Provags-ID: V03:K1:W0hINnDI0ZbdXVpyAdpGvscBey4v4Q8BDN7S+80MT39s8ov6JHi NZBpsdzhzspbCPN1b09xXlI7tg0TeTIxah0t4RJE/6GgaVCCpzbJGS3dma9NXA713fPtqq0 6km3P2/IreMrIo5n1glfRWD43+E7lMukJsvXWTe5rnORFj1Spaai6QNyHvG2LoiXzvXq0Hf jAAeZ0VFw5GoGXSJLStXQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xroRxFA9f5Y=:KvdlsfBnkbfRH9qeGfFpA5 n0PJK033+/l+9qe/WauCwwtaYqiXDW0zBfEvy/coK70Glm86TpH+QghbjYiwPlN8dtcuKe8wm UpPiCsaPj1DXChSYNOt/+ti0DV9mnzdFPZQmpoKA0Q9rSqweJnOh+OVelAJSZwFJJDcw0UEmw eAagmjU29JvWjZuUNIRbwbkGdsmFmCHNFPlKOURROqrGF+HB/8Y5DXSmG2xSqyKzkZKZJgesB t/o3kRzyuL0AhQwpZsLsfq9xVAYzzRrhIEfP/Jst0SZWncsEj9ong885Hu4tjmHdMXZhAs1/e LEsJ7EbqmHRFCbg2U8hl6/Ud3bHFMs0s7U/m0CGTTCdvJ7xPW7DfE0ESmPukawshKnk44xdO/ y8urCZ0uu/lLIVgRl06va7hShWVh/wYr8ZxhRca2P25bgcqy+HVO/QqML9dMDuTDUvHq7Jhp8 StOpd/CkhidPqzo1MsYzPXffI2+Lgtdncu5AtzjvXfOn7oUHyNstmejZwj2y2kxspwONiSgB9 ieYY6egD2t/n5V80IIThsLw7Cr5/cRC8Xt+DPmeG2RNq3sI5dYy5DC6ZKEAm4fxkc5AWrR1gc GAiHy10lg2ZyhZGj1TjNtkBvNNKU/pFqQcV3MBD4tIQ8oD6HnL3hDxACTAa7FUKslSf0Qb/5G eMZD1cvLZ2B/lSO5GRP06VpS477YxK9Uzj1EnJ9iG9vUM93qOiiLBdYAjIhRQFw6G1XaNSl4s e16t+GvqN4kehHzRopWCszwPIuxuH3uCKhI3bg== 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;