aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1307.c
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2012-03-23 18:02:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-23 19:58:40 -0400
commitb24a7267709bb0adb694364572478f919e9c7390 (patch)
tree1b1f56549c9966a483846d10c96dba1153210d38 /drivers/rtc/rtc-ds1307.c
parent32d322bcb0d6886084197247e30aa130956d5978 (diff)
rtc: ds1307: simplify irq setup code
No need to have two seperate if-blocks for setting up the irq. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Tested-by: David Anders <danders.dev@gmail.com> Cc: Austin Boyle <Austin.Boyle@aviatnet.com> Cc: Alessandro Zummo <alessandro.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-ds1307.c')
-rw-r--r--drivers/rtc/rtc-ds1307.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 5098e1ad3a3e..d4543e8730cb 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -646,11 +646,6 @@ static int __devinit ds1307_probe(struct i2c_client *client,
646 case ds_1337: 646 case ds_1337:
647 case ds_1339: 647 case ds_1339:
648 case ds_3231: 648 case ds_3231:
649 /* has IRQ? */
650 if (ds1307->client->irq > 0 && chip->alarm) {
651 INIT_WORK(&ds1307->work, ds1307_work);
652 want_irq = true;
653 }
654 /* get registers that the "rtc" read below won't read... */ 649 /* get registers that the "rtc" read below won't read... */
655 tmp = ds1307->read_block_data(ds1307->client, 650 tmp = ds1307->read_block_data(ds1307->client,
656 DS1337_REG_CONTROL, 2, buf); 651 DS1337_REG_CONTROL, 2, buf);
@@ -668,10 +663,14 @@ static int __devinit ds1307_probe(struct i2c_client *client,
668 * For some variants, be sure alarms can trigger when we're 663 * For some variants, be sure alarms can trigger when we're
669 * running on Vbackup (BBSQI/BBSQW) 664 * running on Vbackup (BBSQI/BBSQW)
670 */ 665 */
671 if (want_irq) { 666 if (ds1307->client->irq > 0 && chip->alarm) {
667 INIT_WORK(&ds1307->work, ds1307_work);
668
672 ds1307->regs[0] |= DS1337_BIT_INTCN 669 ds1307->regs[0] |= DS1337_BIT_INTCN
673 | bbsqi_bitpos[ds1307->type]; 670 | bbsqi_bitpos[ds1307->type];
674 ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); 671 ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
672
673 want_irq = true;
675 } 674 }
676 675
677 i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, 676 i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,