aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max8998.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-max8998.c')
-rw-r--r--drivers/rtc/rtc-max8998.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c
index d5af7baa48b5..f098ad8382de 100644
--- a/drivers/rtc/rtc-max8998.c
+++ b/drivers/rtc/rtc-max8998.c
@@ -16,6 +16,7 @@
16#include <linux/i2c.h> 16#include <linux/i2c.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/bcd.h> 18#include <linux/bcd.h>
19#include <linux/irqdomain.h>
19#include <linux/rtc.h> 20#include <linux/rtc.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/mfd/max8998.h> 22#include <linux/mfd/max8998.h>
@@ -252,7 +253,7 @@ static const struct rtc_class_ops max8998_rtc_ops = {
252static int max8998_rtc_probe(struct platform_device *pdev) 253static int max8998_rtc_probe(struct platform_device *pdev)
253{ 254{
254 struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent); 255 struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent);
255 struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev); 256 struct max8998_platform_data *pdata = max8998->pdata;
256 struct max8998_rtc_info *info; 257 struct max8998_rtc_info *info;
257 int ret; 258 int ret;
258 259
@@ -264,7 +265,6 @@ static int max8998_rtc_probe(struct platform_device *pdev)
264 info->dev = &pdev->dev; 265 info->dev = &pdev->dev;
265 info->max8998 = max8998; 266 info->max8998 = max8998;
266 info->rtc = max8998->rtc; 267 info->rtc = max8998->rtc;
267 info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0;
268 268
269 platform_set_drvdata(pdev, info); 269 platform_set_drvdata(pdev, info);
270 270
@@ -274,7 +274,16 @@ static int max8998_rtc_probe(struct platform_device *pdev)
274 if (IS_ERR(info->rtc_dev)) { 274 if (IS_ERR(info->rtc_dev)) {
275 ret = PTR_ERR(info->rtc_dev); 275 ret = PTR_ERR(info->rtc_dev);
276 dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret); 276 dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
277 goto out_rtc; 277 return ret;
278 }
279
280 if (!max8998->irq_domain)
281 goto no_irq;
282
283 info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0);
284 if (!info->irq) {
285 dev_warn(&pdev->dev, "Failed to map alarm IRQ\n");
286 goto no_irq;
278 } 287 }
279 288
280 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, 289 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
@@ -284,6 +293,7 @@ static int max8998_rtc_probe(struct platform_device *pdev)
284 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", 293 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
285 info->irq, ret); 294 info->irq, ret);
286 295
296no_irq:
287 dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); 297 dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name);
288 if (pdata && pdata->rtc_delay) { 298 if (pdata && pdata->rtc_delay) {
289 info->lp3974_bug_workaround = true; 299 info->lp3974_bug_workaround = true;
@@ -292,15 +302,6 @@ static int max8998_rtc_probe(struct platform_device *pdev)
292 } 302 }
293 303
294 return 0; 304 return 0;
295
296out_rtc:
297 platform_set_drvdata(pdev, NULL);
298 return ret;
299}
300
301static int max8998_rtc_remove(struct platform_device *pdev)
302{
303 return 0;
304} 305}
305 306
306static const struct platform_device_id max8998_rtc_id[] = { 307static const struct platform_device_id max8998_rtc_id[] = {
@@ -315,7 +316,6 @@ static struct platform_driver max8998_rtc_driver = {
315 .owner = THIS_MODULE, 316 .owner = THIS_MODULE,
316 }, 317 },
317 .probe = max8998_rtc_probe, 318 .probe = max8998_rtc_probe,
318 .remove = max8998_rtc_remove,
319 .id_table = max8998_rtc_id, 319 .id_table = max8998_rtc_id,
320}; 320};
321 321