Skip to content

Commit 692f983

Browse files
Wolfram Sangalexandrebelloni
authored andcommitted
rtc: rzn1: drop superfluous wday calculation
The week register simply counts from 0 to 6 where the numbers do not even represent a specific weekday. So we can adopt 'tm_wday' numbering of the RTC core without converting it. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20241122101448.4374-2-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 1ec371b commit 692f983

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

drivers/rtc/rtc-rzn1.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,6 @@ static void rzn1_rtc_get_time_snapshot(struct rzn1_rtc *rtc, struct rtc_time *tm
7575
tm->tm_year = readl(rtc->base + RZN1_RTC_YEARC);
7676
}
7777

78-
static unsigned int rzn1_rtc_tm_to_wday(struct rtc_time *tm)
79-
{
80-
time64_t time;
81-
unsigned int days;
82-
u32 secs;
83-
84-
time = rtc_tm_to_time64(tm);
85-
days = div_s64_rem(time, 86400, &secs);
86-
87-
/* day of the week, 1970-01-01 was a Thursday */
88-
return (days + 4) % 7;
89-
}
90-
9178
static int rzn1_rtc_read_time(struct device *dev, struct rtc_time *tm)
9279
{
9380
struct rzn1_rtc *rtc = dev_get_drvdata(dev);
@@ -109,7 +96,6 @@ static int rzn1_rtc_read_time(struct device *dev, struct rtc_time *tm)
10996
tm->tm_sec = bcd2bin(tm->tm_sec);
11097
tm->tm_min = bcd2bin(tm->tm_min);
11198
tm->tm_hour = bcd2bin(tm->tm_hour);
112-
tm->tm_wday = bcd2bin(tm->tm_wday);
11399
tm->tm_mday = bcd2bin(tm->tm_mday);
114100
tm->tm_mon = bcd2bin(tm->tm_mon) - 1;
115101
tm->tm_year = bcd2bin(tm->tm_year) + 100;
@@ -126,7 +112,6 @@ static int rzn1_rtc_set_time(struct device *dev, struct rtc_time *tm)
126112
tm->tm_sec = bin2bcd(tm->tm_sec);
127113
tm->tm_min = bin2bcd(tm->tm_min);
128114
tm->tm_hour = bin2bcd(tm->tm_hour);
129-
tm->tm_wday = bin2bcd(rzn1_rtc_tm_to_wday(tm));
130115
tm->tm_mday = bin2bcd(tm->tm_mday);
131116
tm->tm_mon = bin2bcd(tm->tm_mon + 1);
132117
tm->tm_year = bin2bcd(tm->tm_year - 100);

0 commit comments

Comments
 (0)