Patchwork RTC/max6900: use rtc_valid_tm to check returning tm for max6900

login
register
mail settings
Submitter Wan ZongShun
Date June 22, 2010, 9:09 a.m.
Message ID <4C207DAF.7010200@gmail.com>
Download mbox | patch
Permalink /patch/56435/
State New
Headers show

Comments

Wan ZongShun - June 22, 2010, 9:09 a.m.
Use rtc_valid_tm to check returning tm for max6900,
it can avoid returning wrong tm value.
---
 drivers/rtc/rtc-max6900.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Wan ZongShun - June 22, 2010, 9:41 a.m.
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>

> Use rtc_valid_tm to check returning tm for max6900,
> it can avoid returning wrong tm value.
> ---
>  drivers/rtc/rtc-max6900.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
> index a4f6665..486142c 100644
> --- a/drivers/rtc/rtc-max6900.c
> +++ b/drivers/rtc/rtc-max6900.c
> @@ -159,7 +159,7 @@ static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
>                      bcd2bin(regs[MAX6900_REG_CENTURY]) * 100 - 1900;
>        tm->tm_wday = bcd2bin(regs[MAX6900_REG_DW]);
>
> -       return 0;
> +       return rtc_valid_tm(tm);
>  }
>
>  static int max6900_i2c_clear_write_protect(struct i2c_client *client)
> --
> 1.6.3.3
>
Dale Farnsworth - June 22, 2010, 12:47 p.m.
On Tue, Jun 22, 2010 at 05:09:03PM +0800, Wan ZongShun wrote:
> Use rtc_valid_tm to check returning tm for max6900,
> it can avoid returning wrong tm value.
> ---
>  drivers/rtc/rtc-max6900.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
> index a4f6665..486142c 100644
> --- a/drivers/rtc/rtc-max6900.c
> +++ b/drivers/rtc/rtc-max6900.c
> @@ -159,7 +159,7 @@ static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
>  		      bcd2bin(regs[MAX6900_REG_CENTURY]) * 100 - 1900;
>  	tm->tm_wday = bcd2bin(regs[MAX6900_REG_DW]);
> 
> -	return 0;
> +	return rtc_valid_tm(tm);
>  }
> 
>  static int max6900_i2c_clear_write_protect(struct i2c_client *client)

Ack.

Thanks,
-Dale

Patch

diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
index a4f6665..486142c 100644
--- a/drivers/rtc/rtc-max6900.c
+++ b/drivers/rtc/rtc-max6900.c
@@ -159,7 +159,7 @@  static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
 		      bcd2bin(regs[MAX6900_REG_CENTURY]) * 100 - 1900;
 	tm->tm_wday = bcd2bin(regs[MAX6900_REG_DW]);

-	return 0;
+	return rtc_valid_tm(tm);
 }

 static int max6900_i2c_clear_write_protect(struct i2c_client *client)