public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] rtc: ds3232: remove unneeded check
@ 2010-10-28 14:07 Dan Carpenter
  2010-10-29  2:28 ` Zang Roy-R61911
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-10-28 14:07 UTC (permalink / raw)
  To: kernel-janitors

bcd2bin() returns unsigned values so they're never less than zero.  I
asked Jack Lan and he said I could just remove that part of the check.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 5706355..7767b4f 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -289,14 +289,10 @@ static void ds3232_update_alarm(struct i2c_client *client)
 	if (ret < 0)
 		goto unlock;
 
-	buf[0] = bcd2bin(buf[0]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[0];
-	buf[1] = bcd2bin(buf[1]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[1];
-	buf[2] = bcd2bin(buf[2]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[2];
-	buf[3] = bcd2bin(buf[3]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[3];
+	buf[0] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[0];
+	buf[1] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[1];
+	buf[2] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[2];
+	buf[3] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[3];
 
 	ret = i2c_smbus_write_i2c_block_data(client, DS3232_REG_ALARM1, 4, buf);
 	if (ret < 0)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [patch] rtc: ds3232: remove unneeded check
  2010-10-28 14:07 [patch] rtc: ds3232: remove unneeded check Dan Carpenter
@ 2010-10-29  2:28 ` Zang Roy-R61911
  0 siblings, 0 replies; 2+ messages in thread
From: Zang Roy-R61911 @ 2010-10-29  2:28 UTC (permalink / raw)
  To: kernel-janitors


> -----Original Message-----
> From: Dan Carpenter [mailto:error27@gmail.com]
> bcd2bin() returns unsigned values so they're never less than zero.  I
> asked Jack Lan and he said I could just remove that part of the check.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
> index 5706355..7767b4f 100644
> --- a/drivers/rtc/rtc-ds3232.c
> +++ b/drivers/rtc/rtc-ds3232.c
> @@ -289,14 +289,10 @@ static void ds3232_update_alarm(struct
i2c_client
> *client)
>  	if (ret < 0)
>  		goto unlock;
> 
> -	buf[0] = bcd2bin(buf[0]) < 0 || (ds3232->rtc->irq_data & RTC_UF)
?
> -								0x80 :
buf[0];
> -	buf[1] = bcd2bin(buf[1]) < 0 || (ds3232->rtc->irq_data & RTC_UF)
?
> -								0x80 :
buf[1];
> -	buf[2] = bcd2bin(buf[2]) < 0 || (ds3232->rtc->irq_data & RTC_UF)
?
> -								0x80 :
buf[2];
> -	buf[3] = bcd2bin(buf[3]) < 0 || (ds3232->rtc->irq_data & RTC_UF)
?
> -								0x80 :
buf[3];
> +	buf[0] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[0];
> +	buf[1] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[1];
> +	buf[2] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[2];
> +	buf[3] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[3];


Acked-by: Roy Zang <tie-fei.zang@freescale.com>

Thanks.
Roy


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-29  2:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 14:07 [patch] rtc: ds3232: remove unneeded check Dan Carpenter
2010-10-29  2:28 ` Zang Roy-R61911

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox