staging: vchiq_core: Pass vchiq_bulk pointer to make_service_callback()
authorUmang Jain <umang.jain@ideasonboard.com>
Wed, 23 Oct 2024 11:04:05 +0000 (16:34 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Nov 2024 23:55:06 +0000 (00:55 +0100)
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@ideasonboard.com>
Link: https://lore.kernel.org/r/20241023110406.885199-6-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index ea49f2b86f5f766b809d28528c8d398b9b03d278..bcb10d6a47fe88849de13d8bc7d6224de7b93c35 100644 (file)
@@ -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;