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