summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vc04_services/interface
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-11 15:36:02 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-11 15:36:02 -0700
commite786741ff1b52769b044b7f4407f39cd13ee5d2d (patch)
treee70502d7d4444fd77b66ebe14b1b3501ca8aad35 /drivers/staging/vc04_services/interface
parent97ff4ca46d3279134cec49752de8c5a62dc68460 (diff)
parent5d1532482943403eb11911898565628fa45863d7 (diff)
downloadlinux-e786741ff1b52769b044b7f4407f39cd13ee5d2d.tar.gz
linux-e786741ff1b52769b044b7f4407f39cd13ee5d2d.tar.bz2
linux-e786741ff1b52769b044b7f4407f39cd13ee5d2d.zip
Merge tag 'staging-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO driver updates from Greg KH: "Here is the big Staging and IIO driver update for 5.3-rc1. Lots of new IIO drivers are in here, along with loads of tiny staging driver cleanups and fixes. Overall we almost break even with the same lines added as removed. Full details are in the shortlog, they are too large to list here. All of these changes have been in linux-next for a while with no reported issues" * tag 'staging-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (608 commits) staging: kpc2000: simplify comparison to NULL in fileops.c staging: kpc2000: simplify comparison to NULL in dma.c staging: kpc2000: simplify comparison to NULL in kpc2000_spi.c staging: rtl8723bs: hal: remove redundant assignment to packetType staging: rtl8723bs: Change return type of hal_btcoex_IsBtDisabled() staging: rtl8723bs: Remove rtw_btcoex_DisplayBtCoexInfo() staging: rtl8723bs: Remove function rtw_btcoex_GetDBG() staging: rtl8723bs: Remove function rtw_btcoex_SetDBG() staging: rtl8723bs: Remove rtw_btcoex_IsBTCoexCtrlAMPDUSize() staging: rtl8723bs: Remove rtw_btcoex_BtInfoNotify() staging: rtl8723bs: Remove rtw_btcoex_ScanNotify() staging: rtl8723bs: Remove rtw_btcoex_SetSingleAntPath() staging: rtl8723bs: Remove rtw_btcoex_SetPGAntNum() staging: rtl8192e: remove redundant initialization of rtstatus staging: rtl8723bs: Remove rtw_btcoex_GetRaMask() staging: rtl8723bs: Remove rtw_btcoex_SetChipType() staging: rtl8723bs: Remove rtw_btcoex_ConnectNotify() staging: rtl8723bs: Remove rtw_btcoex_SetBTCoexist() staging: rtl8723bs: Remove rtw_btcoex_IsBtDisabled() staging: rtl8723bs: Remove rtw_btcoex_IsBtControlLps() ...
Diffstat (limited to 'drivers/staging/vc04_services/interface')
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c2
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c356
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h6
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c4
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c106
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h9
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c4
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h2
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c4
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c11
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h1
11 files changed, 75 insertions, 430 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index c557c9953724..61c69f353cdb 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -523,7 +523,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
(g_cache_line_size - 1)))) {
char *fragments;
- if (down_killable(&g_free_fragments_sema)) {
+ if (down_interruptible(&g_free_fragments_sema)) {
cleanup_pagelistinfo(pagelistinfo);
return NULL;
}
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index ab7d6a0ce94c..cc4383d1ec3e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -238,7 +238,7 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance)
vchiq_log_trace(vchiq_core_log_level,
"%s(%p) called", __func__, instance);
- if (mutex_lock_killable(&state->mutex) != 0)
+ if (mutex_lock_killable(&state->mutex))
return VCHIQ_RETRY;
/* Remove all services */
@@ -280,7 +280,7 @@ VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance)
vchiq_log_trace(vchiq_core_log_level,
"%s(%p) called", __func__, instance);
- if (mutex_lock_killable(&state->mutex) != 0) {
+ if (mutex_lock_killable(&state->mutex)) {
vchiq_log_trace(vchiq_core_log_level,
"%s: call to mutex_lock failed", __func__);
status = VCHIQ_RETRY;
@@ -532,7 +532,8 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
vchiq_log_trace(vchiq_arm_log_level,
"%s - completion queue full", __func__);
DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
- if (wait_for_completion_killable(&instance->remove_event)) {
+ if (wait_for_completion_interruptible(
+ &instance->remove_event)) {
vchiq_log_info(vchiq_arm_log_level,
"service_callback interrupted");
return VCHIQ_RETRY;
@@ -643,9 +644,8 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header,
}
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
- if (wait_for_completion_killable(
- &user_service->remove_event)
- != 0) {
+ if (wait_for_completion_interruptible(
+ &user_service->remove_event)) {
vchiq_log_info(vchiq_arm_log_level,
"%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
@@ -849,7 +849,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break;
}
rc = mutex_lock_killable(&instance->state->mutex);
- if (rc != 0) {
+ if (rc) {
vchiq_log_error(vchiq_arm_log_level,
"vchiq: connect: could not lock mutex for "
"state %d: %d",
@@ -873,9 +873,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
void *userdata;
int srvstate;
- if (copy_from_user
- (&args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ if (copy_from_user(&args, (const void __user *)arg,
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -939,7 +938,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
&(((struct vchiq_create_service __user *)
arg)->handle),
(const void *)&service->handle,
- sizeof(service->handle)) != 0) {
+ sizeof(service->handle))) {
ret = -EFAULT;
vchiq_remove_service(service->handle);
}
@@ -978,7 +977,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
has been closed until the client library calls the
CLOSE_DELIVERED ioctl, signalling close_event. */
if (user_service->close_pending &&
- wait_for_completion_killable(
+ wait_for_completion_interruptible(
&user_service->close_event))
status = VCHIQ_RETRY;
break;
@@ -1014,9 +1013,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case VCHIQ_IOC_QUEUE_MESSAGE: {
struct vchiq_queue_message args;
- if (copy_from_user
- (&args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ if (copy_from_user(&args, (const void __user *)arg,
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -1048,9 +1046,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
(cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ?
VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE;
- if (copy_from_user
- (&args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ if (copy_from_user(&args, (const void __user *)arg,
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -1124,7 +1121,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
&(((struct vchiq_queue_bulk_transfer __user *)
arg)->mode),
(const void *)&mode_waiting,
- sizeof(mode_waiting)) != 0)
+ sizeof(mode_waiting)))
ret = -EFAULT;
}
} break;
@@ -1139,7 +1136,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
if (copy_from_user(&args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -1154,10 +1151,10 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
mutex_unlock(&instance->completion_mutex);
- rc = wait_for_completion_killable(
+ rc = wait_for_completion_interruptible(
&instance->insert_event);
mutex_lock(&instance->completion_mutex);
- if (rc != 0) {
+ if (rc) {
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
vchiq_log_info(vchiq_arm_log_level,
"AWAIT_COMPLETION interrupted");
@@ -1223,7 +1220,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (copy_from_user(&msgbuf,
(const void __user *)
&args.msgbufs[msgbufcount],
- sizeof(msgbuf)) != 0) {
+ sizeof(msgbuf))) {
if (ret == 0)
ret = -EFAULT;
break;
@@ -1231,7 +1228,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* Copy the message to user space */
if (copy_to_user(msgbuf, header,
- msglen) != 0) {
+ msglen)) {
if (ret == 0)
ret = -EFAULT;
break;
@@ -1256,8 +1253,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
(size_t)args.buf + ret *
sizeof(struct vchiq_completion_data)),
completion,
- sizeof(struct vchiq_completion_data))
- != 0) {
+ sizeof(struct vchiq_completion_data))) {
if (ret == 0)
ret = -EFAULT;
break;
@@ -1277,13 +1273,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
&((struct vchiq_await_completion *)arg)
->msgbufcount,
&msgbufcount,
- sizeof(msgbufcount)) != 0) {
+ sizeof(msgbufcount))) {
ret = -EFAULT;
}
}
}
- if (ret != 0)
+ if (ret)
complete(&instance->remove_event);
mutex_unlock(&instance->completion_mutex);
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
@@ -1295,9 +1291,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct vchiq_header *header;
DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
- if (copy_from_user
- (&args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ if (copy_from_user(&args, (const void __user *)arg,
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -1324,7 +1319,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
do {
spin_unlock(&msg_queue_spinlock);
DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
- if (wait_for_completion_killable(
+ if (wait_for_completion_interruptible(
&user_service->insert_event)) {
vchiq_log_info(vchiq_arm_log_level,
"DEQUEUE_MESSAGE interrupted");
@@ -1383,7 +1378,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct vchiq_config config;
if (copy_from_user(&args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -1402,9 +1397,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case VCHIQ_IOC_SET_SERVICE_OPTION: {
struct vchiq_set_service_option args;
- if (copy_from_user(
- &args, (const void __user *)arg,
- sizeof(args)) != 0) {
+ if (copy_from_user(&args, (const void __user *)arg,
+ sizeof(args))) {
ret = -EFAULT;
break;
}
@@ -2328,8 +2322,7 @@ vchiq_keepalive_thread_func(void *v)
while (1) {
long rc = 0, uc = 0;
- if (wait_for_completion_killable(&arm_state->ka_evt)
- != 0) {
+ if (wait_for_completion_interruptible(&arm_state->ka_evt)) {
vchiq_log_error(vchiq_susp_log_level,
"%s interrupted", __func__);
flush_signals(current);
@@ -2561,72 +2554,6 @@ need_resume(struct vchiq_state *state)
vchiq_videocore_wanted(state);
}
-static int
-block_resume(struct vchiq_arm_state *arm_state)
-{
- int status = VCHIQ_SUCCESS;
- const unsigned long timeout_val =
- msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS);
- int resume_count = 0;
-
- /* Allow any threads which were blocked by the last force suspend to
- * complete if they haven't already. Only give this one shot; if
- * blocked_count is incremented after blocked_blocker is completed
- * (which only happens when blocked_count hits 0) then those threads
- * will have to wait until next time around */
- if (arm_state->blocked_count) {
- reinit_completion(&arm_state->blocked_blocker);
- write_unlock_bh(&arm_state->susp_res_lock);
- vchiq_log_info(vchiq_susp_log_level, "%s wait for previously "
- "blocked clients", __func__);
- if (wait_for_completion_killable_timeout(
- &arm_state->blocked_blocker, timeout_val)
- <= 0) {
- vchiq_log_error(vchiq_susp_log_level, "%s wait for "
- "previously blocked clients failed", __func__);
- status = VCHIQ_ERROR;
- write_lock_bh(&arm_state->susp_res_lock);
- goto out;
- }
- vchiq_log_info(vchiq_susp_log_level, "%s previously blocked "
- "clients resumed", __func__);
- write_lock_bh(&arm_state->susp_res_lock);
- }
-
- /* We need to wait for resume to complete if it's in process */
- while (arm_state->vc_resume_state != VC_RESUME_RESUMED &&
- arm_state->vc_resume_state > VC_RESUME_IDLE) {
- if (resume_count > 1) {
- status = VCHIQ_ERROR;
- vchiq_log_error(vchiq_susp_log_level, "%s waited too "
- "many times for resume", __func__);
- goto out;
- }
- write_unlock_bh(&arm_state->susp_res_lock);
- vchiq_log_info(vchiq_susp_log_level, "%s wait for resume",
- __func__);
- if (wait_for_completion_killable_timeout(
- &arm_state->vc_resume_complete, timeout_val)
- <= 0) {
- vchiq_log_error(vchiq_susp_log_level, "%s wait for "
- "resume failed (%s)", __func__,
- resume_state_names[arm_state->vc_resume_state +
- VC_RESUME_NUM_OFFSET]);
- status = VCHIQ_ERROR;
- write_lock_bh(&arm_state->susp_res_lock);
- goto out;
- }
- vchiq_log_info(vchiq_susp_log_level, "%s resumed", __func__);
- write_lock_bh(&arm_state->susp_res_lock);
- resume_count++;
- }
- reinit_completion(&arm_state->resume_blocker);
- arm_state->resume_blocked = 1;
-
-out:
- return status;
-}
-
static inline void
unblock_resume(struct vchiq_arm_state *arm_state)
{
@@ -2712,162 +2639,6 @@ out:
return;
}
-static void
-output_timeout_error(struct vchiq_state *state)
-{
- struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
- char err[50] = "";
- int vc_use_count = arm_state->videocore_use_count;
- int active_services = state->unused_service;
- int i;
-
- if (!arm_state->videocore_use_count) {
- snprintf(err, sizeof(err), " Videocore usecount is 0");
- goto output_msg;
- }
- for (i = 0; i < active_services; i++) {
- struct vchiq_service *service_ptr = state->services[i];
-
- if (service_ptr && service_ptr->service_use_count &&
- (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE)) {
- snprintf(err, sizeof(err), " %c%c%c%c(%d) service has "
- "use count %d%s", VCHIQ_FOURCC_AS_4CHARS(
- service_ptr->base.fourcc),
- service_ptr->client_id,
- service_ptr->service_use_count,
- service_ptr->service_use_count ==
- vc_use_count ? "" : " (+ more)");
- break;
- }
- }
-
-output_msg:
- vchiq_log_error(vchiq_susp_log_level,
- "timed out waiting for vc suspend (%d).%s",
- arm_state->autosuspend_override, err);
-
-}
-
-/* Try to get videocore into suspended state, regardless of autosuspend state.
-** We don't actually force suspend, since videocore may get into a bad state
-** if we force suspend at a bad time. Instead, we wait for autosuspend to
-** determine a good point to suspend. If this doesn't happen within 100ms we
-** report failure.
-**
-** Returns VCHIQ_SUCCESS if videocore suspended successfully, VCHIQ_RETRY if
-** videocore failed to suspend in time or VCHIQ_ERROR if interrupted.
-*/
-VCHIQ_STATUS_T
-vchiq_arm_force_suspend(struct vchiq_state *state)
-{
- struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
- VCHIQ_STATUS_T status = VCHIQ_ERROR;
- long rc = 0;
- int repeat = -1;
-
- if (!arm_state)
- goto out;
-
- vchiq_log_trace(vchiq_susp_log_level, "%s", __func__);
-
- write_lock_bh(&arm_state->susp_res_lock);
-
- status = block_resume(arm_state);
- if (status != VCHIQ_SUCCESS)
- goto unlock;
- if (arm_state->vc_suspend_state == VC_SUSPEND_SUSPENDED) {
- /* Already suspended - just block resume and exit */
- vchiq_log_info(vchiq_susp_log_level, "%s already suspended",
- __func__);
- status = VCHIQ_SUCCESS;
- goto unlock;
- } else if (arm_state->vc_suspend_state <= VC_SUSPEND_IDLE) {
- /* initiate suspend immediately in the case that we're waiting
- * for the timeout */
- stop_suspend_timer(arm_state);
- if (!vchiq_videocore_wanted(state)) {
- vchiq_log_info(vchiq_susp_log_level, "%s videocore "
- "idle, initiating suspend", __func__);
- status = vchiq_arm_vcsuspend(state);
- } else if (arm_state->autosuspend_override <
- FORCE_SUSPEND_FAIL_MAX) {
- vchiq_log_info(vchiq_susp_log_level, "%s letting "
- "videocore go idle", __func__);
- status = VCHIQ_SUCCESS;
- } else {
- vchiq_log_warning(vchiq_susp_log_level, "%s failed too "
- "many times - attempting suspend", __func__);
- status = vchiq_arm_vcsuspend(state);
- }
- } else {
- vchiq_log_info(vchiq_susp_log_level, "%s videocore suspend "
- "in progress - wait for completion", __func__);
- status = VCHIQ_SUCCESS;
- }
-
- /* Wait for suspend to happen due to system idle (not forced..) */
- if (status != VCHIQ_SUCCESS)
- goto unblock_resume;
-
- do {
- write_unlock_bh(&arm_state->susp_res_lock);
-
- rc = wait_for_completion_killable_timeout(
- &arm_state->vc_suspend_complete,
- msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS));
-
- write_lock_bh(&arm_state->susp_res_lock);
- if (rc < 0) {
- vchiq_log_warning(vchiq_susp_log_level, "%s "
- "interrupted waiting for suspend", __func__);
- status = VCHIQ_ERROR;
- goto unblock_resume;
- } else if (rc == 0) {
- if (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) {
- /* Repeat timeout once if in progress */
- if (repeat < 0) {
- repeat = 1;
- continue;
- }
- }
- arm_state->autosuspend_override++;
- output_timeout_error(state);
-
- status = VCHIQ_RETRY;
- goto unblock_resume;
- }
- } while (0 < (repeat--));
-
- /* Check and report state in case we need to abort ARM suspend */
- if (arm_state->vc_suspend_state != VC_SUSPEND_SUSPENDED) {
- status = VCHIQ_RETRY;
- vchiq_log_error(vchiq_susp_log_level,
- "%s videocore suspend failed (state %s)", __func__,
- suspend_state_names[arm_state->vc_suspend_state +
- VC_SUSPEND_NUM_OFFSET]);
- /* Reset the state only if it's still in an error state.
- * Something could have already initiated another suspend. */
- if (arm_state->vc_suspend_state < VC_SUSPEND_IDLE)
- set_suspend_state(arm_state, VC_SUSPEND_IDLE);
-
- goto unblock_resume;
- }
-
- /* successfully suspended - unlock and exit */
- goto unlock;
-
-unblock_resume:
- /* all error states need to unblock resume before exit */
- unblock_resume(arm_state);
-
-unlock:
- write_unlock_bh(&arm_state->susp_res_lock);
-
-out:
- vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, status);
- return status;
-}
-
void
vchiq_check_suspend(struct vchiq_state *state)
{
@@ -2890,49 +2661,6 @@ out:
vchiq_log_trace(vchiq_susp_log_level, "%s exit", __func__);
}
-int
-vchiq_arm_allow_resume(struct vchiq_state *state)
-{
- struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
- int resume = 0;
- int ret = -1;
-
- if (!arm_state)
- goto out;
-
- vchiq_log_trace(vchiq_susp_log_level, "%s", __func__);
-
- write_lock_bh(&arm_state->susp_res_lock);
- unblock_resume(arm_state);
- resume = vchiq_check_resume(state);
- write_unlock_bh(&arm_state->susp_res_lock);
-
- if (resume) {
- if (wait_for_completion_killable(
- &arm_state->vc_resume_complete) < 0) {
- vchiq_log_error(vchiq_susp_log_level,
- "%s interrupted", __func__);
- /* failed, cannot accurately derive suspend
- * state, so exit early. */
- goto out;
- }
- }
-
- read_lock_bh(&arm_state->susp_res_lock);
- if (arm_state->vc_suspend_state == VC_SUSPEND_SUSPENDED) {
- vchiq_log_info(vchiq_susp_log_level,
- "%s: Videocore remains suspended", __func__);
- } else {
- vchiq_log_info(vchiq_susp_log_level,
- "%s: Videocore resumed", __func__);
- ret = 0;
- }
- read_unlock_bh(&arm_state->susp_res_lock);
-out:
- vchiq_log_trace(vchiq_susp_log_level, "%s exit %d", __func__, ret);
- return ret;
-}
-
/* This function should be called with the write lock held */
int
vchiq_check_resume(struct vchiq_state *state)
@@ -3010,7 +2738,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
vchiq_log_info(vchiq_susp_log_level, "%s %s resume "
"blocked - waiting...", __func__, entity);
if (wait_for_completion_killable(
- &arm_state->resume_blocker) != 0) {
+ &arm_state->resume_blocker)) {
vchiq_log_error(vchiq_susp_log_level, "%s %s "
"wait for resume blocker interrupted",
__func__, entity);
@@ -3059,7 +2787,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume",
__func__, entity);
if (wait_for_completion_killable(
- &arm_state->vc_resume_complete) != 0) {
+ &arm_state->vc_resume_complete)) {
vchiq_log_error(vchiq_susp_log_level, "%s %s wait for "
"resume interrupted", __func__, entity);
ret = VCHIQ_ERROR;
@@ -3243,20 +2971,6 @@ static void suspend_timer_callback(struct timer_list *t)
}
VCHIQ_STATUS_T
-vchiq_use_service_no_resume(VCHIQ_SERVICE_HANDLE_T handle)
-{
- VCHIQ_STATUS_T ret = VCHIQ_ERROR;
- struct vchiq_service *service = find_service_by_handle(handle);
-
- if (service) {
- ret = vchiq_use_internal(service->state, service,
- USE_TYPE_SERVICE_NO_RESUME);
- unlock_service(service);
- }
- return ret;
-}
-
-VCHIQ_STATUS_T
vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle)
{
VCHIQ_STATUS_T ret = VCHIQ_ERROR;
@@ -3504,13 +3218,13 @@ static int vchiq_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, drvdata);
err = vchiq_platform_init(pdev, &g_state);
- if (err != 0)
+ if (err)
goto failed_platform_init;
cdev_init(&vchiq_cdev, &vchiq_fops);
vchiq_cdev.owner = THIS_MODULE;
err = cdev_add(&vchiq_cdev, vchiq_devid, 1);
- if (err != 0) {
+ if (err) {
vchiq_log_error(vchiq_arm_log_level,
"Unable to register device");
goto failed_platform_init;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
index c1d5a9d17071..b424323e9613 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
@@ -113,12 +113,6 @@ extern VCHIQ_STATUS_T
vchiq_arm_vcsuspend(struct vchiq_state *state);
extern VCHIQ_STATUS_T
-vchiq_arm_force_suspend(struct vchiq_state *state);
-
-extern int
-vchiq_arm_allow_resume(struct vchiq_state *state);
-
-extern VCHIQ_STATUS_T
vchiq_arm_vcresume(struct vchiq_state *state);
extern VCHIQ_STATUS_T
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
index e87e6619695e..1640906e3929 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
@@ -41,7 +41,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback)
{
connected_init();
- if (mutex_lock_killable(&g_connected_mutex) != 0)
+ if (mutex_lock_killable(&g_connected_mutex))
return;
if (g_connected)
@@ -76,7 +76,7 @@ void vchiq_call_connected_callbacks(void)
connected_init();
- if (mutex_lock_killable(&g_connected_mutex) != 0)
+ if (mutex_lock_killable(&g_connected_mutex))
return;
for (i = 0; i < g_num_deferred_callbacks; i++)
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 0c387b6473a5..183f5cf887e0 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -395,13 +395,21 @@ remote_event_create(wait_queue_head_t *wq, struct remote_event *event)
init_waitqueue_head(wq);
}
+/*
+ * All the event waiting routines in VCHIQ used a custom semaphore
+ * implementation that filtered most signals. This achieved a behaviour similar
+ * to the "killable" family of functions. While cleaning up this code all the
+ * routines where switched to the "interruptible" family of functions, as the
+ * former was deemed unjustified and the use "killable" set all VCHIQ's
+ * threads in D state.
+ */
static inline int
remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
{
if (!event->fired) {
event->armed = 1;
dsb(sy);
- if (wait_event_killable(*wq, event->fired)) {
+ if (wait_event_interruptible(*wq, event->fired)) {
event->armed = 0;
return 0;
}
@@ -560,7 +568,7 @@ reserve_space(struct vchiq_state *state, size_t space, int is_blocking)
remote_event_signal(&state->remote->trigger);
if (!is_blocking ||
- (wait_for_completion_killable(
+ (wait_for_completion_interruptible(
&state->slot_available_event)))
return NULL; /* No space available */
}
@@ -792,7 +800,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
WARN_ON(!(stride <= VCHIQ_SLOT_SIZE));
if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
- (mutex_lock_killable(&state->slot_mutex) != 0))
+ mutex_lock_killable(&state->slot_mutex))
return VCHIQ_RETRY;
if (type == VCHIQ_MSG_DATA) {
@@ -804,8 +812,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
return VCHIQ_ERROR;
}
- WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK |
- QMFLAGS_NO_MUTEX_UNLOCK)) != 0);
+ WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
+ QMFLAGS_NO_MUTEX_UNLOCK));
if (service->closing) {
/* The service has been closed */
@@ -830,7 +838,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
spin_unlock(&quota_spinlock);
mutex_unlock(&state->slot_mutex);
- if (wait_for_completion_killable(
+ if (wait_for_completion_interruptible(
&state->data_quota_event))
return VCHIQ_RETRY;
@@ -861,12 +869,12 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
service_quota->slot_use_count);
VCHIQ_SERVICE_STATS_INC(service, quota_stalls);
mutex_unlock(&state->slot_mutex);
- if (wait_for_completion_killable(
+ if (wait_for_completion_interruptible(
&service_quota->quota_event))
return VCHIQ_RETRY;
if (service->closing)
return VCHIQ_ERROR;
- if (mutex_lock_killable(&state->slot_mutex) != 0)
+ if (mutex_lock_killable(&state->slot_mutex))
return VCHIQ_RETRY;
if (service->srvstate != VCHIQ_SRVSTATE_OPEN) {
/* The service has been closed */
@@ -904,8 +912,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
header, size, VCHIQ_MSG_SRCPORT(msgid),
VCHIQ_MSG_DSTPORT(msgid));
- WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK |
- QMFLAGS_NO_MUTEX_UNLOCK)) != 0);
+ WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
+ QMFLAGS_NO_MUTEX_UNLOCK));
callback_result =
copy_message_data(copy_callback, context,
@@ -1032,8 +1040,8 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
local = state->local;
- if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) &&
- (mutex_lock_killable(&state->sync_mutex) != 0))
+ if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME &&
+ mutex_lock_killable(&state->sync_mutex))
return VCHIQ_RETRY;
remote_event_wait(&state->sync_release_event, &local->sync_release);
@@ -2428,7 +2436,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
QMFLAGS_IS_BLOCKING);
if (status == VCHIQ_SUCCESS) {
/* Wait for the ACK/NAK */
- if (wait_for_completion_killable(&service->remove_event)) {
+ if (wait_for_completion_interruptible(&service->remove_event)) {
status = VCHIQ_RETRY;
vchiq_release_service_internal(service);
} else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) &&
@@ -2514,7 +2522,7 @@ do_abort_bulks(struct vchiq_service *service)
VCHIQ_STATUS_T status;
/* Abort any outstanding bulk transfers */
- if (mutex_lock_killable(&service->bulk_mutex) != 0)
+ if (mutex_lock_killable(&service->bulk_mutex))
return 0;
abort_outstanding_bulks(service, &service->bulk_tx);
abort_outstanding_bulks(service, &service->bulk_rx);
@@ -2795,7 +2803,7 @@ vchiq_connect_internal(struct vchiq_state *state, VCHIQ_INSTANCE_T instance)
}
if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) {
- if (wait_for_completion_killable(&state->connect))
+ if (wait_for_completion_interruptible(&state->connect))
return VCHIQ_RETRY;
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
@@ -2823,45 +2831,6 @@ vchiq_shutdown_internal(struct vchiq_state *state, VCHIQ_INSTANCE_T instance)
}
VCHIQ_STATUS_T
-vchiq_pause_internal(struct vchiq_state *state)
-{
- VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
-
- switch (state->conn_state) {
- case VCHIQ_CONNSTATE_CONNECTED:
- /* Request a pause */
- vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSING);
- request_poll(state, NULL, 0);
- break;
- default:
- vchiq_log_error(vchiq_core_log_level,
- "%s in state %s\n",
- __func__, conn_state_names[state->conn_state]);
- status = VCHIQ_ERROR;
- VCHIQ_STATS_INC(state, error_count);
- break;
- }
-
- return status;
-}
-
-VCHIQ_STATUS_T
-vchiq_resume_internal(struct vchiq_state *state)
-{
- VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
-
- if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) {
- vchiq_set_conn_state(state, VCHIQ_CONNSTATE_RESUMING);
- request_poll(state, NULL, 0);
- } else {
- status = VCHIQ_ERROR;
- VCHIQ_STATS_INC(state, error_count);
- }
-
- return status;
-}
-
-VCHIQ_STATUS_T
vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle)
{
/* Unregister the service */
@@ -2894,7 +2863,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle)
}
while (1) {
- if (wait_for_completion_killable(&service->remove_event)) {
+ if (wait_for_completion_interruptible(&service->remove_event)) {
status = VCHIQ_RETRY;
break;
}
@@ -2955,7 +2924,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle)
request_poll(service->state, service, VCHIQ_POLL_REMOVE);
}
while (1) {
- if (wait_for_completion_killable(&service->remove_event)) {
+ if (wait_for_completion_interruptible(&service->remove_event)) {
status = VCHIQ_RETRY;
break;
}
@@ -3029,7 +2998,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
queue = (dir == VCHIQ_BULK_TRANSMIT) ?
&service->bulk_tx : &service->bulk_rx;
- if (mutex_lock_killable(&service->bulk_mutex) != 0) {
+ if (mutex_lock_killable(&service->bulk_mutex)) {
status = VCHIQ_RETRY;
goto error_exit;
}
@@ -3038,13 +3007,12 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
VCHIQ_SERVICE_STATS_INC(service, bulk_stalls);
do {
mutex_unlock(&service->bulk_mutex);
- if (wait_for_completion_killable(
+ if (wait_for_completion_interruptible(
&service->bulk_remove_event)) {
status = VCHIQ_RETRY;
goto error_exit;
}
- if (mutex_lock_killable(&service->bulk_mutex)
- != 0) {
+ if (mutex_lock_killable(&service->bulk_mutex)) {
status = VCHIQ_RETRY;
goto error_exit;
}
@@ -3072,7 +3040,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
/* The slot mutex must be held when the service is being closed, so
claim it here to ensure that isn't happening */
- if (mutex_lock_killable(&state->slot_mutex) != 0) {
+ if (mutex_lock_killable(&state->slot_mutex)) {
status = VCHIQ_RETRY;
goto cancel_bulk_error_exit;
}
@@ -3093,9 +3061,8 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
QMFLAGS_IS_BLOCKING |
QMFLAGS_NO_MUTEX_LOCK |
QMFLAGS_NO_MUTEX_UNLOCK);
- if (status != VCHIQ_SUCCESS) {
+ if (status != VCHIQ_SUCCESS)
goto unlock_both_error_exit;
- }
queue->local_insert++;
@@ -3115,7 +3082,7 @@ waiting:
if (bulk_waiter) {
bulk_waiter->bulk = bulk;
- if (wait_for_completion_killable(&bulk_waiter->event))
+ if (wait_for_completion_interruptible(&bulk_waiter->event))
status = VCHIQ_RETRY;
else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
status = VCHIQ_ERROR;
@@ -3571,17 +3538,6 @@ VCHIQ_STATUS_T vchiq_send_remote_use(struct vchiq_state *state)
return status;
}
-VCHIQ_STATUS_T vchiq_send_remote_release(struct vchiq_state *state)
-{
- VCHIQ_STATUS_T status = VCHIQ_RETRY;
-
- if (state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
- status = queue_message(state, NULL,
- VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0),
- NULL, NULL, 0, 0);
- return status;
-}
-
VCHIQ_STATUS_T vchiq_send_remote_use_active(struct vchiq_state *state)
{
VCHIQ_STATUS_T status = VCHIQ_RETRY;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index aee2d362e88d..63f71b2a492f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -518,12 +518,6 @@ vchiq_free_service_internal(struct vchiq_service *service);
extern VCHIQ_STATUS_T
vchiq_shutdown_internal(struct vchiq_state *state, VCHIQ_INSTANCE_T instance);
-extern VCHIQ_STATUS_T
-vchiq_pause_internal(struct vchiq_state *state);
-
-extern VCHIQ_STATUS_T
-vchiq_resume_internal(struct vchiq_state *state);
-
extern void
remote_event_pollall(struct vchiq_state *state);
@@ -646,9 +640,6 @@ extern VCHIQ_STATUS_T
vchiq_send_remote_use(struct vchiq_state *state);
extern VCHIQ_STATUS_T
-vchiq_send_remote_release(struct vchiq_state *state);
-
-extern VCHIQ_STATUS_T
vchiq_send_remote_use_active(struct vchiq_state *state);
extern void
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
index 2bb9120883fd..f217b78d95a0 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
@@ -86,7 +86,7 @@ static ssize_t debugfs_log_write(struct file *file,
if (count >= DEBUGFS_WRITE_BUF_SIZE)
count = DEBUGFS_WRITE_BUF_SIZE;
- if (copy_from_user(kbuf, buffer, count) != 0)
+ if (copy_from_user(kbuf, buffer, count))
return -EFAULT;
kbuf[count - 1] = 0;
@@ -151,7 +151,7 @@ static ssize_t debugfs_trace_write(struct file *file,
VCHIQ_INSTANCE_T instance = f->private;
char firstchar;
- if (copy_from_user(&firstchar, buffer, 1) != 0)
+ if (copy_from_user(&firstchar, buffer, 1))
return -EFAULT;
switch (firstchar) {
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index 5445f201e284..c23bd105c40f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -107,8 +107,6 @@ extern VCHIQ_STATUS_T vchiq_open_service(VCHIQ_INSTANCE_T instance,
extern VCHIQ_STATUS_T vchiq_close_service(VCHIQ_SERVICE_HANDLE_T service);
extern VCHIQ_STATUS_T vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T service);
extern VCHIQ_STATUS_T vchiq_use_service(VCHIQ_SERVICE_HANDLE_T service);
-extern VCHIQ_STATUS_T vchiq_use_service_no_resume(
- VCHIQ_SERVICE_HANDLE_T service);
extern VCHIQ_STATUS_T vchiq_release_service(VCHIQ_SERVICE_HANDLE_T service);
extern VCHIQ_STATUS_T
vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T handle,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 13910d205fce..17a4f2c8d8b1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -639,10 +639,8 @@ int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle)
if (service) {
VCHIQ_STATUS_T status = vchiq_close_service(service->handle);
- if (status == VCHIQ_SUCCESS) {
+ if (status == VCHIQ_SUCCESS)
service_free(service);
- service = NULL;
- }
ret = vchiq_status_to_vchi(status);
}
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
index 6c519d8e48cb..5e6d3035dc05 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
@@ -39,18 +39,13 @@ int vchiu_queue_is_empty(struct vchiu_queue *queue)
return queue->read == queue->write;
}
-int vchiu_queue_is_full(struct vchiu_queue *queue)
-{
- return queue->write == queue->read + queue->size;
-}
-
void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header)
{
if (!queue->initialized)
return;
while (queue->write == queue->read + queue->size) {
- if (wait_for_completion_killable(&queue->pop))
+ if (wait_for_completion_interruptible(&queue->pop))
flush_signals(current);
}
@@ -63,7 +58,7 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header)
struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue)
{
while (queue->write == queue->read) {
- if (wait_for_completion_killable(&queue->push))
+ if (wait_for_completion_interruptible(&queue->push))
flush_signals(current);
}
@@ -77,7 +72,7 @@ struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue)
struct vchiq_header *header;
while (queue->write == queue->read) {
- if (wait_for_completion_killable(&queue->push))
+ if (wait_for_completion_interruptible(&queue->push))
flush_signals(current);
}
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
index ee1459468171..f03a4250de0d 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
@@ -40,7 +40,6 @@ extern int vchiu_queue_init(struct vchiu_queue *queue, int size);
extern void vchiu_queue_delete(struct vchiu_queue *queue);
extern int vchiu_queue_is_empty(struct vchiu_queue *queue);
-extern int vchiu_queue_is_full(struct vchiu_queue *queue);
extern void vchiu_queue_push(struct vchiu_queue *queue,
struct vchiq_header *header);