Skip to content

Commit

Permalink
[PATCH] m41t00: fix bitmasks when writing to chip
Browse files Browse the repository at this point in the history
Fix the bitmasks used when writing to the M41T00 registers.

The original code used a mask of 0x7f when writing to each register,
this is incorrect and probably the result of a copy-paste error.  As a
result years from 1980 to 1999 will be read back as 2000 to 2019.

Signed-off-by: David Barksdale <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
David Barksdale authored and Linus Torvalds committed Apr 19, 2006
1 parent b73781c commit 8db08de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/i2c/chips/m41t00.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ m41t00_set(void *arg)
if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0)
|| (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f)
< 0)
|| (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f)
|| (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x3f)
< 0)
|| (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f)
|| (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x3f)
< 0)
|| (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f)
|| (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x1f)
< 0)
|| (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f)
|| (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0xff)
< 0))

dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n");
Expand Down

0 comments on commit 8db08de

Please sign in to comment.