提交 8db08de4 编写于 作者: D David Barksdale 提交者: Linus Torvalds

[PATCH] m41t00: fix bitmasks when writing to chip

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: NDavid Barksdale <amatus@ocgnet.org>
Acked-by: NJean Delvare <khali@linux-fr.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b73781c8
...@@ -131,13 +131,13 @@ m41t00_set(void *arg) ...@@ -131,13 +131,13 @@ m41t00_set(void *arg)
if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0) 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) || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f)
< 0) < 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) < 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) < 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) < 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)) < 0))
dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n"); dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册