[PATCH 5/6] staging: vchiq_core: Pass vchiq_bulk pointer to make_service_callback()

From: Umang Jain
Date: Wed Oct 23 2024 - 07:06:07 EST


Pass struct vchiq_bulk pointer to make_service_callback() instead of
just passing the bulk->cb_data. This is a preparatory change when we
need to pass the callback data user pointer (__user) in a subsequent
commit.

Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
---
.../vc04_services/interface/vchiq_arm/vchiq_core.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

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 6095adaf0cf6..3c811b8f210c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -455,10 +455,18 @@ mark_service_closing(struct vchiq_service *service)

static inline int
make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
- struct vchiq_header *header, void *cb_data)
+ struct vchiq_header *header, struct vchiq_bulk *bulk)
{
+ void *cb_data = NULL;
int status;

+ /*
+ * If a bulk transfer is in progress, pass bulk->cb_data to the
+ * callback function.
+ */
+ if (bulk)
+ cb_data = bulk->cb_data;
+
dev_dbg(service->state->dev, "core: %d: callback:%d (%s, %pK, %pK)\n",
service->state->id, service->localport, reason_names[reason],
header, cb_data);
@@ -1339,8 +1347,7 @@ static int service_notify_bulk(struct vchiq_service *service,
} else if (bulk->mode == VCHIQ_BULK_MODE_CALLBACK) {
enum vchiq_reason reason = get_bulk_reason(bulk);

- return make_service_callback(service, reason, NULL,
- bulk->cb_data);
+ return make_service_callback(service, reason, NULL, bulk);
}

return 0;
--
2.45.2