@@ -99,6 +99,15 @@ static void imx_sc_check_for_events(struct work_struct *work)
99
99
msecs_to_jiffies (REPEAT_INTERVAL ));
100
100
}
101
101
102
+ static void imx_sc_key_action (void * data )
103
+ {
104
+ struct imx_key_drv_data * priv = data ;
105
+
106
+ imx_scu_irq_group_enable (SC_IRQ_GROUP_WAKE , SC_IRQ_BUTTON , false);
107
+ imx_scu_irq_unregister_notifier (& priv -> key_notifier );
108
+ cancel_delayed_work_sync (& priv -> check_work );
109
+ }
110
+
102
111
static int imx_sc_key_probe (struct platform_device * pdev )
103
112
{
104
113
struct imx_key_drv_data * priv ;
@@ -149,27 +158,16 @@ static int imx_sc_key_probe(struct platform_device *pdev)
149
158
return error ;
150
159
}
151
160
161
+ error = devm_add_action_or_reset (& pdev -> dev , imx_sc_key_action , & priv );
162
+ if (error )
163
+ return error ;
164
+
152
165
priv -> key_notifier .notifier_call = imx_sc_key_notify ;
153
166
error = imx_scu_irq_register_notifier (& priv -> key_notifier );
154
- if (error ) {
155
- imx_scu_irq_group_enable (SC_IRQ_GROUP_WAKE , SC_IRQ_BUTTON ,
156
- false);
167
+ if (error )
157
168
dev_err (& pdev -> dev , "failed to register scu notifier\n" );
158
- return error ;
159
- }
160
-
161
- return 0 ;
162
- }
163
-
164
- static int imx_sc_key_remove (struct platform_device * pdev )
165
- {
166
- struct imx_key_drv_data * priv = platform_get_drvdata (pdev );
167
-
168
- imx_scu_irq_group_enable (SC_IRQ_GROUP_WAKE , SC_IRQ_BUTTON , false);
169
- imx_scu_irq_unregister_notifier (& priv -> key_notifier );
170
- cancel_delayed_work_sync (& priv -> check_work );
171
169
172
- return 0 ;
170
+ return error ;
173
171
}
174
172
175
173
static const struct of_device_id imx_sc_key_ids [] = {
@@ -184,7 +182,6 @@ static struct platform_driver imx_sc_key_driver = {
184
182
.of_match_table = imx_sc_key_ids ,
185
183
},
186
184
.probe = imx_sc_key_probe ,
187
- .remove = imx_sc_key_remove ,
188
185
};
189
186
module_platform_driver (imx_sc_key_driver );
190
187
0 commit comments