From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] rtc: ds3232: remove unneeded check
Date: Thu, 28 Oct 2010 14:07:13 +0000 [thread overview]
Message-ID: <20101028140713.GF6062@bicker> (raw)
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)
next reply other threads:[~2010-10-28 14:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 14:07 Dan Carpenter [this message]
2010-10-29 2:28 ` [patch] rtc: ds3232: remove unneeded check Zang Roy-R61911
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101028140713.GF6062@bicker \
--to=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox