Typedefing structs is not encouraged in the kernel. The removal of typedefs was requested in interface/vchi/TODO in commit 7626e002225a4c1b9455689b1f22909dfeff43ca. Signed-off-by: Dominic Braun <inf.braun@xxxxxx> Signed-off-by: Tobias Büttner <tobias.buettner@xxxxxx> --- .../interface/vchiq_arm/vchiq_arm.c | 52 ++++--- .../interface/vchiq_arm/vchiq_arm.h | 9 +- .../interface/vchiq_arm/vchiq_core.c | 147 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 54 ++++--- 4 files changed, 136 insertions(+), 126 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 8df4e1a33fd5..bd4548baf576 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -110,7 +110,7 @@ static const char *const resume_state_names[] = { static void suspend_timer_callback(struct timer_list *t); struct user_service_struct { - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *service; void *userdata; VCHIQ_INSTANCE_T instance; char is_vchi; @@ -335,7 +335,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_struct *service = NULL; int srvstate; vchiq_log_trace(vchiq_core_log_level, @@ -374,7 +374,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_struct *service = NULL; vchiq_log_trace(vchiq_core_log_level, "%s(%p) called", __func__, instance); @@ -461,7 +461,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_struct *service; VCHIQ_STATUS_T status; struct bulk_waiter_node *waiter = NULL; @@ -619,7 +619,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header_struct *header, ** contains a circular buffer for completion records. */ struct user_service_struct *user_service; - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *service; VCHIQ_INSTANCE_T instance; bool skip_completion = false; @@ -834,7 +834,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_struct *service = NULL; long ret = 0; int i, rc; @@ -1201,7 +1201,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) for (ret = 0; ret < args.count; ret++) { struct vchiq_completion_data_struct *completion; - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *service; struct user_service_struct *user_service; struct vchiq_header_struct *header; @@ -1996,7 +1996,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_struct *service; int ret = 0; int i; @@ -2069,7 +2069,7 @@ static int vchiq_release(struct inode *inode, struct file *file) while (instance->completion_remove != instance->completion_insert) { struct vchiq_completion_data_struct *completion; - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *service; completion = &instance->completions[ instance->completion_remove & (MAX_COMPLETIONS - 1)]; @@ -2175,7 +2175,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_struct *service = state->services[i]; VCHIQ_INSTANCE_T instance; if (service && (service->base.callback == service_callback)) { @@ -2186,7 +2186,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_struct *service = state->services[i]; VCHIQ_INSTANCE_T instance; if (service && (service->base.callback == service_callback)) { @@ -2216,7 +2216,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_struct *service) { struct user_service_struct *user_service = (struct user_service_struct *)service->base.userdata; @@ -2771,7 +2772,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_struct *service_ptr = state->services[i]; if (service_ptr && service_ptr->service_use_count && (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) { @@ -3006,8 +3007,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_struct *service, + enum USE_TYPE_E use_type) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -3140,7 +3141,8 @@ 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_struct *service) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -3225,13 +3227,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_struct *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_struct *service) { return vchiq_release_internal(service->state, service); } @@ -3245,7 +3247,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_struct *service; int use_count = 0, i; i = 0; @@ -3272,7 +3274,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_struct *service; int i; i = 0; @@ -3299,7 +3301,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_struct *service = find_service_by_handle(handle); if (service) { ret = vchiq_use_internal(service->state, service, @@ -3313,7 +3315,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_struct *service = find_service_by_handle(handle); if (service) { ret = vchiq_use_internal(service->state, service, @@ -3327,7 +3329,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_struct *service = find_service_by_handle(handle); if (service) { ret = vchiq_release_internal(service->state, service); @@ -3378,7 +3380,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_struct *service_ptr = state->services[i]; if (!service_ptr) continue; @@ -3430,7 +3432,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_struct *service) { struct vchiq_arm_state_struct *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 9942287d5b73..feecd8738602 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h @@ -164,7 +164,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_struct *service); extern VCHIQ_STATUS_T vchiq_platform_suspend(VCHIQ_STATE_T *state); @@ -188,10 +188,11 @@ 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_struct *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_struct *service); extern struct vchiq_debugfs_node_struct * 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 db2ce2ea17db..7bf9893ed87a 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_struct *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_struct * find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *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_struct * find_service_by_port(VCHIQ_STATE_T *state, int localport) { - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service_struct *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_struct * find_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *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_struct * find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *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_struct * next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, int *pidx) { - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service_struct *service = NULL; int idx = *pidx; spin_lock(&service_spinlock); while (idx < state->unused_service) { - VCHIQ_SERVICE_T *srv = state->services[idx++]; + struct vchiq_service_struct *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_struct *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_struct *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_struct *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_struct *service = handle_to_service(handle); return service ? service->base.userdata : NULL; } @@ -349,13 +349,14 @@ 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_struct *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_struct *service, + int sh_thread) { VCHIQ_STATE_T *state = service->state; struct vchiq_service_quota_struct *service_quota; @@ -380,14 +381,15 @@ 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_struct *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_struct *header, void *bulk_userdata) +make_service_callback(struct vchiq_service_struct *service, + VCHIQ_REASON_T reason, struct vchiq_header_struct *header, + void *bulk_userdata) { VCHIQ_STATUS_T status; @@ -487,7 +489,7 @@ calc_stride(size_t size) } /* Called by the slot handler thread */ -static VCHIQ_SERVICE_T * +static struct vchiq_service_struct * get_listening_service(VCHIQ_STATE_T *state, int fourcc) { int i; @@ -495,7 +497,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_struct *service = state->services[i]; if (service && (service->public_fourcc == fourcc) && @@ -511,13 +513,13 @@ get_listening_service(VCHIQ_STATE_T *state, int fourcc) } /* Called by the slot handler thread */ -static VCHIQ_SERVICE_T * +static struct vchiq_service_struct * 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_struct *service = state->services[i]; if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN) && (service->remoteport == port)) { @@ -529,7 +531,8 @@ 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_struct *service, + int poll_type) { u32 value; @@ -805,13 +808,11 @@ 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_struct *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_struct *service_quota = NULL; @@ -1055,13 +1056,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_struct *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_struct *header; @@ -1156,7 +1155,8 @@ claim_slot(VCHIQ_SLOT_INFO_T *slot) static void release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info, - struct vchiq_header_struct *header, VCHIQ_SERVICE_T *service) + struct vchiq_header_struct *header, + struct vchiq_service_struct *service) { int release_count; @@ -1208,8 +1208,8 @@ 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_struct *queue, - int retry_poll) +notify_bulks(struct vchiq_service_struct *service, + struct vchiq_bulk_queue_struct *queue, int retry_poll) { VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -1303,7 +1303,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_struct *service = find_service_by_port(state, (group<<5) + i); u32 service_flags; @@ -1359,7 +1359,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_struct *service, struct vchiq_bulk_queue_struct *queue) { int is_tx = (queue == &service->bulk_tx); @@ -1412,7 +1412,7 @@ abort_outstanding_bulks(VCHIQ_SERVICE_T *service, static int parse_open(VCHIQ_STATE_T *state, struct vchiq_header_struct *header) { - VCHIQ_SERVICE_T *service = NULL; + struct vchiq_service_struct *service = NULL; int msgid, size; unsigned int localport, remoteport; @@ -1535,7 +1535,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_struct *service = NULL; int tx_pos; DEBUG_INITIALISE(state->local) @@ -2000,7 +2000,7 @@ sync_func(void *v) state->remote->slot_sync); while (1) { - VCHIQ_SERVICE_T *service; + struct vchiq_service_struct *service; int msgid, size; int type; unsigned int localport, remoteport; @@ -2320,17 +2320,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_struct * vchiq_add_service_internal(VCHIQ_STATE_T *state, const struct vchiq_service_params_struct *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_struct *service; + struct vchiq_service_struct **pservice = NULL; struct vchiq_service_quota_struct *service_quota; int i; - service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL); + service = kmalloc(sizeof(*service), GFP_KERNEL); if (!service) return service; @@ -2382,7 +2382,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_struct *srv = state->services[i]; if (!srv) { pservice = &state->services[i]; @@ -2391,7 +2391,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_struct *srv = state->services[i]; if (!srv) pservice = &state->services[i]; @@ -2452,7 +2452,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_struct *service, int client_id) { struct vchiq_open_payload payload = { service->base.fourcc, @@ -2495,7 +2495,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_struct *service) { VCHIQ_STATE_T *state = service->state; int slot_last = state->remote->slot_last; @@ -2558,7 +2558,7 @@ release_service_messages(VCHIQ_SERVICE_T *service) } static int -do_abort_bulks(VCHIQ_SERVICE_T *service) +do_abort_bulks(struct vchiq_service_struct *service) { VCHIQ_STATUS_T status; @@ -2577,7 +2577,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_struct *service, int failstate) { VCHIQ_STATUS_T status; int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); @@ -2639,7 +2639,8 @@ 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_struct *service, + int close_recvd) { VCHIQ_STATE_T *state = service->state; VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -2773,7 +2774,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_struct *service) { VCHIQ_STATE_T *state = service->state; @@ -2788,7 +2789,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_struct *service) { VCHIQ_STATE_T *state = service->state; @@ -2821,7 +2822,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_struct *service; int i; /* Find all services registered to this client and enable them. */ @@ -2857,7 +2858,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_struct *service; int i; /* Find all services registered to this client and enable them. */ @@ -2914,7 +2915,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_struct *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_SUCCESS; if (!service) @@ -2973,7 +2974,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_struct *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_SUCCESS; if (!service) @@ -3040,7 +3041,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_struct *service = find_service_by_handle(handle); struct vchiq_bulk_queue_struct *queue; struct vchiq_bulk_struct *bulk; VCHIQ_STATE_T *state; @@ -3192,7 +3193,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_struct *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_ERROR; if (!service || @@ -3241,7 +3242,7 @@ void vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, struct vchiq_header_struct *header) { - VCHIQ_SERVICE_T *service = find_service_by_handle(handle); + struct vchiq_service_struct *service = find_service_by_handle(handle); VCHIQ_SHARED_STATE_T *remote; VCHIQ_STATE_T *state; int slot_index; @@ -3281,7 +3282,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_struct *service = find_service_by_handle(handle); if (!service || (vchiq_check_service(service) != VCHIQ_SUCCESS) || @@ -3310,7 +3311,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_struct *service = find_service_by_handle(handle); VCHIQ_STATUS_T status = VCHIQ_ERROR; if (service) { @@ -3482,7 +3483,8 @@ 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_struct *service = + find_service_by_port(state, i); if (service) { vchiq_dump_service_state(dump_context, service); @@ -3492,7 +3494,8 @@ 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_struct *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 bd38b3dd9f3e..63cdb2bff224 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 { struct vchiq_service_base_struct 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_struct 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_struct { 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_struct *services[VCHIQ_MAX_SERVICES]; struct vchiq_service_quota_struct service_quotas[VCHIQ_MAX_SERVICES]; VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS]; @@ -529,22 +529,24 @@ 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_struct * vchiq_add_service_internal(VCHIQ_STATE_T *state, const struct vchiq_service_params_struct *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_struct *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_struct *service, + int close_recvd); extern void -vchiq_terminate_service_internal(VCHIQ_SERVICE_T *service); +vchiq_terminate_service_internal(struct vchiq_service_struct *service); extern void -vchiq_free_service_internal(VCHIQ_SERVICE_T *service); +vchiq_free_service_internal(struct vchiq_service_struct *service); extern VCHIQ_STATUS_T vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); @@ -567,7 +569,8 @@ 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_struct *service); extern void vchiq_loud_error_header(void); @@ -576,9 +579,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_struct *service, + int poll_type); -static inline VCHIQ_SERVICE_T * +static inline struct vchiq_service_struct * handle_to_service(VCHIQ_SERVICE_HANDLE_T handle) { VCHIQ_STATE_T *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) & @@ -589,29 +593,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_struct * find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service_struct * find_service_by_port(VCHIQ_STATE_T *state, int localport); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service_struct * find_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service_struct * find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle); -extern VCHIQ_SERVICE_T * +extern struct vchiq_service_struct * 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_struct *service); extern void -unlock_service(VCHIQ_SERVICE_T *service); +unlock_service(struct vchiq_service_struct *service); /* The following functions are called from vchiq_core, and external ** implementations must be provided. */ @@ -649,13 +653,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_struct *service); extern VCHIQ_STATUS_T -vchiq_use_service_internal(VCHIQ_SERVICE_T *service); +vchiq_use_service_internal(struct vchiq_service_struct *service); extern VCHIQ_STATUS_T -vchiq_release_service_internal(VCHIQ_SERVICE_T *service); +vchiq_release_service_internal(struct vchiq_service_struct *service); extern void vchiq_on_remote_use(VCHIQ_STATE_T *state); @@ -667,7 +671,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_struct *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