Message ID | 1317241107-11392-3-git-send-email-w.sang@pengutronix.de |
---|---|
State | Superseded |
Headers | show |
tested with DS1307 and MCP79410 Tested-by: David Anders <danders.dev@gmail.com> On Wed, Sep 28, 2011 at 3:18 PM, Wolfram Sang <w.sang@pengutronix.de> wrote: > No need to have two seperate if-blocks for setting up the irq. > They can be merged. > > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> > --- > drivers/rtc/rtc-ds1307.c | 10 ++++------ > 1 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c > index 6a64f4a..2a98601 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, > case ds_1337: > case ds_1339: > case ds_3231: > - /* has IRQ? */ > - if (ds1307->client->irq > 0 && chip && chip->alarm) { > - INIT_WORK(&ds1307->work, ds1307_work); > - want_irq = true; > - } > /* get registers that the "rtc" read below won't read... */ > tmp = ds1307->read_block_data(ds1307->client, > DS1337_REG_CONTROL, 2, buf); > @@ -668,10 +663,13 @@ static int __devinit ds1307_probe(struct i2c_client > *client, > * For some variants, be sure alarms can trigger when we're > * running on Vbackup (BBSQI/BBSQW) > */ > - if (want_irq) { > + if (ds1307->client->irq > 0 && chip && chip->alarm) { > ds1307->regs[0] |= DS1337_BIT_INTCN > | bbsqi_bitpos[ds1307->type]; > ds1307->regs[0] &= ~(DS1337_BIT_A2IE | > DS1337_BIT_A1IE); > + > + INIT_WORK(&ds1307->work, ds1307_work); > + want_irq = true; > } > > i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, > -- > 1.7.2.5 > >
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 6a64f4a..2a98601 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, case ds_1337: case ds_1339: case ds_3231: - /* has IRQ? */ - if (ds1307->client->irq > 0 && chip && chip->alarm) { - INIT_WORK(&ds1307->work, ds1307_work); - want_irq = true; - } /* get registers that the "rtc" read below won't read... */ tmp = ds1307->read_block_data(ds1307->client, DS1337_REG_CONTROL, 2, buf); @@ -668,10 +663,13 @@ static int __devinit ds1307_probe(struct i2c_client *client, * For some variants, be sure alarms can trigger when we're * running on Vbackup (BBSQI/BBSQW) */ - if (want_irq) { + if (ds1307->client->irq > 0 && chip && chip->alarm) { ds1307->regs[0] |= DS1337_BIT_INTCN | bbsqi_bitpos[ds1307->type]; ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); + + INIT_WORK(&ds1307->work, ds1307_work); + want_irq = true; } i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
No need to have two seperate if-blocks for setting up the irq. They can be merged. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> --- drivers/rtc/rtc-ds1307.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)