Skip to contentSkip to conversation

rtc-cmos: fix broken NVRAM bank 2 writing

PATCH Superseded Ondrej Zary 2 participants 3 messages Nov 13, 2011 – Nov 23, 2011 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc-cmos: fix broken NVRAM bank 2 writing

Fix writing to NVRAM bank 2 in rtc-cmos driver. It never worked since its introduction in 2.6.28 because of a typo.

drivers/rtc/rtc-cmos.c +1 -1
@@ -164,7 +164,7 @@ static inline unsigned char cmos_read_ba
 static inline void cmos_write_bank2(unsigned char val, unsigned char addr)
 {
 	outb(addr, RTC_PORT(2));
-	outb(val, RTC_PORT(2));
+	outb(val, RTC_PORT(3));
 }
 
 #else
Signature · 1 line
Ondrej Zary
#1 lore raw
Quoted 8 lines · On Sun, 13 Nov 2011 23:20:31 +0100 Ondrej Zary <[email protected]>…

Fix writing to NVRAM bank 2 in rtc-cmos driver. It never worked since its introduction in 2.6.28 because of a typo.

drivers/rtc/rtc-cmos.c static inline unsigned char cmos_read_ba · line 170

Quoted 8 lines
drivers/rtc/rtc-cmos.c +1 -1
@@ -164,7 +164,7 @@ static inline unsigned char cmos_read_ba
 static inline void cmos_write_bank2(unsigned char val, unsigned char addr)
 {
 	outb(addr, RTC_PORT(2));
-	outb(val, RTC_PORT(2));
+	outb(val, RTC_PORT(3));
 }
 
 #else

Strange. Can you suggest why this bug has lived for so long without anyone noticing it?

#2 lore raw
Quoted 18 lines · Andrew Morton

On Sun, 13 Nov 2011 23:20:31 +0100

Quoted 15 lines · Ondrej Zary

Fix writing to NVRAM bank 2 in rtc-cmos driver. It never worked since its introduction in 2.6.28 because of a typo.

--- linux-3.1-orig/drivers/rtc/rtc-cmos.c 2011-10-24 09:10:05.000000000
+0200 +++ linux-3.1/drivers/rtc/rtc-cmos.c 2011-11-08 17:43:29.000000000
+0100 @@ -164,7 +164,7 @@ static inline unsigned char cmos_read_ba
static inline void cmos_write_bank2(unsigned char val, unsigned char
addr) {

drivers/rtc/rtc-cmos.c +1 -1
 	outb(addr, RTC_PORT(2));
-	outb(val, RTC_PORT(2));
+	outb(val, RTC_PORT(3));
 }
Quoted 4 lines
Quoted 1 line

#else

Strange. Can you suggest why this bug has lived for so long without anyone noticing it?

Probably because nobody uses it. It's hidden in sysfs (/sys/class/rtc/rtc0/device/nvram) and there's another (old) module "nvram" that does (mostly) the same thing (except there's no bank 2 support).

Signature · 1 line
Ondrej Zary