Commit a772f116 authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Greg Kroah-Hartman

staging: vchiq: switch to wait_for_completion_killable

This fixes f27e47bc ("staging: vchiq: use completions instead of
semaphores") as it neglected the subtle down_interruptible() macro
override in vchiq_killable.h. Hence all completions should be killable
instead of interruptible.

Fixes: f27e47bc ("staging: vchiq: use completions instead of semaphores")
Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 649496b6
...@@ -561,8 +561,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, ...@@ -561,8 +561,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
vchiq_log_trace(vchiq_arm_log_level, vchiq_log_trace(vchiq_arm_log_level,
"%s - completion queue full", __func__); "%s - completion queue full", __func__);
DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
if (wait_for_completion_interruptible( if (wait_for_completion_killable( &instance->remove_event)) {
&instance->remove_event)) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
"service_callback interrupted"); "service_callback interrupted");
return VCHIQ_RETRY; return VCHIQ_RETRY;
...@@ -673,7 +672,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, ...@@ -673,7 +672,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header,
} }
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
if (wait_for_completion_interruptible( if (wait_for_completion_killable(
&user_service->remove_event) &user_service->remove_event)
!= 0) { != 0) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
...@@ -1008,7 +1007,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1008,7 +1007,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
has been closed until the client library calls the has been closed until the client library calls the
CLOSE_DELIVERED ioctl, signalling close_event. */ CLOSE_DELIVERED ioctl, signalling close_event. */
if (user_service->close_pending && if (user_service->close_pending &&
wait_for_completion_interruptible( wait_for_completion_killable(
&user_service->close_event)) &user_service->close_event))
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
break; break;
...@@ -1184,7 +1183,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1184,7 +1183,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
DEBUG_TRACE(AWAIT_COMPLETION_LINE); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
mutex_unlock(&instance->completion_mutex); mutex_unlock(&instance->completion_mutex);
rc = wait_for_completion_interruptible( rc = wait_for_completion_killable(
&instance->insert_event); &instance->insert_event);
mutex_lock(&instance->completion_mutex); mutex_lock(&instance->completion_mutex);
if (rc != 0) { if (rc != 0) {
...@@ -1353,7 +1352,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1353,7 +1352,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
do { do {
spin_unlock(&msg_queue_spinlock); spin_unlock(&msg_queue_spinlock);
DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
if (wait_for_completion_interruptible( if (wait_for_completion_killable(
&user_service->insert_event)) { &user_service->insert_event)) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
"DEQUEUE_MESSAGE interrupted"); "DEQUEUE_MESSAGE interrupted");
...@@ -2358,7 +2357,7 @@ vchiq_keepalive_thread_func(void *v) ...@@ -2358,7 +2357,7 @@ vchiq_keepalive_thread_func(void *v)
while (1) { while (1) {
long rc = 0, uc = 0; long rc = 0, uc = 0;
if (wait_for_completion_interruptible(&arm_state->ka_evt) if (wait_for_completion_killable(&arm_state->ka_evt)
!= 0) { != 0) {
vchiq_log_error(vchiq_susp_log_level, vchiq_log_error(vchiq_susp_log_level,
"%s interrupted", __func__); "%s interrupted", __func__);
...@@ -2608,7 +2607,7 @@ block_resume(VCHIQ_ARM_STATE_T *arm_state) ...@@ -2608,7 +2607,7 @@ block_resume(VCHIQ_ARM_STATE_T *arm_state)
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
vchiq_log_info(vchiq_susp_log_level, "%s wait for previously " vchiq_log_info(vchiq_susp_log_level, "%s wait for previously "
"blocked clients", __func__); "blocked clients", __func__);
if (wait_for_completion_interruptible_timeout( if (wait_for_completion_killable_timeout(
&arm_state->blocked_blocker, timeout_val) &arm_state->blocked_blocker, timeout_val)
<= 0) { <= 0) {
vchiq_log_error(vchiq_susp_log_level, "%s wait for " vchiq_log_error(vchiq_susp_log_level, "%s wait for "
...@@ -2634,7 +2633,7 @@ block_resume(VCHIQ_ARM_STATE_T *arm_state) ...@@ -2634,7 +2633,7 @@ block_resume(VCHIQ_ARM_STATE_T *arm_state)
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
vchiq_log_info(vchiq_susp_log_level, "%s wait for resume", vchiq_log_info(vchiq_susp_log_level, "%s wait for resume",
__func__); __func__);
if (wait_for_completion_interruptible_timeout( if (wait_for_completion_killable_timeout(
&arm_state->vc_resume_complete, timeout_val) &arm_state->vc_resume_complete, timeout_val)
<= 0) { <= 0) {
vchiq_log_error(vchiq_susp_log_level, "%s wait for " vchiq_log_error(vchiq_susp_log_level, "%s wait for "
...@@ -2841,7 +2840,7 @@ vchiq_arm_force_suspend(VCHIQ_STATE_T *state) ...@@ -2841,7 +2840,7 @@ vchiq_arm_force_suspend(VCHIQ_STATE_T *state)
do { do {
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
rc = wait_for_completion_interruptible_timeout( rc = wait_for_completion_killable_timeout(
&arm_state->vc_suspend_complete, &arm_state->vc_suspend_complete,
msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS)); msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS));
...@@ -2937,7 +2936,7 @@ vchiq_arm_allow_resume(VCHIQ_STATE_T *state) ...@@ -2937,7 +2936,7 @@ vchiq_arm_allow_resume(VCHIQ_STATE_T *state)
write_unlock_bh(&arm_state->susp_res_lock); write_unlock_bh(&arm_state->susp_res_lock);
if (resume) { if (resume) {
if (wait_for_completion_interruptible( if (wait_for_completion_killable(
&arm_state->vc_resume_complete) < 0) { &arm_state->vc_resume_complete) < 0) {
vchiq_log_error(vchiq_susp_log_level, vchiq_log_error(vchiq_susp_log_level,
"%s interrupted", __func__); "%s interrupted", __func__);
......
...@@ -589,7 +589,7 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) ...@@ -589,7 +589,7 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking)
remote_event_signal(&state->remote->trigger); remote_event_signal(&state->remote->trigger);
if (!is_blocking || if (!is_blocking ||
(wait_for_completion_interruptible( (wait_for_completion_killable(
&state->slot_available_event))) &state->slot_available_event)))
return NULL; /* No space available */ return NULL; /* No space available */
} }
...@@ -859,7 +859,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ...@@ -859,7 +859,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
spin_unlock(&quota_spinlock); spin_unlock(&quota_spinlock);
mutex_unlock(&state->slot_mutex); mutex_unlock(&state->slot_mutex);
if (wait_for_completion_interruptible( if (wait_for_completion_killable(
&state->data_quota_event)) &state->data_quota_event))
return VCHIQ_RETRY; return VCHIQ_RETRY;
...@@ -890,7 +890,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, ...@@ -890,7 +890,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
service_quota->slot_use_count); service_quota->slot_use_count);
VCHIQ_SERVICE_STATS_INC(service, quota_stalls); VCHIQ_SERVICE_STATS_INC(service, quota_stalls);
mutex_unlock(&state->slot_mutex); mutex_unlock(&state->slot_mutex);
if (wait_for_completion_interruptible( if (wait_for_completion_killable(
&service_quota->quota_event)) &service_quota->quota_event))
return VCHIQ_RETRY; return VCHIQ_RETRY;
if (service->closing) if (service->closing)
...@@ -1739,8 +1739,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) ...@@ -1739,8 +1739,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
&service->bulk_rx : &service->bulk_tx; &service->bulk_rx : &service->bulk_tx;
DEBUG_TRACE(PARSE_LINE); DEBUG_TRACE(PARSE_LINE);
if (mutex_lock_killable( if (mutex_lock_killable(&service->bulk_mutex)) {
&service->bulk_mutex) != 0) {
DEBUG_TRACE(PARSE_LINE); DEBUG_TRACE(PARSE_LINE);
goto bail_not_ready; goto bail_not_ready;
} }
...@@ -2453,7 +2452,7 @@ vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id) ...@@ -2453,7 +2452,7 @@ vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id)
QMFLAGS_IS_BLOCKING); QMFLAGS_IS_BLOCKING);
if (status == VCHIQ_SUCCESS) { if (status == VCHIQ_SUCCESS) {
/* Wait for the ACK/NAK */ /* Wait for the ACK/NAK */
if (wait_for_completion_interruptible(&service->remove_event)) { if (wait_for_completion_killable(&service->remove_event)) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
vchiq_release_service_internal(service); vchiq_release_service_internal(service);
} else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) && } else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) &&
...@@ -2820,7 +2819,7 @@ vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance) ...@@ -2820,7 +2819,7 @@ vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INSTANCE_T instance)
} }
if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) { if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) {
if (wait_for_completion_interruptible(&state->connect)) if (wait_for_completion_killable(&state->connect))
return VCHIQ_RETRY; return VCHIQ_RETRY;
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
...@@ -2919,7 +2918,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle) ...@@ -2919,7 +2918,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle)
} }
while (1) { while (1) {
if (wait_for_completion_interruptible(&service->remove_event)) { if (wait_for_completion_killable(&service->remove_event)) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
break; break;
} }
...@@ -2980,7 +2979,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle) ...@@ -2980,7 +2979,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle)
request_poll(service->state, service, VCHIQ_POLL_REMOVE); request_poll(service->state, service, VCHIQ_POLL_REMOVE);
} }
while (1) { while (1) {
if (wait_for_completion_interruptible(&service->remove_event)) { if (wait_for_completion_killable(&service->remove_event)) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
break; break;
} }
...@@ -3063,7 +3062,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ...@@ -3063,7 +3062,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); VCHIQ_SERVICE_STATS_INC(service, bulk_stalls);
do { do {
mutex_unlock(&service->bulk_mutex); mutex_unlock(&service->bulk_mutex);
if (wait_for_completion_interruptible( if (wait_for_completion_killable(
&service->bulk_remove_event)) { &service->bulk_remove_event)) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
goto error_exit; goto error_exit;
...@@ -3140,7 +3139,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ...@@ -3140,7 +3139,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
if (bulk_waiter) { if (bulk_waiter) {
bulk_waiter->bulk = bulk; bulk_waiter->bulk = bulk;
if (wait_for_completion_interruptible(&bulk_waiter->event)) if (wait_for_completion_killable(&bulk_waiter->event))
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
status = VCHIQ_ERROR; status = VCHIQ_ERROR;
......
...@@ -80,7 +80,7 @@ void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header) ...@@ -80,7 +80,7 @@ void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header)
return; return;
while (queue->write == queue->read + queue->size) { while (queue->write == queue->read + queue->size) {
if (wait_for_completion_interruptible(&queue->pop)) if (wait_for_completion_killable(&queue->pop))
flush_signals(current); flush_signals(current);
} }
...@@ -93,7 +93,7 @@ void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header) ...@@ -93,7 +93,7 @@ void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header)
VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue) VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue)
{ {
while (queue->write == queue->read) { while (queue->write == queue->read) {
if (wait_for_completion_interruptible(&queue->push)) if (wait_for_completion_killable(&queue->push))
flush_signals(current); flush_signals(current);
} }
...@@ -107,7 +107,7 @@ VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue) ...@@ -107,7 +107,7 @@ VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue)
VCHIQ_HEADER_T *header; VCHIQ_HEADER_T *header;
while (queue->write == queue->read) { while (queue->write == queue->read) {
if (wait_for_completion_interruptible(&queue->push)) if (wait_for_completion_killable(&queue->push))
flush_signals(current); flush_signals(current);
} }
......
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