Skip to content

Commit 3e5def4

Browse files
lategoodbyegregkh
authored andcommitted
staging: vchiq_arm: Improve initial VCHIQ connect
The code to start the keep-alive thread on initial VCHIQ connect within vchiq_platform_conn_state_changed is unnecessary complex. Move the keep-alive thread wake-up into a separate function and call it during VCHIQ connect. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-6-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 86bc882 commit 3e5def4

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ struct vchiq_arm_state {
9797
* tracked separately with the state.
9898
*/
9999
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;
107100
};
108101

109102
static int
@@ -1336,26 +1329,19 @@ vchiq_check_service(struct vchiq_service *service)
13361329
return ret;
13371330
}
13381331

1332+
void vchiq_platform_connected(struct vchiq_state *state)
1333+
{
1334+
struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
1335+
1336+
wake_up_process(arm_state->ka_thread);
1337+
}
1338+
13391339
void vchiq_platform_conn_state_changed(struct vchiq_state *state,
13401340
enum vchiq_connstate oldstate,
13411341
enum vchiq_connstate newstate)
13421342
{
1343-
struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
1344-
13451343
dev_dbg(state->dev, "suspend: %d: %s->%s\n",
13461344
state->id, get_conn_state_name(oldstate), get_conn_state_name(newstate));
1347-
if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED)
1348-
return;
1349-
1350-
write_lock_bh(&arm_state->susp_res_lock);
1351-
if (arm_state->first_connect) {
1352-
write_unlock_bh(&arm_state->susp_res_lock);
1353-
return;
1354-
}
1355-
1356-
arm_state->first_connect = 1;
1357-
write_unlock_bh(&arm_state->susp_res_lock);
1358-
wake_up_process(arm_state->ka_thread);
13591345
}
13601346

13611347
static const struct of_device_id vchiq_of_match[] = {

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,6 +3343,7 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
33433343
return -EAGAIN;
33443344

33453345
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
3346+
vchiq_platform_connected(state);
33463347
complete(&state->connect);
33473348
}
33483349

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ int vchiq_send_remote_use(struct vchiq_state *state);
575575

576576
int vchiq_send_remote_use_active(struct vchiq_state *state);
577577

578+
void vchiq_platform_connected(struct vchiq_state *state);
579+
578580
void vchiq_platform_conn_state_changed(struct vchiq_state *state,
579581
enum vchiq_connstate oldstate,
580582
enum vchiq_connstate newstate);

0 commit comments

Comments
 (0)