hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rtc/rtc-rk808.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * RTC driver for Rockchip RK808
34 *
....@@ -5,15 +6,6 @@
56 *
67 * Author: Chris Zhong <zyw@rock-chips.com>
78 * Author: Zhang Qing <zhangqing@rock-chips.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify it
10
- * under the terms and conditions of the GNU General Public License,
11
- * version 2, as published by the Free Software Foundation.
12
- *
13
- * This program is distributed in the hope it will be useful, but WITHOUT
14
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
- * more details.
179 */
1810
1911 #include <linux/module.h>
....@@ -241,10 +233,8 @@
241233 return ret;
242234 }
243235
244
- dev_dbg(dev, "alrm read RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
245
- 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1,
246
- alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour,
247
- alrm->time.tm_min, alrm->time.tm_sec);
236
+ dev_dbg(dev, "alrm read RTC date/time %ptRd(%d) %ptRt\n",
237
+ &alrm->time, alrm->time.tm_wday, &alrm->time);
248238
249239 alrm->enabled = (int_reg & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M) ? 1 : 0;
250240
....@@ -292,10 +282,8 @@
292282 dev_err(dev, "Failed to stop alarm: %d\n", ret);
293283 return ret;
294284 }
295
- dev_dbg(dev, "alrm set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
296
- 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1,
297
- alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour,
298
- alrm->time.tm_min, alrm->time.tm_sec);
285
+ dev_dbg(dev, "alrm set RTC date/time %ptRd(%d) %ptRt\n",
286
+ &alrm->time, alrm->time.tm_wday, &alrm->time);
299287
300288 if (rk808_rtc->flag & RTC_NEED_TRANSITIONS)
301289 gregorian_to_rockchip(&alrm->time);
....@@ -378,8 +366,7 @@
378366 /* Turn off the alarm if it should not be a wake source. */
379367 static int rk808_rtc_suspend(struct device *dev)
380368 {
381
- struct platform_device *pdev = to_platform_device(dev);
382
- struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev);
369
+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
383370
384371 if (device_may_wakeup(dev))
385372 enable_irq_wake(rk808_rtc->irq);
....@@ -392,8 +379,7 @@
392379 */
393380 static int rk808_rtc_resume(struct device *dev)
394381 {
395
- struct platform_device *pdev = to_platform_device(dev);
396
- struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev);
382
+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
397383
398384 if (device_may_wakeup(dev))
399385 disable_irq_wake(rk808_rtc->irq);
....@@ -484,7 +470,7 @@
484470 if (ret) {
485471 dev_err(&pdev->dev,
486472 "Failed to write RTC status: %d\n", ret);
487
- return ret;
473
+ return ret;
488474 }
489475
490476 device_init_wakeup(&pdev->dev, 1);
....@@ -496,12 +482,8 @@
496482 rk808_rtc->rtc->ops = &rk808_rtc_ops;
497483
498484 rk808_rtc->irq = platform_get_irq(pdev, 0);
499
- if (rk808_rtc->irq < 0) {
500
- if (rk808_rtc->irq != -EPROBE_DEFER)
501
- dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
502
- rk808_rtc->irq);
485
+ if (rk808_rtc->irq < 0)
503486 return rk808_rtc->irq;
504
- }
505487
506488 /* request alarm irq of rk808 */
507489 ret = devm_request_threaded_irq(&pdev->dev, rk808_rtc->irq, NULL,