@@ -58,8 +58,6 @@ static DEFINE_SPINLOCK(freezer_delta_lock);
58
58
#endif
59
59
60
60
#ifdef CONFIG_RTC_CLASS
61
- static struct wakeup_source * ws ;
62
-
63
61
/* rtc timer and device for setting alarm wakeups at suspend */
64
62
static struct rtc_timer rtctimer ;
65
63
static struct rtc_device * rtcdev ;
@@ -88,7 +86,6 @@ static int alarmtimer_rtc_add_device(struct device *dev,
88
86
{
89
87
unsigned long flags ;
90
88
struct rtc_device * rtc = to_rtc_device (dev );
91
- struct wakeup_source * __ws ;
92
89
struct platform_device * pdev ;
93
90
int ret = 0 ;
94
91
@@ -100,12 +97,13 @@ static int alarmtimer_rtc_add_device(struct device *dev,
100
97
if (!device_may_wakeup (rtc -> dev .parent ))
101
98
return -1 ;
102
99
103
- __ws = wakeup_source_register (dev , "alarmtimer" );
104
100
pdev = platform_device_register_data (dev , "alarmtimer" ,
105
101
PLATFORM_DEVID_AUTO , NULL , 0 );
102
+ if (!IS_ERR (pdev ))
103
+ device_init_wakeup (& pdev -> dev , true);
106
104
107
105
spin_lock_irqsave (& rtcdev_lock , flags );
108
- if (__ws && !IS_ERR (pdev ) && !rtcdev ) {
106
+ if (!IS_ERR (pdev ) && !rtcdev ) {
109
107
if (!try_module_get (rtc -> owner )) {
110
108
ret = -1 ;
111
109
goto unlock ;
@@ -114,8 +112,6 @@ static int alarmtimer_rtc_add_device(struct device *dev,
114
112
rtcdev = rtc ;
115
113
/* hold a reference so it doesn't go away */
116
114
get_device (dev );
117
- ws = __ws ;
118
- __ws = NULL ;
119
115
pdev = NULL ;
120
116
} else {
121
117
ret = -1 ;
@@ -124,7 +120,6 @@ static int alarmtimer_rtc_add_device(struct device *dev,
124
120
spin_unlock_irqrestore (& rtcdev_lock , flags );
125
121
126
122
platform_device_unregister (pdev );
127
- wakeup_source_unregister (__ws );
128
123
129
124
return ret ;
130
125
}
@@ -291,7 +286,7 @@ static int alarmtimer_suspend(struct device *dev)
291
286
return 0 ;
292
287
293
288
if (ktime_to_ns (min ) < 2 * NSEC_PER_SEC ) {
294
- __pm_wakeup_event ( ws , 2 * MSEC_PER_SEC );
289
+ pm_wakeup_event ( dev , 2 * MSEC_PER_SEC );
295
290
return - EBUSY ;
296
291
}
297
292
@@ -306,7 +301,7 @@ static int alarmtimer_suspend(struct device *dev)
306
301
/* Set alarm, if in the past reject suspend briefly to handle */
307
302
ret = rtc_timer_start (rtc , & rtctimer , now , 0 );
308
303
if (ret < 0 )
309
- __pm_wakeup_event ( ws , MSEC_PER_SEC );
304
+ pm_wakeup_event ( dev , MSEC_PER_SEC );
310
305
return ret ;
311
306
}
312
307
0 commit comments