@@ -71,7 +71,7 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
71
71
/* Issue the READ command */
72
72
M48T59_SET_BITS (M48T59_CNTL_READ , M48T59_CNTL );
73
73
74
- tm -> tm_year = bcd2bin (M48T59_READ (M48T59_YEAR ));
74
+ tm -> tm_year = bcd2bin (M48T59_READ (M48T59_YEAR )) + pdata -> yy_offset ;
75
75
/* tm_mon is 0-11 */
76
76
tm -> tm_mon = bcd2bin (M48T59_READ (M48T59_MONTH )) - 1 ;
77
77
tm -> tm_mday = bcd2bin (M48T59_READ (M48T59_MDAY ));
@@ -82,10 +82,6 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
82
82
dev_dbg (dev , "Century bit is enabled\n" );
83
83
tm -> tm_year += 100 ; /* one century */
84
84
}
85
- #ifdef CONFIG_SPARC
86
- /* Sun SPARC machines count years since 1968 */
87
- tm -> tm_year += 68 ;
88
- #endif
89
85
90
86
tm -> tm_wday = bcd2bin (val & 0x07 );
91
87
tm -> tm_hour = bcd2bin (M48T59_READ (M48T59_HOUR ) & 0x3F );
@@ -106,12 +102,7 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
106
102
struct m48t59_private * m48t59 = dev_get_drvdata (dev );
107
103
unsigned long flags ;
108
104
u8 val = 0 ;
109
- int year = tm -> tm_year ;
110
-
111
- #ifdef CONFIG_SPARC
112
- /* Sun SPARC machines count years since 1968 */
113
- year -= 68 ;
114
- #endif
105
+ int year = tm -> tm_year - pdata -> yy_offset ;
115
106
116
107
dev_dbg (dev , "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n" ,
117
108
year + 1900 , tm -> tm_mon , tm -> tm_mday ,
@@ -162,11 +153,7 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
162
153
/* Issue the READ command */
163
154
M48T59_SET_BITS (M48T59_CNTL_READ , M48T59_CNTL );
164
155
165
- tm -> tm_year = bcd2bin (M48T59_READ (M48T59_YEAR ));
166
- #ifdef CONFIG_SPARC
167
- /* Sun SPARC machines count years since 1968 */
168
- tm -> tm_year += 68 ;
169
- #endif
156
+ tm -> tm_year = bcd2bin (M48T59_READ (M48T59_YEAR )) + pdata -> yy_offset ;
170
157
/* tm_mon is 0-11 */
171
158
tm -> tm_mon = bcd2bin (M48T59_READ (M48T59_MONTH )) - 1 ;
172
159
@@ -197,12 +184,7 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
197
184
struct rtc_time * tm = & alrm -> time ;
198
185
u8 mday , hour , min , sec ;
199
186
unsigned long flags ;
200
- int year = tm -> tm_year ;
201
-
202
- #ifdef CONFIG_SPARC
203
- /* Sun SPARC machines count years since 1968 */
204
- year -= 68 ;
205
- #endif
187
+ int year = tm -> tm_year - pdata -> yy_offset ;
206
188
207
189
/* If no irq, we don't support ALARM */
208
190
if (m48t59 -> irq == NO_IRQ )
0 commit comments