Commit 6e475350 authored by Yamanappagouda Patil's avatar Yamanappagouda Patil Committed by Greg Kroah-Hartman

staging: vc04_services: Fixed 'missing a blank line' warnings.

Fixed checkpatch.pl "missing a blank line after declarations" warning
messages in vc04_services module.
Signed-off-by: default avatarYamanappagouda Patil <goudapatilk@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 57ce4df9
...@@ -208,6 +208,7 @@ VCHIQ_STATUS_T ...@@ -208,6 +208,7 @@ VCHIQ_STATUS_T
vchiq_platform_init_state(VCHIQ_STATE_T *state) vchiq_platform_init_state(VCHIQ_STATE_T *state)
{ {
VCHIQ_STATUS_T status = VCHIQ_SUCCESS; VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
state->platform_state = kzalloc(sizeof(VCHIQ_2835_ARM_STATE_T), GFP_KERNEL); state->platform_state = kzalloc(sizeof(VCHIQ_2835_ARM_STATE_T), GFP_KERNEL);
((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited = 1; ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited = 1;
status = vchiq_arm_init_state(state, &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state); status = vchiq_arm_init_state(state, &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state);
...@@ -293,6 +294,7 @@ vchiq_dump_platform_state(void *dump_context) ...@@ -293,6 +294,7 @@ vchiq_dump_platform_state(void *dump_context)
{ {
char buf[80]; char buf[80];
int len; int len;
len = snprintf(buf, sizeof(buf), len = snprintf(buf, sizeof(buf),
" Platform: 2835 (VC master)"); " Platform: 2835 (VC master)");
vchiq_dump(dump_context, buf, len + 1); vchiq_dump(dump_context, buf, len + 1);
...@@ -591,6 +593,7 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, ...@@ -591,6 +593,7 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
(pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) *
g_fragments_size; g_fragments_size;
int head_bytes, tail_bytes; int head_bytes, tail_bytes;
head_bytes = (g_cache_line_size - pagelist->offset) & head_bytes = (g_cache_line_size - pagelist->offset) &
(g_cache_line_size - 1); (g_cache_line_size - 1);
tail_bytes = (pagelist->offset + actual) & tail_bytes = (pagelist->offset + actual) &
......
...@@ -210,6 +210,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, ...@@ -210,6 +210,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
{ {
VCHIQ_COMPLETION_DATA_T *completion; VCHIQ_COMPLETION_DATA_T *completion;
int insert; int insert;
DEBUG_INITIALISE(g_state.local) DEBUG_INITIALISE(g_state.local)
insert = instance->completion_insert; insert = instance->completion_insert;
...@@ -281,6 +282,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, ...@@ -281,6 +282,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header,
VCHIQ_SERVICE_T *service; VCHIQ_SERVICE_T *service;
VCHIQ_INSTANCE_T instance; VCHIQ_INSTANCE_T instance;
bool skip_completion = false; bool skip_completion = false;
DEBUG_INITIALISE(g_state.local) DEBUG_INITIALISE(g_state.local)
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
...@@ -316,6 +318,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, ...@@ -316,6 +318,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header,
if ((user_service->message_available_pos - if ((user_service->message_available_pos -
instance->completion_remove) < 0) { instance->completion_remove) < 0) {
VCHIQ_STATUS_T status; VCHIQ_STATUS_T status;
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
"Inserting extra MESSAGE_AVAILABLE"); "Inserting extra MESSAGE_AVAILABLE");
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
...@@ -520,6 +523,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -520,6 +523,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
VCHIQ_SERVICE_T *service = NULL; VCHIQ_SERVICE_T *service = NULL;
long ret = 0; long ret = 0;
int i, rc; int i, rc;
DEBUG_INITIALISE(g_state.local) DEBUG_INITIALISE(g_state.local)
vchiq_log_trace(vchiq_arm_log_level, vchiq_log_trace(vchiq_arm_log_level,
...@@ -742,6 +746,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -742,6 +746,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case VCHIQ_IOC_QUEUE_MESSAGE: { case VCHIQ_IOC_QUEUE_MESSAGE: {
VCHIQ_QUEUE_MESSAGE_T args; VCHIQ_QUEUE_MESSAGE_T args;
if (copy_from_user if (copy_from_user
(&args, (const void __user *)arg, (&args, (const void __user *)arg,
sizeof(args)) != 0) { sizeof(args)) != 0) {
...@@ -754,6 +759,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -754,6 +759,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if ((service != NULL) && (args.count <= MAX_ELEMENTS)) { if ((service != NULL) && (args.count <= MAX_ELEMENTS)) {
/* Copy elements into kernel space */ /* Copy elements into kernel space */
VCHIQ_ELEMENT_T elements[MAX_ELEMENTS]; VCHIQ_ELEMENT_T elements[MAX_ELEMENTS];
if (copy_from_user(elements, args.elements, if (copy_from_user(elements, args.elements,
args.count * sizeof(VCHIQ_ELEMENT_T)) == 0) args.count * sizeof(VCHIQ_ELEMENT_T)) == 0)
status = vchiq_ioc_queue_message status = vchiq_ioc_queue_message
...@@ -770,6 +776,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -770,6 +776,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case VCHIQ_IOC_QUEUE_BULK_RECEIVE: { case VCHIQ_IOC_QUEUE_BULK_RECEIVE: {
VCHIQ_QUEUE_BULK_TRANSFER_T args; VCHIQ_QUEUE_BULK_TRANSFER_T args;
struct bulk_waiter_node *waiter = NULL; struct bulk_waiter_node *waiter = NULL;
VCHIQ_BULK_DIR_T dir = VCHIQ_BULK_DIR_T dir =
(cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ? (cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ?
VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE; VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE;
...@@ -797,6 +804,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -797,6 +804,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
args.userdata = &waiter->bulk_waiter; args.userdata = &waiter->bulk_waiter;
} else if (args.mode == VCHIQ_BULK_MODE_WAITING) { } else if (args.mode == VCHIQ_BULK_MODE_WAITING) {
struct list_head *pos; struct list_head *pos;
mutex_lock(&instance->bulk_waiter_list_mutex); mutex_lock(&instance->bulk_waiter_list_mutex);
list_for_each(pos, &instance->bulk_waiter_list) { list_for_each(pos, &instance->bulk_waiter_list) {
if (list_entry(pos, struct bulk_waiter_node, if (list_entry(pos, struct bulk_waiter_node,
...@@ -882,6 +890,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -882,6 +890,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
instance->completion_insert) instance->completion_insert)
&& !instance->closing) { && !instance->closing) {
int rc; int rc;
DEBUG_TRACE(AWAIT_COMPLETION_LINE); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
mutex_unlock(&instance->completion_mutex); mutex_unlock(&instance->completion_mutex);
rc = down_interruptible(&instance->insert_event); rc = down_interruptible(&instance->insert_event);
...@@ -1229,6 +1238,7 @@ static int ...@@ -1229,6 +1238,7 @@ static int
vchiq_open(struct inode *inode, struct file *file) vchiq_open(struct inode *inode, struct file *file)
{ {
int dev = iminor(inode) & 0x0f; int dev = iminor(inode) & 0x0f;
vchiq_log_info(vchiq_arm_log_level, "vchiq_open"); vchiq_log_info(vchiq_arm_log_level, "vchiq_open");
switch (dev) { switch (dev) {
case VCHIQ_MINOR: { case VCHIQ_MINOR: {
...@@ -1284,6 +1294,7 @@ vchiq_release(struct inode *inode, struct file *file) ...@@ -1284,6 +1294,7 @@ vchiq_release(struct inode *inode, struct file *file)
{ {
int dev = iminor(inode) & 0x0f; int dev = iminor(inode) & 0x0f;
int ret = 0; int ret = 0;
switch (dev) { switch (dev) {
case VCHIQ_MINOR: { case VCHIQ_MINOR: {
VCHIQ_INSTANCE_T instance = file->private_data; VCHIQ_INSTANCE_T instance = file->private_data;
...@@ -1365,6 +1376,7 @@ vchiq_release(struct inode *inode, struct file *file) ...@@ -1365,6 +1376,7 @@ vchiq_release(struct inode *inode, struct file *file)
instance->completion_insert) { instance->completion_insert) {
VCHIQ_COMPLETION_DATA_T *completion; VCHIQ_COMPLETION_DATA_T *completion;
VCHIQ_SERVICE_T *service; VCHIQ_SERVICE_T *service;
completion = &instance->completions[ completion = &instance->completions[
instance->completion_remove & instance->completion_remove &
(MAX_COMPLETIONS - 1)]; (MAX_COMPLETIONS - 1)];
...@@ -1387,9 +1399,11 @@ vchiq_release(struct inode *inode, struct file *file) ...@@ -1387,9 +1399,11 @@ vchiq_release(struct inode *inode, struct file *file)
{ {
struct list_head *pos, *next; struct list_head *pos, *next;
list_for_each_safe(pos, next, list_for_each_safe(pos, next,
&instance->bulk_waiter_list) { &instance->bulk_waiter_list) {
struct bulk_waiter_node *waiter; struct bulk_waiter_node *waiter;
waiter = list_entry(pos, waiter = list_entry(pos,
struct bulk_waiter_node, struct bulk_waiter_node,
list); list);
...@@ -1430,8 +1444,10 @@ vchiq_dump(void *dump_context, const char *str, int len) ...@@ -1430,8 +1444,10 @@ vchiq_dump(void *dump_context, const char *str, int len)
if (context->actual < context->space) { if (context->actual < context->space) {
int copy_bytes; int copy_bytes;
if (context->offset > 0) { if (context->offset > 0) {
int skip_bytes = min(len, (int)context->offset); int skip_bytes = min(len, (int)context->offset);
str += skip_bytes; str += skip_bytes;
len -= skip_bytes; len -= skip_bytes;
context->offset -= skip_bytes; context->offset -= skip_bytes;
...@@ -1452,6 +1468,7 @@ vchiq_dump(void *dump_context, const char *str, int len) ...@@ -1452,6 +1468,7 @@ vchiq_dump(void *dump_context, const char *str, int len)
** carriage return. */ ** carriage return. */
if ((len == 0) && (str[copy_bytes - 1] == '\0')) { if ((len == 0) && (str[copy_bytes - 1] == '\0')) {
char cr = '\n'; char cr = '\n';
if (copy_to_user(context->buf + context->actual - 1, if (copy_to_user(context->buf + context->actual - 1,
&cr, 1)) &cr, 1))
context->actual = -EFAULT; context->actual = -EFAULT;
...@@ -1599,17 +1616,14 @@ dump_phys_mem(void *virt_addr, u32 num_bytes) ...@@ -1599,17 +1616,14 @@ dump_phys_mem(void *virt_addr, u32 num_bytes)
} }
while (offset < end_offset) { while (offset < end_offset) {
int page_offset = offset % PAGE_SIZE; int page_offset = offset % PAGE_SIZE;
page_idx = offset / PAGE_SIZE;
page_idx = offset / PAGE_SIZE;
if (page_idx != prev_idx) { if (page_idx != prev_idx) {
if (page != NULL) if (page != NULL)
kunmap(page); kunmap(page);
page = pages[page_idx]; page = pages[page_idx];
kmapped_virt_ptr = kmap(page); kmapped_virt_ptr = kmap(page);
prev_idx = page_idx; prev_idx = page_idx;
} }
...@@ -1643,6 +1657,7 @@ vchiq_read(struct file *file, char __user *buf, ...@@ -1643,6 +1657,7 @@ vchiq_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
DUMP_CONTEXT_T context; DUMP_CONTEXT_T context;
context.buf = buf; context.buf = buf;
context.actual = 0; context.actual = 0;
context.space = count; context.space = count;
...@@ -1686,6 +1701,7 @@ int ...@@ -1686,6 +1701,7 @@ int
vchiq_videocore_wanted(VCHIQ_STATE_T *state) vchiq_videocore_wanted(VCHIQ_STATE_T *state)
{ {
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
if (!arm_state) if (!arm_state)
/* autosuspend not supported - always return wanted */ /* autosuspend not supported - always return wanted */
return 1; return 1;
...@@ -1753,6 +1769,7 @@ vchiq_keepalive_thread_func(void *v) ...@@ -1753,6 +1769,7 @@ vchiq_keepalive_thread_func(void *v)
while (1) { while (1) {
long rc = 0, uc = 0; long rc = 0, uc = 0;
if (wait_for_completion_interruptible(&arm_state->ka_evt) if (wait_for_completion_interruptible(&arm_state->ka_evt)
!= 0) { != 0) {
vchiq_log_error(vchiq_susp_log_level, vchiq_log_error(vchiq_susp_log_level,
...@@ -1982,6 +1999,7 @@ static inline int ...@@ -1982,6 +1999,7 @@ static inline int
need_resume(VCHIQ_STATE_T *state) need_resume(VCHIQ_STATE_T *state)
{ {
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
return (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) && return (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) &&
(arm_state->vc_resume_state < VC_RESUME_REQUESTED) && (arm_state->vc_resume_state < VC_RESUME_REQUESTED) &&
vchiq_videocore_wanted(state); vchiq_videocore_wanted(state);
...@@ -2155,6 +2173,7 @@ output_timeout_error(VCHIQ_STATE_T *state) ...@@ -2155,6 +2173,7 @@ output_timeout_error(VCHIQ_STATE_T *state)
} }
for (i = 0; i < active_services; i++) { for (i = 0; i < active_services; i++) {
VCHIQ_SERVICE_T *service_ptr = state->services[i]; VCHIQ_SERVICE_T *service_ptr = state->services[i];
if (service_ptr && service_ptr->service_use_count && if (service_ptr && service_ptr->service_use_count &&
(service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) { (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) {
snprintf(err, sizeof(err), " %c%c%c%c(%d) service has " snprintf(err, sizeof(err), " %c%c%c%c(%d) service has "
...@@ -2502,6 +2521,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ...@@ -2502,6 +2521,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
if (ret == VCHIQ_SUCCESS) { if (ret == VCHIQ_SUCCESS) {
VCHIQ_STATUS_T status = VCHIQ_SUCCESS; VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0); long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0);
while (ack_cnt && (status == VCHIQ_SUCCESS)) { while (ack_cnt && (status == VCHIQ_SUCCESS)) {
/* Send the use notify to videocore */ /* Send the use notify to videocore */
status = vchiq_send_remote_use_active(state); status = vchiq_send_remote_use_active(state);
...@@ -2584,6 +2604,7 @@ void ...@@ -2584,6 +2604,7 @@ void
vchiq_on_remote_use(VCHIQ_STATE_T *state) vchiq_on_remote_use(VCHIQ_STATE_T *state)
{ {
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); vchiq_log_trace(vchiq_susp_log_level, "%s", __func__);
atomic_inc(&arm_state->ka_use_count); atomic_inc(&arm_state->ka_use_count);
complete(&arm_state->ka_evt); complete(&arm_state->ka_evt);
...@@ -2593,6 +2614,7 @@ void ...@@ -2593,6 +2614,7 @@ void
vchiq_on_remote_release(VCHIQ_STATE_T *state) vchiq_on_remote_release(VCHIQ_STATE_T *state)
{ {
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
vchiq_log_trace(vchiq_susp_log_level, "%s", __func__); vchiq_log_trace(vchiq_susp_log_level, "%s", __func__);
atomic_inc(&arm_state->ka_release_count); atomic_inc(&arm_state->ka_release_count);
complete(&arm_state->ka_evt); complete(&arm_state->ka_evt);
...@@ -2621,6 +2643,7 @@ vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance) ...@@ -2621,6 +2643,7 @@ vchiq_instance_get_use_count(VCHIQ_INSTANCE_T instance)
{ {
VCHIQ_SERVICE_T *service; VCHIQ_SERVICE_T *service;
int use_count = 0, i; int use_count = 0, i;
i = 0; i = 0;
while ((service = next_service_by_instance(instance->state, while ((service = next_service_by_instance(instance->state,
instance, &i)) != NULL) { instance, &i)) != NULL) {
...@@ -2647,6 +2670,7 @@ vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) ...@@ -2647,6 +2670,7 @@ vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace)
{ {
VCHIQ_SERVICE_T *service; VCHIQ_SERVICE_T *service;
int i; int i;
i = 0; i = 0;
while ((service = next_service_by_instance(instance->state, while ((service = next_service_by_instance(instance->state,
instance, &i)) != NULL) { instance, &i)) != NULL) {
...@@ -2660,6 +2684,7 @@ static void suspend_timer_callback(unsigned long context) ...@@ -2660,6 +2684,7 @@ static void suspend_timer_callback(unsigned long context)
{ {
VCHIQ_STATE_T *state = (VCHIQ_STATE_T *)context; VCHIQ_STATE_T *state = (VCHIQ_STATE_T *)context;
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
if (!arm_state) if (!arm_state)
goto out; goto out;
vchiq_log_info(vchiq_susp_log_level, vchiq_log_info(vchiq_susp_log_level,
...@@ -2674,6 +2699,7 @@ vchiq_use_service_no_resume(VCHIQ_SERVICE_HANDLE_T handle) ...@@ -2674,6 +2699,7 @@ vchiq_use_service_no_resume(VCHIQ_SERVICE_HANDLE_T handle)
{ {
VCHIQ_STATUS_T ret = VCHIQ_ERROR; VCHIQ_STATUS_T ret = VCHIQ_ERROR;
VCHIQ_SERVICE_T *service = find_service_by_handle(handle); VCHIQ_SERVICE_T *service = find_service_by_handle(handle);
if (service) { if (service) {
ret = vchiq_use_internal(service->state, service, ret = vchiq_use_internal(service->state, service,
USE_TYPE_SERVICE_NO_RESUME); USE_TYPE_SERVICE_NO_RESUME);
...@@ -2687,6 +2713,7 @@ vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle) ...@@ -2687,6 +2713,7 @@ vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle)
{ {
VCHIQ_STATUS_T ret = VCHIQ_ERROR; VCHIQ_STATUS_T ret = VCHIQ_ERROR;
VCHIQ_SERVICE_T *service = find_service_by_handle(handle); VCHIQ_SERVICE_T *service = find_service_by_handle(handle);
if (service) { if (service) {
ret = vchiq_use_internal(service->state, service, ret = vchiq_use_internal(service->state, service,
USE_TYPE_SERVICE); USE_TYPE_SERVICE);
...@@ -2700,6 +2727,7 @@ vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle) ...@@ -2700,6 +2727,7 @@ vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle)
{ {
VCHIQ_STATUS_T ret = VCHIQ_ERROR; VCHIQ_STATUS_T ret = VCHIQ_ERROR;
VCHIQ_SERVICE_T *service = find_service_by_handle(handle); VCHIQ_SERVICE_T *service = find_service_by_handle(handle);
if (service) { if (service) {
ret = vchiq_release_internal(service->state, service); ret = vchiq_release_internal(service->state, service);
unlock_service(service); unlock_service(service);
...@@ -2744,6 +2772,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) ...@@ -2744,6 +2772,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
for (i = 0; (i < active_services) && (j < local_max_services); i++) { for (i = 0; (i < active_services) && (j < local_max_services); i++) {
VCHIQ_SERVICE_T *service_ptr = state->services[i]; VCHIQ_SERVICE_T *service_ptr = state->services[i];
if (!service_ptr) if (!service_ptr)
continue; continue;
...@@ -2832,12 +2861,14 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, ...@@ -2832,12 +2861,14 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state,
VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate) VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate)
{ {
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id, vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id,
get_conn_state_name(oldstate), get_conn_state_name(newstate)); get_conn_state_name(oldstate), get_conn_state_name(newstate));
if (state->conn_state == VCHIQ_CONNSTATE_CONNECTED) { if (state->conn_state == VCHIQ_CONNSTATE_CONNECTED) {
write_lock_bh(&arm_state->susp_res_lock); write_lock_bh(&arm_state->susp_res_lock);
if (!arm_state->first_connect) { if (!arm_state->first_connect) {
char threadname[16]; char threadname[16];
arm_state->first_connect = 1; arm_state->first_connect = 1;
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
snprintf(threadname, sizeof(threadname), "vchiq-keep/%d", snprintf(threadname, sizeof(threadname), "vchiq-keep/%d",
......
...@@ -192,6 +192,7 @@ VCHIQ_SERVICE_T * ...@@ -192,6 +192,7 @@ VCHIQ_SERVICE_T *
find_service_by_port(VCHIQ_STATE_T *state, int localport) find_service_by_port(VCHIQ_STATE_T *state, int localport)
{ {
VCHIQ_SERVICE_T *service = NULL; VCHIQ_SERVICE_T *service = NULL;
if ((unsigned int)localport <= VCHIQ_PORT_MAX) { if ((unsigned int)localport <= VCHIQ_PORT_MAX) {
spin_lock(&service_spinlock); spin_lock(&service_spinlock);
service = state->services[localport]; service = state->services[localport];
...@@ -268,6 +269,7 @@ next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance, ...@@ -268,6 +269,7 @@ next_service_by_instance(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance,
spin_lock(&service_spinlock); spin_lock(&service_spinlock);
while (idx < state->unused_service) { while (idx < state->unused_service) {
VCHIQ_SERVICE_T *srv = state->services[idx++]; VCHIQ_SERVICE_T *srv = state->services[idx++];
if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) && if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) &&
(srv->instance == instance)) { (srv->instance == instance)) {
service = srv; service = srv;
...@@ -381,6 +383,7 @@ make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason, ...@@ -381,6 +383,7 @@ make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason,
VCHIQ_HEADER_T *header, void *bulk_userdata) VCHIQ_HEADER_T *header, void *bulk_userdata)
{ {
VCHIQ_STATUS_T status; VCHIQ_STATUS_T status;
vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %pK, %pK)", vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %pK, %pK)",
service->state->id, service->localport, reason_names[reason], service->state->id, service->localport, reason_names[reason],
header, bulk_userdata); header, bulk_userdata);
...@@ -399,6 +402,7 @@ inline void ...@@ -399,6 +402,7 @@ inline void
vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate) vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate)
{ {
VCHIQ_CONNSTATE_T oldstate = state->conn_state; VCHIQ_CONNSTATE_T oldstate = state->conn_state;
vchiq_log_info(vchiq_core_log_level, "%d: %s->%s", state->id, vchiq_log_info(vchiq_core_log_level, "%d: %s->%s", state->id,
conn_state_names[oldstate], conn_state_names[oldstate],
conn_state_names[newstate]); conn_state_names[newstate]);
...@@ -485,6 +489,7 @@ get_listening_service(VCHIQ_STATE_T *state, int fourcc) ...@@ -485,6 +489,7 @@ get_listening_service(VCHIQ_STATE_T *state, int fourcc)
for (i = 0; i < state->unused_service; i++) { for (i = 0; i < state->unused_service; i++) {
VCHIQ_SERVICE_T *service = state->services[i]; VCHIQ_SERVICE_T *service = state->services[i];
if (service && if (service &&
(service->public_fourcc == fourcc) && (service->public_fourcc == fourcc) &&
((service->srvstate == VCHIQ_SRVSTATE_LISTENING) || ((service->srvstate == VCHIQ_SRVSTATE_LISTENING) ||
...@@ -503,8 +508,10 @@ static VCHIQ_SERVICE_T * ...@@ -503,8 +508,10 @@ static VCHIQ_SERVICE_T *
get_connected_service(VCHIQ_STATE_T *state, unsigned int port) get_connected_service(VCHIQ_STATE_T *state, unsigned int port)
{ {
int i; int i;
for (i = 0; i < state->unused_service; i++) { for (i = 0; i < state->unused_service; i++) {
VCHIQ_SERVICE_T *service = state->services[i]; VCHIQ_SERVICE_T *service = state->services[i];
if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN) if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN)
&& (service->remoteport == port)) { && (service->remoteport == port)) {
lock_service(service); lock_service(service);
...@@ -645,11 +652,13 @@ process_free_queue(VCHIQ_STATE_T *state) ...@@ -645,11 +652,13 @@ process_free_queue(VCHIQ_STATE_T *state)
VCHIQ_HEADER_T *header = VCHIQ_HEADER_T *header =
(VCHIQ_HEADER_T *)(data + pos); (VCHIQ_HEADER_T *)(data + pos);
int msgid = header->msgid; int msgid = header->msgid;
if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA) { if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA) {
int port = VCHIQ_MSG_SRCPORT(msgid); int port = VCHIQ_MSG_SRCPORT(msgid);
VCHIQ_SERVICE_QUOTA_T *service_quota = VCHIQ_SERVICE_QUOTA_T *service_quota =
&state->service_quotas[port]; &state->service_quotas[port];
int count; int count;
spin_lock(&quota_spinlock); spin_lock(&quota_spinlock);
count = service_quota->message_use_count; count = service_quota->message_use_count;
if (count > 0) if (count > 0)
...@@ -719,6 +728,7 @@ process_free_queue(VCHIQ_STATE_T *state) ...@@ -719,6 +728,7 @@ process_free_queue(VCHIQ_STATE_T *state)
if (data_found) { if (data_found) {
int count; int count;
spin_lock(&quota_spinlock); spin_lock(&quota_spinlock);
count = state->data_use_count; count = state->data_use_count;
if (count > 0) if (count > 0)
...@@ -1059,6 +1069,7 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ...@@ -1059,6 +1069,7 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
{ {
int oldmsgid = header->msgid; int oldmsgid = header->msgid;
if (oldmsgid != VCHIQ_MSGID_PADDING) if (oldmsgid != VCHIQ_MSGID_PADDING)
vchiq_log_error(vchiq_core_log_level, vchiq_log_error(vchiq_core_log_level,
"%d: qms - msgid %x, not PADDING", "%d: qms - msgid %x, not PADDING",
...@@ -1143,6 +1154,7 @@ release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info, ...@@ -1143,6 +1154,7 @@ release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info,
if (header) { if (header) {
int msgid = header->msgid; int msgid = header->msgid;
if (((msgid & VCHIQ_MSGID_CLAIMED) == 0) || if (((msgid & VCHIQ_MSGID_CLAIMED) == 0) ||
(service && service->closing)) { (service && service->closing)) {
mutex_unlock(&state->recycle_mutex); mutex_unlock(&state->recycle_mutex);
...@@ -1252,6 +1264,7 @@ notify_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue, ...@@ -1252,6 +1264,7 @@ notify_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue,
} }
if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) { if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) {
struct bulk_waiter *waiter; struct bulk_waiter *waiter;
spin_lock(&bulk_waiter_spinlock); spin_lock(&bulk_waiter_spinlock);
waiter = bulk->userdata; waiter = bulk->userdata;
if (waiter) { if (waiter) {
...@@ -1301,6 +1314,7 @@ poll_services(VCHIQ_STATE_T *state) ...@@ -1301,6 +1314,7 @@ poll_services(VCHIQ_STATE_T *state)
for (group = 0; group < BITSET_SIZE(state->unused_service); group++) { for (group = 0; group < BITSET_SIZE(state->unused_service); group++) {
u32 flags; u32 flags;
flags = atomic_xchg(&state->poll_services[group], 0); flags = atomic_xchg(&state->poll_services[group], 0);
for (i = 0; flags; i++) { for (i = 0; flags; i++) {
if (flags & (1 << i)) { if (flags & (1 << i)) {
...@@ -1308,6 +1322,7 @@ poll_services(VCHIQ_STATE_T *state) ...@@ -1308,6 +1322,7 @@ poll_services(VCHIQ_STATE_T *state)
find_service_by_port(state, find_service_by_port(state,
(group<<5) + i); (group<<5) + i);
u32 service_flags; u32 service_flags;
flags &= ~(1 << i); flags &= ~(1 << i);
if (!service) if (!service)
continue; continue;
...@@ -1421,6 +1436,7 @@ static void ...@@ -1421,6 +1436,7 @@ static void
abort_outstanding_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) abort_outstanding_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue)
{ {
int is_tx = (queue == &service->bulk_tx); int is_tx = (queue == &service->bulk_tx);
vchiq_log_trace(vchiq_core_log_level, vchiq_log_trace(vchiq_core_log_level,
"%d: aob:%d %cx - li=%x ri=%x p=%x", "%d: aob:%d %cx - li=%x ri=%x p=%x",
service->state->id, service->localport, is_tx ? 't' : 'r', service->state->id, service->localport, is_tx ? 't' : 'r',
...@@ -1484,6 +1500,7 @@ static void ...@@ -1484,6 +1500,7 @@ static void
resume_bulks(VCHIQ_STATE_T *state) resume_bulks(VCHIQ_STATE_T *state)
{ {
int i; int i;
if (unlikely(atomic_dec_return(&pause_bulks_count) != 0)) { if (unlikely(atomic_dec_return(&pause_bulks_count) != 0)) {
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
atomic_set(&pause_bulks_count, 0); atomic_set(&pause_bulks_count, 0);
...@@ -1507,6 +1524,7 @@ resume_bulks(VCHIQ_STATE_T *state) ...@@ -1507,6 +1524,7 @@ resume_bulks(VCHIQ_STATE_T *state)
VCHIQ_SERVICE_T *service = state->services[i]; VCHIQ_SERVICE_T *service = state->services[i];
int resolved_rx = 0; int resolved_rx = 0;
int resolved_tx = 0; int resolved_tx = 0;
if (!service || (service->srvstate != VCHIQ_SRVSTATE_OPEN)) if (!service || (service->srvstate != VCHIQ_SRVSTATE_OPEN))
continue; continue;
...@@ -1550,6 +1568,7 @@ parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) ...@@ -1550,6 +1568,7 @@ parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header)
/* A matching service exists */ /* A matching service exists */
short version = payload->version; short version = payload->version;
short version_min = payload->version_min; short version_min = payload->version_min;
if ((service->version < version_min) || if ((service->version < version_min) ||
(version < service->version_min)) { (version < service->version_min)) {
/* Version mismatch */ /* Version mismatch */
...@@ -1651,6 +1670,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) ...@@ -1651,6 +1670,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
VCHIQ_SHARED_STATE_T *remote = state->remote; VCHIQ_SHARED_STATE_T *remote = state->remote;
VCHIQ_SERVICE_T *service = NULL; VCHIQ_SERVICE_T *service = NULL;
int tx_pos; int tx_pos;
DEBUG_INITIALISE(state->local) DEBUG_INITIALISE(state->local)
tx_pos = remote->tx_pos; tx_pos = remote->tx_pos;
...@@ -1664,6 +1684,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) ...@@ -1664,6 +1684,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
DEBUG_TRACE(PARSE_LINE); DEBUG_TRACE(PARSE_LINE);
if (!state->rx_data) { if (!state->rx_data) {
int rx_index; int rx_index;
WARN_ON(!((state->rx_pos & VCHIQ_SLOT_MASK) == 0)); WARN_ON(!((state->rx_pos & VCHIQ_SLOT_MASK) == 0));
rx_index = remote->slot_queue[ rx_index = remote->slot_queue[
SLOT_QUEUE_INDEX_FROM_POS(state->rx_pos) & SLOT_QUEUE_INDEX_FROM_POS(state->rx_pos) &
...@@ -1841,6 +1862,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) ...@@ -1841,6 +1862,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
case VCHIQ_MSG_BULK_RX: case VCHIQ_MSG_BULK_RX:
case VCHIQ_MSG_BULK_TX: { case VCHIQ_MSG_BULK_TX: {
VCHIQ_BULK_QUEUE_T *queue; VCHIQ_BULK_QUEUE_T *queue;
WARN_ON(!state->is_master); WARN_ON(!state->is_master);
queue = (type == VCHIQ_MSG_BULK_RX) ? queue = (type == VCHIQ_MSG_BULK_RX) ?
&service->bulk_tx : &service->bulk_rx; &service->bulk_tx : &service->bulk_rx;
...@@ -2054,6 +2076,7 @@ slot_handler_func(void *v) ...@@ -2054,6 +2076,7 @@ slot_handler_func(void *v)
{ {
VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
VCHIQ_SHARED_STATE_T *local = state->local; VCHIQ_SHARED_STATE_T *local = state->local;
DEBUG_INITIALISE(local) DEBUG_INITIALISE(local)
while (1) { while (1) {
...@@ -2613,6 +2636,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state, ...@@ -2613,6 +2636,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
if (srvstate == VCHIQ_SRVSTATE_OPENING) { if (srvstate == VCHIQ_SRVSTATE_OPENING) {
for (i = 0; i < state->unused_service; i++) { for (i = 0; i < state->unused_service; i++) {
VCHIQ_SERVICE_T *srv = state->services[i]; VCHIQ_SERVICE_T *srv = state->services[i];
if (!srv) { if (!srv) {
pservice = &state->services[i]; pservice = &state->services[i];
break; break;
...@@ -2621,6 +2645,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state, ...@@ -2621,6 +2645,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
} else { } else {
for (i = (state->unused_service - 1); i >= 0; i--) { for (i = (state->unused_service - 1); i >= 0; i--) {
VCHIQ_SERVICE_T *srv = state->services[i]; VCHIQ_SERVICE_T *srv = state->services[i];
if (!srv) if (!srv)
pservice = &state->services[i]; pservice = &state->services[i];
else if ((srv->public_fourcc == params->fourcc) else if ((srv->public_fourcc == params->fourcc)
...@@ -2766,6 +2791,7 @@ release_service_messages(VCHIQ_SERVICE_T *service) ...@@ -2766,6 +2791,7 @@ release_service_messages(VCHIQ_SERVICE_T *service)
(VCHIQ_HEADER_T *)(data + pos); (VCHIQ_HEADER_T *)(data + pos);
int msgid = header->msgid; int msgid = header->msgid;
int port = VCHIQ_MSG_DSTPORT(msgid); int port = VCHIQ_MSG_DSTPORT(msgid);
if ((port == service->localport) && if ((port == service->localport) &&
(msgid & VCHIQ_MSGID_CLAIMED)) { (msgid & VCHIQ_MSGID_CLAIMED)) {
vchiq_log_info(vchiq_core_log_level, vchiq_log_info(vchiq_core_log_level,
...@@ -3498,6 +3524,7 @@ vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, VCHIQ_HEADER_T *header) ...@@ -3498,6 +3524,7 @@ vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle, VCHIQ_HEADER_T *header)
if ((slot_index >= remote->slot_first) && if ((slot_index >= remote->slot_first) &&
(slot_index <= remote->slot_last)) { (slot_index <= remote->slot_last)) {
int msgid = header->msgid; int msgid = header->msgid;
if (msgid & VCHIQ_MSGID_CLAIMED) { if (msgid & VCHIQ_MSGID_CLAIMED) {
VCHIQ_SLOT_INFO_T *slot_info = VCHIQ_SLOT_INFO_T *slot_info =
SLOT_INFO_FROM_INDEX(state, slot_index); SLOT_INFO_FROM_INDEX(state, slot_index);
...@@ -3656,9 +3683,9 @@ vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state, ...@@ -3656,9 +3683,9 @@ vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state,
"COMPLETION_QUEUE_FULL_COUNT" "COMPLETION_QUEUE_FULL_COUNT"
}; };
int i; int i;
char buf[80]; char buf[80];
int len; int len;
len = snprintf(buf, sizeof(buf), len = snprintf(buf, sizeof(buf),
" %s: slots %d-%d tx_pos=%x recycle=%x", " %s: slots %d-%d tx_pos=%x recycle=%x",
label, shared->slot_first, shared->slot_last, label, shared->slot_first, shared->slot_last,
...@@ -3762,9 +3789,11 @@ vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) ...@@ -3762,9 +3789,11 @@ vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service)
&service->state->service_quotas[service->localport]; &service->state->service_quotas[service->localport];
int fourcc = service->base.fourcc; int fourcc = service->base.fourcc;
int tx_pending, rx_pending; int tx_pending, rx_pending;
if (service->remoteport != VCHIQ_PORT_FREE) { if (service->remoteport != VCHIQ_PORT_FREE) {
int len2 = snprintf(remoteport, sizeof(remoteport), int len2 = snprintf(remoteport, sizeof(remoteport),
"%u", service->remoteport); "%u", service->remoteport);
if (service->public_fourcc != VCHIQ_FOURCC_INVALID) if (service->public_fourcc != VCHIQ_FOURCC_INVALID)
snprintf(remoteport + len2, snprintf(remoteport + len2,
sizeof(remoteport) - len2, sizeof(remoteport) - len2,
...@@ -3866,6 +3895,7 @@ vchiq_loud_error_footer(void) ...@@ -3866,6 +3895,7 @@ vchiq_loud_error_footer(void)
VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state) VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state)
{ {
VCHIQ_STATUS_T status = VCHIQ_RETRY; VCHIQ_STATUS_T status = VCHIQ_RETRY;
if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
status = queue_message(state, NULL, status = queue_message(state, NULL,
VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0),
...@@ -3876,6 +3906,7 @@ VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state) ...@@ -3876,6 +3906,7 @@ VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T *state)
VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state) VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state)
{ {
VCHIQ_STATUS_T status = VCHIQ_RETRY; VCHIQ_STATUS_T status = VCHIQ_RETRY;
if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
status = queue_message(state, NULL, status = queue_message(state, NULL,
VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0),
...@@ -3886,6 +3917,7 @@ VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state) ...@@ -3886,6 +3917,7 @@ VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T *state)
VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T *state) VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T *state)
{ {
VCHIQ_STATUS_T status = VCHIQ_RETRY; VCHIQ_STATUS_T status = VCHIQ_RETRY;
if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
status = queue_message(state, NULL, status = queue_message(state, NULL,
VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0),
......
...@@ -167,6 +167,7 @@ static int vchiq_debugfs_create_log_entries(struct dentry *top) ...@@ -167,6 +167,7 @@ static int vchiq_debugfs_create_log_entries(struct dentry *top)
struct dentry *dir; struct dentry *dir;
size_t i; size_t i;
int ret = 0; int ret = 0;
dir = debugfs_create_dir("log", vchiq_debugfs_top()); dir = debugfs_create_dir("log", vchiq_debugfs_top());
if (!dir) if (!dir)
return -ENOMEM; return -ENOMEM;
...@@ -174,6 +175,7 @@ static int vchiq_debugfs_create_log_entries(struct dentry *top) ...@@ -174,6 +175,7 @@ static int vchiq_debugfs_create_log_entries(struct dentry *top)
for (i = 0; i < n_log_entries; i++) { for (i = 0; i < n_log_entries; i++) {
void *levp = (void *)vchiq_debugfs_log_entries[i].plevel; void *levp = (void *)vchiq_debugfs_log_entries[i].plevel;
dir = debugfs_create_file(vchiq_debugfs_log_entries[i].name, dir = debugfs_create_file(vchiq_debugfs_log_entries[i].name,
0644, 0644,
debugfs_info.log_categories, debugfs_info.log_categories,
...@@ -312,6 +314,7 @@ int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance) ...@@ -312,6 +314,7 @@ int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance)
void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance) void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
{ {
VCHIQ_DEBUGFS_NODE_T *node = vchiq_instance_get_debugfs_node(instance); VCHIQ_DEBUGFS_NODE_T *node = vchiq_instance_get_debugfs_node(instance);
debugfs_remove_recursive(node->dentry); debugfs_remove_recursive(node->dentry);
} }
......
...@@ -147,9 +147,11 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) ...@@ -147,9 +147,11 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance)
if (status == VCHIQ_SUCCESS) { if (status == VCHIQ_SUCCESS) {
struct list_head *pos, *next; struct list_head *pos, *next;
list_for_each_safe(pos, next, list_for_each_safe(pos, next,
&instance->bulk_waiter_list) { &instance->bulk_waiter_list) {
struct bulk_waiter_node *waiter; struct bulk_waiter_node *waiter;
waiter = list_entry(pos, waiter = list_entry(pos,
struct bulk_waiter_node, struct bulk_waiter_node,
list); list);
...@@ -406,6 +408,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, ...@@ -406,6 +408,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data,
if (waiter) { if (waiter) {
VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk; VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk;
if (bulk) { if (bulk) {
/* This thread has an outstanding bulk transfer. */ /* This thread has an outstanding bulk transfer. */
if ((bulk->data != data) || if ((bulk->data != data) ||
...@@ -435,6 +438,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, ...@@ -435,6 +438,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data,
if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) ||
!waiter->bulk_waiter.bulk) { !waiter->bulk_waiter.bulk) {
VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk; VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk;
if (bulk) { if (bulk) {
/* Cancel the signal when the transfer /* Cancel the signal when the transfer
** completes. */ ** completes. */
......
...@@ -556,6 +556,7 @@ EXPORT_SYMBOL(vchi_connect); ...@@ -556,6 +556,7 @@ EXPORT_SYMBOL(vchi_connect);
int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle) int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle)
{ {
VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
return vchiq_status_to_vchi(vchiq_shutdown(instance)); return vchiq_status_to_vchi(vchiq_shutdown(instance));
} }
EXPORT_SYMBOL(vchi_disconnect); EXPORT_SYMBOL(vchi_disconnect);
...@@ -733,6 +734,7 @@ int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle) ...@@ -733,6 +734,7 @@ int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle)
{ {
int32_t ret = -1; int32_t ret = -1;
SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
if (service) { if (service) {
VCHIQ_STATUS_T status = vchiq_close_service(service->handle); VCHIQ_STATUS_T status = vchiq_close_service(service->handle);
if (status == VCHIQ_SUCCESS) { if (status == VCHIQ_SUCCESS) {
...@@ -750,8 +752,10 @@ int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle) ...@@ -750,8 +752,10 @@ int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle)
{ {
int32_t ret = -1; int32_t ret = -1;
SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
if (service) { if (service) {
VCHIQ_STATUS_T status = vchiq_remove_service(service->handle); VCHIQ_STATUS_T status = vchiq_remove_service(service->handle);
if (status == VCHIQ_SUCCESS) { if (status == VCHIQ_SUCCESS) {
service_free(service); service_free(service);
service = NULL; service = NULL;
...@@ -770,6 +774,7 @@ int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle, ...@@ -770,6 +774,7 @@ int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
int32_t ret = -1; int32_t ret = -1;
SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
VCHIQ_SERVICE_OPTION_T vchiq_option; VCHIQ_SERVICE_OPTION_T vchiq_option;
switch (option) { switch (option) {
case VCHI_SERVICE_OPTION_TRACE: case VCHI_SERVICE_OPTION_TRACE:
vchiq_option = VCHIQ_SERVICE_OPTION_TRACE; vchiq_option = VCHIQ_SERVICE_OPTION_TRACE;
...@@ -797,6 +802,7 @@ int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle, short *peer_ve ...@@ -797,6 +802,7 @@ int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle, short *peer_ve
{ {
int32_t ret = -1; int32_t ret = -1;
SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
if (service) if (service)
{ {
VCHIQ_STATUS_T status; VCHIQ_STATUS_T status;
...@@ -827,6 +833,7 @@ void ...@@ -827,6 +833,7 @@ void
vchi_writebuf_uint32(void *_ptr, uint32_t value) vchi_writebuf_uint32(void *_ptr, uint32_t value)
{ {
unsigned char *ptr = _ptr; unsigned char *ptr = _ptr;
ptr[0] = (unsigned char)((value >> 0) & 0xFF); ptr[0] = (unsigned char)((value >> 0) & 0xFF);
ptr[1] = (unsigned char)((value >> 8) & 0xFF); ptr[1] = (unsigned char)((value >> 8) & 0xFF);
ptr[2] = (unsigned char)((value >> 16) & 0xFF); ptr[2] = (unsigned char)((value >> 16) & 0xFF);
...@@ -841,6 +848,7 @@ uint16_t ...@@ -841,6 +848,7 @@ uint16_t
vchi_readbuf_uint16(const void *_ptr) vchi_readbuf_uint16(const void *_ptr)
{ {
const unsigned char *ptr = _ptr; const unsigned char *ptr = _ptr;
return ptr[0] | (ptr[1] << 8); return ptr[0] | (ptr[1] << 8);
} }
...@@ -869,6 +877,7 @@ vchi_writebuf_uint16(void *_ptr, uint16_t value) ...@@ -869,6 +877,7 @@ vchi_writebuf_uint16(void *_ptr, uint16_t value)
int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle) int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle)
{ {
int32_t ret = -1; int32_t ret = -1;
SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
if (service) if (service)
ret = vchiq_status_to_vchi(vchiq_use_service(service->handle)); ret = vchiq_status_to_vchi(vchiq_use_service(service->handle));
...@@ -889,6 +898,7 @@ EXPORT_SYMBOL(vchi_service_use); ...@@ -889,6 +898,7 @@ EXPORT_SYMBOL(vchi_service_use);
int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle) int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle)
{ {
int32_t ret = -1; int32_t ret = -1;
SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle; SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
if (service) if (service)
ret = vchiq_status_to_vchi( ret = vchiq_status_to_vchi(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment