diff options
Diffstat (limited to 'drivers/rtc/rtc-ds1305.c')
-rw-r--r-- | drivers/rtc/rtc-ds1305.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c index 2736b11a1b1e..7836c9cec557 100644 --- a/drivers/rtc/rtc-ds1305.c +++ b/drivers/rtc/rtc-ds1305.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/bcd.h> | 13 | #include <linux/bcd.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/rtc.h> | 15 | #include <linux/rtc.h> |
15 | #include <linux/workqueue.h> | 16 | #include <linux/workqueue.h> |
16 | 17 | ||
@@ -617,7 +618,6 @@ static struct bin_attribute nvram = { | |||
617 | static int __devinit ds1305_probe(struct spi_device *spi) | 618 | static int __devinit ds1305_probe(struct spi_device *spi) |
618 | { | 619 | { |
619 | struct ds1305 *ds1305; | 620 | struct ds1305 *ds1305; |
620 | struct rtc_device *rtc; | ||
621 | int status; | 621 | int status; |
622 | u8 addr, value; | 622 | u8 addr, value; |
623 | struct ds1305_platform_data *pdata = spi->dev.platform_data; | 623 | struct ds1305_platform_data *pdata = spi->dev.platform_data; |
@@ -756,14 +756,13 @@ static int __devinit ds1305_probe(struct spi_device *spi) | |||
756 | dev_dbg(&spi->dev, "AM/PM\n"); | 756 | dev_dbg(&spi->dev, "AM/PM\n"); |
757 | 757 | ||
758 | /* register RTC ... from here on, ds1305->ctrl needs locking */ | 758 | /* register RTC ... from here on, ds1305->ctrl needs locking */ |
759 | rtc = rtc_device_register("ds1305", &spi->dev, | 759 | ds1305->rtc = rtc_device_register("ds1305", &spi->dev, |
760 | &ds1305_ops, THIS_MODULE); | 760 | &ds1305_ops, THIS_MODULE); |
761 | if (IS_ERR(rtc)) { | 761 | if (IS_ERR(ds1305->rtc)) { |
762 | status = PTR_ERR(rtc); | 762 | status = PTR_ERR(ds1305->rtc); |
763 | dev_dbg(&spi->dev, "register rtc --> %d\n", status); | 763 | dev_dbg(&spi->dev, "register rtc --> %d\n", status); |
764 | goto fail0; | 764 | goto fail0; |
765 | } | 765 | } |
766 | ds1305->rtc = rtc; | ||
767 | 766 | ||
768 | /* Maybe set up alarm IRQ; be ready to handle it triggering right | 767 | /* Maybe set up alarm IRQ; be ready to handle it triggering right |
769 | * away. NOTE that we don't share this. The signal is active low, | 768 | * away. NOTE that we don't share this. The signal is active low, |
@@ -774,12 +773,14 @@ static int __devinit ds1305_probe(struct spi_device *spi) | |||
774 | if (spi->irq) { | 773 | if (spi->irq) { |
775 | INIT_WORK(&ds1305->work, ds1305_work); | 774 | INIT_WORK(&ds1305->work, ds1305_work); |
776 | status = request_irq(spi->irq, ds1305_irq, | 775 | status = request_irq(spi->irq, ds1305_irq, |
777 | 0, dev_name(&rtc->dev), ds1305); | 776 | 0, dev_name(&ds1305->rtc->dev), ds1305); |
778 | if (status < 0) { | 777 | if (status < 0) { |
779 | dev_dbg(&spi->dev, "request_irq %d --> %d\n", | 778 | dev_dbg(&spi->dev, "request_irq %d --> %d\n", |
780 | spi->irq, status); | 779 | spi->irq, status); |
781 | goto fail1; | 780 | goto fail1; |
782 | } | 781 | } |
782 | |||
783 | device_set_wakeup_capable(&spi->dev, 1); | ||
783 | } | 784 | } |
784 | 785 | ||
785 | /* export NVRAM */ | 786 | /* export NVRAM */ |
@@ -794,7 +795,7 @@ static int __devinit ds1305_probe(struct spi_device *spi) | |||
794 | fail2: | 795 | fail2: |
795 | free_irq(spi->irq, ds1305); | 796 | free_irq(spi->irq, ds1305); |
796 | fail1: | 797 | fail1: |
797 | rtc_device_unregister(rtc); | 798 | rtc_device_unregister(ds1305->rtc); |
798 | fail0: | 799 | fail0: |
799 | kfree(ds1305); | 800 | kfree(ds1305); |
800 | return status; | 801 | return status; |
@@ -802,7 +803,7 @@ fail0: | |||
802 | 803 | ||
803 | static int __devexit ds1305_remove(struct spi_device *spi) | 804 | static int __devexit ds1305_remove(struct spi_device *spi) |
804 | { | 805 | { |
805 | struct ds1305 *ds1305 = spi_get_drvdata(spi); | 806 | struct ds1305 *ds1305 = spi_get_drvdata(spi); |
806 | 807 | ||
807 | sysfs_remove_bin_file(&spi->dev.kobj, &nvram); | 808 | sysfs_remove_bin_file(&spi->dev.kobj, &nvram); |
808 | 809 | ||