]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: DSPGW: mailbox log cleanup
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Thu, 21 Sep 2006 14:41:40 +0000 (17:41 +0300)
committerJuha Yrjola <juha.yrjola@solidboot.com>
Thu, 21 Sep 2006 15:45:47 +0000 (18:45 +0300)
mailbox log small clean-up

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
arch/arm/plat-omap/dsp/dsp.h
arch/arm/plat-omap/dsp/dsp_core.c
arch/arm/plat-omap/dsp/ipbuf.c
arch/arm/plat-omap/dsp/mblog.c

index 2cac2c3b2971a7bbe5383e0165c84f4ee54a0d05..3e97f710837ffb6b81a23a6a3dcfa82779c63d03 100644 (file)
@@ -57,10 +57,10 @@ enum dsp_mem_type_e {
        MEM_TYPE_EXTERN,
 };
 
-enum arm_dsp_dir_e {
-       DIR_A2D,
-       DIR_D2A,
-};
+
+typedef int __bitwise arm_dsp_dir_t;
+#define DIR_A2D        ((__force arm_dsp_dir_t) 1)
+#define DIR_D2A        ((__force arm_dsp_dir_t) 2)
 
 enum cfgstat_e {
        CFGSTAT_CLEAN = 0,
@@ -163,8 +163,8 @@ extern struct ipbuf_head *bid_to_ipbuf(u16 bid);
 extern void ipbuf_start(void);
 extern void ipbuf_stop(void);
 extern int ipbuf_config(u16 ln, u16 lsz, void *base);
-extern int ipbuf_sys_config(void *p, enum arm_dsp_dir_e dir);
-extern int ipbuf_p_validate(void *p, enum arm_dsp_dir_e dir);
+extern int ipbuf_sys_config(void *p, arm_dsp_dir_t dir);
+extern int ipbuf_p_validate(void *p, arm_dsp_dir_t dir);
 extern struct ipbuf_head *get_free_ipbuf(u8 tid);
 extern void release_ipbuf(struct ipbuf_head *ipb_h);
 extern void balance_ipbuf(void);
@@ -239,11 +239,6 @@ extern const struct cmdinfo *cmdinfo[];
 #define cmd_name(mb)   (cmdinfo[(mb).cmd_h]->name)
 extern char *subcmd_name(struct mbcmd *mb);
 
-extern void mblog_add(struct mbcmd *mb, enum arm_dsp_dir_e dir);
-#ifdef CONFIG_OMAP_DSP_MBCMD_VERBOSE
-extern void mblog_printcmd(struct mbcmd *mb, enum arm_dsp_dir_e dir);
-#else /* CONFIG_OMAP_DSP_MBCMD_VERBOSE */
-#define mblog_printcmd(mb, dir)        do {} while(0)
-#endif /* CONFIG_OMAP_DSP_MBCMD_VERBOSE */
+extern void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir);
 
 extern struct platform_device dsp_device;
index 4f2deada105cf1a62cc0d4ac0e28b0070e852c7f..b012f39d1985912009e8e651473c5946101ee716 100644 (file)
@@ -203,7 +203,6 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
                mbseq->ad_arm++;
 
        mblog_add(mb, DIR_A2D);
-       mblog_printcmd(mb, DIR_A2D);
 
        ret = mbox_send(mbox_dsp, *(mbox_msg_t *)mb);
 
@@ -249,7 +248,6 @@ static void mbcmd_receiver(mbox_msg_t msg)
        (*mbseq_expect)++;
 
        mblog_add(mb, DIR_D2A);
-       mblog_printcmd(mb, DIR_D2A);
 
        /* call handler for the command */
        if (cmdinfo[mb->cmd_h]->handler)
index 77cf271eaa1d1d22d4fdf58cfc284e8a0ab924f9..605c18ca1f1b7b75cab367a6c3b19f36fbc3312c 100644 (file)
@@ -126,7 +126,7 @@ free_out:
        return ret;
 }
 
-int ipbuf_sys_config(void *p, enum arm_dsp_dir_e dir)
+int ipbuf_sys_config(void *p, arm_dsp_dir_t dir)
 {
        char *dir_str = (dir == DIR_D2A) ? "D2A" : "A2D";
 
@@ -161,7 +161,7 @@ int ipbuf_sys_config(void *p, enum arm_dsp_dir_e dir)
        return 0;
 }
 
-int ipbuf_p_validate(void *p, enum arm_dsp_dir_e dir)
+int ipbuf_p_validate(void *p, arm_dsp_dir_t dir)
 {
        char *dir_str = (dir == DIR_D2A) ? "D2A" : "A2D";
 
index 287c378bf76acbbcdb1a44d119a1f3965f45d038..95c4d7a7e95d5168218561c0d2c01401a23eb775 100644 (file)
@@ -111,7 +111,7 @@ char *subcmd_name(struct mbcmd *mb)
 struct mblogent {
        unsigned long jiffies;
        mbox_msg_t msg;
-       enum arm_dsp_dir_e dir;
+       arm_dsp_dir_t dir;
 };
 
 static struct {
@@ -123,7 +123,43 @@ static struct {
        .lock = SPIN_LOCK_UNLOCKED,
 };
 
-void mblog_add(struct mbcmd *mb, enum arm_dsp_dir_e dir)
+#ifdef CONFIG_OMAP_DSP_MBCMD_VERBOSE
+static inline void mblog_print_cmd(struct mbcmd *mb, arm_dsp_dir_t dir)
+{
+       const struct cmdinfo *ci = cmdinfo[mb->cmd_h];
+       char *dir_str;
+       char *subname;
+
+       dir_str = (dir == DIR_A2D) ? "sending  " : "receiving";
+       switch (ci->cmd_l_type) {
+       case CMD_L_TYPE_SUBCMD:
+               subname = subcmd_name(mb);
+               if (unlikely(!subname))
+                       subname = "Unknown";
+               printk(KERN_DEBUG
+                      "mbox: %s seq=%d, cmd=%02x:%02x(%s:%s), data=%04x\n",
+                      dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
+                      ci->name, subname, mb->data);
+               break;
+       case CMD_L_TYPE_TID:
+               printk(KERN_DEBUG
+                      "mbox: %s seq=%d, cmd=%02x:%02x(%s:task %d), data=%04x\n",
+                      dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
+                      ci->name, mb->cmd_l, mb->data);
+               break;
+       case CMD_L_TYPE_NULL:
+               printk(KERN_DEBUG
+                      "mbox: %s seq=%d, cmd=%02x:%02x(%s), data=%04x\n",
+                      dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
+                      ci->name, mb->data);
+               break;
+       }
+}
+#else
+static inline void mblog_print_cmd(struct mbcmd *mb, arm_dsp_dir_t dir) { }
+#endif
+
+void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir)
 {
        struct mblogent *ent;
 
@@ -147,6 +183,8 @@ void mblog_add(struct mbcmd *mb, enum arm_dsp_dir_e dir)
        if (++mblog.wp == MBLOG_DEPTH)
                mblog.wp = 0;
        spin_unlock(&mblog.lock);
+
+       mblog_print_cmd(mb, dir);
 }
 
 /*
@@ -219,46 +257,6 @@ done:
 
 static struct device_attribute dev_attr_mblog = __ATTR_RO(mblog);
 
-#ifdef CONFIG_OMAP_DSP_MBCMD_VERBOSE
-void mblog_printcmd(struct mbcmd *mb, enum arm_dsp_dir_e dir)
-{
-       struct cmdinfo ci_null = {
-               .name = "Unknown",
-               .cmd_l_type = CMD_L_TYPE_NULL,
-       };
-       const struct cmdinfo *ci;
-       char *dir_str;
-       char *subname;
-
-       dir_str = (dir == DIR_A2D) ? "sending" : "receiving";
-
-       if ((ci = cmdinfo[mb->cmd_h]) == NULL)
-               ci = &ci_null;
-
-       switch (ci->cmd_l_type) {
-       case CMD_L_TYPE_SUBCMD:
-               if ((subname = subcmd_name(mb)) == NULL)
-                       subname = "Unknown";
-               printk(KERN_DEBUG
-                      "mbox: %s cmd=%02x:%02x(%s:%s), data=%04x\n",
-                      dir_str, mb->cmd_h, mb->cmd_l,
-                      ci->name, subname, mb->data);
-               break;
-       case CMD_L_TYPE_TID:
-               printk(KERN_DEBUG
-                      "mbox: %s cmd=%02x:%02x(%s:task %d), data=%04x\n",
-                      dir_str, mb->cmd_h, mb->cmd_l,
-                      ci->name, mb->cmd_l, mb->data);
-               break;
-       case CMD_L_TYPE_NULL:
-               printk(KERN_DEBUG
-                      "mbox: %s cmd=%02x:%02x(%s), data=%04x\n",
-                      dir_str, mb->cmd_h, mb->cmd_l, ci->name, mb->data);
-               break;
-       }
-}
-#endif /* CONFIG_OMAP_DSP_MBCMD_VERBOSE */
-
 void __init mblog_init(void)
 {
        device_create_file(&dsp_device.dev, &dev_attr_mblog);