From: Stefan Wahren <wahrenst@gmx.net>
To: Florian Fainelli <florian.fainelli@broadcom.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Umang Jain <umang.jain@ideasonboard.com>,
Ojaswin Mujoo <ojaswin98@gmail.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
linux-arm-kernel@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
kernel-list@raspberrypi.com, linux-staging@lists.linux.dev,
Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH 5/5] staging: vchiq_arm: Improve initial VCHIQ connect
Date: Sun, 9 Mar 2025 13:50:14 +0100 [thread overview]
Message-ID: <20250309125014.37166-6-wahrenst@gmx.net> (raw)
In-Reply-To: <20250309125014.37166-1-wahrenst@gmx.net>
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>
---
.../interface/vchiq_arm/vchiq_arm.c | 28 +++++--------------
.../interface/vchiq_arm/vchiq_core.c | 1 +
.../interface/vchiq_arm/vchiq_core.h | 2 ++
3 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 64f9536f1232..be0c2bf9561a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -97,13 +97,6 @@ struct vchiq_arm_state {
* tracked separately with the state.
*/
int peer_use_count;
-
- /*
- * Flag to indicate that the first vchiq connect has made it through.
- * This means that both sides should be fully ready, and we should
- * be able to suspend after this point.
- */
- int first_connect;
};
static int
@@ -1336,26 +1329,19 @@ vchiq_check_service(struct vchiq_service *service)
return ret;
}
+void vchiq_platform_connected(struct vchiq_state *state)
+{
+ struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
+
+ wake_up_process(arm_state->ka_thread);
+}
+
void vchiq_platform_conn_state_changed(struct vchiq_state *state,
enum vchiq_connstate oldstate,
enum vchiq_connstate newstate)
{
- struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
-
dev_dbg(state->dev, "suspend: %d: %s->%s\n",
state->id, get_conn_state_name(oldstate), get_conn_state_name(newstate));
- if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED)
- return;
-
- write_lock_bh(&arm_state->susp_res_lock);
- if (arm_state->first_connect) {
- write_unlock_bh(&arm_state->susp_res_lock);
- return;
- }
-
- arm_state->first_connect = 1;
- write_unlock_bh(&arm_state->susp_res_lock);
- wake_up_process(arm_state->ka_thread);
}
static const struct of_device_id vchiq_of_match[] = {
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 8d5795db4f39..5e38609aad06 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3343,6 +3343,7 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
return -EAGAIN;
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
+ vchiq_platform_connected(state);
complete(&state->connect);
}
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 9b4e766990a4..3b5c0618e567 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -575,6 +575,8 @@ int vchiq_send_remote_use(struct vchiq_state *state);
int vchiq_send_remote_use_active(struct vchiq_state *state);
+void vchiq_platform_connected(struct vchiq_state *state);
+
void vchiq_platform_conn_state_changed(struct vchiq_state *state,
enum vchiq_connstate oldstate,
enum vchiq_connstate newstate);
--
2.34.1
prev parent reply other threads:[~2025-03-09 13:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 12:50 [PATCH 0/5] staging: vchiq_arm: Fix & improve resource handling Stefan Wahren
2025-03-09 12:50 ` [PATCH 1/5] staging: vchiq_arm: Register debugfs after cdev Stefan Wahren
2025-03-09 12:50 ` [PATCH 2/5] staging: vchiq_arm: Fix possible NPR of keep-alive thread Stefan Wahren
2025-03-09 12:50 ` [PATCH 3/5] staging: vchiq_arm: Stop kthreads if vchiq cdev register fails Stefan Wahren
2025-03-09 12:50 ` [PATCH 4/5] staging: vchiq_arm: Create keep-alive thread during probe Stefan Wahren
2025-06-26 18:22 ` Maíra Canal
2025-06-26 20:14 ` Stefan Wahren
2025-06-26 20:30 ` Maíra Canal
2025-06-27 15:18 ` Stefan Wahren
2025-06-27 22:28 ` Maíra Canal
2025-06-28 22:34 ` Stefan Wahren
2025-08-24 18:37 ` MichaIng
2025-08-24 19:58 ` Stefan Wahren
2025-08-24 20:14 ` MichaIng
2025-03-09 12:50 ` Stefan Wahren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250309125014.37166-6-wahrenst@gmx.net \
--to=wahrenst@gmx.net \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dan.carpenter@linaro.org \
--cc=florian.fainelli@broadcom.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-list@raspberrypi.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-staging@lists.linux.dev \
--cc=ojaswin98@gmail.com \
--cc=umang.jain@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox