rtc-x1205: reset clock to sane state after power failure
authorJohannes Weiner <[email protected]>
Tue, 1 Dec 2009 21:17:49 +0000 (13:17 -0800)
committerLinus Torvalds <[email protected]>
Wed, 2 Dec 2009 00:32:20 +0000 (16:32 -0800)
When detecting power failure, the probe function would reset the clock
time to defined state.

However, the clock's _date_ might still be bogus and a subsequent probe
fails when sanity-checking these values.

Change the power-failure fixup code to do a full setting of rtc_time,
including a valid date.

Signed-off-by: Johannes Weiner <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/rtc/rtc-x1205.c

index cc9ba47b215426871a9f352f46cd7340893bb38e..6583c1a8b0702b260c70cb7f13845ea8257b0f2b 100644 (file)
@@ -280,9 +280,9 @@ static int x1205_fix_osc(struct i2c_client *client)
        int err;
        struct rtc_time tm;
 
-       tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+       memset(&tm, 0, sizeof(tm));
 
-       err = x1205_set_datetime(client, &tm, 0, X1205_CCR_BASE, 0);
+       err = x1205_set_datetime(client, &tm, 1, X1205_CCR_BASE, 0);
        if (err < 0)
                dev_err(&client->dev, "unable to restart the oscillator\n");