summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorKaz Fukuoka <kfukuoka@nvidia.com>2011-06-27 16:57:31 -0700
committerNiket Sirsi <nsirsi@nvidia.com>2011-06-29 15:44:03 -0700
commit8b44d1206d867ca1777d76f2d9c04c0eb1088ea7 (patch)
treee8a02233f86248590c3a333af38fabd1a0372efe /drivers/media
parent3d3270abd92bd7dd439395ce5ae54f0abd71c456 (diff)
media: tegra: avp: Clean avp_svc_thread shutdown
- Avoid exiting from avp_svc_thread in error case. - Add nicer messages. bug 840262 bug 836806 Change-Id: I28fe1de9451b10a810f61db94ad3a7770703fd09 Reviewed-on: http://git-master/r/38581 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tegra/avp/avp_svc.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/media/video/tegra/avp/avp_svc.c b/drivers/media/video/tegra/avp/avp_svc.c
index 1a6d06b49d8f..a8bfdcf1fd53 100644
--- a/drivers/media/video/tegra/avp/avp_svc.c
+++ b/drivers/media/video/tegra/avp/avp_svc.c
@@ -579,12 +579,12 @@ static int avp_svc_thread(void *data)
u8 buf[TEGRA_RPC_MAX_MSG_LEN];
struct svc_msg *msg = (struct svc_msg *)buf;
int ret;
+ long timeout;
BUG_ON(!avp_svc->cpu_ep);
ret = trpc_wait_peer(avp_svc->cpu_ep, -1);
if (ret) {
- /* XXX: teardown?! */
pr_err("%s: no connection from AVP (%d)\n", __func__, ret);
goto err;
}
@@ -596,12 +596,19 @@ static int avp_svc_thread(void *data)
ret = trpc_recv_msg(avp_svc->rpc_node, avp_svc->cpu_ep, buf,
TEGRA_RPC_MAX_MSG_LEN, -1);
DBG(AVP_DBG_TRACE_SVC, "%s: got message\n", __func__);
- if (ret < 0) {
- pr_err("%s: couldn't receive msg\n", __func__);
- /* XXX: port got closed? we should exit? */
- goto err;
- } else if (!ret) {
- pr_err("%s: received msg of len 0?!\n", __func__);
+
+ if (ret == -ECONNRESET || ret == -ENOTCONN) {
+ pr_info("%s: AVP seems to be down; "
+ "wait for kthread_stop\n", __func__);
+ timeout = msecs_to_jiffies(100);
+ timeout = schedule_timeout_interruptible(timeout);
+ if (timeout == 0)
+ pr_err("%s: timed out while waiting for "
+ "kthread_stop\n", __func__);
+ continue;
+ } else if (ret <= 0) {
+ pr_err("%s: couldn't receive msg (ret=%d)\n",
+ __func__, ret);
continue;
}
dispatch_svc_message(avp_svc, msg, ret);
@@ -609,7 +616,7 @@ static int avp_svc_thread(void *data)
err:
trpc_put(avp_svc->cpu_ep);
- pr_info("%s: done\n", __func__);
+ pr_info("%s: exiting\n", __func__);
return ret;
}