@@ -280,29 +280,6 @@ static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state
280
280
return 0 ;
281
281
}
282
282
283
- int
284
- vchiq_platform_init_state (struct vchiq_state * state )
285
- {
286
- struct vchiq_arm_state * platform_state ;
287
-
288
- platform_state = devm_kzalloc (state -> dev , sizeof (* platform_state ), GFP_KERNEL );
289
- if (!platform_state )
290
- return - ENOMEM ;
291
-
292
- rwlock_init (& platform_state -> susp_res_lock );
293
-
294
- init_completion (& platform_state -> ka_evt );
295
- atomic_set (& platform_state -> ka_use_count , 0 );
296
- atomic_set (& platform_state -> ka_use_ack_count , 0 );
297
- atomic_set (& platform_state -> ka_release_count , 0 );
298
-
299
- platform_state -> state = state ;
300
-
301
- state -> platform_state = (struct opaque_platform_state * )platform_state ;
302
-
303
- return 0 ;
304
- }
305
-
306
283
static struct vchiq_arm_state * vchiq_platform_get_arm_state (struct vchiq_state * state )
307
284
{
308
285
return (struct vchiq_arm_state * )state -> platform_state ;
@@ -1011,6 +988,39 @@ vchiq_keepalive_thread_func(void *v)
1011
988
return 0 ;
1012
989
}
1013
990
991
+ int
992
+ vchiq_platform_init_state (struct vchiq_state * state )
993
+ {
994
+ struct vchiq_arm_state * platform_state ;
995
+ char threadname [16 ];
996
+
997
+ platform_state = devm_kzalloc (state -> dev , sizeof (* platform_state ), GFP_KERNEL );
998
+ if (!platform_state )
999
+ return - ENOMEM ;
1000
+
1001
+ snprintf (threadname , sizeof (threadname ), "vchiq-keep/%d" ,
1002
+ state -> id );
1003
+ platform_state -> ka_thread = kthread_create (& vchiq_keepalive_thread_func ,
1004
+ (void * )state , threadname );
1005
+ if (IS_ERR (platform_state -> ka_thread )) {
1006
+ dev_err (state -> dev , "couldn't create thread %s\n" , threadname );
1007
+ return PTR_ERR (platform_state -> ka_thread );
1008
+ }
1009
+
1010
+ rwlock_init (& platform_state -> susp_res_lock );
1011
+
1012
+ init_completion (& platform_state -> ka_evt );
1013
+ atomic_set (& platform_state -> ka_use_count , 0 );
1014
+ atomic_set (& platform_state -> ka_use_ack_count , 0 );
1015
+ atomic_set (& platform_state -> ka_release_count , 0 );
1016
+
1017
+ platform_state -> state = state ;
1018
+
1019
+ state -> platform_state = (struct opaque_platform_state * )platform_state ;
1020
+
1021
+ return 0 ;
1022
+ }
1023
+
1014
1024
int
1015
1025
vchiq_use_internal (struct vchiq_state * state , struct vchiq_service * service ,
1016
1026
enum USE_TYPE_E use_type )
@@ -1331,7 +1341,6 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
1331
1341
enum vchiq_connstate newstate )
1332
1342
{
1333
1343
struct vchiq_arm_state * arm_state = vchiq_platform_get_arm_state (state );
1334
- char threadname [16 ];
1335
1344
1336
1345
dev_dbg (state -> dev , "suspend: %d: %s->%s\n" ,
1337
1346
state -> id , get_conn_state_name (oldstate ), get_conn_state_name (newstate ));
@@ -1346,17 +1355,7 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
1346
1355
1347
1356
arm_state -> first_connect = 1 ;
1348
1357
write_unlock_bh (& arm_state -> susp_res_lock );
1349
- snprintf (threadname , sizeof (threadname ), "vchiq-keep/%d" ,
1350
- state -> id );
1351
- arm_state -> ka_thread = kthread_create (& vchiq_keepalive_thread_func ,
1352
- (void * )state ,
1353
- threadname );
1354
- if (IS_ERR (arm_state -> ka_thread )) {
1355
- dev_err (state -> dev , "suspend: Couldn't create thread %s\n" ,
1356
- threadname );
1357
- } else {
1358
- wake_up_process (arm_state -> ka_thread );
1359
- }
1358
+ wake_up_process (arm_state -> ka_thread );
1360
1359
}
1361
1360
1362
1361
static const struct of_device_id vchiq_of_match [] = {
0 commit comments