staging: tidspbridge: overwrite DSP error codes
authorSapiens, Rene <rene.sapiens@ti.com>
Thu, 4 Nov 2010 00:31:24 +0000 (00:31 +0000)
committerOmar Ramirez Luna <omar.ramirez@ti.com>
Sat, 5 Feb 2011 02:11:11 +0000 (20:11 -0600)
When calling the DSP's remote functions, the DSP returns error
codes different from the ones managed by the kernel, the
function's return value is shared with the MPU using a shared
structure. This patch overwrites those error codes by kernel
specifics and deletes unnecessary code.

Signed-off-by: Rene Sapiens <rene.sapiens@ti.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
drivers/staging/tidspbridge/rmgr/disp.c

index b7ce4353e06b02413df5a14421d545678675b416..560069aade5a16906da6db4156db3212a49452d3 100644 (file)
@@ -460,17 +460,6 @@ int disp_node_create(struct disp_object *disp_obj,
                DBC_ASSERT(ul_bytes < (RMS_COMMANDBUFSIZE * sizeof(rms_word)));
                status = send_message(disp_obj, node_get_timeout(hnode),
                                      ul_bytes, node_env);
-               if (status >= 0) {
-                       /*
-                        * Message successfully received from RMS.
-                        * Return the status of the Node's create function
-                        * on the DSP-side
-                        */
-                       status = (((rms_word *) (disp_obj->pbuf))[0]);
-                       if (status < 0)
-                               dev_dbg(bridge, "%s: DSP-side failed: 0x%x\n",
-                                       __func__, status);
-               }
        }
 func_end:
        return status;
@@ -513,18 +502,6 @@ int disp_node_delete(struct disp_object *disp_obj,
                        status = send_message(disp_obj, node_get_timeout(hnode),
                                              sizeof(struct rms_command),
                                              &dw_arg);
-                       if (status >= 0) {
-                               /*
-                                * Message successfully received from RMS.
-                                * Return the status of the Node's delete
-                                * function on the DSP-side
-                                */
-                               status = (((rms_word *) (disp_obj->pbuf))[0]);
-                               if (status < 0)
-                                       dev_dbg(bridge, "%s: DSP-side failed: "
-                                               "0x%x\n", __func__, status);
-                       }
-
                }
        }
        return status;
@@ -566,18 +543,6 @@ int disp_node_run(struct disp_object *disp_obj,
                        status = send_message(disp_obj, node_get_timeout(hnode),
                                              sizeof(struct rms_command),
                                              &dw_arg);
-                       if (status >= 0) {
-                               /*
-                                * Message successfully received from RMS.
-                                * Return the status of the Node's execute
-                                * function on the DSP-side
-                                */
-                               status = (((rms_word *) (disp_obj->pbuf))[0]);
-                               if (status < 0)
-                                       dev_dbg(bridge, "%s: DSP-side failed: "
-                                               "0x%x\n", __func__, status);
-                       }
-
                }
        }
 
@@ -739,7 +704,14 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
                } else {
                        if (CHNL_IS_IO_COMPLETE(chnl_ioc_obj)) {
                                DBC_ASSERT(chnl_ioc_obj.pbuf == pbuf);
-                               status = (*((rms_word *) chnl_ioc_obj.pbuf));
+                               if (*((int *)chnl_ioc_obj.pbuf) < 0) {
+                                       /* Translate DSP's to kernel error */
+                                       status = -EREMOTEIO;
+                                       dev_dbg(bridge, "%s: DSP-side failed:"
+                                               " DSP errcode = 0x%x, Kernel "
+                                               "errcode = %d\n", __func__,
+                                               *(int *)pbuf, status);
+                               }
                                *pdw_arg =
                                    (((rms_word *) (chnl_ioc_obj.pbuf))[1]);
                        } else {