diff options
Diffstat (limited to 'drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 104 |
1 files changed, 76 insertions, 28 deletions
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 b9d94f6b9bef..76351078affb 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3298,7 +3298,7 @@ vchiq_set_service_option(unsigned int handle, return status; } -static void +static int vchiq_dump_shared_state(void *dump_context, struct vchiq_state *state, struct vchiq_shared_state *shared, const char *label) { @@ -3318,16 +3318,21 @@ vchiq_dump_shared_state(void *dump_context, struct vchiq_state *state, int i; char buf[80]; int len; + int err; len = scnprintf(buf, sizeof(buf), " %s: slots %d-%d tx_pos=%x recycle=%x", label, shared->slot_first, shared->slot_last, shared->tx_pos, shared->slot_queue_recycle); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; len = scnprintf(buf, sizeof(buf), " Slots claimed:"); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; for (i = shared->slot_first; i <= shared->slot_last; i++) { struct vchiq_slot_info slot_info = @@ -3336,27 +3341,34 @@ vchiq_dump_shared_state(void *dump_context, struct vchiq_state *state, len = scnprintf(buf, sizeof(buf), " %d: %d/%d", i, slot_info.use_count, slot_info.release_count); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; } } for (i = 1; i < shared->debug[DEBUG_ENTRIES]; i++) { len = scnprintf(buf, sizeof(buf), " DEBUG: %s = %d(%x)", debug_names[i], shared->debug[i], shared->debug[i]); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; } + return 0; } -void -vchiq_dump_state(void *dump_context, struct vchiq_state *state) +int vchiq_dump_state(void *dump_context, struct vchiq_state *state) { char buf[80]; int len; int i; + int err; len = scnprintf(buf, sizeof(buf), "State %d: %s", state->id, conn_state_names[state->conn_state]); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; len = scnprintf(buf, sizeof(buf), " tx_pos=%x(@%pK), rx_pos=%x(@%pK)", @@ -3364,12 +3376,16 @@ vchiq_dump_state(void *dump_context, struct vchiq_state *state) state->tx_data + (state->local_tx_pos & VCHIQ_SLOT_MASK), state->rx_pos, state->rx_data + (state->rx_pos & VCHIQ_SLOT_MASK)); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; len = scnprintf(buf, sizeof(buf), " Version: %d (min %d)", VCHIQ_VERSION, VCHIQ_VERSION_MIN); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; if (VCHIQ_ENABLE_STATS) { len = scnprintf(buf, sizeof(buf), @@ -3377,7 +3393,9 @@ vchiq_dump_state(void *dump_context, struct vchiq_state *state) "error_count=%d", state->stats.ctrl_tx_count, state->stats.ctrl_rx_count, state->stats.error_count); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; } len = scnprintf(buf, sizeof(buf), @@ -3388,30 +3406,49 @@ vchiq_dump_state(void *dump_context, struct vchiq_state *state) state->data_quota - state->data_use_count, state->local->slot_queue_recycle - state->slot_queue_available, state->stats.slot_stalls, state->stats.data_stalls); - vchiq_dump(dump_context, buf, len + 1); - - vchiq_dump_platform_state(dump_context); - - vchiq_dump_shared_state(dump_context, state, state->local, "Local"); - vchiq_dump_shared_state(dump_context, state, state->remote, "Remote"); - - vchiq_dump_platform_instances(dump_context); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; + + err = vchiq_dump_platform_state(dump_context); + if (err) + return err; + + err = vchiq_dump_shared_state(dump_context, + state, + state->local, + "Local"); + if (err) + return err; + err = vchiq_dump_shared_state(dump_context, + state, + state->remote, + "Remote"); + if (err) + return err; + + err = vchiq_dump_platform_instances(dump_context); + if (err) + return err; for (i = 0; i < state->unused_service; i++) { struct vchiq_service *service = find_service_by_port(state, i); if (service) { - vchiq_dump_service_state(dump_context, service); + err = vchiq_dump_service_state(dump_context, service); unlock_service(service); + if (err) + return err; } } + return 0; } -void -vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) +int vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) { char buf[80]; int len; + int err; len = scnprintf(buf, sizeof(buf), "Service %u: %s (ref %u)", service->localport, srvstate_names[service->srvstate], @@ -3444,7 +3481,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) service_quota->slot_use_count, service_quota->slot_quota); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; tx_pending = service->bulk_tx.local_insert - service->bulk_tx.remote_insert; @@ -3463,7 +3502,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) BULK_INDEX(service->bulk_rx.remove)].size : 0); if (VCHIQ_ENABLE_STATS) { - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; len = scnprintf(buf, sizeof(buf), " Ctrl: tx_count=%d, tx_bytes=%llu, " @@ -3472,7 +3513,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) service->stats.ctrl_tx_bytes, service->stats.ctrl_rx_count, service->stats.ctrl_rx_bytes); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; len = scnprintf(buf, sizeof(buf), " Bulk: tx_count=%d, tx_bytes=%llu, " @@ -3481,7 +3524,9 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) service->stats.bulk_tx_bytes, service->stats.bulk_rx_count, service->stats.bulk_rx_bytes); - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; len = scnprintf(buf, sizeof(buf), " %d quota stalls, %d slot stalls, " @@ -3494,10 +3539,13 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service) } } - vchiq_dump(dump_context, buf, len + 1); + err = vchiq_dump(dump_context, buf, len + 1); + if (err) + return err; if (service->srvstate != VCHIQ_SRVSTATE_FREE) - vchiq_dump_platform_service_state(dump_context, service); + err = vchiq_dump_platform_service_state(dump_context, service); + return err; } void |