media: tegra: avp: respond to unsupported service ids
Sachin Nikam [Thu, 30 Jun 2011 15:40:05 +0000 (20:40 +0530)]
AVP service driver responds error to AVP for invalid or unsupported
service IDs.

Bug 843473

Original-Change-Id: Ic747c7cf0b34b6b30abdb64c4ff005d298fa1530
Signed-off-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-on: http://git-master/r/39225
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: Rc2cf57d3643343c6cb59cd5da8c5c8351dd2e95e

drivers/media/video/tegra/avp/avp_svc.c

index 0c22530..7b374a0 100644 (file)
@@ -459,7 +459,7 @@ static void do_svc_module_clock_set(struct avp_svc_info *avp_svc,
        aclk = &avp_svc->clks[mod->clk_req];
        ret = clk_set_rate(aclk->clk, msg->clk_freq);
        if (ret) {
-               pr_err("avp_svc: Failed to set module (id = %d) frequency to %d kHz\n",
+               pr_err("avp_svc: Failed to set module (id = %d) frequency to %d Hz\n",
                        msg->module_id, msg->clk_freq);
                resp.err = AVP_ERR_EINVAL;
                resp.act_freq = 0;
@@ -478,6 +478,17 @@ send_response:
                      sizeof(resp), GFP_KERNEL);
 }
 
+static void do_svc_unsupported_msg(struct avp_svc_info *avp_svc,
+                       u32 resp_svc_id)
+{
+       struct svc_common_resp resp;
+
+       resp.err = AVP_ERR_ENOTSUP;
+       resp.svc_id = resp_svc_id;
+       trpc_send_msg(avp_svc->rpc_node, avp_svc->cpu_ep, &resp,
+                       sizeof(resp), GFP_KERNEL);
+}
+
 static int dispatch_svc_message(struct avp_svc_info *avp_svc,
                                struct svc_msg *msg,
                                size_t len)
@@ -565,7 +576,8 @@ static int dispatch_svc_message(struct avp_svc_info *avp_svc,
                do_svc_module_clock_set(avp_svc, msg, len);
                break;
        default:
-               pr_err("avp_svc: invalid SVC call 0x%x\n", msg->svc_id);
+               pr_warning("avp_svc: Unsupported SVC call 0x%x\n", msg->svc_id);
+               do_svc_unsupported_msg(avp_svc, msg->svc_id);
                ret = -ENOMSG;
                break;
        }