Typedefing structs is not encouraged in the kernel. Signed-off-by: Dominic Braun <inf.braun@xxxxxx> Signed-off-by: Tobias Büttner <tobias.buettner@xxxxxx> --- .../interface/vchiq_arm/vchiq_arm.c | 51 +++---- .../interface/vchiq_arm/vchiq_arm.h | 8 +- .../interface/vchiq_arm/vchiq_core.c | 137 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 51 +++---- 4 files changed, 122 insertions(+), 125 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index f997bf69d03b..fae0ab61ceee 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -111,7 +111,7 @@ static const char *const resume_state_names[] = { static void suspend_timer_callback(struct timer_list *t); struct user_service { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; void *userdata; VCHIQ_INSTANCE_T instance; char is_vchi; @@ -337,7 +337,7 @@ VCHIQ_STATUS_T vchiq_add_service( { VCHIQ_STATUS_T status; VCHIQ_STATE_T *state = instance->state; - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; int srvstate; vchiq_log_trace(vchiq_core_log_level, @@ -376,7 +376,7 @@ VCHIQ_STATUS_T vchiq_open_service( { VCHIQ_STATUS_T status = VCHIQ_ERROR; VCHIQ_STATE_T *state = instance->state; - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; vchiq_log_trace(vchiq_core_log_level, "%s(%p) called", __func__, instance); @@ -463,7 +463,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, unsigned int size, VCHIQ_BULK_DIR_T dir) { VCHIQ_INSTANCE_T instance; - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; VCHIQ_STATUS_T status; struct bulk_waiter_node *waiter = NULL; @@ -621,7 +621,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header, ** contains a circular buffer for completion records. */ struct user_service *user_service; - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; VCHIQ_INSTANCE_T instance; bool skip_completion = false; @@ -836,7 +836,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { VCHIQ_INSTANCE_T instance = file->private_data; VCHIQ_STATUS_T status = VCHIQ_SUCCESS; - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; long ret = 0; int i, rc; @@ -1203,7 +1203,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) for (ret = 0; ret < args.count; ret++) { struct vchiq_completion_data *completion; - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; struct user_service *user_service; struct vchiq_header *header; @@ -1993,7 +1993,7 @@ static int vchiq_release(struct inode *inode, struct file *file) { VCHIQ_INSTANCE_T instance = file->private_data; VCHIQ_STATE_T *state = vchiq_get_state(); - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; int ret = 0; int i; @@ -2064,7 +2064,7 @@ static int vchiq_release(struct inode *inode, struct file *file) while (instance->completion_remove != instance->completion_insert) { struct vchiq_completion_data *completion; - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; completion = &instance->completions[ instance->completion_remove & (MAX_COMPLETIONS - 1)]; @@ -2169,7 +2169,7 @@ vchiq_dump_platform_instances(void *dump_context) marking those that have been dumped. */ for (i = 0; i < state->unused_service; i++) { - VCHIQ_SERVICE_T *service = state->services[i]; + struct vchiq_service *service = state->services[i]; VCHIQ_INSTANCE_T instance; if (service && (service->base.callback == service_callback)) { @@ -2180,7 +2180,7 @@ vchiq_dump_platform_instances(void *dump_context) } for (i = 0; i < state->unused_service; i++) { - VCHIQ_SERVICE_T *service = state->services[i]; + struct vchiq_service *service = state->services[i]; VCHIQ_INSTANCE_T instance; if (service && (service->base.callback == service_callback)) { @@ -2210,7 +2210,8 @@ vchiq_dump_platform_instances(void *dump_context) ***************************************************************************/ void -vchiq_dump_platform_service_state(void *dump_context, VCHIQ_SERVICE_T *service) +vchiq_dump_platform_service_state(void *dump_context, + struct vchiq_service *service) { struct user_service *user_service = (struct user_service *)service->base.userdata; @@ -2758,7 +2759,7 @@ output_timeout_error(VCHIQ_STATE_T *state) goto output_msg; } for (i = 0; i < active_services; i++) { - VCHIQ_SERVICE_T *service_ptr = state->services[i]; + struct vchiq_service *service_ptr = state->services[i]; if (service_ptr && service_ptr->service_use_count && (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) { @@ -2989,8 +2990,8 @@ vchiq_check_resume(VCHIQ_STATE_T *state) } VCHIQ_STATUS_T -vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - enum USE_TYPE_E use_type) +vchiq_use_internal(VCHIQ_STATE_T *state, struct vchiq_service *service, + enum USE_TYPE_E use_type) { struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; @@ -3122,7 +3123,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, } VCHIQ_STATUS_T -vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service) +vchiq_release_internal(VCHIQ_STATE_T *state, struct vchiq_service *service) { struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_STATUS_T ret = VCHIQ_SUCCESS; @@ -3204,13 +3205,13 @@ vchiq_on_remote_release(VCHIQ_STATE_T *state) } VCHIQ_STATUS_T -vchiq_use_service_internal(VCHIQ_SERVICE_T *service) +vchiq_use_service_internal(struct vchiq_service *service) { return vchiq_use_internal(service->state, service, USE_TYPE_SERVICE); } VCHIQ_STATUS_T -vchiq_release_service_internal(VCHIQ_SERVICE_T *service) +vchiq_release_service_internal(struct vchiq_service *service) { return vchiq_release_internal(service->state, service); } @@ -3224,7 +3225,7 @@ vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance) int vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; int use_count = 0, i; i = 0; @@ -3251,7 +3252,7 @@ vchiq_instance_get_trace(VCHIQ_INSTANCE_T instance) void vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; int i; i = 0; @@ -3278,7 +3279,7 @@ VCHIQ_STATUS_T vchiq_use_service_no_resume(VCHIQ_SERVICE_HANDLE_T handle) { VCHIQ_STATUS_T ret = VCHIQ_ERROR; - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); if (service) { ret = vchiq_use_internal(service->state, service, @@ -3292,7 +3293,7 @@ VCHIQ_STATUS_T vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle) { VCHIQ_STATUS_T ret = VCHIQ_ERROR; - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); if (service) { ret = vchiq_use_internal(service->state, service, @@ -3306,7 +3307,7 @@ VCHIQ_STATUS_T vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle) { VCHIQ_STATUS_T ret = VCHIQ_ERROR; - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); if (service) { ret = vchiq_release_internal(service->state, service); @@ -3356,7 +3357,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) only_nonzero = 1; for (i = 0; i < active_services; i++) { - VCHIQ_SERVICE_T *service_ptr = state->services[i]; + struct vchiq_service *service_ptr = state->services[i]; if (!service_ptr) continue; @@ -3408,7 +3409,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) } VCHIQ_STATUS_T -vchiq_check_service(VCHIQ_SERVICE_T *service) +vchiq_check_service(struct vchiq_service *service) { struct vchiq_arm_state *arm_state; VCHIQ_STATUS_T ret = VCHIQ_ERROR; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h index 5a62ef79c78b..e04dcdb82a02 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h @@ -163,7 +163,7 @@ extern VCHIQ_STATUS_T vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle); extern VCHIQ_STATUS_T -vchiq_check_service(VCHIQ_SERVICE_T *service); +vchiq_check_service(struct vchiq_service *service); extern VCHIQ_STATUS_T vchiq_platform_suspend(VCHIQ_STATE_T *state); @@ -187,10 +187,10 @@ extern int vchiq_videocore_wanted(VCHIQ_STATE_T *state); extern VCHIQ_STATUS_T -vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - enum USE_TYPE_E use_type); +vchiq_use_internal(VCHIQ_STATE_T *state, struct vchiq_service *service, + enum USE_TYPE_E use_type); extern VCHIQ_STATUS_T -vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service); +vchiq_release_internal(VCHIQ_STATE_T *state, struct vchiq_service *service); extern struct vchiq_debugfs_node * vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance); 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 8dec156f2dce..d4935b208c78 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -153,7 +153,7 @@ static const char *msg_type_str(unsigned int msg_type) } static inline void -vchiq_set_service_state(VCHIQ_SERVICE_T *service, int newstate) +vchiq_set_service_state(struct vchiq_service *service, int newstate) { vchiq_log_info(vchiq_core_log_level, "%d: srv:%d %s->%s", service->state->id, service->localport, @@ -162,10 +162,10 @@ vchiq_set_service_state(VCHIQ_SERVICE_T *service, int newstate) service->srvstate = newstate; } -VCHIQ_SERVICE_T * +struct vchiq_service * find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; spin_lock(&service_spinlock); service = handle_to_service(handle); @@ -184,10 +184,10 @@ find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) return service; } -VCHIQ_SERVICE_T * +struct vchiq_service * find_service_by_port(VCHIQ_STATE_T *state, int localport) { - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; if ((unsigned int)localport <= VCHIQ_PORT_MAX) { spin_lock(&service_spinlock); @@ -207,11 +207,11 @@ find_service_by_port(VCHIQ_STATE_T *state, int localport) return service; } -VCHIQ_SERVICE_T * +struct vchiq_service * find_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; spin_lock(&service_spinlock); service = handle_to_service(handle); @@ -231,11 +231,11 @@ find_service_for_instance(VCHIQ_INSTANCE_T instance, return service; } -VCHIQ_SERVICE_T * +struct vchiq_service * find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; spin_lock(&service_spinlock); service = handle_to_service(handle); @@ -257,16 +257,16 @@ find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, return service; } -VCHIQ_SERVICE_T * +struct vchiq_service * next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, int *pidx) { - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; int idx = *pidx; spin_lock(&service_spinlock); while (idx < state->unused_service) { - VCHIQ_SERVICE_T *srv = state->services[idx++]; + struct vchiq_service *srv = state->services[idx++]; if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) && (srv->instance == instance)) { @@ -284,7 +284,7 @@ next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, } void -lock_service(VCHIQ_SERVICE_T *service) +lock_service(struct vchiq_service *service) { spin_lock(&service_spinlock); WARN_ON(!service); @@ -296,7 +296,7 @@ lock_service(VCHIQ_SERVICE_T *service) } void -unlock_service(VCHIQ_SERVICE_T *service) +unlock_service(struct vchiq_service *service) { spin_lock(&service_spinlock); if (!service) { @@ -328,7 +328,7 @@ unlock_service(VCHIQ_SERVICE_T *service) int vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); int id; id = service ? service->client_id : 0; @@ -341,7 +341,7 @@ vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T handle) void * vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service = handle_to_service(handle); + struct vchiq_service *service = handle_to_service(handle); return service ? service->base.userdata : NULL; } @@ -349,13 +349,13 @@ vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T handle) int vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service = handle_to_service(handle); + struct vchiq_service *service = handle_to_service(handle); return service ? service->base.fourcc : 0; } static void -mark_service_closing_internal(VCHIQ_SERVICE_T *service, int sh_thread) +mark_service_closing_internal(struct vchiq_service *service, int sh_thread) { VCHIQ_STATE_T *state = service->state; struct vchiq_service_quota *service_quota; @@ -380,14 +380,14 @@ mark_service_closing_internal(VCHIQ_SERVICE_T *service, int sh_thread) } static void -mark_service_closing(VCHIQ_SERVICE_T *service) +mark_service_closing(struct vchiq_service *service) { mark_service_closing_internal(service, 0); } static inline VCHIQ_STATUS_T -make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason, - struct vchiq_header *header, void *bulk_userdata) +make_service_callback(struct vchiq_service *service, VCHIQ_REASON_T reason, + struct vchiq_header *header, void *bulk_userdata) { VCHIQ_STATUS_T status; @@ -483,7 +483,7 @@ calc_stride(size_t size) } /* Called by the slot handler thread */ -static VCHIQ_SERVICE_T * +static struct vchiq_service * get_listening_service(VCHIQ_STATE_T *state, int fourcc) { int i; @@ -491,7 +491,7 @@ get_listening_service(VCHIQ_STATE_T *state, int fourcc) WARN_ON(fourcc == VCHIQ_FOURCC_INVALID); for (i = 0; i < state->unused_service; i++) { - VCHIQ_SERVICE_T *service = state->services[i]; + struct vchiq_service *service = state->services[i]; if (service && (service->public_fourcc == fourcc) && @@ -507,13 +507,13 @@ get_listening_service(VCHIQ_STATE_T *state, int fourcc) } /* Called by the slot handler thread */ -static VCHIQ_SERVICE_T * +static struct vchiq_service * get_connected_service(VCHIQ_STATE_T *state, unsigned int port) { int i; for (i = 0; i < state->unused_service; i++) { - VCHIQ_SERVICE_T *service = state->services[i]; + struct vchiq_service *service = state->services[i]; if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN) && (service->remoteport == port)) { @@ -525,7 +525,7 @@ get_connected_service(VCHIQ_STATE_T *state, unsigned int port) } inline void -request_poll(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int poll_type) +request_poll(VCHIQ_STATE_T *state, struct vchiq_service *service, int poll_type) { u32 value; @@ -800,13 +800,10 @@ copy_message_data( /* Called by the slot handler and application threads */ static VCHIQ_STATUS_T -queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - int msgid, - ssize_t (*copy_callback)(void *context, void *dest, - size_t offset, size_t maxsize), - void *context, - size_t size, - int flags) +queue_message(VCHIQ_STATE_T *state, struct vchiq_service *service, int msgid, + ssize_t (*copy_callback)(void *context, void *dest, + size_t offset, size_t maxsize), + void *context, size_t size, int flags) { VCHIQ_SHARED_STATE_T *local; struct vchiq_service_quota *service_quota = NULL; @@ -1050,13 +1047,11 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, /* Called by the slot handler and application threads */ static VCHIQ_STATUS_T -queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - int msgid, - ssize_t (*copy_callback)(void *context, void *dest, - size_t offset, size_t maxsize), - void *context, - int size, - int is_blocking) +queue_message_sync(VCHIQ_STATE_T *state, struct vchiq_service *service, + int msgid, + ssize_t (*copy_callback)(void *context, void *dest, + size_t offset, size_t maxsize), + void *context, int size, int is_blocking) { VCHIQ_SHARED_STATE_T *local; struct vchiq_header *header; @@ -1151,7 +1146,7 @@ claim_slot(VCHIQ_SLOT_INFO_T *slot) static void release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info, - struct vchiq_header *header, VCHIQ_SERVICE_T *service) + struct vchiq_header *header, struct vchiq_service *service) { int release_count; @@ -1203,7 +1198,7 @@ release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info, /* Called by the slot handler - don't hold the bulk mutex */ static VCHIQ_STATUS_T -notify_bulks(VCHIQ_SERVICE_T *service, struct vchiq_bulk_queue *queue, +notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue, int retry_poll) { VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -1298,7 +1293,7 @@ poll_services(VCHIQ_STATE_T *state) flags = atomic_xchg(&state->poll_services[group], 0); for (i = 0; flags; i++) { if (flags & (1 << i)) { - VCHIQ_SERVICE_T *service = + struct vchiq_service *service = find_service_by_port(state, (group<<5) + i); u32 service_flags; @@ -1354,7 +1349,7 @@ poll_services(VCHIQ_STATE_T *state) /* Called with the bulk_mutex held */ static void -abort_outstanding_bulks(VCHIQ_SERVICE_T *service, +abort_outstanding_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue) { int is_tx = (queue == &service->bulk_tx); @@ -1407,7 +1402,7 @@ abort_outstanding_bulks(VCHIQ_SERVICE_T *service, static int parse_open(VCHIQ_STATE_T *state, struct vchiq_header *header) { - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; int msgid, size; unsigned int localport, remoteport; @@ -1530,7 +1525,7 @@ static void parse_rx_slots(VCHIQ_STATE_T *state) { VCHIQ_SHARED_STATE_T *remote = state->remote; - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service *service = NULL; int tx_pos; DEBUG_INITIALISE(state->local) @@ -1995,7 +1990,7 @@ sync_func(void *v) state->remote->slot_sync); while (1) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; int msgid, size; int type; unsigned int localport, remoteport; @@ -2303,17 +2298,17 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero) } /* Called from application thread when a client or server service is created. */ -VCHIQ_SERVICE_T * +struct vchiq_service * vchiq_add_service_internal(VCHIQ_STATE_T *state, const struct vchiq_service_params *params, int srvstate, VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term) { - VCHIQ_SERVICE_T *service; - VCHIQ_SERVICE_T **pservice = NULL; + struct vchiq_service *service; + struct vchiq_service **pservice = NULL; struct vchiq_service_quota *service_quota; int i; - service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL); + service = kmalloc(sizeof(*service), GFP_KERNEL); if (!service) return service; @@ -2365,7 +2360,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state, if (srvstate == VCHIQ_SRVSTATE_OPENING) { for (i = 0; i < state->unused_service; i++) { - VCHIQ_SERVICE_T *srv = state->services[i]; + struct vchiq_service *srv = state->services[i]; if (!srv) { pservice = &state->services[i]; @@ -2374,7 +2369,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state, } } else { for (i = (state->unused_service - 1); i >= 0; i--) { - VCHIQ_SERVICE_T *srv = state->services[i]; + struct vchiq_service *srv = state->services[i]; if (!srv) pservice = &state->services[i]; @@ -2435,7 +2430,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state, } VCHIQ_STATUS_T -vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id) +vchiq_open_service_internal(struct vchiq_service *service, int client_id) { struct vchiq_open_payload payload = { service->base.fourcc, @@ -2478,7 +2473,7 @@ vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id) } static void -release_service_messages(VCHIQ_SERVICE_T *service) +release_service_messages(struct vchiq_service *service) { VCHIQ_STATE_T *state = service->state; int slot_last = state->remote->slot_last; @@ -2539,7 +2534,7 @@ release_service_messages(VCHIQ_SERVICE_T *service) } static int -do_abort_bulks(VCHIQ_SERVICE_T *service) +do_abort_bulks(struct vchiq_service *service) { VCHIQ_STATUS_T status; @@ -2558,7 +2553,7 @@ do_abort_bulks(VCHIQ_SERVICE_T *service) } static VCHIQ_STATUS_T -close_service_complete(VCHIQ_SERVICE_T *service, int failstate) +close_service_complete(struct vchiq_service *service, int failstate) { VCHIQ_STATUS_T status; int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); @@ -2620,7 +2615,7 @@ close_service_complete(VCHIQ_SERVICE_T *service, int failstate) /* Called by the slot handler */ VCHIQ_STATUS_T -vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd) +vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) { VCHIQ_STATE_T *state = service->state; VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -2754,7 +2749,7 @@ vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd) /* Called from the application process upon process death */ void -vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service) +vchiq_terminate_service_internal(struct vchiq_service *service) { VCHIQ_STATE_T *state = service->state; @@ -2769,7 +2764,7 @@ vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service) /* Called from the slot handler */ void -vchiq_free_service_internal(VCHIQ_SERVICE_T *service) +vchiq_free_service_internal(struct vchiq_service *service) { VCHIQ_STATE_T *state = service->state; @@ -2802,7 +2797,7 @@ vchiq_free_service_internal(VCHIQ_SERVICE_T *service) VCHIQ_STATUS_T vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; int i; /* Find all services registered to this client and enable them. */ @@ -2838,7 +2833,7 @@ vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) VCHIQ_STATUS_T vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) { - VCHIQ_SERVICE_T *service; + struct vchiq_service *service; int i; /* Find all services registered to this client and enable them. */ @@ -2895,7 +2890,7 @@ VCHIQ_STATUS_T vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle) { /* Unregister the service */ - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_SUCCESS; if (!service) @@ -2954,7 +2949,7 @@ VCHIQ_STATUS_T vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle) { /* Unregister the service */ - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_SUCCESS; if (!service) @@ -3021,7 +3016,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, VCHIQ_BULK_MODE_T mode, VCHIQ_BULK_DIR_T dir) { - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); struct vchiq_bulk_queue *queue; struct vchiq_bulk *bulk; VCHIQ_STATE_T *state; @@ -3173,7 +3168,7 @@ vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T handle, void *context, size_t size) { - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_ERROR; if (!service || @@ -3222,7 +3217,7 @@ void vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, struct vchiq_header *header) { - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); VCHIQ_SHARED_STATE_T *remote; VCHIQ_STATE_T *state; int slot_index; @@ -3262,7 +3257,7 @@ VCHIQ_STATUS_T vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, short *peer_version) { VCHIQ_STATUS_T status = VCHIQ_ERROR; - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); if (!service || (vchiq_check_service(service) != VCHIQ_SUCCESS) || @@ -3291,7 +3286,7 @@ VCHIQ_STATUS_T vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle, VCHIQ_SERVICE_OPTION_T option, int value) { - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_ERROR; if (service) { @@ -3463,7 +3458,7 @@ vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state) vchiq_dump_platform_instances(dump_context); for (i = 0; i < state->unused_service; i++) { - VCHIQ_SERVICE_T *service = find_service_by_port(state, i); + struct vchiq_service *service = find_service_by_port(state, i); if (service) { vchiq_dump_service_state(dump_context, service); @@ -3473,7 +3468,7 @@ vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state) } void -vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) +vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) { char buf[80]; int len; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 11dabe464c9b..be81b40f51d2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -280,7 +280,7 @@ typedef struct vchiq_slot_info_struct { short release_count; } VCHIQ_SLOT_INFO_T; -typedef struct vchiq_service_struct { +struct vchiq_service { struct vchiq_service_base base; VCHIQ_SERVICE_HANDLE_T handle; unsigned int ref_count; @@ -326,11 +326,11 @@ typedef struct vchiq_service_struct { uint64_t bulk_tx_bytes; uint64_t bulk_rx_bytes; } stats; -} VCHIQ_SERVICE_T; +}; -/* The quota information is outside VCHIQ_SERVICE_T so that it can be - statically allocated, since for accounting reasons a service's slot - usage is carried over between users of the same port number. +/* The quota information is outside struct vchiq_service so that it can + * be statically allocated, since for accounting reasons a service's slot + * usage is carried over between users of the same port number. */ struct vchiq_service_quota { unsigned short slot_quota; @@ -496,7 +496,7 @@ struct vchiq_state_struct { int error_count; } stats; - VCHIQ_SERVICE_T * services[VCHIQ_MAX_SERVICES]; + struct vchiq_service *services[VCHIQ_MAX_SERVICES]; struct vchiq_service_quota service_quotas[VCHIQ_MAX_SERVICES]; VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS]; @@ -529,22 +529,22 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero); extern VCHIQ_STATUS_T vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service * vchiq_add_service_internal(VCHIQ_STATE_T *state, const struct vchiq_service_params *params, int srvstate, VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term); extern VCHIQ_STATUS_T -vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id); +vchiq_open_service_internal(struct vchiq_service *service, int client_id); extern VCHIQ_STATUS_T -vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd); +vchiq_close_service_internal(struct vchiq_service *service, int close_recvd); extern void -vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service); +vchiq_terminate_service_internal(struct vchiq_service *service); extern void -vchiq_free_service_internal(VCHIQ_SERVICE_T *service); +vchiq_free_service_internal(struct vchiq_service *service); extern VCHIQ_STATUS_T vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); @@ -567,7 +567,7 @@ extern void vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state); extern void -vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service); +vchiq_dump_service_state(void *dump_context, struct vchiq_service *service); extern void vchiq_loud_error_header(void); @@ -576,9 +576,10 @@ extern void vchiq_loud_error_footer(void); extern void -request_poll(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int poll_type); +request_poll(VCHIQ_STATE_T *state, struct vchiq_service *service, + int poll_type); -static inline VCHIQ_SERVICE_T * +static inline struct vchiq_service * handle_to_service(VCHIQ_SERVICE_HANDLE_T handle) { VCHIQ_STATE_T *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) & @@ -589,29 +590,29 @@ handle_to_service(VCHIQ_SERVICE_HANDLE_T handle) return state->services[handle & (VCHIQ_MAX_SERVICES - 1)]; } -extern VCHIQ_SERVICE_T * +extern struct vchiq_service * find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service * find_service_by_port(VCHIQ_STATE_T *state, int localport); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service * find_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service * find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service * next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, int *pidx); extern void -lock_service(VCHIQ_SERVICE_T *service); +lock_service(struct vchiq_service *service); extern void -unlock_service(VCHIQ_SERVICE_T *service); +unlock_service(struct vchiq_service *service); /* The following functions are called from vchiq_core, and external ** implementations must be provided. */ @@ -649,13 +650,13 @@ vchiq_dump_platform_instances(void *dump_context); extern void vchiq_dump_platform_service_state(void *dump_context, - VCHIQ_SERVICE_T *service); + struct vchiq_service *service); extern VCHIQ_STATUS_T -vchiq_use_service_internal(VCHIQ_SERVICE_T *service); +vchiq_use_service_internal(struct vchiq_service *service); extern VCHIQ_STATUS_T -vchiq_release_service_internal(VCHIQ_SERVICE_T *service); +vchiq_release_service_internal(struct vchiq_service *service); extern void vchiq_on_remote_use(VCHIQ_STATE_T *state); @@ -667,7 +668,7 @@ extern VCHIQ_STATUS_T vchiq_platform_init_state(VCHIQ_STATE_T *state); extern VCHIQ_STATUS_T -vchiq_check_service(VCHIQ_SERVICE_T *service); +vchiq_check_service(struct vchiq_service *service); extern void vchiq_on_remote_use_active(VCHIQ_STATE_T *state); -- 2.17.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel