Commit 3414994b authored by Umang Jain's avatar Umang Jain Committed by Greg Kroah-Hartman

staging: vc04_services: Drop VCHIQ_SUCCESS usage

Drop the usage of VCHIQ_SUCCESS vchiq_status enum type. Replace it with
0 to report the success status.

This patch acts as intermediatory to address the TODO item:
	* Get rid of custom function return values
for vc04_services/interface.
Signed-off-by: default avatarUmang Jain <umang.jain@ideasonboard.com>
Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/20221223122404.170585-3-umang.jain@ideasonboard.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3ba31722
...@@ -101,7 +101,7 @@ static int audio_vchi_callback(struct vchiq_instance *vchiq_instance, ...@@ -101,7 +101,7 @@ static int audio_vchi_callback(struct vchiq_instance *vchiq_instance,
struct vc_audio_msg *m; struct vc_audio_msg *m;
if (reason != VCHIQ_MESSAGE_AVAILABLE) if (reason != VCHIQ_MESSAGE_AVAILABLE)
return VCHIQ_SUCCESS; return 0;
m = (void *)header->data; m = (void *)header->data;
if (m->type == VC_AUDIO_MSG_TYPE_RESULT) { if (m->type == VC_AUDIO_MSG_TYPE_RESULT) {
...@@ -119,7 +119,7 @@ static int audio_vchi_callback(struct vchiq_instance *vchiq_instance, ...@@ -119,7 +119,7 @@ static int audio_vchi_callback(struct vchiq_instance *vchiq_instance,
} }
vchiq_release_message(vchiq_instance, instance->service_handle, header); vchiq_release_message(vchiq_instance, instance->service_handle, header);
return VCHIQ_SUCCESS; return 0;
} }
static int static int
......
...@@ -19,7 +19,6 @@ enum vchiq_reason { ...@@ -19,7 +19,6 @@ enum vchiq_reason {
enum vchiq_status { enum vchiq_status {
VCHIQ_ERROR = -1, VCHIQ_ERROR = -1,
VCHIQ_SUCCESS = 0,
VCHIQ_RETRY = 1 VCHIQ_RETRY = 1
}; };
......
...@@ -724,7 +724,7 @@ void free_bulk_waiter(struct vchiq_instance *instance) ...@@ -724,7 +724,7 @@ void free_bulk_waiter(struct vchiq_instance *instance)
int vchiq_shutdown(struct vchiq_instance *instance) int vchiq_shutdown(struct vchiq_instance *instance)
{ {
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
struct vchiq_state *state = instance->state; struct vchiq_state *state = instance->state;
if (mutex_lock_killable(&state->mutex)) if (mutex_lock_killable(&state->mutex))
...@@ -761,7 +761,7 @@ int vchiq_connect(struct vchiq_instance *instance) ...@@ -761,7 +761,7 @@ int vchiq_connect(struct vchiq_instance *instance)
} }
status = vchiq_connect_internal(state, instance); status = vchiq_connect_internal(state, instance);
if (status == VCHIQ_SUCCESS) if (!status)
instance->connected = 1; instance->connected = 1;
mutex_unlock(&state->mutex); mutex_unlock(&state->mutex);
...@@ -793,7 +793,7 @@ vchiq_add_service(struct vchiq_instance *instance, ...@@ -793,7 +793,7 @@ vchiq_add_service(struct vchiq_instance *instance,
if (service) { if (service) {
*phandle = service->handle; *phandle = service->handle;
status = VCHIQ_SUCCESS; status = 0;
} else { } else {
status = VCHIQ_ERROR; status = VCHIQ_ERROR;
} }
...@@ -822,7 +822,7 @@ vchiq_open_service(struct vchiq_instance *instance, ...@@ -822,7 +822,7 @@ vchiq_open_service(struct vchiq_instance *instance,
if (service) { if (service) {
*phandle = service->handle; *phandle = service->handle;
status = vchiq_open_service_internal(service, current->pid); status = vchiq_open_service_internal(service, current->pid);
if (status != VCHIQ_SUCCESS) { if (status) {
vchiq_remove_service(instance, service->handle); vchiq_remove_service(instance, service->handle);
*phandle = VCHIQ_SERVICE_HANDLE_INVALID; *phandle = VCHIQ_SERVICE_HANDLE_INVALID;
} }
...@@ -1004,7 +1004,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1004,7 +1004,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
return VCHIQ_RETRY; return VCHIQ_RETRY;
} else if (instance->closing) { } 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; return 0;
} }
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
} }
...@@ -1041,7 +1041,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1041,7 +1041,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
complete(&instance->insert_event); complete(&instance->insert_event);
return VCHIQ_SUCCESS; return 0;
} }
int int
...@@ -1066,14 +1066,14 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1066,14 +1066,14 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
service = handle_to_service(instance, handle); service = handle_to_service(instance, handle);
if (WARN_ON(!service)) { if (WARN_ON(!service)) {
rcu_read_unlock(); rcu_read_unlock();
return VCHIQ_SUCCESS; return 0;
} }
user_service = (struct user_service *)service->base.userdata; user_service = (struct user_service *)service->base.userdata;
if (!instance || instance->closing) { if (!instance || instance->closing) {
rcu_read_unlock(); rcu_read_unlock();
return VCHIQ_SUCCESS; return 0;
} }
/* /*
...@@ -1110,7 +1110,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1110,7 +1110,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
status = add_completion(instance, reason, NULL, user_service, status = add_completion(instance, reason, NULL, user_service,
bulk_userdata); bulk_userdata);
if (status != VCHIQ_SUCCESS) { if (status) {
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service); vchiq_service_put(service);
return status; return status;
...@@ -1158,7 +1158,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1158,7 +1158,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
vchiq_service_put(service); vchiq_service_put(service);
if (skip_completion) if (skip_completion)
return VCHIQ_SUCCESS; return 0;
return add_completion(instance, reason, header, user_service, return add_completion(instance, reason, header, user_service,
bulk_userdata); bulk_userdata);
...@@ -1350,14 +1350,14 @@ vchiq_keepalive_thread_func(void *v) ...@@ -1350,14 +1350,14 @@ vchiq_keepalive_thread_func(void *v)
} }
status = vchiq_connect(instance); status = vchiq_connect(instance);
if (status != VCHIQ_SUCCESS) { if (status) {
vchiq_log_error(vchiq_susp_log_level, "%s vchiq_connect failed %d", __func__, vchiq_log_error(vchiq_susp_log_level, "%s vchiq_connect failed %d", __func__,
status); status);
goto shutdown; goto shutdown;
} }
status = vchiq_add_service(instance, &params, &ka_handle); status = vchiq_add_service(instance, &params, &ka_handle);
if (status != VCHIQ_SUCCESS) { if (status) {
vchiq_log_error(vchiq_susp_log_level, "%s vchiq_open_service failed %d", __func__, vchiq_log_error(vchiq_susp_log_level, "%s vchiq_open_service failed %d", __func__,
status); status);
goto shutdown; goto shutdown;
...@@ -1386,14 +1386,14 @@ vchiq_keepalive_thread_func(void *v) ...@@ -1386,14 +1386,14 @@ vchiq_keepalive_thread_func(void *v)
while (uc--) { while (uc--) {
atomic_inc(&arm_state->ka_use_ack_count); atomic_inc(&arm_state->ka_use_ack_count);
status = vchiq_use_service(instance, ka_handle); status = vchiq_use_service(instance, ka_handle);
if (status != VCHIQ_SUCCESS) { if (status) {
vchiq_log_error(vchiq_susp_log_level, 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--) { while (rc--) {
status = vchiq_release_service(instance, ka_handle); status = vchiq_release_service(instance, ka_handle);
if (status != VCHIQ_SUCCESS) { if (status) {
vchiq_log_error(vchiq_susp_log_level, vchiq_log_error(vchiq_susp_log_level,
"%s vchiq_release_service error %d", __func__, "%s vchiq_release_service error %d", __func__,
status); status);
...@@ -1446,13 +1446,13 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, ...@@ -1446,13 +1446,13 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
if (!ret) { if (!ret) {
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
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) {
/* 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);
if (status == VCHIQ_SUCCESS) if (!status)
ack_cnt--; ack_cnt--;
else else
atomic_add(ack_cnt, &arm_state->ka_use_ack_count); atomic_add(ack_cnt, &arm_state->ka_use_ack_count);
...@@ -1708,7 +1708,7 @@ vchiq_check_service(struct vchiq_service *service) ...@@ -1708,7 +1708,7 @@ vchiq_check_service(struct vchiq_service *service)
read_lock_bh(&arm_state->susp_res_lock); read_lock_bh(&arm_state->susp_res_lock);
if (service->service_use_count) if (service->service_use_count)
ret = VCHIQ_SUCCESS; ret = 0;
read_unlock_bh(&arm_state->susp_res_lock); read_unlock_bh(&arm_state->susp_res_lock);
if (ret == VCHIQ_ERROR) { if (ret == VCHIQ_ERROR) {
......
...@@ -478,7 +478,7 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason, ...@@ -478,7 +478,7 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
vchiq_log_warning(vchiq_core_log_level, vchiq_log_warning(vchiq_core_log_level,
"%d: ignoring ERROR from callback to service %x", "%d: ignoring ERROR from callback to service %x",
service->state->id, service->handle); service->state->id, service->handle);
status = VCHIQ_SUCCESS; status = 0;
} }
if (reason != VCHIQ_MESSAGE_AVAILABLE) if (reason != VCHIQ_MESSAGE_AVAILABLE)
...@@ -1145,7 +1145,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, ...@@ -1145,7 +1145,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
remote_event_signal(&state->remote->trigger); remote_event_signal(&state->remote->trigger);
return VCHIQ_SUCCESS; return 0;
} }
/* Called by the slot handler and application threads */ /* Called by the slot handler and application threads */
...@@ -1233,7 +1233,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, ...@@ -1233,7 +1233,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE) if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE)
mutex_unlock(&state->sync_mutex); mutex_unlock(&state->sync_mutex);
return VCHIQ_SUCCESS; return 0;
} }
static inline void static inline void
...@@ -1313,7 +1313,7 @@ static int ...@@ -1313,7 +1313,7 @@ static int
notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue, notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
int retry_poll) int retry_poll)
{ {
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
vchiq_log_trace(vchiq_core_log_level, "%d: nb:%d %cx - p=%x rn=%x r=%x", service->state->id, vchiq_log_trace(vchiq_core_log_level, "%d: nb:%d %cx - p=%x rn=%x r=%x", service->state->id,
service->localport, (queue == &service->bulk_tx) ? 't' : 'r', service->localport, (queue == &service->bulk_tx) ? 't' : 'r',
...@@ -1367,7 +1367,7 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue, ...@@ -1367,7 +1367,7 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
complete(&service->bulk_remove_event); complete(&service->bulk_remove_event);
} }
if (!retry_poll) if (!retry_poll)
status = VCHIQ_SUCCESS; status = 0;
if (status == VCHIQ_RETRY) if (status == VCHIQ_RETRY)
request_poll(service->state, service, (queue == &service->bulk_tx) ? request_poll(service->state, service, (queue == &service->bulk_tx) ?
...@@ -1408,13 +1408,12 @@ poll_services_of_group(struct vchiq_state *state, int group) ...@@ -1408,13 +1408,12 @@ poll_services_of_group(struct vchiq_state *state, int group)
*/ */
service->public_fourcc = VCHIQ_FOURCC_INVALID; service->public_fourcc = VCHIQ_FOURCC_INVALID;
if (vchiq_close_service_internal(service, NO_CLOSE_RECVD) != if (vchiq_close_service_internal(service, NO_CLOSE_RECVD))
VCHIQ_SUCCESS)
request_poll(state, service, VCHIQ_POLL_REMOVE); request_poll(state, service, VCHIQ_POLL_REMOVE);
} else if (service_flags & BIT(VCHIQ_POLL_TERMINATE)) { } else if (service_flags & BIT(VCHIQ_POLL_TERMINATE)) {
vchiq_log_info(vchiq_core_log_level, "%d: ps - terminate %d<->%d", vchiq_log_info(vchiq_core_log_level, "%d: ps - terminate %d<->%d",
state->id, service->localport, service->remoteport); state->id, service->localport, service->remoteport);
if (vchiq_close_service_internal(service, NO_CLOSE_RECVD) != VCHIQ_SUCCESS) if (vchiq_close_service_internal(service, NO_CLOSE_RECVD))
request_poll(state, service, VCHIQ_POLL_TERMINATE); request_poll(state, service, VCHIQ_POLL_TERMINATE);
} }
if (service_flags & BIT(VCHIQ_POLL_TXNOTIFY)) if (service_flags & BIT(VCHIQ_POLL_TXNOTIFY))
...@@ -2505,7 +2504,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id) ...@@ -2505,7 +2504,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
service->version, service->version,
service->version_min service->version_min
}; };
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
service->client_id = client_id; service->client_id = client_id;
vchiq_use_service_internal(service); vchiq_use_service_internal(service);
...@@ -2516,7 +2515,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id) ...@@ -2516,7 +2515,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
sizeof(payload), sizeof(payload),
QMFLAGS_IS_BLOCKING); QMFLAGS_IS_BLOCKING);
if (status != VCHIQ_SUCCESS) if (status)
return status; return status;
/* Wait for the ACK/NAK */ /* Wait for the ACK/NAK */
...@@ -2612,11 +2611,11 @@ do_abort_bulks(struct vchiq_service *service) ...@@ -2612,11 +2611,11 @@ do_abort_bulks(struct vchiq_service *service)
mutex_unlock(&service->bulk_mutex); mutex_unlock(&service->bulk_mutex);
status = notify_bulks(service, &service->bulk_tx, NO_RETRY_POLL); status = notify_bulks(service, &service->bulk_tx, NO_RETRY_POLL);
if (status != VCHIQ_SUCCESS) if (status)
return 0; return 0;
status = notify_bulks(service, &service->bulk_rx, NO_RETRY_POLL); status = notify_bulks(service, &service->bulk_rx, NO_RETRY_POLL);
return (status == VCHIQ_SUCCESS); return !status;
} }
static int static int
...@@ -2688,7 +2687,7 @@ int ...@@ -2688,7 +2687,7 @@ int
vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
{ {
struct vchiq_state *state = service->state; struct vchiq_state *state = service->state;
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID); int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID);
int close_id = MAKE_CLOSE(service->localport, int close_id = MAKE_CLOSE(service->localport,
VCHIQ_MSG_DSTPORT(service->remoteport)); VCHIQ_MSG_DSTPORT(service->remoteport));
...@@ -2740,11 +2739,11 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) ...@@ -2740,11 +2739,11 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
release_service_messages(service); release_service_messages(service);
if (status == VCHIQ_SUCCESS) if (!status)
status = queue_message(state, service, close_id, NULL, status = queue_message(state, service, close_id, NULL,
NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK); NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK);
if (status != VCHIQ_SUCCESS) { if (status) {
if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC) if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)
mutex_unlock(&state->sync_mutex); mutex_unlock(&state->sync_mutex);
break; break;
...@@ -2778,7 +2777,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd) ...@@ -2778,7 +2777,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
break; break;
} }
if (status == VCHIQ_SUCCESS) if (!status)
status = close_service_complete(service, VCHIQ_SRVSTATE_CLOSERECVD); status = close_service_complete(service, VCHIQ_SRVSTATE_CLOSERECVD);
break; break;
...@@ -2872,7 +2871,7 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc ...@@ -2872,7 +2871,7 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
complete(&state->connect); complete(&state->connect);
} }
return VCHIQ_SUCCESS; return 0;
} }
void void
...@@ -2894,7 +2893,7 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle) ...@@ -2894,7 +2893,7 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle)
{ {
/* Unregister the service */ /* Unregister the service */
struct vchiq_service *service = find_service_by_handle(instance, handle); struct vchiq_service *service = find_service_by_handle(instance, handle);
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
if (!service) if (!service)
return VCHIQ_ERROR; return VCHIQ_ERROR;
...@@ -2936,7 +2935,7 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle) ...@@ -2936,7 +2935,7 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle)
srvstate_names[service->srvstate]); srvstate_names[service->srvstate]);
} }
if ((status == VCHIQ_SUCCESS) && if (!status &&
(service->srvstate != VCHIQ_SRVSTATE_FREE) && (service->srvstate != VCHIQ_SRVSTATE_FREE) &&
(service->srvstate != VCHIQ_SRVSTATE_LISTENING)) (service->srvstate != VCHIQ_SRVSTATE_LISTENING))
status = VCHIQ_ERROR; status = VCHIQ_ERROR;
...@@ -2952,7 +2951,7 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle) ...@@ -2952,7 +2951,7 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle)
{ {
/* Unregister the service */ /* Unregister the service */
struct vchiq_service *service = find_service_by_handle(instance, handle); struct vchiq_service *service = find_service_by_handle(instance, handle);
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
if (!service) if (!service)
return VCHIQ_ERROR; return VCHIQ_ERROR;
...@@ -2997,8 +2996,7 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle) ...@@ -2997,8 +2996,7 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle)
srvstate_names[service->srvstate]); srvstate_names[service->srvstate]);
} }
if ((status == VCHIQ_SUCCESS) && if (!status && (service->srvstate != VCHIQ_SRVSTATE_FREE))
(service->srvstate != VCHIQ_SRVSTATE_FREE))
status = VCHIQ_ERROR; status = VCHIQ_ERROR;
vchiq_service_put(service); vchiq_service_put(service);
...@@ -3038,7 +3036,7 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, ...@@ -3038,7 +3036,7 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle,
if (!offset && !uoffset) if (!offset && !uoffset)
goto error_exit; goto error_exit;
if (vchiq_check_service(service) != VCHIQ_SUCCESS) if (vchiq_check_service(service))
goto error_exit; goto error_exit;
switch (mode) { switch (mode) {
...@@ -3131,7 +3129,7 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, ...@@ -3131,7 +3129,7 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle,
QMFLAGS_IS_BLOCKING | QMFLAGS_IS_BLOCKING |
QMFLAGS_NO_MUTEX_LOCK | QMFLAGS_NO_MUTEX_LOCK |
QMFLAGS_NO_MUTEX_UNLOCK); QMFLAGS_NO_MUTEX_UNLOCK);
if (status != VCHIQ_SUCCESS) if (status)
goto unlock_both_error_exit; goto unlock_both_error_exit;
queue->local_insert++; queue->local_insert++;
...@@ -3146,7 +3144,7 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, ...@@ -3146,7 +3144,7 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle,
waiting: waiting:
vchiq_service_put(service); vchiq_service_put(service);
status = VCHIQ_SUCCESS; status = 0;
if (bulk_waiter) { if (bulk_waiter) {
bulk_waiter->bulk = bulk; bulk_waiter->bulk = bulk;
...@@ -3185,7 +3183,7 @@ vchiq_queue_message(struct vchiq_instance *instance, unsigned int handle, ...@@ -3185,7 +3183,7 @@ vchiq_queue_message(struct vchiq_instance *instance, unsigned int handle,
if (!service) if (!service)
goto error_exit; goto error_exit;
if (vchiq_check_service(service) != VCHIQ_SUCCESS) if (vchiq_check_service(service))
goto error_exit; goto error_exit;
if (!size) { if (!size) {
...@@ -3296,14 +3294,14 @@ vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handle, sho ...@@ -3296,14 +3294,14 @@ vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handle, sho
if (!service) if (!service)
goto exit; goto exit;
if (vchiq_check_service(service) != VCHIQ_SUCCESS) if (vchiq_check_service(service))
goto exit; goto exit;
if (!peer_version) if (!peer_version)
goto exit; goto exit;
*peer_version = service->peer_version; *peer_version = service->peer_version;
status = VCHIQ_SUCCESS; status = 0;
exit: exit:
if (service) if (service)
......
...@@ -112,7 +112,7 @@ vchiq_ioc_queue_message(struct vchiq_instance *instance, unsigned int handle, ...@@ -112,7 +112,7 @@ vchiq_ioc_queue_message(struct vchiq_instance *instance, unsigned int handle,
struct vchiq_element *elements, unsigned long count) struct vchiq_element *elements, unsigned long count)
{ {
struct vchiq_io_copy_callback_context context; struct vchiq_io_copy_callback_context context;
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
unsigned long i; unsigned long i;
size_t total_size = 0; size_t total_size = 0;
...@@ -142,7 +142,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance, ...@@ -142,7 +142,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
{ {
struct user_service *user_service = NULL; struct user_service *user_service = NULL;
struct vchiq_service *service; struct vchiq_service *service;
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
struct vchiq_service_params_kernel params; struct vchiq_service_params_kernel params;
int srvstate; int srvstate;
...@@ -190,7 +190,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance, ...@@ -190,7 +190,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
if (args->is_open) { if (args->is_open) {
status = vchiq_open_service_internal(service, instance->pid); status = vchiq_open_service_internal(service, instance->pid);
if (status != VCHIQ_SUCCESS) { if (status) {
vchiq_remove_service(instance, service->handle); vchiq_remove_service(instance, service->handle);
return (status == VCHIQ_RETRY) ? return (status == VCHIQ_RETRY) ?
-EINTR : -EIO; -EINTR : -EIO;
...@@ -577,7 +577,7 @@ static long ...@@ -577,7 +577,7 @@ static long
vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct vchiq_instance *instance = file->private_data; struct vchiq_instance *instance = file->private_data;
enum vchiq_status status = VCHIQ_SUCCESS; int status = 0;
struct vchiq_service *service = NULL; struct vchiq_service *service = NULL;
long ret = 0; long ret = 0;
int i, rc; int i, rc;
...@@ -598,12 +598,12 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -598,12 +598,12 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
instance, &i))) { instance, &i))) {
status = vchiq_remove_service(instance, service->handle); status = vchiq_remove_service(instance, service->handle);
vchiq_service_put(service); vchiq_service_put(service);
if (status != VCHIQ_SUCCESS) if (status)
break; break;
} }
service = NULL; service = NULL;
if (status == VCHIQ_SUCCESS) { if (!status) {
/* Wake the completion thread and ask it to exit */ /* Wake the completion thread and ask it to exit */
instance->closing = 1; instance->closing = 1;
complete(&instance->insert_event); complete(&instance->insert_event);
...@@ -627,7 +627,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -627,7 +627,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
status = vchiq_connect_internal(instance->state, instance); status = vchiq_connect_internal(instance->state, instance);
mutex_unlock(&instance->state->mutex); mutex_unlock(&instance->state->mutex);
if (status == VCHIQ_SUCCESS) if (!status)
instance->connected = 1; instance->connected = 1;
else else
vchiq_log_error(vchiq_arm_log_level, vchiq_log_error(vchiq_arm_log_level,
...@@ -675,7 +675,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -675,7 +675,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
status = (cmd == VCHIQ_IOC_CLOSE_SERVICE) ? status = (cmd == VCHIQ_IOC_CLOSE_SERVICE) ?
vchiq_close_service(instance, service->handle) : vchiq_close_service(instance, service->handle) :
vchiq_remove_service(instance, service->handle); vchiq_remove_service(instance, service->handle);
if (status != VCHIQ_SUCCESS) if (status)
break; break;
} }
...@@ -868,7 +868,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -868,7 +868,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ret = -EINTR; ret = -EINTR;
} }
if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK)) if (!status && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK))
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
" ioctl instance %pK, cmd %s -> status %d, %ld", " ioctl instance %pK, cmd %s -> status %d, %ld",
instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ?
......
...@@ -559,7 +559,7 @@ static int service_callback(struct vchiq_instance *vchiq_instance, ...@@ -559,7 +559,7 @@ static int service_callback(struct vchiq_instance *vchiq_instance,
if (!instance) { if (!instance) {
pr_err("Message callback passed NULL instance\n"); pr_err("Message callback passed NULL instance\n");
return VCHIQ_SUCCESS; return 0;
} }
switch (reason) { switch (reason) {
...@@ -643,7 +643,7 @@ static int service_callback(struct vchiq_instance *vchiq_instance, ...@@ -643,7 +643,7 @@ static int service_callback(struct vchiq_instance *vchiq_instance,
break; break;
} }
return VCHIQ_SUCCESS; return 0;
} }
static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
......
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