Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'staging-6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
"Here are some small driver fixes for the vchiq_arm staging driver:

- reverts of previous changes that turned out to caused problems.

- change to prevent a resource leak

All of these have been in linux-next this week with no reported
problems"

* tag 'staging-6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: vchiq_arm: Make vchiq_shutdown never fail
Revert "staging: vchiq_arm: Create keep-alive thread during probe"
Revert "staging: vchiq_arm: Improve initial VCHIQ connect"

+56 -45
+56 -42
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
··· 97 97 * tracked separately with the state. 98 98 */ 99 99 int peer_use_count; 100 + 101 + /* 102 + * Flag to indicate that the first vchiq connect has made it through. 103 + * This means that both sides should be fully ready, and we should 104 + * be able to suspend after this point. 105 + */ 106 + int first_connect; 100 107 }; 101 108 102 109 static int ··· 280 273 return 0; 281 274 } 282 275 276 + int 277 + vchiq_platform_init_state(struct vchiq_state *state) 278 + { 279 + struct vchiq_arm_state *platform_state; 280 + 281 + platform_state = devm_kzalloc(state->dev, sizeof(*platform_state), GFP_KERNEL); 282 + if (!platform_state) 283 + return -ENOMEM; 284 + 285 + rwlock_init(&platform_state->susp_res_lock); 286 + 287 + init_completion(&platform_state->ka_evt); 288 + atomic_set(&platform_state->ka_use_count, 0); 289 + atomic_set(&platform_state->ka_use_ack_count, 0); 290 + atomic_set(&platform_state->ka_release_count, 0); 291 + 292 + platform_state->state = state; 293 + 294 + state->platform_state = (struct opaque_platform_state *)platform_state; 295 + 296 + return 0; 297 + } 298 + 283 299 static struct vchiq_arm_state *vchiq_platform_get_arm_state(struct vchiq_state *state) 284 300 { 285 301 return (struct vchiq_arm_state *)state->platform_state; ··· 393 363 struct vchiq_state *state = instance->state; 394 364 int ret = 0; 395 365 396 - if (mutex_lock_killable(&state->mutex)) 397 - return -EAGAIN; 366 + mutex_lock(&state->mutex); 398 367 399 368 /* Remove all services */ 400 369 vchiq_shutdown_internal(state, instance); ··· 1011 982 } 1012 983 1013 984 int 1014 - vchiq_platform_init_state(struct vchiq_state *state) 1015 - { 1016 - struct vchiq_arm_state *platform_state; 1017 - char threadname[16]; 1018 - 1019 - platform_state = devm_kzalloc(state->dev, sizeof(*platform_state), GFP_KERNEL); 1020 - if (!platform_state) 1021 - return -ENOMEM; 1022 - 1023 - snprintf(threadname, sizeof(threadname), "vchiq-keep/%d", 1024 - state->id); 1025 - platform_state->ka_thread = kthread_create(&vchiq_keepalive_thread_func, 1026 - (void *)state, threadname); 1027 - if (IS_ERR(platform_state->ka_thread)) { 1028 - dev_err(state->dev, "couldn't create thread %s\n", threadname); 1029 - return PTR_ERR(platform_state->ka_thread); 1030 - } 1031 - 1032 - rwlock_init(&platform_state->susp_res_lock); 1033 - 1034 - init_completion(&platform_state->ka_evt); 1035 - atomic_set(&platform_state->ka_use_count, 0); 1036 - atomic_set(&platform_state->ka_use_ack_count, 0); 1037 - atomic_set(&platform_state->ka_release_count, 0); 1038 - 1039 - platform_state->state = state; 1040 - 1041 - state->platform_state = (struct opaque_platform_state *)platform_state; 1042 - 1043 - return 0; 1044 - } 1045 - 1046 - int 1047 985 vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, 1048 986 enum USE_TYPE_E use_type) 1049 987 { ··· 1325 1329 return ret; 1326 1330 } 1327 1331 1328 - void vchiq_platform_connected(struct vchiq_state *state) 1329 - { 1330 - struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); 1331 - 1332 - wake_up_process(arm_state->ka_thread); 1333 - } 1334 - 1335 1332 void vchiq_platform_conn_state_changed(struct vchiq_state *state, 1336 1333 enum vchiq_connstate oldstate, 1337 1334 enum vchiq_connstate newstate) 1338 1335 { 1336 + struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); 1337 + char threadname[16]; 1338 + 1339 1339 dev_dbg(state->dev, "suspend: %d: %s->%s\n", 1340 1340 state->id, get_conn_state_name(oldstate), get_conn_state_name(newstate)); 1341 + if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED) 1342 + return; 1343 + 1344 + write_lock_bh(&arm_state->susp_res_lock); 1345 + if (arm_state->first_connect) { 1346 + write_unlock_bh(&arm_state->susp_res_lock); 1347 + return; 1348 + } 1349 + 1350 + arm_state->first_connect = 1; 1351 + write_unlock_bh(&arm_state->susp_res_lock); 1352 + snprintf(threadname, sizeof(threadname), "vchiq-keep/%d", 1353 + state->id); 1354 + arm_state->ka_thread = kthread_create(&vchiq_keepalive_thread_func, 1355 + (void *)state, 1356 + threadname); 1357 + if (IS_ERR(arm_state->ka_thread)) { 1358 + dev_err(state->dev, "suspend: Couldn't create thread %s\n", 1359 + threadname); 1360 + } else { 1361 + wake_up_process(arm_state->ka_thread); 1362 + } 1341 1363 } 1342 1364 1343 1365 static const struct of_device_id vchiq_of_match[] = {
-1
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
··· 3343 3343 return -EAGAIN; 3344 3344 3345 3345 vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); 3346 - vchiq_platform_connected(state); 3347 3346 complete(&state->connect); 3348 3347 } 3349 3348
-2
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
··· 575 575 576 576 int vchiq_send_remote_use_active(struct vchiq_state *state); 577 577 578 - void vchiq_platform_connected(struct vchiq_state *state); 579 - 580 578 void vchiq_platform_conn_state_changed(struct vchiq_state *state, 581 579 enum vchiq_connstate oldstate, 582 580 enum vchiq_connstate newstate);