]> err.no Git - linux-2.6/blobdiff - drivers/i2c/chips/ds1337.c
i2c: Fix the i2c_smbus_read_i2c_block_data() prototype
[linux-2.6] / drivers / i2c / chips / ds1337.c
index a9d4ac770e398b4c130e044eb25a21d930e17d5e..ec17d6b684a23bf8fb50127fd935ff2cb8322204 100644 (file)
@@ -53,7 +53,6 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd,
  */
 static struct i2c_driver ds1337_driver = {
        .driver = {
-               .owner  = THIS_MODULE,
                .name   = "ds1337",
        },
        .attach_adapter = ds1337_attach_adapter,
@@ -348,13 +347,19 @@ static void ds1337_init_client(struct i2c_client *client)
 
        if ((status & 0x80) || (control & 0x80)) {
                /* RTC not running */
-               u8 buf[16];
+               u8 buf[1+16];   /* First byte is interpreted as address */
                struct i2c_msg msg[1];
 
                dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__);
 
                /* Initialize all, including STATUS and CONTROL to zero */
                memset(buf, 0, sizeof(buf));
+
+               /* Write valid values in the date/time registers */
+               buf[1+DS1337_REG_DAY] = 1;
+               buf[1+DS1337_REG_DATE] = 1;
+               buf[1+DS1337_REG_MONTH] = 1;
+
                msg[0].addr = client->addr;
                msg[0].flags = 0;
                msg[0].len = sizeof(buf);