diff mbox

RTC: v3020 driver bugfix

Message ID 36176.167.216.14.194.1256001083.squirrel@www.concentris-systems.com
State Superseded, archived
Headers show

Commit Message

Scott Valentine Oct. 20, 2009, 1:11 a.m. UTC
v3020 read_bit always returns 0 when left_shift > 7

The v3020 read_bit function's return type is (unsigned char). The code
returns a value masked by (1 << left_shift) that is casted to the return
type. If left_shift is larger than 7, the cast will always result in a 0
return value. The problem was discovered with left_shift = 16, and the
included patch corrects the problem.

The bug was introduced in the last (Apr 3 2009) commit of the file, kernel
versions 2.6.30 and later.





Scott Valentine

Concentris Systems LLC
Manoa Innovation Center, Suite #238
2800 Woodlawn Drive
Honolulu, HI  96822

http://www.Concentris-Systems.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---
diff mbox

Patch

diff -uNr a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
--- a/drivers/rtc/rtc-v3020.c   2009-10-15 14:41:50.000000000 -1000
+++ b/drivers/rtc/rtc-v3020.c   2009-10-19 14:06:27.000000000 -1000
@@ -96,7 +96,7 @@ 

 static unsigned char v3020_mmio_read_bit(struct v3020 *chip)
 {
-       return readl(chip->ioaddress) & (1 << chip->leftshift);
+       return ((readl(chip->ioaddress) & (1 << chip->leftshift)) != 0);
 }

 static struct v3020_chip_ops v3020_mmio_ops = {