Commit 5c01fc5c authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Greg Kroah-Hartman
Browse files

staging: vchi: Move vchi_queue_kernel_message() into vchiq



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: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-43-nsaenzjulienne@suse.de


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0bda14fd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ 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,
	status = vchiq_queue_kernel_message(instance->service_handle,
					    m, sizeof(*m));
	if (status) {
		dev_err(instance->dev,
@@ -350,7 +350,7 @@ 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,
			status = vchiq_queue_kernel_message(instance->service_handle,
							    src, bytes);
			src += bytes;
			count -= bytes;
+0 −4
Original line number Diff line number Diff line
@@ -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.
+20 −3
Original line number Diff line number Diff line
@@ -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,
+2 −2
Original line number Diff line number Diff line
@@ -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);
+0 −22
Original line number Diff line number Diff line
@@ -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
 *
Loading