From: "Mateusz Jończyk" <mat.jonczyk@o2.pl>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>,
Huacai Chen <chenhuacai@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
linux-mips@vger.kernel.org, linux-rtc@vger.kernel.org,
"Mateusz Jończyk" <mat.jonczyk@o2.pl>
Subject: [PATCH 3/4] mips: remove redundant macro mc146818_decode_year
Date: Sun, 13 Jul 2025 12:04:33 +0200 [thread overview]
Message-ID: <20250713100434.699843-4-mat.jonczyk@o2.pl> (raw)
In-Reply-To: <20250713100434.699843-1-mat.jonczyk@o2.pl>
The mc146818_decode_year macro is used only in mc146818_get_cmos_time(),
which in turn is called only in
arch/mips/loongson2ef/common/time.c
and
arch/mips/mti-malta/malta-time.c
so on mach-jazz it is unused and can be removed. On other platforms it
is defined in the same way, so it can be safely folded into
mc146818_get_cmos_time().
Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
---
arch/mips/include/asm/mach-generic/mc146818rtc.h | 4 ----
arch/mips/include/asm/mach-jazz/mc146818rtc.h | 2 --
arch/mips/include/asm/mach-malta/mc146818rtc.h | 2 --
arch/mips/include/asm/mc146818-time.h | 5 ++++-
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/mips/include/asm/mach-generic/mc146818rtc.h b/arch/mips/include/asm/mach-generic/mc146818rtc.h
index 9c72e540ff56..249279b0494d 100644
--- a/arch/mips/include/asm/mach-generic/mc146818rtc.h
+++ b/arch/mips/include/asm/mach-generic/mc146818rtc.h
@@ -29,8 +29,4 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
#define RTC_ALWAYS_BCD 0
-#ifndef mc146818_decode_year
-#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
-#endif
-
#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mach-jazz/mc146818rtc.h b/arch/mips/include/asm/mach-jazz/mc146818rtc.h
index 987f727afe25..639bff8ebca3 100644
--- a/arch/mips/include/asm/mach-jazz/mc146818rtc.h
+++ b/arch/mips/include/asm/mach-jazz/mc146818rtc.h
@@ -33,6 +33,4 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
#define RTC_ALWAYS_BCD 0
-#define mc146818_decode_year(year) ((year) + 1980)
-
#endif /* __ASM_MACH_JAZZ_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mach-malta/mc146818rtc.h b/arch/mips/include/asm/mach-malta/mc146818rtc.h
index e8cc7fdf7415..7da2c0ea55da 100644
--- a/arch/mips/include/asm/mach-malta/mc146818rtc.h
+++ b/arch/mips/include/asm/mach-malta/mc146818rtc.h
@@ -31,6 +31,4 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
#define RTC_ALWAYS_BCD 0
-#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
-
#endif /* __ASM_MACH_MALTA_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mc146818-time.h b/arch/mips/include/asm/mc146818-time.h
index 07bf30bee792..4e07914e94e6 100644
--- a/arch/mips/include/asm/mc146818-time.h
+++ b/arch/mips/include/asm/mc146818-time.h
@@ -37,7 +37,10 @@ static inline time64_t mc146818_get_cmos_time(void)
year = bcd2bin(year);
}
spin_unlock_irqrestore(&rtc_lock, flags);
- year = mc146818_decode_year(year);
+ if (year < 70)
+ year += 2000;
+ else
+ year += 1900;
return mktime64(year, mon, day, hour, min, sec);
}
--
2.25.1
next prev parent reply other threads:[~2025-07-13 10:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 10:04 [PATCH 0/4] mips: CMOS RTC refactoring Mateusz Jończyk
2025-07-13 10:04 ` [PATCH 1/4] mips: remove unused function mc146818_set_rtc_mmss Mateusz Jończyk
2025-07-13 10:04 ` [PATCH 2/4] mips/mach-rm: remove custom mc146818rtc.h file Mateusz Jończyk
2025-07-13 10:04 ` Mateusz Jończyk [this message]
2025-07-13 10:04 ` [PATCH 4/4] mips/malta,loongson2ef: use generic mc146818_get_time function Mateusz Jończyk
2025-07-16 18:07 ` [PATCH 0/4] mips: CMOS RTC refactoring Thomas Bogendoerfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250713100434.699843-4-mat.jonczyk@o2.pl \
--to=mat.jonczyk@o2.pl \
--cc=alexandre.belloni@bootlin.com \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-mips@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).