Skip to content

Commit ebe0b2e

Browse files
lategoodbyegregkh
authored andcommitted
Revert "staging: vchiq_arm: Improve initial VCHIQ connect"
The commit 3e5def4 ("staging: vchiq_arm: Improve initial VCHIQ connect") based on the assumption that in good case the VCHIQ connect always happen and therefore the keep-alive thread is guaranteed to be woken up. This is wrong, because in certain configurations there are no VCHIQ users and so the VCHIQ connect never happen. So revert it. Fixes: 3e5def4 ("staging: vchiq_arm: Improve initial VCHIQ connect") Reported-by: Maíra Canal <[email protected]> Closes: https://lore.kernel.org/linux-staging/[email protected]/ Cc: [email protected] Signed-off-by: Stefan Wahren <[email protected]> Reviewed-by: Maíra Canal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d0b3b7b commit ebe0b2e

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ 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;
100107
};
101108

102109
static int
@@ -1329,19 +1336,26 @@ vchiq_check_service(struct vchiq_service *service)
13291336
return ret;
13301337
}
13311338

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+
13431345
dev_dbg(state->dev, "suspend: %d: %s->%s\n",
13441346
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);
13451359
}
13461360

13471361
static const struct of_device_id vchiq_of_match[] = {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3343,7 +3343,6 @@ 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);
33473346
complete(&state->connect);
33483347
}
33493348

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,6 @@ 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-
580578
void vchiq_platform_conn_state_changed(struct vchiq_state *state,
581579
enum vchiq_connstate oldstate,
582580
enum vchiq_connstate newstate);

0 commit comments

Comments
 (0)