Commit 2611045e authored by Marcelo Diop-Gonzalez's avatar Marcelo Diop-Gonzalez Committed by Greg Kroah-Hartman

staging: vchiq: Refactor indentation in vchiq_platform_conn_state_changed()

Reducing the indentation level helps a bit with
the readability of this function. There's also a checkpatch
fix here, moving the first argument to kthread_create() onto
the same line, as well as a relocation of the statement
"char threadname[16];" to the top of the function to avoid
a declaration in the middle of code.
Signed-off-by: default avatarMarcelo Diop-Gonzalez <marcgonzalez@google.com>
Link: https://lore.kernel.org/r/20191114232801.71458-1-marcgonzalez@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 635dad09
...@@ -3132,20 +3132,24 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state, ...@@ -3132,20 +3132,24 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
enum vchiq_connstate newstate) enum vchiq_connstate newstate)
{ {
struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
char threadname[16];
vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id, vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id,
get_conn_state_name(oldstate), get_conn_state_name(newstate)); get_conn_state_name(oldstate), get_conn_state_name(newstate));
if (state->conn_state == VCHIQ_CONNSTATE_CONNECTED) { if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED)
return;
write_lock_bh(&arm_state->susp_res_lock); write_lock_bh(&arm_state->susp_res_lock);
if (!arm_state->first_connect) { if (arm_state->first_connect) {
char threadname[16]; write_unlock_bh(&arm_state->susp_res_lock);
return;
}
arm_state->first_connect = 1; arm_state->first_connect = 1;
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
snprintf(threadname, sizeof(threadname), "vchiq-keep/%d", snprintf(threadname, sizeof(threadname), "vchiq-keep/%d",
state->id); state->id);
arm_state->ka_thread = kthread_create( arm_state->ka_thread = kthread_create(&vchiq_keepalive_thread_func,
&vchiq_keepalive_thread_func,
(void *)state, (void *)state,
threadname); threadname);
if (IS_ERR(arm_state->ka_thread)) { if (IS_ERR(arm_state->ka_thread)) {
...@@ -3155,9 +3159,6 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state, ...@@ -3155,9 +3159,6 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
} else { } else {
wake_up_process(arm_state->ka_thread); wake_up_process(arm_state->ka_thread);
} }
} else
write_unlock_bh(&arm_state->susp_res_lock);
}
} }
static const struct of_device_id vchiq_of_match[] = { static const struct of_device_id vchiq_of_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment