@@ -55,7 +55,7 @@ struct arche_platform_drvdata {
55
55
56
56
enum svc_wakedetect_state wake_detect_state ;
57
57
int wake_detect_irq ;
58
- spinlock_t lock ;
58
+ spinlock_t wake_lock ; /* Protect wake_detect_state */
59
59
unsigned long wake_detect_start ;
60
60
struct notifier_block pm_notifier ;
61
61
@@ -117,15 +117,15 @@ static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid)
117
117
struct arche_platform_drvdata * arche_pdata = devid ;
118
118
unsigned long flags ;
119
119
120
- spin_lock_irqsave (& arche_pdata -> lock , flags );
120
+ spin_lock_irqsave (& arche_pdata -> wake_lock , flags );
121
121
if (arche_pdata -> wake_detect_state != WD_STATE_COLDBOOT_TRIG ) {
122
122
/* Something is wrong */
123
- spin_unlock_irqrestore (& arche_pdata -> lock , flags );
123
+ spin_unlock_irqrestore (& arche_pdata -> wake_lock , flags );
124
124
return IRQ_HANDLED ;
125
125
}
126
126
127
127
arche_pdata -> wake_detect_state = WD_STATE_COLDBOOT_START ;
128
- spin_unlock_irqrestore (& arche_pdata -> lock , flags );
128
+ spin_unlock_irqrestore (& arche_pdata -> wake_lock , flags );
129
129
130
130
/* It should complete power cycle, so first make sure it is poweroff */
131
131
device_for_each_child (arche_pdata -> dev , NULL , apb_poweroff );
@@ -137,9 +137,9 @@ static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid)
137
137
if (usb3613_hub_mode_ctrl (true))
138
138
dev_warn (arche_pdata -> dev , "failed to control hub device\n" );
139
139
140
- spin_lock_irqsave (& arche_pdata -> lock , flags );
140
+ spin_lock_irqsave (& arche_pdata -> wake_lock , flags );
141
141
arche_pdata -> wake_detect_state = WD_STATE_IDLE ;
142
- spin_unlock_irqrestore (& arche_pdata -> lock , flags );
142
+ spin_unlock_irqrestore (& arche_pdata -> wake_lock , flags );
143
143
144
144
return IRQ_HANDLED ;
145
145
}
@@ -149,7 +149,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
149
149
struct arche_platform_drvdata * arche_pdata = devid ;
150
150
unsigned long flags ;
151
151
152
- spin_lock_irqsave (& arche_pdata -> lock , flags );
152
+ spin_lock_irqsave (& arche_pdata -> wake_lock , flags );
153
153
154
154
if (gpio_get_value (arche_pdata -> wake_detect_gpio )) {
155
155
/* wake/detect rising */
@@ -170,7 +170,9 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
170
170
WD_STATE_COLDBOOT_START ) {
171
171
arche_pdata -> wake_detect_state =
172
172
WD_STATE_COLDBOOT_TRIG ;
173
- spin_unlock_irqrestore (& arche_pdata -> lock , flags );
173
+ spin_unlock_irqrestore (
174
+ & arche_pdata -> wake_lock ,
175
+ flags );
174
176
return IRQ_WAKE_THREAD ;
175
177
}
176
178
}
@@ -188,7 +190,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
188
190
}
189
191
}
190
192
191
- spin_unlock_irqrestore (& arche_pdata -> lock , flags );
193
+ spin_unlock_irqrestore (& arche_pdata -> wake_lock , flags );
192
194
193
195
return IRQ_HANDLED ;
194
196
}
@@ -257,9 +259,9 @@ static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pda
257
259
/* Send disconnect/detach event to SVC */
258
260
gpio_direction_output (arche_pdata -> wake_detect_gpio , 0 );
259
261
usleep_range (100 , 200 );
260
- spin_lock_irqsave (& arche_pdata -> lock , flags );
262
+ spin_lock_irqsave (& arche_pdata -> wake_lock , flags );
261
263
arche_pdata -> wake_detect_state = WD_STATE_IDLE ;
262
- spin_unlock_irqrestore (& arche_pdata -> lock , flags );
264
+ spin_unlock_irqrestore (& arche_pdata -> wake_lock , flags );
263
265
264
266
clk_disable_unprepare (arche_pdata -> svc_ref_clk );
265
267
}
@@ -465,7 +467,7 @@ static int arche_platform_probe(struct platform_device *pdev)
465
467
466
468
arche_pdata -> dev = & pdev -> dev ;
467
469
468
- spin_lock_init (& arche_pdata -> lock );
470
+ spin_lock_init (& arche_pdata -> wake_lock );
469
471
arche_pdata -> wake_detect_irq =
470
472
gpio_to_irq (arche_pdata -> wake_detect_gpio );
471
473
0 commit comments