Commit 82a9eb4a authored by Umang Jain's avatar Umang Jain Committed by Greg Kroah-Hartman

staging: vc04_services: Drop VCHIQ_RETRY usage

Drop the usage of VCHIQ_RETRY vchiq_status enum type in most of the
places and replace it with -EAGAIN. The exception to this replacement
is vchiq_send_remote_use() and vchiq_send_remote_use_active() which will
be addressed in the subsequent commit.

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-5-umang.jain@ideasonboard.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ab73dc85
......@@ -728,7 +728,7 @@ int vchiq_shutdown(struct vchiq_instance *instance)
struct vchiq_state *state = instance->state;
if (mutex_lock_killable(&state->mutex))
return VCHIQ_RETRY;
return -EAGAIN;
/* Remove all services */
vchiq_shutdown_internal(state, instance);
......@@ -756,7 +756,7 @@ int vchiq_connect(struct vchiq_instance *instance)
if (mutex_lock_killable(&state->mutex)) {
vchiq_log_trace(vchiq_core_log_level, "%s: call to mutex_lock failed", __func__);
status = VCHIQ_RETRY;
status = -EAGAIN;
goto failed;
}
status = vchiq_connect_internal(state, instance);
......@@ -859,11 +859,11 @@ vchiq_bulk_transmit(struct vchiq_instance *instance, unsigned int handle, const
}
/*
* vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
* vchiq_*_bulk_transfer() may return -EAGAIN, so we need
* to implement a retry mechanism since this function is
* supposed to block until queued
*/
if (status != VCHIQ_RETRY)
if (status != -EAGAIN)
break;
msleep(1);
......@@ -896,11 +896,11 @@ int vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int handle,
}
/*
* vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
* vchiq_*_bulk_transfer() may return -EAGAIN, so we need
* to implement a retry mechanism since this function is
* supposed to block until queued
*/
if (status != VCHIQ_RETRY)
if (status != -EAGAIN)
break;
msleep(1);
......@@ -961,7 +961,7 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
status = vchiq_bulk_transfer(instance, 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 != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
if (bulk) {
......@@ -1001,7 +1001,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
if (wait_for_completion_interruptible(&instance->remove_event)) {
vchiq_log_info(vchiq_arm_log_level, "service_callback interrupted");
return VCHIQ_RETRY;
return -EAGAIN;
} else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "service_callback closing");
return 0;
......@@ -1122,7 +1122,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
return VCHIQ_RETRY;
return -EAGAIN;
} else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
......
......@@ -132,7 +132,7 @@ vchiq_ioc_queue_message(struct vchiq_instance *instance, unsigned int handle,
if (status == -EINVAL)
return -EIO;
else if (status == VCHIQ_RETRY)
else if (status == -EAGAIN)
return -EINTR;
return 0;
}
......@@ -192,7 +192,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
status = vchiq_open_service_internal(service, instance->pid);
if (status) {
vchiq_remove_service(instance, service->handle);
return (status == VCHIQ_RETRY) ?
return (status == -EAGAIN) ?
-EINTR : -EIO;
}
}
......@@ -338,7 +338,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
goto out;
}
if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) ||
if ((status != -EAGAIN) || fatal_signal_pending(current) ||
!waiter->bulk_waiter.bulk) {
if (waiter->bulk_waiter.bulk) {
/* Cancel the signal when the transfer completes. */
......@@ -366,7 +366,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
return ret;
else if (status == -EINVAL)
return -EIO;
else if (status == VCHIQ_RETRY)
else if (status == -EAGAIN)
return -EINTR;
return 0;
}
......@@ -686,7 +686,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
*/
if (user_service->close_pending &&
wait_for_completion_interruptible(&user_service->close_event))
status = VCHIQ_RETRY;
status = -EAGAIN;
break;
}
......@@ -864,7 +864,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (ret == 0) {
if (status == -EINVAL)
ret = -EIO;
else if (status == VCHIQ_RETRY)
else if (status == -EAGAIN)
ret = -EINTR;
}
......
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