mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] m41t00: fix bitmasks when writing to chip
@ 2006-04-12 16:58 amatus
  0 siblings, 0 replies; only message in thread
From: amatus @ 2006-04-12 16:58 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

From: David Barksdale <amatus@ocgnet.org>

This patch fixes the bitmasks used when writing to the M41T00 registers.
The origional 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 <amatus@ocgnet.org>

---

The following patch is against the 2.6.16.4 linux kernel

--- linux-2.6.16.4/drivers/i2c/chips/m41t00.c.orig	2006-04-12 11:28:04.740793700 -0500
+++ linux-2.6.16.4/drivers/i2c/chips/m41t00.c	2006-04-12 11:29:58.093959100 -0500
@@ -129,13 +129,13 @@ m41t00_set_tlet(ulong 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");

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-12 16:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12 16:58 [PATCH] m41t00: fix bitmasks when writing to chip amatus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®