Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2689
b: refs/heads/master
c: 6069ffd
h: refs/heads/master
i:
  2687: fb4d3fd
v: v3
  • Loading branch information
Ladislav Michl authored and Greg Kroah-Hartman committed Jun 22, 2005
1 parent e9aeadd commit 51c96f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e9d0ba1305cd7c6efd2ab3a003e58a27da1796b
refs/heads/master: 6069ffde15472da9d041a58df490d388bb175d51
28 changes: 14 additions & 14 deletions trunk/drivers/i2c/chips/ds1337.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
buf[4], buf[5], buf[6]);

if (result >= 0) {
dt->tm_sec = BCD_TO_BIN(buf[0]);
dt->tm_min = BCD_TO_BIN(buf[1]);
dt->tm_sec = BCD2BIN(buf[0]);
dt->tm_min = BCD2BIN(buf[1]);
val = buf[2] & 0x3f;
dt->tm_hour = BCD_TO_BIN(val);
dt->tm_wday = BCD_TO_BIN(buf[3]) - 1;
dt->tm_mday = BCD_TO_BIN(buf[4]);
dt->tm_hour = BCD2BIN(val);
dt->tm_wday = BCD2BIN(buf[3]) - 1;
dt->tm_mday = BCD2BIN(buf[4]);
val = buf[5] & 0x7f;
dt->tm_mon = BCD_TO_BIN(val);
dt->tm_year = 1900 + BCD_TO_BIN(buf[6]);
dt->tm_mon = BCD2BIN(val);
dt->tm_year = 1900 + BCD2BIN(buf[6]);
if (buf[5] & 0x80)
dt->tm_year += 100;

Expand Down Expand Up @@ -174,19 +174,19 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
dt->tm_mday, dt->tm_mon, dt->tm_year, dt->tm_wday);

buf[0] = 0; /* reg offset */
buf[1] = BIN_TO_BCD(dt->tm_sec);
buf[2] = BIN_TO_BCD(dt->tm_min);
buf[3] = BIN_TO_BCD(dt->tm_hour) | (1 << 6);
buf[4] = BIN_TO_BCD(dt->tm_wday) + 1;
buf[5] = BIN_TO_BCD(dt->tm_mday);
buf[6] = BIN_TO_BCD(dt->tm_mon);
buf[1] = BIN2BCD(dt->tm_sec);
buf[2] = BIN2BCD(dt->tm_min);
buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6);
buf[4] = BIN2BCD(dt->tm_wday) + 1;
buf[5] = BIN2BCD(dt->tm_mday);
buf[6] = BIN2BCD(dt->tm_mon);
if (dt->tm_year >= 2000) {
val = dt->tm_year - 2000;
buf[6] |= (1 << 7);
} else {
val = dt->tm_year - 1900;
}
buf[7] = BIN_TO_BCD(val);
buf[7] = BIN2BCD(val);

msg[0].addr = client->addr;
msg[0].flags = 0;
Expand Down

0 comments on commit 51c96f2

Please sign in to comment.