static enum vchiq_status
vchiq_blocking_bulk_transfer(unsigned int handle, void *data,
- unsigned int size, enum vchiq_bulk_dir dir);
+ unsigned int size, enum vchiq_bulk_dir dir);
static irqreturn_t
vchiq_doorbell_irq(int irq, void *dev_id)
}
/* do not try and release vmalloc pages */
} else {
- actual_pages = pin_user_pages_fast(
- (unsigned long)ubuf & PAGE_MASK,
- num_pages,
- type == PAGELIST_READ,
- pages);
+ actual_pages = pin_user_pages_fast((unsigned long)ubuf & PAGE_MASK, num_pages,
+ type == PAGELIST_READ, pages);
if (actual_pages != num_pages) {
vchiq_log_info(vchiq_arm_log_level,
/* Partial cache lines (fragments) require special measures */
if ((type == PAGELIST_READ) &&
- ((pagelist->offset & (g_cache_line_size - 1)) ||
- ((pagelist->offset + pagelist->length) &
- (g_cache_line_size - 1)))) {
+ ((pagelist->offset & (g_cache_line_size - 1)) ||
+ ((pagelist->offset + pagelist->length) &
+ (g_cache_line_size - 1)))) {
char *fragments;
if (down_interruptible(&g_free_fragments_sema)) {
kunmap(pages[0]);
}
if ((actual >= 0) && (head_bytes < actual) &&
- (tail_bytes != 0)) {
+ (tail_bytes != 0)) {
memcpy((char *)kmap(pages[num_pages - 1]) +
((pagelist->offset + actual) &
(PAGE_SIZE - 1) & ~(g_cache_line_size - 1)),
}
g_dev = dev;
- vchiq_log_info(vchiq_arm_log_level,
- "vchiq_init - done (slots %pK, phys %pad)",
- vchiq_slot_zero, &slot_phys);
+ vchiq_log_info(vchiq_arm_log_level, "vchiq_init - done (slots %pK, phys %pad)",
+ vchiq_slot_zero, &slot_phys);
vchiq_call_connected_callbacks();
char buf[80];
int len;
- len = snprintf(buf, sizeof(buf),
- " Platform: 2835 (VC master)");
+ len = snprintf(buf, sizeof(buf), " Platform: 2835 (VC master)");
return vchiq_dump(dump_context, buf, len + 1);
}
usleep_range(500, 600);
}
if (i == VCHIQ_INIT_RETRIES) {
- vchiq_log_error(vchiq_core_log_level,
- "%s: videocore not initialized\n", __func__);
+ vchiq_log_error(vchiq_core_log_level, "%s: videocore not initialized\n", __func__);
ret = -ENOTCONN;
goto failed;
} else if (i > 0) {
vchiq_log_warning(vchiq_core_log_level,
- "%s: videocore initialized after %d retries\n",
- __func__, i);
+ "%s: videocore initialized after %d retries\n", __func__, i);
}
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
if (!instance) {
vchiq_log_error(vchiq_core_log_level,
- "%s: error allocating vchiq instance\n", __func__);
+ "%s: error allocating vchiq instance\n", __func__);
ret = -ENOMEM;
goto failed;
}
ret = 0;
failed:
- vchiq_log_trace(vchiq_core_log_level,
- "%s(%p): returning %d", __func__, instance, ret);
+ vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, ret);
return ret;
}
list_for_each_entry_safe(waiter, next,
&instance->bulk_waiter_list, list) {
list_del(&waiter->list);
- vchiq_log_info(vchiq_arm_log_level,
- "bulk_waiter - cleaned up %pK for pid %d",
- waiter, waiter->pid);
+ vchiq_log_info(vchiq_arm_log_level, "bulk_waiter - cleaned up %pK for pid %d",
+ waiter, waiter->pid);
kfree(waiter);
}
}
mutex_unlock(&state->mutex);
- vchiq_log_trace(vchiq_core_log_level,
- "%s(%p): returning %d", __func__, instance, status);
+ vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status);
free_bulk_waiter(instance);
kfree(instance);
struct vchiq_state *state = instance->state;
if (mutex_lock_killable(&state->mutex)) {
- vchiq_log_trace(vchiq_core_log_level,
- "%s: call to mutex_lock failed", __func__);
+ vchiq_log_trace(vchiq_core_log_level, "%s: call to mutex_lock failed", __func__);
status = VCHIQ_RETRY;
goto failed;
}
mutex_unlock(&state->mutex);
failed:
- vchiq_log_trace(vchiq_core_log_level,
- "%s(%p): returning %d", __func__, instance, status);
+ vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status);
return status;
}
? VCHIQ_SRVSTATE_LISTENING
: VCHIQ_SRVSTATE_HIDDEN;
- service = vchiq_add_service_internal(
- state,
- params,
- srvstate,
- instance,
- NULL);
+ service = vchiq_add_service_internal(state, params, srvstate, instance, NULL);
if (service) {
*phandle = service->handle;
status = VCHIQ_ERROR;
}
- vchiq_log_trace(vchiq_core_log_level,
- "%s(%p): returning %d", __func__, instance, status);
+ vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status);
return status;
}
if (!vchiq_is_connected(instance))
goto failed;
- service = vchiq_add_service_internal(state,
- params,
- VCHIQ_SRVSTATE_OPENING,
- instance,
- NULL);
+ service = vchiq_add_service_internal(state, params, VCHIQ_SRVSTATE_OPENING, instance, NULL);
if (service) {
*phandle = service->handle;
}
failed:
- vchiq_log_trace(vchiq_core_log_level,
- "%s(%p): returning %d", __func__, instance, status);
+ vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status);
return status;
}
VCHIQ_BULK_TRANSMIT);
break;
case VCHIQ_BULK_MODE_BLOCKING:
- status = vchiq_blocking_bulk_transfer(handle,
- (void *)data, size, VCHIQ_BULK_TRANSMIT);
+ status = vchiq_blocking_bulk_transfer(handle, (void *)data, size,
+ VCHIQ_BULK_TRANSMIT);
break;
default:
return VCHIQ_ERROR;
mode, VCHIQ_BULK_RECEIVE);
break;
case VCHIQ_BULK_MODE_BLOCKING:
- status = vchiq_blocking_bulk_transfer(handle,
- (void *)data, size, VCHIQ_BULK_RECEIVE);
+ status = vchiq_blocking_bulk_transfer(handle, (void *)data, size,
+ VCHIQ_BULK_RECEIVE);
break;
default:
return VCHIQ_ERROR;
if (bulk) {
/* This thread has an outstanding bulk transfer. */
/* FIXME: why compare a dma address to a pointer? */
- if ((bulk->data != (dma_addr_t)(uintptr_t)data) ||
- (bulk->size != size)) {
+ if ((bulk->data != (dma_addr_t)(uintptr_t)data) || (bulk->size != size)) {
/*
* This is not a retry of the previous one.
* Cancel the signal when the transfer completes.
} else {
waiter = kzalloc(sizeof(*waiter), GFP_KERNEL);
if (!waiter) {
- vchiq_log_error(vchiq_core_log_level,
- "%s - out of memory", __func__);
+ vchiq_log_error(vchiq_core_log_level, "%s - out of memory", __func__);
return VCHIQ_ERROR;
}
}
status = vchiq_bulk_transfer(handle, data, NULL, size,
&waiter->bulk_waiter,
VCHIQ_BULK_MODE_BLOCKING, dir);
- if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) ||
- !waiter->bulk_waiter.bulk) {
+ if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
if (bulk) {
mutex_lock(&instance->bulk_waiter_list_mutex);
list_add(&waiter->list, &instance->bulk_waiter_list);
mutex_unlock(&instance->bulk_waiter_list_mutex);
- vchiq_log_info(vchiq_arm_log_level,
- "saved bulk_waiter %pK for pid %d",
- waiter, current->pid);
+ vchiq_log_info(vchiq_arm_log_level, "saved bulk_waiter %pK for pid %d", waiter,
+ current->pid);
}
return status;
while ((insert - instance->completion_remove) >= MAX_COMPLETIONS) {
/* Out of space - wait for the client */
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
- vchiq_log_trace(vchiq_arm_log_level,
- "%s - completion queue full", __func__);
+ vchiq_log_trace(vchiq_arm_log_level, "%s - completion queue full", __func__);
DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
- if (wait_for_completion_interruptible(
- &instance->remove_event)) {
- vchiq_log_info(vchiq_arm_log_level,
- "service_callback interrupted");
+ if (wait_for_completion_interruptible(&instance->remove_event)) {
+ vchiq_log_info(vchiq_arm_log_level, "service_callback interrupted");
return VCHIQ_RETRY;
} else if (instance->closing) {
- vchiq_log_info(vchiq_arm_log_level,
- "service_callback closing");
+ vchiq_log_info(vchiq_arm_log_level, "service_callback closing");
return VCHIQ_SUCCESS;
}
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
return VCHIQ_SUCCESS;
vchiq_log_trace(vchiq_arm_log_level,
- "%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
- __func__, (unsigned long)user_service,
- service->localport, user_service->userdata,
- reason, (unsigned long)header,
- (unsigned long)instance, (unsigned long)bulk_userdata);
+ "%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
+ __func__, (unsigned long)user_service, service->localport,
+ user_service->userdata, reason, (unsigned long)header,
+ (unsigned long)instance, (unsigned long)bulk_userdata);
if (header && user_service->is_vchi) {
spin_lock(&msg_queue_spinlock);
spin_unlock(&msg_queue_spinlock);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
DEBUG_COUNT(MSG_QUEUE_FULL_COUNT);
- vchiq_log_trace(vchiq_arm_log_level,
- "service_callback - msg queue full");
+ vchiq_log_trace(vchiq_arm_log_level, "service_callback - msg queue full");
/*
* If there is no MESSAGE_AVAILABLE in the completion
* queue, add one
enum vchiq_status status;
vchiq_log_info(vchiq_arm_log_level,
- "Inserting extra MESSAGE_AVAILABLE");
+ "Inserting extra MESSAGE_AVAILABLE");
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
- status = add_completion(instance, reason,
- NULL, user_service, bulk_userdata);
+ status = add_completion(instance, reason, NULL, user_service,
+ bulk_userdata);
if (status != VCHIQ_SUCCESS) {
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
return status;
}
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
- if (wait_for_completion_interruptible(
- &user_service->remove_event)) {
- vchiq_log_info(vchiq_arm_log_level,
- "%s interrupted", __func__);
+ if (wait_for_completion_interruptible(&user_service->remove_event)) {
+ vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
return VCHIQ_RETRY;
} else if (instance->closing) {
- vchiq_log_info(vchiq_arm_log_level,
- "%s closing", __func__);
+ vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
return VCHIQ_ERROR;
}
len = scnprintf(buf, sizeof(buf), " instance %pK", service->instance);
- if ((service->base.callback == service_callback) &&
- user_service->is_vchi) {
- len += scnprintf(buf + len, sizeof(buf) - len,
- ", %d/%d messages",
- user_service->msg_insert - user_service->msg_remove,
- MSG_QUEUE_SIZE);
+ if ((service->base.callback == service_callback) && user_service->is_vchi) {
+ len += scnprintf(buf + len, sizeof(buf) - len, ", %d/%d messages",
+ user_service->msg_insert - user_service->msg_remove,
+ MSG_QUEUE_SIZE);
if (user_service->dequeue_pending)
len += scnprintf(buf + len, sizeof(buf) - len,
struct vchiq_header *header,
unsigned int service_user, void *bulk_user)
{
- vchiq_log_error(vchiq_susp_log_level,
- "%s callback reason %d", __func__, reason);
+ vchiq_log_error(vchiq_susp_log_level, "%s callback reason %d", __func__, reason);
return 0;
}
ret = vchiq_initialise(&instance);
if (ret) {
- vchiq_log_error(vchiq_susp_log_level,
- "%s vchiq_initialise failed %d", __func__, ret);
+ vchiq_log_error(vchiq_susp_log_level, "%s vchiq_initialise failed %d", __func__,
+ ret);
goto exit;
}
status = vchiq_connect(instance);
if (status != VCHIQ_SUCCESS) {
- vchiq_log_error(vchiq_susp_log_level,
- "%s vchiq_connect failed %d", __func__, status);
+ vchiq_log_error(vchiq_susp_log_level, "%s vchiq_connect failed %d", __func__,
+ status);
goto shutdown;
}
status = vchiq_add_service(instance, ¶ms, &ka_handle);
if (status != VCHIQ_SUCCESS) {
- vchiq_log_error(vchiq_susp_log_level,
- "%s vchiq_open_service failed %d", __func__, status);
+ vchiq_log_error(vchiq_susp_log_level, "%s vchiq_open_service failed %d", __func__,
+ status);
goto shutdown;
}
long rc = 0, uc = 0;
if (wait_for_completion_interruptible(&arm_state->ka_evt)) {
- vchiq_log_error(vchiq_susp_log_level,
- "%s interrupted", __func__);
+ vchiq_log_error(vchiq_susp_log_level, "%s interrupted", __func__);
flush_signals(current);
continue;
}
status = vchiq_use_service(ka_handle);
if (status != VCHIQ_SUCCESS) {
vchiq_log_error(vchiq_susp_log_level,
- "%s vchiq_use_service error %d",
- __func__, status);
+ "%s vchiq_use_service error %d", __func__, status);
}
}
while (rc--) {
status = vchiq_release_service(ka_handle);
if (status != VCHIQ_SUCCESS) {
vchiq_log_error(vchiq_susp_log_level,
- "%s vchiq_release_service error %d",
- __func__, status);
+ "%s vchiq_release_service error %d", __func__,
+ status);
}
}
}
local_uc = ++arm_state->videocore_use_count;
++(*entity_uc);
- vchiq_log_trace(vchiq_susp_log_level,
- "%s %s count %d, state count %d",
- __func__, entity, *entity_uc, local_uc);
+ vchiq_log_trace(vchiq_susp_log_level, "%s %s count %d, state count %d", __func__, entity,
+ *entity_uc, local_uc);
write_unlock_bh(&arm_state->susp_res_lock);
if (status == VCHIQ_SUCCESS)
ack_cnt--;
else
- atomic_add(ack_cnt,
- &arm_state->ka_use_ack_count);
+ atomic_add(ack_cnt, &arm_state->ka_use_ack_count);
}
}
--arm_state->videocore_use_count;
--(*entity_uc);
- vchiq_log_trace(vchiq_susp_log_level,
- "%s %s count %d, state count %d",
- __func__, entity, *entity_uc,
- arm_state->videocore_use_count);
+ vchiq_log_trace(vchiq_susp_log_level, "%s %s count %d, state count %d", __func__, entity,
+ *entity_uc, arm_state->videocore_use_count);
unlock:
write_unlock_bh(&arm_state->susp_res_lock);
struct vchiq_service *service = find_service_by_handle(handle);
if (service) {
- ret = vchiq_use_internal(service->state, service,
- USE_TYPE_SERVICE);
+ ret = vchiq_use_internal(service->state, service, USE_TYPE_SERVICE);
vchiq_service_put(service);
}
return ret;
"with non-zero use-count", active_services, found);
for (i = 0; i < found; i++) {
- vchiq_log_warning(vchiq_susp_log_level,
- "----- %c%c%c%c:%d service count %d %s",
- VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc),
- service_data[i].clientid,
- service_data[i].use_count,
- service_data[i].use_count ? nz : "");
+ vchiq_log_warning(vchiq_susp_log_level, "----- %c%c%c%c:%d service count %d %s",
+ VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc),
+ service_data[i].clientid, service_data[i].use_count,
+ service_data[i].use_count ? nz : "");
}
- vchiq_log_warning(vchiq_susp_log_level,
- "----- VCHIQ use count count %d", peer_count);
- vchiq_log_warning(vchiq_susp_log_level,
- "--- Overall vchiq instance use count %d", vc_use_count);
+ vchiq_log_warning(vchiq_susp_log_level, "----- VCHIQ use count count %d", peer_count);
+ vchiq_log_warning(vchiq_susp_log_level, "--- Overall vchiq instance use count %d",
+ vc_use_count);
kfree(service_data);
}
if (ret == VCHIQ_ERROR) {
vchiq_log_error(vchiq_susp_log_level,
- "%s ERROR - %c%c%c%c:%d service count %d, state count %d", __func__,
- VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc),
- service->client_id, service->service_use_count,
- arm_state->videocore_use_count);
+ "%s ERROR - %c%c%c%c:%d service count %d, state count %d", __func__,
+ VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id,
+ service->service_use_count, arm_state->videocore_use_count);
vchiq_dump_service_use_state(service->state);
}
out:
char threadname[16];
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)
return;