staging: vchi: Move vchi_queue_kernel_message() into vchiq
authorNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Mon, 29 Jun 2020 15:09:40 +0000 (17:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Jul 2020 13:47:07 +0000 (15:47 +0200)
We can't really merge it with vchiq_queue_message() as it has internal
users that will not benefit from the retry mechanism
vchiq_queue_kernel_message() uses. So, for the sake of getting rid of
vchi, move it into vchiq.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-43-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
drivers/staging/vc04_services/interface/vchi/vchi.h
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c

index 28d64bc895cd94c0acbe80da4ff01d8abf33b86c..efaa2ae11f527a9a8f19b9a57ec1870d6b8299d2 100644 (file)
@@ -44,8 +44,8 @@ static int bcm2835_audio_send_msg_locked(struct bcm2835_audio_instance *instance
                init_completion(&instance->msg_avail_comp);
        }
 
-       status = vchi_queue_kernel_message(instance->service_handle,
-                                          m, sizeof(*m));
+       status = vchiq_queue_kernel_message(instance->service_handle,
+                                           m, sizeof(*m));
        if (status) {
                dev_err(instance->dev,
                        "vchi message queue failed: %d, msg=%d\n",
@@ -350,8 +350,8 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
                while (count > 0) {
                        int bytes = min(instance->max_packet, count);
 
-                       status = vchi_queue_kernel_message(instance->service_handle,
-                                                          src, bytes);
+                       status = vchiq_queue_kernel_message(instance->service_handle,
+                                                           src, bytes);
                        src += bytes;
                        count -= bytes;
                }
index c800796f9986cf48ec5fb035d8545dd66deb8704..6de5df43cc29724f73cf3dcbb3fa179e62f51a13 100644 (file)
@@ -37,10 +37,6 @@ extern int32_t vchi_service_use(unsigned handle);
 // Routine to decrement ref count on a named service
 extern int32_t vchi_service_release(unsigned handle);
 
-/* Routine to send a message from kernel memory across a service */
-extern int vchi_queue_kernel_message(unsigned handle, void *data,
-                                    unsigned int size);
-
 // Routine to look at a message in place.
 // The message is dequeued, so the caller is left holding it; the descriptor is
 // filled in and must be released when the user has finished with the message.
index bb69c91c44b06f93f53315631eff14c2f857b507..39d15f9f4a1854578d4ec2ecfd6d2e86a18b9830 100644 (file)
@@ -3213,11 +3213,28 @@ error_exit:
        return status;
 }
 
-enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context,
-                                     size_t size)
+int vchiq_queue_kernel_message(unsigned handle, void *data, unsigned size)
 {
-       return vchiq_queue_message(handle, memcpy_copy_callback, context, size);
+       enum vchiq_status status;
+
+       while (1) {
+               status = vchiq_queue_message(handle, memcpy_copy_callback,
+                                            data, size);
+
+               /*
+                * vchiq_queue_message() may return VCHIQ_RETRY, so we need to
+                * implement a retry mechanism since this function is supposed
+                * to block until queued
+                */
+               if (status != VCHIQ_RETRY)
+                       break;
+
+               msleep(1);
+       }
+
+       return status;
 }
+EXPORT_SYMBOL(vchiq_queue_kernel_message);
 
 void
 vchiq_release_message(unsigned int handle,
index 931debcd64920d5f3f2787671f5aabba93c9a2d4..6374eda4ea0c3b907e275ce97e05b231c902661b 100644 (file)
@@ -89,8 +89,8 @@ extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance,
 extern enum vchiq_status vchiq_close_service(unsigned int service);
 extern enum vchiq_status vchiq_use_service(unsigned int service);
 extern enum vchiq_status vchiq_release_service(unsigned int service);
-extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle,
-                                                   void *context, size_t size);
+extern int vchiq_queue_kernel_message(unsigned handle, void *data,
+                                     unsigned size);
 extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header);
 extern void           vchiq_release_message(unsigned int service,
        struct vchiq_header *header);
index 33493643b5f8d5035911c1f79f748c47298852d1..57ac6a289a0830cd888430f79680fc35deb05a2b 100644 (file)
@@ -9,28 +9,6 @@
 #include "../vchi/vchi.h"
 #include "vchiq.h"
 
-int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size)
-{
-       enum vchiq_status status;
-
-       while (1) {
-               status = vchiq_queue_kernel_message(handle, data, size);
-
-               /*
-                * vchiq_queue_message() may return VCHIQ_RETRY, so we need to
-                * implement a retry mechanism since this function is supposed
-                * to block until queued
-                */
-               if (status != VCHIQ_RETRY)
-                       break;
-
-               msleep(1);
-       }
-
-       return status;
-}
-EXPORT_SYMBOL(vchi_queue_kernel_message);
-
 /***********************************************************
  * Name: vchi_held_msg_release
  *
index 4c6a6f4d89fc24a5118a1f20f03585c3d52f9afd..c7a425db1d29cdc6b5ba23e172335f606efaab16 100644 (file)
@@ -440,10 +440,9 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
 
        vchi_service_use(instance->service_handle);
 
-       ret = vchi_queue_kernel_message(instance->service_handle,
-                                       &m,
-                                       sizeof(struct mmal_msg_header) +
-                                       sizeof(m.u.buffer_from_host));
+       ret = vchiq_queue_kernel_message(instance->service_handle, &m,
+                                        sizeof(struct mmal_msg_header) +
+                                        sizeof(m.u.buffer_from_host));
 
        vchi_service_release(instance->service_handle);
 
@@ -681,10 +680,9 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
 
        vchi_service_use(instance->service_handle);
 
-       ret = vchi_queue_kernel_message(instance->service_handle,
-                                       msg,
-                                       sizeof(struct mmal_msg_header) +
-                                       payload_len);
+       ret = vchiq_queue_kernel_message(instance->service_handle, msg,
+                                        sizeof(struct mmal_msg_header) +
+                                        payload_len);
 
        vchi_service_release(instance->service_handle);