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_2835_arm.c | 23 ++-- .../interface/vchiq_arm/vchiq_arm.c | 64 ++++----- .../interface/vchiq_arm/vchiq_arm.h | 38 +++--- .../interface/vchiq_arm/vchiq_core.c | 126 ++++++++++-------- .../interface/vchiq_arm/vchiq_core.h | 80 ++++++----- 5 files changed, 179 insertions(+), 152 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 33e45feb9940..7a854cf68ddb 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -106,7 +106,8 @@ static void free_pagelist(struct vchiq_pagelist_info *pagelistinfo, int actual); -int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) +int vchiq_platform_init(struct platform_device *pdev, + struct vchiq_state_struct *state) { struct device *dev = &pdev->dev; struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev); @@ -204,7 +205,7 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) } VCHIQ_STATUS_T -vchiq_platform_init_state(VCHIQ_STATE_T *state) +vchiq_platform_init_state(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_SUCCESS; struct vchiq_2835_state *platform_state; @@ -222,7 +223,7 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state) } struct vchiq_arm_state_struct* -vchiq_platform_get_arm_state(VCHIQ_STATE_T *state) +vchiq_platform_get_arm_state(struct vchiq_state_struct *state) { struct vchiq_2835_state *platform_state; @@ -291,29 +292,29 @@ vchiq_dump_platform_state(void *dump_context) } VCHIQ_STATUS_T -vchiq_platform_suspend(VCHIQ_STATE_T *state) +vchiq_platform_suspend(struct vchiq_state_struct *state) { return VCHIQ_ERROR; } VCHIQ_STATUS_T -vchiq_platform_resume(VCHIQ_STATE_T *state) +vchiq_platform_resume(struct vchiq_state_struct *state) { return VCHIQ_SUCCESS; } void -vchiq_platform_paused(VCHIQ_STATE_T *state) +vchiq_platform_paused(struct vchiq_state_struct *state) { } void -vchiq_platform_resumed(VCHIQ_STATE_T *state) +vchiq_platform_resumed(struct vchiq_state_struct *state) { } int -vchiq_platform_videocore_wanted(VCHIQ_STATE_T *state) +vchiq_platform_videocore_wanted(struct vchiq_state_struct *state) { return 1; // autosuspend not supported - videocore always wanted } @@ -324,12 +325,12 @@ vchiq_platform_use_suspend_timer(void) return 0; } void -vchiq_dump_platform_use_state(VCHIQ_STATE_T *state) +vchiq_dump_platform_use_state(struct vchiq_state_struct *state) { vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use"); } void -vchiq_platform_handle_timeout(VCHIQ_STATE_T *state) +vchiq_platform_handle_timeout(struct vchiq_state_struct *state) { (void)state; } @@ -340,7 +341,7 @@ vchiq_platform_handle_timeout(VCHIQ_STATE_T *state) static irqreturn_t vchiq_doorbell_irq(int irq, void *dev_id) { - VCHIQ_STATE_T *state = dev_id; + struct vchiq_state_struct *state = dev_id; irqreturn_t ret = IRQ_NONE; unsigned int status; 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 f0a3b055c7bd..b1be6124cf72 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -132,7 +132,7 @@ struct bulk_waiter_node { }; struct vchiq_instance_struct { - VCHIQ_STATE_T *state; + struct vchiq_state_struct *state; struct vchiq_completion_data_struct completions[MAX_COMPLETIONS]; int completion_insert; int completion_remove; @@ -162,7 +162,7 @@ struct dump_context_struct { static struct cdev vchiq_cdev; static dev_t vchiq_devid; -static VCHIQ_STATE_T g_state; +static struct vchiq_state_struct g_state; static struct class *vchiq_class; static DEFINE_SPINLOCK(msg_queue_spinlock); static struct platform_device *bcm2835_camera; @@ -207,7 +207,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *instance_out) { VCHIQ_STATUS_T status = VCHIQ_ERROR; - VCHIQ_STATE_T *state; + struct vchiq_state_struct *state; VCHIQ_INSTANCE_T instance = NULL; int i; @@ -260,7 +260,7 @@ EXPORT_SYMBOL(vchiq_initialise); VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) { VCHIQ_STATUS_T status; - VCHIQ_STATE_T *state = instance->state; + struct vchiq_state_struct *state = instance->state; vchiq_log_trace(vchiq_core_log_level, "%s(%p) called", __func__, instance); @@ -302,7 +302,7 @@ static int vchiq_is_connected(VCHIQ_INSTANCE_T instance) VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance) { VCHIQ_STATUS_T status; - VCHIQ_STATE_T *state = instance->state; + struct vchiq_state_struct *state = instance->state; vchiq_log_trace(vchiq_core_log_level, "%s(%p) called", __func__, instance); @@ -334,7 +334,7 @@ VCHIQ_STATUS_T vchiq_add_service( VCHIQ_SERVICE_HANDLE_T *phandle) { VCHIQ_STATUS_T status; - VCHIQ_STATE_T *state = instance->state; + struct vchiq_state_struct *state = instance->state; struct vchiq_service_struct *service = NULL; int srvstate; @@ -373,7 +373,7 @@ VCHIQ_STATUS_T vchiq_open_service( VCHIQ_SERVICE_HANDLE_T *phandle) { VCHIQ_STATUS_T status = VCHIQ_ERROR; - VCHIQ_STATE_T *state = instance->state; + struct vchiq_state_struct *state = instance->state; struct vchiq_service_struct *service = NULL; vchiq_log_trace(vchiq_core_log_level, @@ -1961,7 +1961,7 @@ vchiq_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int vchiq_open(struct inode *inode, struct file *file) { - VCHIQ_STATE_T *state = vchiq_get_state(); + struct vchiq_state_struct *state = vchiq_get_state(); VCHIQ_INSTANCE_T instance; vchiq_log_info(vchiq_arm_log_level, "vchiq_open"); @@ -1995,7 +1995,7 @@ static int vchiq_open(struct inode *inode, struct file *file) static int vchiq_release(struct inode *inode, struct file *file) { VCHIQ_INSTANCE_T instance = file->private_data; - VCHIQ_STATE_T *state = vchiq_get_state(); + struct vchiq_state_struct *state = vchiq_get_state(); struct vchiq_service_struct *service; int ret = 0; int i; @@ -2166,7 +2166,7 @@ vchiq_dump(void *dump_context, const char *str, int len) void vchiq_dump_platform_instances(void *dump_context) { - VCHIQ_STATE_T *state = vchiq_get_state(); + struct vchiq_state_struct *state = vchiq_get_state(); char buf[80]; int len; int i; @@ -2265,7 +2265,7 @@ vchiq_read(struct file *file, char __user *buf, return context.actual; } -VCHIQ_STATE_T * +struct vchiq_state_struct * vchiq_get_state(void) { @@ -2296,7 +2296,7 @@ vchiq_fops = { */ int -vchiq_videocore_wanted(VCHIQ_STATE_T *state) +vchiq_videocore_wanted(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2331,7 +2331,7 @@ vchiq_keepalive_vchiq_callback(VCHIQ_REASON_T reason, static int vchiq_keepalive_thread_func(void *v) { - VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; + struct vchiq_state_struct *state = (struct vchiq_state_struct *)v; struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2411,7 +2411,7 @@ vchiq_keepalive_thread_func(void *v) } VCHIQ_STATUS_T -vchiq_arm_init_state(VCHIQ_STATE_T *state, +vchiq_arm_init_state(struct vchiq_state_struct *state, struct vchiq_arm_state_struct *arm_state) { if (arm_state) { @@ -2594,7 +2594,7 @@ stop_suspend_timer(struct vchiq_arm_state_struct *arm_state) } static inline int -need_resume(VCHIQ_STATE_T *state) +need_resume(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2680,7 +2680,7 @@ unblock_resume(struct vchiq_arm_state_struct *arm_state) /* Initiate suspend via slot handler. Should be called with the write lock * held */ VCHIQ_STATUS_T -vchiq_arm_vcsuspend(VCHIQ_STATE_T *state) +vchiq_arm_vcsuspend(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_ERROR; struct vchiq_arm_state_struct *arm_state = @@ -2730,7 +2730,7 @@ vchiq_arm_vcsuspend(VCHIQ_STATE_T *state) } void -vchiq_platform_check_suspend(VCHIQ_STATE_T *state) +vchiq_platform_check_suspend(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2758,7 +2758,7 @@ vchiq_platform_check_suspend(VCHIQ_STATE_T *state) } static void -output_timeout_error(VCHIQ_STATE_T *state) +output_timeout_error(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2804,7 +2804,7 @@ output_timeout_error(VCHIQ_STATE_T *state) ** videocore failed to suspend in time or VCHIQ_ERROR if interrupted. */ VCHIQ_STATUS_T -vchiq_arm_force_suspend(VCHIQ_STATE_T *state) +vchiq_arm_force_suspend(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2916,7 +2916,7 @@ vchiq_arm_force_suspend(VCHIQ_STATE_T *state) } void -vchiq_check_suspend(VCHIQ_STATE_T *state) +vchiq_check_suspend(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2939,7 +2939,7 @@ vchiq_check_suspend(VCHIQ_STATE_T *state) } int -vchiq_arm_allow_resume(VCHIQ_STATE_T *state) +vchiq_arm_allow_resume(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -2984,7 +2984,7 @@ vchiq_arm_allow_resume(VCHIQ_STATE_T *state) /* This function should be called with the write lock held */ int -vchiq_check_resume(VCHIQ_STATE_T *state) +vchiq_check_resume(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -3007,7 +3007,8 @@ vchiq_check_resume(VCHIQ_STATE_T *state) } VCHIQ_STATUS_T -vchiq_use_internal(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, +vchiq_use_internal(struct vchiq_state_struct *state, + struct vchiq_service_struct *service, enum USE_TYPE_E use_type) { struct vchiq_arm_state_struct *arm_state = @@ -3141,7 +3142,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, } VCHIQ_STATUS_T -vchiq_release_internal(VCHIQ_STATE_T *state, +vchiq_release_internal(struct vchiq_state_struct *state, struct vchiq_service_struct *service) { struct vchiq_arm_state_struct *arm_state = @@ -3205,7 +3206,7 @@ vchiq_release_internal(VCHIQ_STATE_T *state, } void -vchiq_on_remote_use(VCHIQ_STATE_T *state) +vchiq_on_remote_use(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -3216,7 +3217,7 @@ vchiq_on_remote_use(VCHIQ_STATE_T *state) } void -vchiq_on_remote_release(VCHIQ_STATE_T *state) +vchiq_on_remote_release(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -3290,7 +3291,7 @@ static void suspend_timer_callback(struct timer_list *t) { struct vchiq_arm_state_struct *arm_state = from_timer(arm_state, t, suspend_timer); - VCHIQ_STATE_T *state = arm_state->state; + struct vchiq_state_struct *state = arm_state->state; vchiq_log_info(vchiq_susp_log_level, "%s - suspend timer expired - check suspend", __func__); @@ -3345,7 +3346,7 @@ struct service_data_struct { }; void -vchiq_dump_service_use_state(VCHIQ_STATE_T *state) +vchiq_dump_service_use_state(struct vchiq_state_struct *state) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); @@ -3465,13 +3466,14 @@ vchiq_check_service(struct vchiq_service_struct *service) } /* stub functions */ -void vchiq_on_remote_use_active(VCHIQ_STATE_T *state) +void vchiq_on_remote_use_active(struct vchiq_state_struct *state) { (void)state; } -void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, - VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate) +void vchiq_platform_conn_state_changed(struct vchiq_state_struct *state, + VCHIQ_CONNSTATE_T oldstate, + VCHIQ_CONNSTATE_T newstate) { struct vchiq_arm_state_struct *arm_state = vchiq_platform_get_arm_state(state); 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 feecd8738602..b4489b611660 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h @@ -83,7 +83,7 @@ struct vchiq_arm_state_struct { unsigned int wake_address; - VCHIQ_STATE_T *state; + struct vchiq_state_struct *state; struct timer_list suspend_timer; int suspend_timer_timeout; int suspend_timer_running; @@ -131,32 +131,33 @@ struct vchiq_drvdata { extern int vchiq_arm_log_level; extern int vchiq_susp_log_level; -int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state); +int vchiq_platform_init(struct platform_device *pdev, + struct vchiq_state_struct *state); -extern VCHIQ_STATE_T * +extern struct vchiq_state_struct * vchiq_get_state(void); extern VCHIQ_STATUS_T -vchiq_arm_vcsuspend(VCHIQ_STATE_T *state); +vchiq_arm_vcsuspend(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_arm_force_suspend(VCHIQ_STATE_T *state); +vchiq_arm_force_suspend(struct vchiq_state_struct *state); extern int -vchiq_arm_allow_resume(VCHIQ_STATE_T *state); +vchiq_arm_allow_resume(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_arm_vcresume(VCHIQ_STATE_T *state); +vchiq_arm_vcresume(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_arm_init_state(VCHIQ_STATE_T *state, +vchiq_arm_init_state(struct vchiq_state_struct *state, struct vchiq_arm_state_struct *arm_state); extern int -vchiq_check_resume(VCHIQ_STATE_T *state); +vchiq_check_resume(struct vchiq_state_struct *state); extern void -vchiq_check_suspend(VCHIQ_STATE_T *state); +vchiq_check_suspend(struct vchiq_state_struct *state); VCHIQ_STATUS_T vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle); @@ -167,31 +168,32 @@ extern VCHIQ_STATUS_T vchiq_check_service(struct vchiq_service_struct *service); extern VCHIQ_STATUS_T -vchiq_platform_suspend(VCHIQ_STATE_T *state); +vchiq_platform_suspend(struct vchiq_state_struct *state); extern int -vchiq_platform_videocore_wanted(VCHIQ_STATE_T *state); +vchiq_platform_videocore_wanted(struct vchiq_state_struct *state); extern int vchiq_platform_use_suspend_timer(void); extern void -vchiq_dump_platform_use_state(VCHIQ_STATE_T *state); +vchiq_dump_platform_use_state(struct vchiq_state_struct *state); extern void -vchiq_dump_service_use_state(VCHIQ_STATE_T *state); +vchiq_dump_service_use_state(struct vchiq_state_struct *state); extern struct vchiq_arm_state_struct* -vchiq_platform_get_arm_state(VCHIQ_STATE_T *state); +vchiq_platform_get_arm_state(struct vchiq_state_struct *state); extern int -vchiq_videocore_wanted(VCHIQ_STATE_T *state); +vchiq_videocore_wanted(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_use_internal(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, +vchiq_use_internal(struct vchiq_state_struct *state, + struct vchiq_service_struct *service, enum USE_TYPE_E use_type); extern VCHIQ_STATUS_T -vchiq_release_internal(VCHIQ_STATE_T *state, +vchiq_release_internal(struct vchiq_state_struct *state, struct vchiq_service_struct *service); extern struct vchiq_debugfs_node_struct * 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 72f02ea06a2b..e8b46d91fc90 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -89,7 +89,7 @@ static DEFINE_SPINLOCK(service_spinlock); DEFINE_SPINLOCK(bulk_waiter_spinlock); static DEFINE_SPINLOCK(quota_spinlock); -VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES]; +struct vchiq_state_struct *vchiq_states[VCHIQ_MAX_STATES]; static unsigned int handle_seq; static const char *const srvstate_names[] = { @@ -128,7 +128,8 @@ static const char *const conn_state_names[] = { }; static void -release_message_sync(VCHIQ_STATE_T *state, struct vchiq_header_struct *header); +release_message_sync(struct vchiq_state_struct *state, + struct vchiq_header_struct *header); static const char *msg_type_str(unsigned int msg_type) { @@ -185,7 +186,7 @@ find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle) } struct vchiq_service_struct * -find_service_by_port(VCHIQ_STATE_T *state, int localport) +find_service_by_port(struct vchiq_state_struct *state, int localport) { struct vchiq_service_struct *service = NULL; @@ -258,8 +259,8 @@ find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, } struct vchiq_service_struct * -next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, - int *pidx) +next_service_by_instance(struct vchiq_state_struct *state, + VCHIQ_INSTANCE_T instance, int *pidx) { struct vchiq_service_struct *service = NULL; int idx = *pidx; @@ -309,7 +310,7 @@ unlock_service(struct vchiq_service_struct *service) } service->ref_count--; if (!service->ref_count) { - VCHIQ_STATE_T *state = service->state; + struct vchiq_state_struct *state = service->state; WARN_ON(service->srvstate != VCHIQ_SRVSTATE_FREE); state->services[service->localport] = NULL; @@ -358,7 +359,7 @@ static void mark_service_closing_internal(struct vchiq_service_struct *service, int sh_thread) { - VCHIQ_STATE_T *state = service->state; + struct vchiq_state_struct *state = service->state; struct vchiq_service_quota_struct *service_quota; service->closing = 1; @@ -408,7 +409,8 @@ make_service_callback(struct vchiq_service_struct *service, } inline void -vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate) +vchiq_set_conn_state(struct vchiq_state_struct *state, + VCHIQ_CONNSTATE_T newstate) { VCHIQ_CONNSTATE_T oldstate = state->conn_state; @@ -428,7 +430,8 @@ remote_event_create(struct remote_event_struct *event) } static inline int -remote_event_wait(VCHIQ_STATE_T *state, struct remote_event_struct *event) +remote_event_wait(struct vchiq_state_struct *state, + struct remote_event_struct *event) { if (!event->fired) { event->armed = 1; @@ -450,7 +453,7 @@ remote_event_wait(VCHIQ_STATE_T *state, struct remote_event_struct *event) } static inline void -remote_event_signal_local(VCHIQ_STATE_T *state, +remote_event_signal_local(struct vchiq_state_struct *state, struct remote_event_struct *event) { event->armed = 0; @@ -458,14 +461,15 @@ remote_event_signal_local(VCHIQ_STATE_T *state, } static inline void -remote_event_poll(VCHIQ_STATE_T *state, struct remote_event_struct *event) +remote_event_poll(struct vchiq_state_struct *state, + struct remote_event_struct *event) { if (event->fired && event->armed) remote_event_signal_local(state, event); } void -remote_event_pollall(VCHIQ_STATE_T *state) +remote_event_pollall(struct vchiq_state_struct *state) { remote_event_poll(state, &state->local->sync_trigger); remote_event_poll(state, &state->local->sync_release); @@ -490,7 +494,7 @@ calc_stride(size_t size) /* Called by the slot handler thread */ static struct vchiq_service_struct * -get_listening_service(VCHIQ_STATE_T *state, int fourcc) +get_listening_service(struct vchiq_state_struct *state, int fourcc) { int i; @@ -514,7 +518,7 @@ get_listening_service(VCHIQ_STATE_T *state, int fourcc) /* Called by the slot handler thread */ static struct vchiq_service_struct * -get_connected_service(VCHIQ_STATE_T *state, unsigned int port) +get_connected_service(struct vchiq_state_struct *state, unsigned int port) { int i; @@ -531,8 +535,8 @@ get_connected_service(VCHIQ_STATE_T *state, unsigned int port) } inline void -request_poll(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, - int poll_type) +request_poll(struct vchiq_state_struct *state, + struct vchiq_service_struct *service, int poll_type) { u32 value; @@ -561,7 +565,7 @@ request_poll(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, /* Called from queue_message, by the slot handler and application threads, ** with slot_mutex held */ static struct vchiq_header_struct * -reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) +reserve_space(struct vchiq_state_struct *state, size_t space, int is_blocking) { struct vchiq_shared_state_struct *local = state->local; int tx_pos = state->local_tx_pos; @@ -622,7 +626,8 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) /* Called by the recycle thread. */ static void -process_free_queue(VCHIQ_STATE_T *state, BITSET_T *service_found, size_t length) +process_free_queue(struct vchiq_state_struct *state, BITSET_T *service_found, + size_t length) { struct vchiq_shared_state_struct *local = state->local; int slot_queue_available; @@ -808,8 +813,8 @@ copy_message_data( /* Called by the slot handler and application threads */ static VCHIQ_STATUS_T -queue_message(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, - int msgid, +queue_message(struct vchiq_state_struct *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) @@ -1056,8 +1061,8 @@ queue_message(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, /* Called by the slot handler and application threads */ static VCHIQ_STATUS_T -queue_message_sync(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, - int msgid, +queue_message_sync(struct vchiq_state_struct *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) @@ -1154,7 +1159,8 @@ claim_slot(struct vchiq_slot_info_struct *slot) } static void -release_slot(VCHIQ_STATE_T *state, struct vchiq_slot_info_struct *slot_info, +release_slot(struct vchiq_state_struct *state, + struct vchiq_slot_info_struct *slot_info, struct vchiq_header_struct *header, struct vchiq_service_struct *service) { @@ -1293,7 +1299,7 @@ notify_bulks(struct vchiq_service_struct *service, /* Called by the slot handler thread */ static void -poll_services(VCHIQ_STATE_T *state) +poll_services(struct vchiq_state_struct *state) { int group, i; @@ -1410,7 +1416,7 @@ abort_outstanding_bulks(struct vchiq_service_struct *service, } static int -parse_open(VCHIQ_STATE_T *state, struct vchiq_header_struct *header) +parse_open(struct vchiq_state_struct *state, struct vchiq_header_struct *header) { struct vchiq_service_struct *service = NULL; int msgid, size; @@ -1532,7 +1538,7 @@ parse_open(VCHIQ_STATE_T *state, struct vchiq_header_struct *header) /* Called by the slot handler thread */ static void -parse_rx_slots(VCHIQ_STATE_T *state) +parse_rx_slots(struct vchiq_state_struct *state) { struct vchiq_shared_state_struct *remote = state->remote; struct vchiq_service_struct *service = NULL; @@ -1886,7 +1892,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) static int slot_handler_func(void *v) { - VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; + struct vchiq_state_struct *state = (struct vchiq_state_struct *)v; struct vchiq_shared_state_struct *local = state->local; DEBUG_INITIALISE(local) @@ -1970,7 +1976,7 @@ slot_handler_func(void *v) static int recycle_func(void *v) { - VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; + struct vchiq_state_struct *state = (struct vchiq_state_struct *)v; struct vchiq_shared_state_struct *local = state->local; BITSET_T *found; size_t length; @@ -1994,7 +2000,7 @@ recycle_func(void *v) static int sync_func(void *v) { - VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; + struct vchiq_state_struct *state = (struct vchiq_state_struct *)v; struct vchiq_shared_state_struct *local = state->local; struct vchiq_header_struct *header = (struct vchiq_header_struct *)SLOT_DATA_FROM_INDEX(state, @@ -2155,7 +2161,8 @@ vchiq_init_slots(void *mem_base, int mem_size) } VCHIQ_STATUS_T -vchiq_init_state(VCHIQ_STATE_T *state, struct vchiq_slot_zero_struct *slot_zero) +vchiq_init_state(struct vchiq_state_struct *state, + struct vchiq_slot_zero_struct *slot_zero) { struct vchiq_shared_state_struct *local; struct vchiq_shared_state_struct *remote; @@ -2185,7 +2192,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, struct vchiq_slot_zero_struct *slot_zero) return VCHIQ_ERROR; } - memset(state, 0, sizeof(VCHIQ_STATE_T)); + memset(state, 0, sizeof(struct vchiq_state_struct)); /* initialize shared state pointers @@ -2237,18 +2244,22 @@ vchiq_init_state(VCHIQ_STATE_T *state, struct vchiq_slot_zero_struct *slot_zero) state->data_use_count = 0; state->data_quota = state->slot_queue_available - 1; - local->trigger.event = offsetof(VCHIQ_STATE_T, trigger_event); + local->trigger.event = + offsetof(struct vchiq_state_struct, trigger_event); remote_event_create(&local->trigger); local->tx_pos = 0; - local->recycle.event = offsetof(VCHIQ_STATE_T, recycle_event); + local->recycle.event = + offsetof(struct vchiq_state_struct, recycle_event); remote_event_create(&local->recycle); local->slot_queue_recycle = state->slot_queue_available; - local->sync_trigger.event = offsetof(VCHIQ_STATE_T, sync_trigger_event); + local->sync_trigger.event = + offsetof(struct vchiq_state_struct, sync_trigger_event); remote_event_create(&local->sync_trigger); - local->sync_release.event = offsetof(VCHIQ_STATE_T, sync_release_event); + local->sync_release.event = + offsetof(struct vchiq_state_struct, sync_release_event); remote_event_create(&local->sync_release); /* At start-of-day, the slot is empty and available */ @@ -2322,9 +2333,10 @@ vchiq_init_state(VCHIQ_STATE_T *state, struct vchiq_slot_zero_struct *slot_zero) /* Called from application thread when a client or server service is created. */ 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_add_service_internal(struct vchiq_state_struct *state, + const struct vchiq_service_params_struct *params, + int srvstate, VCHIQ_INSTANCE_T instance, + VCHIQ_USERDATA_TERM_T userdata_term) { struct vchiq_service_struct *service; struct vchiq_service_struct **pservice = NULL; @@ -2498,7 +2510,7 @@ vchiq_open_service_internal(struct vchiq_service_struct *service, int client_id) static void release_service_messages(struct vchiq_service_struct *service) { - VCHIQ_STATE_T *state = service->state; + struct vchiq_state_struct *state = service->state; int slot_last = state->remote->slot_last; int i; @@ -2643,7 +2655,7 @@ VCHIQ_STATUS_T vchiq_close_service_internal(struct vchiq_service_struct *service, int close_recvd) { - VCHIQ_STATE_T *state = service->state; + struct vchiq_state_struct *state = service->state; VCHIQ_STATUS_T status = VCHIQ_SUCCESS; int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); @@ -2777,7 +2789,7 @@ vchiq_close_service_internal(struct vchiq_service_struct *service, void vchiq_terminate_service_internal(struct vchiq_service_struct *service) { - VCHIQ_STATE_T *state = service->state; + struct vchiq_state_struct *state = service->state; vchiq_log_info(vchiq_core_log_level, "%d: tsi - (%d<->%d)", state->id, service->localport, service->remoteport); @@ -2792,7 +2804,7 @@ vchiq_terminate_service_internal(struct vchiq_service_struct *service) void vchiq_free_service_internal(struct vchiq_service_struct *service) { - VCHIQ_STATE_T *state = service->state; + struct vchiq_state_struct *state = service->state; vchiq_log_info(vchiq_core_log_level, "%d: fsi - (%d)", state->id, service->localport); @@ -2821,7 +2833,8 @@ vchiq_free_service_internal(struct vchiq_service_struct *service) } VCHIQ_STATUS_T -vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) +vchiq_connect_internal(struct vchiq_state_struct *state, + VCHIQ_INSTANCE_T instance) { struct vchiq_service_struct *service; int i; @@ -2857,7 +2870,8 @@ 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_shutdown_internal(struct vchiq_state_struct *state, + VCHIQ_INSTANCE_T instance) { struct vchiq_service_struct *service; int i; @@ -2874,7 +2888,7 @@ vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) } VCHIQ_STATUS_T -vchiq_pause_internal(VCHIQ_STATE_T *state) +vchiq_pause_internal(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -2897,7 +2911,7 @@ vchiq_pause_internal(VCHIQ_STATE_T *state) } VCHIQ_STATUS_T -vchiq_resume_internal(VCHIQ_STATE_T *state) +vchiq_resume_internal(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_SUCCESS; @@ -3045,7 +3059,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T 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; + struct vchiq_state_struct *state; struct bulk_waiter *bulk_waiter = NULL; const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r'; const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? @@ -3245,7 +3259,7 @@ vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, { struct vchiq_service_struct *service = find_service_by_handle(handle); struct vchiq_shared_state_struct *remote; - VCHIQ_STATE_T *state; + struct vchiq_state_struct *state; int slot_index; if (!service) @@ -3273,7 +3287,8 @@ vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, } static void -release_message_sync(VCHIQ_STATE_T *state, struct vchiq_header_struct *header) +release_message_sync(struct vchiq_state_struct *state, + struct vchiq_header_struct *header) { header->msgid = VCHIQ_MSGID_PADDING; remote_event_signal(&state->remote->sync_release); @@ -3386,8 +3401,9 @@ vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle, } static void -vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state, - struct vchiq_shared_state_struct *shared, const char *label) +vchiq_dump_shared_state(void *dump_context, struct vchiq_state_struct *state, + struct vchiq_shared_state_struct *shared, + const char *label) { static const char *const debug_names[] = { "<entries>", @@ -3435,7 +3451,7 @@ vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state, } void -vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state) +vchiq_dump_state(void *dump_context, struct vchiq_state_struct *state) { char buf[80]; int len; @@ -3613,7 +3629,7 @@ vchiq_loud_error_footer(void) "================"); } -VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state) +VCHIQ_STATUS_T vchiq_send_remote_use(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_RETRY; @@ -3624,7 +3640,7 @@ VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state) return status; } -VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state) +VCHIQ_STATUS_T vchiq_send_remote_release(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_RETRY; @@ -3635,7 +3651,7 @@ VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state) return status; } -VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T *state) +VCHIQ_STATUS_T vchiq_send_remote_use_active(struct vchiq_state_struct *state) { VCHIQ_STATUS_T status = VCHIQ_RETRY; 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 b5a041c36c48..edc3e78af55e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -262,14 +262,14 @@ struct vchiq_bulk_queue_struct { struct remote_event_struct { int armed; int fired; - /* Contains offset from the beginning of the VCHIQ_STATE_T structure */ + /* Contains offset from the beginning of the vchiq_state_struct + * structure + */ u32 event; }; typedef struct opaque_platform_state_t *VCHIQ_PLATFORM_STATE_T; -typedef struct vchiq_state_struct VCHIQ_STATE_T; - struct vchiq_slot_struct { char data[VCHIQ_SLOT_SIZE]; }; @@ -299,7 +299,7 @@ struct vchiq_service_struct { short version_min; short peer_version; - VCHIQ_STATE_T *state; + struct vchiq_state_struct *state; VCHIQ_INSTANCE_T instance; int service_use_count; @@ -515,7 +515,7 @@ extern int vchiq_core_log_level; extern int vchiq_core_msg_log_level; extern int vchiq_sync_log_level; -extern VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES]; +extern struct vchiq_state_struct *vchiq_states[VCHIQ_MAX_STATES]; extern const char * get_conn_state_name(VCHIQ_CONNSTATE_T conn_state); @@ -524,16 +524,18 @@ extern struct vchiq_slot_zero_struct * vchiq_init_slots(void *mem_base, int mem_size); extern VCHIQ_STATUS_T -vchiq_init_state(VCHIQ_STATE_T *state, +vchiq_init_state(struct vchiq_state_struct *state, struct vchiq_slot_zero_struct *slot_zero); extern VCHIQ_STATUS_T -vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); +vchiq_connect_internal(struct vchiq_state_struct *state, + VCHIQ_INSTANCE_T instance); 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); +vchiq_add_service_internal(struct vchiq_state_struct *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(struct vchiq_service_struct *service, @@ -550,16 +552,17 @@ extern void vchiq_free_service_internal(struct vchiq_service_struct *service); extern VCHIQ_STATUS_T -vchiq_shutdown_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance); +vchiq_shutdown_internal(struct vchiq_state_struct *state, + VCHIQ_INSTANCE_T instance); extern VCHIQ_STATUS_T -vchiq_pause_internal(VCHIQ_STATE_T *state); +vchiq_pause_internal(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_resume_internal(VCHIQ_STATE_T *state); +vchiq_resume_internal(struct vchiq_state_struct *state); extern void -remote_event_pollall(VCHIQ_STATE_T *state); +remote_event_pollall(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *offset, int size, @@ -567,7 +570,7 @@ vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *offset, int size, VCHIQ_BULK_DIR_T dir); extern void -vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state); +vchiq_dump_state(void *dump_context, struct vchiq_state_struct *state); extern void vchiq_dump_service_state(void *dump_context, @@ -580,14 +583,15 @@ extern void vchiq_loud_error_footer(void); extern void -request_poll(VCHIQ_STATE_T *state, struct vchiq_service_struct *service, - int poll_type); +request_poll(struct vchiq_state_struct *state, + struct vchiq_service_struct *service, int poll_type); static inline struct vchiq_service_struct * handle_to_service(VCHIQ_SERVICE_HANDLE_T handle) { - VCHIQ_STATE_T *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) & - (VCHIQ_MAX_STATES - 1)]; + struct vchiq_state_struct *state = + vchiq_states[(handle / VCHIQ_MAX_SERVICES) & + (VCHIQ_MAX_STATES - 1)]; if (!state) return NULL; @@ -598,7 +602,7 @@ extern struct vchiq_service_struct * find_service_by_handle(VCHIQ_SERVICE_HANDLE_T handle); extern struct vchiq_service_struct * -find_service_by_port(VCHIQ_STATE_T *state, int localport); +find_service_by_port(struct vchiq_state_struct *state, int localport); extern struct vchiq_service_struct * find_service_for_instance(VCHIQ_INSTANCE_T instance, @@ -609,8 +613,8 @@ find_closed_service_for_instance(VCHIQ_INSTANCE_T instance, VCHIQ_SERVICE_HANDLE_T handle); extern struct vchiq_service_struct * -next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, - int *pidx); +next_service_by_instance(struct vchiq_state_struct *state, + VCHIQ_INSTANCE_T instance, int *pidx); extern void lock_service(struct vchiq_service_struct *service); @@ -632,16 +636,16 @@ extern void remote_event_signal(struct remote_event_struct *event); void -vchiq_platform_check_suspend(VCHIQ_STATE_T *state); +vchiq_platform_check_suspend(struct vchiq_state_struct *state); extern void -vchiq_platform_paused(VCHIQ_STATE_T *state); +vchiq_platform_paused(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_platform_resume(VCHIQ_STATE_T *state); +vchiq_platform_resume(struct vchiq_state_struct *state); extern void -vchiq_platform_resumed(VCHIQ_STATE_T *state); +vchiq_platform_resumed(struct vchiq_state_struct *state); extern void vchiq_dump(void *dump_context, const char *str, int len); @@ -663,38 +667,40 @@ extern VCHIQ_STATUS_T vchiq_release_service_internal(struct vchiq_service_struct *service); extern void -vchiq_on_remote_use(VCHIQ_STATE_T *state); +vchiq_on_remote_use(struct vchiq_state_struct *state); extern void -vchiq_on_remote_release(VCHIQ_STATE_T *state); +vchiq_on_remote_release(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_platform_init_state(VCHIQ_STATE_T *state); +vchiq_platform_init_state(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T vchiq_check_service(struct vchiq_service_struct *service); extern void -vchiq_on_remote_use_active(VCHIQ_STATE_T *state); +vchiq_on_remote_use_active(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_send_remote_use(VCHIQ_STATE_T *state); +vchiq_send_remote_use(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_send_remote_release(VCHIQ_STATE_T *state); +vchiq_send_remote_release(struct vchiq_state_struct *state); extern VCHIQ_STATUS_T -vchiq_send_remote_use_active(VCHIQ_STATE_T *state); +vchiq_send_remote_use_active(struct vchiq_state_struct *state); extern void -vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, - VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate); +vchiq_platform_conn_state_changed(struct vchiq_state_struct *state, + VCHIQ_CONNSTATE_T oldstate, + VCHIQ_CONNSTATE_T newstate); extern void -vchiq_platform_handle_timeout(VCHIQ_STATE_T *state); +vchiq_platform_handle_timeout(struct vchiq_state_struct *state); extern void -vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate); +vchiq_set_conn_state(struct vchiq_state_struct *state, + VCHIQ_CONNSTATE_T newstate); extern void vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, -- 2.17.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel