hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rtc/rtc-wm8350.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Real Time Clock driver for Wolfson Microelectronics WM8350
34 *
....@@ -5,12 +6,6 @@
56 *
67 * Author: Liam Girdwood
78 * linux@wolfsonmicro.com
8
- *
9
- * This program is free software; you can redistribute it and/or modify it
10
- * under the terms of the GNU General Public License as published by the
11
- * Free Software Foundation; either version 2 of the License, or (at your
12
- * option) any later version.
13
- *
149 */
1510
1611 #include <linux/module.h>
....@@ -340,8 +335,7 @@
340335 #ifdef CONFIG_PM_SLEEP
341336 static int wm8350_rtc_suspend(struct device *dev)
342337 {
343
- struct platform_device *pdev = to_platform_device(dev);
344
- struct wm8350 *wm8350 = dev_get_drvdata(&pdev->dev);
338
+ struct wm8350 *wm8350 = dev_get_drvdata(dev);
345339 int ret = 0;
346340 u16 reg;
347341
....@@ -351,8 +345,7 @@
351345 reg & WM8350_RTC_ALMSTS) {
352346 ret = wm8350_rtc_stop_alarm(wm8350);
353347 if (ret != 0)
354
- dev_err(&pdev->dev, "Failed to stop RTC alarm: %d\n",
355
- ret);
348
+ dev_err(dev, "Failed to stop RTC alarm: %d\n", ret);
356349 }
357350
358351 return ret;
....@@ -360,15 +353,13 @@
360353
361354 static int wm8350_rtc_resume(struct device *dev)
362355 {
363
- struct platform_device *pdev = to_platform_device(dev);
364
- struct wm8350 *wm8350 = dev_get_drvdata(&pdev->dev);
356
+ struct wm8350 *wm8350 = dev_get_drvdata(dev);
365357 int ret;
366358
367359 if (wm8350->rtc.alarm_enabled) {
368360 ret = wm8350_rtc_start_alarm(wm8350);
369361 if (ret != 0)
370
- dev_err(&pdev->dev,
371
- "Failed to restart RTC alarm: %d\n", ret);
362
+ dev_err(dev, "Failed to restart RTC alarm: %d\n", ret);
372363 }
373364
374365 return 0;
....@@ -441,14 +432,21 @@
441432 return ret;
442433 }
443434
444
- wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
435
+ ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
445436 wm8350_rtc_update_handler, 0,
446437 "RTC Seconds", wm8350);
438
+ if (ret)
439
+ return ret;
440
+
447441 wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC);
448442
449
- wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM,
443
+ ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM,
450444 wm8350_rtc_alarm_handler, 0,
451445 "RTC Alarm", wm8350);
446
+ if (ret) {
447
+ wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350);
448
+ return ret;
449
+ }
452450
453451 return 0;
454452 }