diff options
Diffstat (limited to 'drivers/i2c/chips/ds1337.c')
-rw-r--r-- | drivers/i2c/chips/ds1337.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 93d483b8b770..ec17d6b684a2 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c | |||
@@ -347,13 +347,19 @@ static void ds1337_init_client(struct i2c_client *client) | |||
347 | 347 | ||
348 | if ((status & 0x80) || (control & 0x80)) { | 348 | if ((status & 0x80) || (control & 0x80)) { |
349 | /* RTC not running */ | 349 | /* RTC not running */ |
350 | u8 buf[16]; | 350 | u8 buf[1+16]; /* First byte is interpreted as address */ |
351 | struct i2c_msg msg[1]; | 351 | struct i2c_msg msg[1]; |
352 | 352 | ||
353 | dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); | 353 | dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); |
354 | 354 | ||
355 | /* Initialize all, including STATUS and CONTROL to zero */ | 355 | /* Initialize all, including STATUS and CONTROL to zero */ |
356 | memset(buf, 0, sizeof(buf)); | 356 | memset(buf, 0, sizeof(buf)); |
357 | |||
358 | /* Write valid values in the date/time registers */ | ||
359 | buf[1+DS1337_REG_DAY] = 1; | ||
360 | buf[1+DS1337_REG_DATE] = 1; | ||
361 | buf[1+DS1337_REG_MONTH] = 1; | ||
362 | |||
357 | msg[0].addr = client->addr; | 363 | msg[0].addr = client->addr; |
358 | msg[0].flags = 0; | 364 | msg[0].flags = 0; |
359 | msg[0].len = sizeof(buf); | 365 | msg[0].len = sizeof(buf); |