Commit 65c75366 authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Greg Kroah-Hartman

staging: vchi: Use struct vchiq_service_params

For initialization, vchi has its own params structure, which is then
translated to vchiq's params structure. They are essentially the same,
so lets directly use vchiq's.
Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-31-nsaenzjulienne@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47cc5b16
......@@ -122,11 +122,12 @@ static int
vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
struct bcm2835_audio_instance *instance)
{
struct service_creation params = {
.version = VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER),
.service_id = VC_AUDIO_SERVER_NAME,
struct vchiq_service_params params = {
.version = VC_AUDIOSERV_VER,
.version_min = VC_AUDIOSERV_MIN_VER,
.fourcc = VC_AUDIO_SERVER_NAME,
.callback = audio_vchi_callback,
.callback_param = instance,
.userdata = instance,
};
int status;
......
......@@ -8,12 +8,6 @@
* Global defs
*****************************************************************************/
struct vchi_version {
uint32_t version;
uint32_t version_min;
};
#define VCHI_VERSION_EX(v_, m_) { v_, m_ }
// Macros to manipulate 'FOURCC' values
#define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3]))
......@@ -31,17 +25,6 @@ struct vchi_service {
unsigned int handle;
};
// structure used to provide the information needed to open a server or a client
struct service_creation {
struct vchi_version version;
int32_t service_id;
enum vchiq_status (*callback)(enum vchiq_reason reason,
struct vchiq_header *header,
unsigned int handle,
void *bulk_userdata);
void *callback_param;
};
// Opaque handle for a VCHIQ instance
struct vchiq_instance;
......@@ -64,7 +47,7 @@ extern int32_t vchi_disconnect(struct vchiq_instance *instance);
*****************************************************************************/
// Routine to open a named service
extern int32_t vchi_service_open(struct vchiq_instance *instance,
struct service_creation *setup,
struct vchiq_service_params *setup,
struct vchi_service **service);
extern int32_t vchi_get_peer_version(struct vchi_service *service,
......
......@@ -265,23 +265,15 @@ static void service_free(struct vchi_service *service)
}
int32_t vchi_service_open(struct vchiq_instance *instance,
struct service_creation *setup,
struct vchiq_service_params *params,
struct vchi_service **service)
{
*service = service_alloc();
if (*service) {
struct vchiq_service_params params;
enum vchiq_status status;
memset(&params, 0, sizeof(params));
params.fourcc = setup->service_id;
params.callback = setup->callback;
params.userdata = setup->callback_param;
params.version = setup->version.version;
params.version_min = setup->version.version_min;
status = vchiq_open_service(instance, &params,
status = vchiq_open_service(instance, params,
&((*service)->handle));
if (status != VCHIQ_SUCCESS) {
service_free(*service);
......
......@@ -1860,11 +1860,12 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
int status;
struct vchiq_mmal_instance *instance;
static struct vchiq_instance *vchiq_instance;
struct service_creation params = {
.version = VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER),
.service_id = VC_MMAL_SERVER_NAME,
struct vchiq_service_params params = {
.version = VC_MMAL_VER,
.version_min = VC_MMAL_MIN_VER,
.fourcc = VC_MMAL_SERVER_NAME,
.callback = service_callback,
.callback_param = NULL,
.userdata = NULL,
};
/* compile time checks to ensure structure size as they are
......@@ -1906,7 +1907,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
mutex_init(&instance->context_map_lock);
idr_init_base(&instance->context_map, 1);
params.callback_param = instance;
params.userdata = instance;
instance->bulk_wq = alloc_ordered_workqueue("mmal-vchiq",
WQ_MEM_RECLAIM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment