]> Pileus Git - ~andy/linux/blobdiff - drivers/rtc/rtc-max8998.c
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / drivers / rtc / rtc-max8998.c
index d5af7baa48b56c893e449b418d158f7b25448628..f098ad8382de021a7a66a442680c42d9393d7af6 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/bcd.h>
+#include <linux/irqdomain.h>
 #include <linux/rtc.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/max8998.h>
@@ -252,7 +253,7 @@ static const struct rtc_class_ops max8998_rtc_ops = {
 static int max8998_rtc_probe(struct platform_device *pdev)
 {
        struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent);
-       struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev);
+       struct max8998_platform_data *pdata = max8998->pdata;
        struct max8998_rtc_info *info;
        int ret;
 
@@ -264,7 +265,6 @@ static int max8998_rtc_probe(struct platform_device *pdev)
        info->dev = &pdev->dev;
        info->max8998 = max8998;
        info->rtc = max8998->rtc;
-       info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0;
 
        platform_set_drvdata(pdev, info);
 
@@ -274,7 +274,16 @@ static int max8998_rtc_probe(struct platform_device *pdev)
        if (IS_ERR(info->rtc_dev)) {
                ret = PTR_ERR(info->rtc_dev);
                dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
-               goto out_rtc;
+               return ret;
+       }
+
+       if (!max8998->irq_domain)
+               goto no_irq;
+
+       info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0);
+       if (!info->irq) {
+               dev_warn(&pdev->dev, "Failed to map alarm IRQ\n");
+               goto no_irq;
        }
 
        ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
@@ -284,6 +293,7 @@ static int max8998_rtc_probe(struct platform_device *pdev)
                dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
                        info->irq, ret);
 
+no_irq:
        dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name);
        if (pdata && pdata->rtc_delay) {
                info->lp3974_bug_workaround = true;
@@ -292,15 +302,6 @@ static int max8998_rtc_probe(struct platform_device *pdev)
        }
 
        return 0;
-
-out_rtc:
-       platform_set_drvdata(pdev, NULL);
-       return ret;
-}
-
-static int max8998_rtc_remove(struct platform_device *pdev)
-{
-       return 0;
 }
 
 static const struct platform_device_id max8998_rtc_id[] = {
@@ -315,7 +316,6 @@ static struct platform_driver max8998_rtc_driver = {
                .owner  = THIS_MODULE,
        },
        .probe          = max8998_rtc_probe,
-       .remove         = max8998_rtc_remove,
        .id_table       = max8998_rtc_id,
 };