diff options
Diffstat (limited to 'drivers/rtc/rtc-ds1374.c')
-rw-r--r-- | drivers/rtc/rtc-ds1374.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 32b27739ec2a..47fb6357c346 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/rtc.h> | 24 | #include <linux/rtc.h> |
25 | #include <linux/bcd.h> | 25 | #include <linux/bcd.h> |
26 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
27 | #include <linux/slab.h> | ||
27 | 28 | ||
28 | #define DS1374_REG_TOD0 0x00 /* Time of Day */ | 29 | #define DS1374_REG_TOD0 0x00 /* Time of Day */ |
29 | #define DS1374_REG_TOD1 0x01 | 30 | #define DS1374_REG_TOD1 0x01 |
@@ -283,7 +284,7 @@ static void ds1374_work(struct work_struct *work) | |||
283 | 284 | ||
284 | stat = i2c_smbus_read_byte_data(client, DS1374_REG_SR); | 285 | stat = i2c_smbus_read_byte_data(client, DS1374_REG_SR); |
285 | if (stat < 0) | 286 | if (stat < 0) |
286 | return; | 287 | goto unlock; |
287 | 288 | ||
288 | if (stat & DS1374_REG_SR_AF) { | 289 | if (stat & DS1374_REG_SR_AF) { |
289 | stat &= ~DS1374_REG_SR_AF; | 290 | stat &= ~DS1374_REG_SR_AF; |
@@ -302,7 +303,7 @@ static void ds1374_work(struct work_struct *work) | |||
302 | out: | 303 | out: |
303 | if (!ds1374->exiting) | 304 | if (!ds1374->exiting) |
304 | enable_irq(client->irq); | 305 | enable_irq(client->irq); |
305 | 306 | unlock: | |
306 | mutex_unlock(&ds1374->mutex); | 307 | mutex_unlock(&ds1374->mutex); |
307 | } | 308 | } |
308 | 309 | ||
@@ -383,6 +384,8 @@ static int ds1374_probe(struct i2c_client *client, | |||
383 | dev_err(&client->dev, "unable to request IRQ\n"); | 384 | dev_err(&client->dev, "unable to request IRQ\n"); |
384 | goto out_free; | 385 | goto out_free; |
385 | } | 386 | } |
387 | |||
388 | device_set_wakeup_capable(&client->dev, 1); | ||
386 | } | 389 | } |
387 | 390 | ||
388 | ds1374->rtc = rtc_device_register(client->name, &client->dev, | 391 | ds1374->rtc = rtc_device_register(client->name, &client->dev, |
@@ -400,7 +403,6 @@ out_irq: | |||
400 | free_irq(client->irq, client); | 403 | free_irq(client->irq, client); |
401 | 404 | ||
402 | out_free: | 405 | out_free: |
403 | i2c_set_clientdata(client, NULL); | ||
404 | kfree(ds1374); | 406 | kfree(ds1374); |
405 | return ret; | 407 | return ret; |
406 | } | 408 | } |
@@ -415,11 +417,10 @@ static int __devexit ds1374_remove(struct i2c_client *client) | |||
415 | mutex_unlock(&ds1374->mutex); | 417 | mutex_unlock(&ds1374->mutex); |
416 | 418 | ||
417 | free_irq(client->irq, client); | 419 | free_irq(client->irq, client); |
418 | flush_scheduled_work(); | 420 | cancel_work_sync(&ds1374->work); |
419 | } | 421 | } |
420 | 422 | ||
421 | rtc_device_unregister(ds1374->rtc); | 423 | rtc_device_unregister(ds1374->rtc); |
422 | i2c_set_clientdata(client, NULL); | ||
423 | kfree(ds1374); | 424 | kfree(ds1374); |
424 | return 0; | 425 | return 0; |
425 | } | 426 | } |