Skip to contentSkip to conversation

dspbridge cleanup patches

PATCH NAK Omar Ramirez Luna 6 participants 28 messages Nov 24, 2009 – Nov 26, 2009 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover dspbridge cleanup patches

Following patches are cleanups, removing history of files, tab spacing and also remove DPC layer.

Omar Ramirez Luna (8):
DSPBRIDGE: trivial checkpatch fixes
DSPBRIDGE: Fix multiline macros to use do while
DSPBRIDGE: Use _IOxx macro to define ioctls
DSPBRIDGE: trivial cleanup and indentation for io_sm
DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
DSPBRIDGE: Remove DPC module from SERVICES layer
DSPBRIDGE: Remove DPC object structure
DSPBRIDGE: trivial file history cleanup

 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h    |   47 +-
 arch/arm/plat-omap/include/dspbridge/_dcd.h        |   40 +-
 arch/arm/plat-omap/include/dspbridge/brddefs.h     |   20 +-
 arch/arm/plat-omap/include/dspbridge/cfg.h         |   50 +-
 arch/arm/plat-omap/include/dspbridge/cfgdefs.h     |   27 +-
 arch/arm/plat-omap/include/dspbridge/chnl.h        |   45 +-
 arch/arm/plat-omap/include/dspbridge/chnl_sm.h     |   30 +-
 arch/arm/plat-omap/include/dspbridge/chnldefs.h    |   26 +-
 arch/arm/plat-omap/include/dspbridge/chnlpriv.h    |   33 +-
 arch/arm/plat-omap/include/dspbridge/clk.h         |   11 +-
 arch/arm/plat-omap/include/dspbridge/cmm.h         |   66 +-
 arch/arm/plat-omap/include/dspbridge/cmmdefs.h     |   20 +-
 arch/arm/plat-omap/include/dspbridge/cod.h         |   58 +-
 arch/arm/plat-omap/include/dspbridge/dbc.h         |   40 +-
 arch/arm/plat-omap/include/dspbridge/dbdcd.h       |   26 +-
 arch/arm/plat-omap/include/dspbridge/dbdcddef.h    |   27 +-
 arch/arm/plat-omap/include/dspbridge/dbdefs.h      |   61 +-
 arch/arm/plat-omap/include/dspbridge/dbg.h         |   25 +-
 arch/arm/plat-omap/include/dspbridge/dbl.h         |   14 -
 arch/arm/plat-omap/include/dspbridge/dbldefs.h     |   12 -
 arch/arm/plat-omap/include/dspbridge/dbll.h        |   15 +-
 arch/arm/plat-omap/include/dspbridge/dblldefs.h    |   11 -
 arch/arm/plat-omap/include/dspbridge/dbtype.h      |   21 +-
 arch/arm/plat-omap/include/dspbridge/dehdefs.h     |   14 +-
 arch/arm/plat-omap/include/dspbridge/dev.h         |   64 +-
 arch/arm/plat-omap/include/dspbridge/devdefs.h     |   15 +-
 arch/arm/plat-omap/include/dspbridge/disp.h        |   31 +-
 arch/arm/plat-omap/include/dspbridge/dispdefs.h    |   14 +-
 arch/arm/plat-omap/include/dspbridge/dmm.h         |   18 +-
 arch/arm/plat-omap/include/dspbridge/dpc.h         |  167 ---
 arch/arm/plat-omap/include/dspbridge/drv.h         |   48 +-
 arch/arm/plat-omap/include/dspbridge/drvdefs.h     |   13 +-
 arch/arm/plat-omap/include/dspbridge/dspdrv.h      |   33 +-
 .../plat-omap/include/dspbridge/dynamic_loader.h   |    2 -
 arch/arm/plat-omap/include/dspbridge/errbase.h     |   37 +-
 arch/arm/plat-omap/include/dspbridge/gb.h          |   10 +-
 arch/arm/plat-omap/include/dspbridge/getsection.h  |   21 +-
 arch/arm/plat-omap/include/dspbridge/gh.h          |    8 -
 arch/arm/plat-omap/include/dspbridge/gs.h          |   15 +-
 arch/arm/plat-omap/include/dspbridge/gt.h          |   30 +-
 arch/arm/plat-omap/include/dspbridge/host_os.h     |   10 -
 arch/arm/plat-omap/include/dspbridge/io.h          |   21 +-
 arch/arm/plat-omap/include/dspbridge/io_sm.h       |   46 +-
 arch/arm/plat-omap/include/dspbridge/iodefs.h      |   13 +-
 arch/arm/plat-omap/include/dspbridge/ldr.h         |   34 +-
 arch/arm/plat-omap/include/dspbridge/list.h        |   36 +-
 arch/arm/plat-omap/include/dspbridge/mbx_sh.h      |   25 +-
 arch/arm/plat-omap/include/dspbridge/mem.h         |   78 +-
 arch/arm/plat-omap/include/dspbridge/memdefs.h     |   16 +-
 arch/arm/plat-omap/include/dspbridge/mgr.h         |   32 +-
 arch/arm/plat-omap/include/dspbridge/mgrpriv.h     |   14 +-
 arch/arm/plat-omap/include/dspbridge/msg.h         |   24 +-
 arch/arm/plat-omap/include/dspbridge/msgdefs.h     |   15 +-
 arch/arm/plat-omap/include/dspbridge/nldr.h        |   29 +-
 arch/arm/plat-omap/include/dspbridge/nldrdefs.h    |   14 +-
 arch/arm/plat-omap/include/dspbridge/node.h        |   48 +-
 arch/arm/plat-omap/include/dspbridge/nodedefs.h    |   16 +-
 arch/arm/plat-omap/include/dspbridge/nodepriv.h    |   23 +-
 arch/arm/plat-omap/include/dspbridge/ntfy.h        |   22 +-
 arch/arm/plat-omap/include/dspbridge/proc.h        |   47 +-
 arch/arm/plat-omap/include/dspbridge/procpriv.h    |   13 +-
 arch/arm/plat-omap/include/dspbridge/pwr.h         |   19 -
 arch/arm/plat-omap/include/dspbridge/pwr_sh.h      |   12 +-
 arch/arm/plat-omap/include/dspbridge/reg.h         |   35 +-
 arch/arm/plat-omap/include/dspbridge/rmm.h         |   26 +-
 arch/arm/plat-omap/include/dspbridge/rms_sh.h      |   34 +-
 arch/arm/plat-omap/include/dspbridge/rmstypes.h    |   15 +-
 arch/arm/plat-omap/include/dspbridge/services.h    |   17 +-
 arch/arm/plat-omap/include/dspbridge/std.h         |   48 -
 arch/arm/plat-omap/include/dspbridge/strm.h        |   41 +-
 arch/arm/plat-omap/include/dspbridge/strmdefs.h    |   14 +-
 arch/arm/plat-omap/include/dspbridge/sync.h        |   40 +-
 arch/arm/plat-omap/include/dspbridge/utildefs.h    |   16 +-
 arch/arm/plat-omap/include/dspbridge/uuidutil.h    |   16 +-
 arch/arm/plat-omap/include/dspbridge/wcd.h         |   49 +-
 arch/arm/plat-omap/include/dspbridge/wcdioctl.h    |  198 ++---
 arch/arm/plat-omap/include/dspbridge/wmd.h         |   57 +-
 arch/arm/plat-omap/include/dspbridge/wmdchnl.h     |   29 +-
 arch/arm/plat-omap/include/dspbridge/wmddeh.h      |   30 +-
 arch/arm/plat-omap/include/dspbridge/wmdio.h       |   24 +-
 arch/arm/plat-omap/include/dspbridge/wmdioctl.h    |   26 +-
 arch/arm/plat-omap/include/dspbridge/wmdmsg.h      |   27 +-
 drivers/dsp/bridge/Makefile                        |    3 +-
 drivers/dsp/bridge/dynload/cload.c                 |   17 +-
 drivers/dsp/bridge/dynload/dlclasses_hdr.h         |    2 -
 drivers/dsp/bridge/dynload/dload_internal.h        |   46 +-
 drivers/dsp/bridge/dynload/doff.h                  |   75 +-
 drivers/dsp/bridge/dynload/getsection.c            |    2 -
 drivers/dsp/bridge/dynload/header.h                |   20 +-
 drivers/dsp/bridge/dynload/module_list.h           |   98 +-
 drivers/dsp/bridge/dynload/params.h                |  205 ++--
 drivers/dsp/bridge/dynload/reloc.c                 |   43 +-
 drivers/dsp/bridge/dynload/reloc_table.h           |   55 +-
 drivers/dsp/bridge/dynload/reloc_table_c6000.c     |    7 +-
 drivers/dsp/bridge/dynload/tramp.c                 |   18 +-
 drivers/dsp/bridge/dynload/tramp_table_c6000.c     |   24 +-
 drivers/dsp/bridge/gen/_gt_para.c                  |   24 +-
 drivers/dsp/bridge/gen/gb.c                        |   17 +-
 drivers/dsp/bridge/gen/gh.c                        |    5 -
 drivers/dsp/bridge/gen/gs.c                        |   20 +-
 drivers/dsp/bridge/gen/gt.c                        |   16 +-
 drivers/dsp/bridge/gen/uuidutil.c                  |   20 +-
 drivers/dsp/bridge/hw/EasiGlobal.h                 |    8 +-
 drivers/dsp/bridge/hw/GlobalTypes.h                |  157 ++--
 drivers/dsp/bridge/hw/IPIAccInt.h                  |    7 +-
 drivers/dsp/bridge/hw/IVA2RegAcM.h                 |    6 +-
 drivers/dsp/bridge/hw/MLBAccInt.h                  |  118 +-
 drivers/dsp/bridge/hw/MLBRegAcM.h                  |  319 +++---
 drivers/dsp/bridge/hw/MMUAccInt.h                  |  100 +-
 drivers/dsp/bridge/hw/MMURegAcM.h                  |  416 ++++----
 drivers/dsp/bridge/hw/PRCMAccInt.h                 |  201 ++--
 drivers/dsp/bridge/hw/PRCMRegAcM.h                 | 1197 +++++++++-----------
 drivers/dsp/bridge/hw/hw_defs.h                    |   21 +-
 drivers/dsp/bridge/hw/hw_dspssC64P.c               |   13 +-
 drivers/dsp/bridge/hw/hw_dspssC64P.h               |   15 +-
 drivers/dsp/bridge/hw/hw_mbox.c                    |   15 +-
 drivers/dsp/bridge/hw/hw_mbox.h                    |   63 +-
 drivers/dsp/bridge/hw/hw_mmu.c                     |   37 +-
 drivers/dsp/bridge/hw/hw_mmu.h                     |   21 +-
 drivers/dsp/bridge/hw/hw_prcm.c                    |   12 +-
 drivers/dsp/bridge/hw/hw_prcm.h                    |   12 +-
 drivers/dsp/bridge/pmgr/chnl.c                     |   52 +-
 drivers/dsp/bridge/pmgr/chnlobj.h                  |   25 +-
 drivers/dsp/bridge/pmgr/cmm.c                      |  118 +--
 drivers/dsp/bridge/pmgr/cod.c                      |   51 +-
 drivers/dsp/bridge/pmgr/dbll.c                     |   65 +-
 drivers/dsp/bridge/pmgr/dev.c                      |  106 +--
 drivers/dsp/bridge/pmgr/dmm.c                      |   47 +-
 drivers/dsp/bridge/pmgr/io.c                       |   25 +-
 drivers/dsp/bridge/pmgr/ioobj.h                    |   19 +-
 drivers/dsp/bridge/pmgr/msg.c                      |   23 +-
 drivers/dsp/bridge/pmgr/msgobj.h                   |   19 +-
 drivers/dsp/bridge/pmgr/wcd.c                      |  196 +---
 drivers/dsp/bridge/rmgr/dbdcd.c                    |   56 +-
 drivers/dsp/bridge/rmgr/disp.c                     |   39 +-
 drivers/dsp/bridge/rmgr/drv.c                      |  102 +--
 drivers/dsp/bridge/rmgr/drv_interface.c            |   44 +-
 drivers/dsp/bridge/rmgr/drv_interface.h            |   12 -
 drivers/dsp/bridge/rmgr/dspdrv.c                   |   79 +--
 drivers/dsp/bridge/rmgr/mgr.c                      |   30 +-
 drivers/dsp/bridge/rmgr/nldr.c                     |  108 +--
 drivers/dsp/bridge/rmgr/node.c                     |  289 ++---
 drivers/dsp/bridge/rmgr/proc.c                     |  119 +--
 drivers/dsp/bridge/rmgr/pwr.c                      |   19 +-
 drivers/dsp/bridge/rmgr/rmm.c                      |   14 -
 drivers/dsp/bridge/rmgr/strm.c                     |   49 +-
 drivers/dsp/bridge/services/cfg.c                  |   78 +--
 drivers/dsp/bridge/services/clk.c                  |   25 +-
 drivers/dsp/bridge/services/dbg.c                  |   35 +-
 drivers/dsp/bridge/services/dpc.c                  |  274 -----
 drivers/dsp/bridge/services/list.c                 |   33 -
 drivers/dsp/bridge/services/mem.c                  |   40 +-
 drivers/dsp/bridge/services/ntfy.c                 |   27 +-
 drivers/dsp/bridge/services/reg.c                  |   21 +-
 drivers/dsp/bridge/services/regsup.c               |   30 +-
 drivers/dsp/bridge/services/regsup.h               |    8 -
 drivers/dsp/bridge/services/services.c             |   30 +-
 drivers/dsp/bridge/services/sync.c                 |   35 +-
 drivers/dsp/bridge/wmd/_cmm.h                      |   22 +-
 drivers/dsp/bridge/wmd/_deh.h                      |   18 +-
 drivers/dsp/bridge/wmd/_msg_sm.h                   |   21 +-
 drivers/dsp/bridge/wmd/_tiomap.h                   |  251 ++---
 drivers/dsp/bridge/wmd/_tiomap_mmu.h               |   16 +-
 drivers/dsp/bridge/wmd/_tiomap_pwr.h               |   13 +-
 drivers/dsp/bridge/wmd/_tiomap_util.h              |   13 +-
 drivers/dsp/bridge/wmd/chnl_sm.c                   |   77 +--
 drivers/dsp/bridge/wmd/io_sm.c                     |  608 +++++-----
 drivers/dsp/bridge/wmd/mmu_fault.c                 |   34 +-
 drivers/dsp/bridge/wmd/mmu_fault.h                 |   16 +-
 drivers/dsp/bridge/wmd/msg_sm.c                    |  107 +--
 drivers/dsp/bridge/wmd/tiomap3430.c                |   37 +-
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c            |   41 +-
 drivers/dsp/bridge/wmd/tiomap_io.c                 |   17 +-
 drivers/dsp/bridge/wmd/tiomap_io.h                 |   14 +-
 drivers/dsp/bridge/wmd/tiomap_sm.c                 |   11 +-
 drivers/dsp/bridge/wmd/ue_deh.c                    |   61 +-
 176 files changed, 2895 insertions(+), 6893 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
 delete mode 100644 drivers/dsp/bridge/services/dpc.c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 2/9 DSPBRIDGE: trivial checkpatch fixes

Quick fixes like:
* ERROR: space required after that ',' (ctx:VxV)
* ERROR: "foo *const bar" should be "foo *const bar"
* WARNING: line over 80 characters
* ERROR: code indent should use tabs where possible
* ERROR: space required before the open parenthesis '('
* WARNING: suspect code indent for conditional statements

---
 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |    2 +-
 arch/arm/plat-omap/include/dspbridge/chnlpriv.h |    2 +-
 arch/arm/plat-omap/include/dspbridge/dbc.h      |    2 +-
 arch/arm/plat-omap/include/dspbridge/dbdefs.h   |    8 +-
 arch/arm/plat-omap/include/dspbridge/gt.h       |    2 +-
 arch/arm/plat-omap/include/dspbridge/io_sm.h    |    6 +-
 arch/arm/plat-omap/include/dspbridge/wcdioctl.h |    4 +-
 drivers/dsp/bridge/dynload/reloc.c              |   29 +-
 drivers/dsp/bridge/gen/_gt_para.c               |    2 +-
 drivers/dsp/bridge/gen/gs.c                     |    3 +-
 drivers/dsp/bridge/hw/GlobalTypes.h             |    4 +-
 drivers/dsp/bridge/hw/PRCMRegAcM.h              |   24 +-
 drivers/dsp/bridge/hw/hw_mbox.h                 |   44 +--
 drivers/dsp/bridge/pmgr/cmm.c                   |    5 +-
 drivers/dsp/bridge/pmgr/cod.c                   |    4 +-
 drivers/dsp/bridge/pmgr/dbll.c                  |   45 ++--
 drivers/dsp/bridge/pmgr/dev.c                   |    2 +-
 drivers/dsp/bridge/rmgr/disp.c                  |    4 +-
 drivers/dsp/bridge/rmgr/drv.c                   |   24 +-
 drivers/dsp/bridge/rmgr/drv_interface.c         |   12 +-
 drivers/dsp/bridge/rmgr/nldr.c                  |   28 +-
 drivers/dsp/bridge/rmgr/node.c                  |  209 ++++++------
 drivers/dsp/bridge/rmgr/proc.c                  |   14 +-
 drivers/dsp/bridge/services/cfg.c               |   18 +-
 drivers/dsp/bridge/services/clk.c               |    5 +-
 drivers/dsp/bridge/services/dbg.c               |    2 +-
 drivers/dsp/bridge/services/regsup.c            |   14 +-
 drivers/dsp/bridge/wmd/_tiomap.h                |   48 ++--
 drivers/dsp/bridge/wmd/chnl_sm.c                |    2 +-
 drivers/dsp/bridge/wmd/io_sm.c                  |  396 +++++++++++------------
 drivers/dsp/bridge/wmd/mmu_fault.c              |    3 +-
 drivers/dsp/bridge/wmd/msg_sm.c                 |   77 +++---
 drivers/dsp/bridge/wmd/tiomap3430.c             |   23 +-
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c         |   24 +-
 drivers/dsp/bridge/wmd/tiomap_sm.c              |   11 +-
 drivers/dsp/bridge/wmd/ue_deh.c                 |   29 +-
 36 files changed, 564 insertions(+), 567 deletions(-)
arch/arm/plat-omap/include/dspbridge/_chnl_sm.h +1 -1
index 33c2135..f22b2cb 100644
@@ -145,7 +145,7 @@ struct loadMonStruct {
 		struct SYNC_OBJECT *hSyncEvent;
 		/* Name of Sync event */
 		char szEventName[SYNC_MAXNAMELENGTH + 1];
-               u32 hProcess;   /* Process which created this channel */
+		u32 hProcess;   /* Process which created this channel */
 		u32 pCBArg;	/* Argument to use with callback */
 		struct LST_LIST *pIORequests;	/* List of IOR's to driver */
 		s32 cIOCs;	/* Number of IOC's in queue */
arch/arm/plat-omap/include/dspbridge/chnlpriv.h +1 -1
index 86fc468..2eadfa0 100644
@@ -83,7 +83,7 @@
 		u32 cPosition;	/* Total bytes transferred.        */
 		u32 cIOCs;	/* Number of IOCs in queue.               */
 		u32 cIOReqs;	/* Number of IO Requests in queue.        */
-               u32 hProcess;   /* Process owning this channel.     */
+		u32 hProcess;   /* Process owning this channel.     */
 		/*
 		 * Name of channel I/O completion event. Not required in Linux
 		 */
arch/arm/plat-omap/include/dspbridge/dbc.h +1 -1
index e9cb548..13b1ff6 100644
@@ -36,7 +36,7 @@
 
 #define DBC_Assert(exp) \
     if (!(exp)) \
-	printk("%s, line %d: Assertion (" #exp ") failed.\n", \
+	printk(KERN_ERR "%s, line %d: Assertion (" #exp ") failed.\n", \
 	__FILE__, __LINE__)
 #define DBC_Require DBC_Assert	/* Function Precondition.  */
 #define DBC_Ensure  DBC_Assert	/* Function Postcondition. */
arch/arm/plat-omap/include/dspbridge/dbdefs.h +4 -4
index bae19e7..1a7d5fa 100644
@@ -21,9 +21,9 @@
 
 #include <linux/types.h>
 
-#include <dspbridge/dbtype.h>		/* GPP side type definitions           */
-#include <dspbridge/std.h>		/* DSP/BIOS type definitions           */
-#include <dspbridge/rms_sh.h>		/* Types shared between GPP and DSP    */
+#include <dspbridge/dbtype.h>		/* GPP side type definitions */
+#include <dspbridge/std.h>		/* DSP/BIOS type definitions */
+#include <dspbridge/rms_sh.h>		/* Types shared between GPP and DSP */
 
 #define PG_SIZE_4K 4096
 #define PG_MASK(pg_size) (~((pg_size)-1))
@@ -553,7 +553,7 @@ bit 6 - MMU element size = 64bit (valid only for non mixed page entries)
 #define AUTOSTART	"AutoStart"		/* Statically load flag */
 #define CURRENTCONFIG	"CurrentConfig"		/* Current resources */
 #define SHMSIZE		"SHMSize"		/* Size of SHM reservd on MPU */
-#define TCWORDSWAP	"TCWordSwap"		/* Traffic Contoller Word Swap */
+#define TCWORDSWAP	"TCWordSwap"		/* Traffic Controller WordSwp */
 #define DSPRESOURCES	"DspTMSResources"	/* C55 DSP resurces on OMAP */
 
 #endif				/* DBDEFS_ */
arch/arm/plat-omap/include/dspbridge/gt.h +1 -1
index b43b1e7..c110234 100644
@@ -232,7 +232,7 @@ extern struct GT_Config _GT_params;
 
 #define GT_assert(mask, expr) \
 	(!(expr) ? \
-	    printk("assertion violation: %s, line %d\n", \
+	    printk(KERN_ERR "assertion violation: %s, line %d\n", \
 			    __FILE__, __LINE__), NULL : NULL)
 
 #define GT_config(config)     (_GT_params = *(config))
arch/arm/plat-omap/include/dspbridge/io_sm.h +3 -3
index b8f4fb7..77f9e25 100644
@@ -291,13 +291,13 @@
 
 	extern void IO_IntrDSP2(IN struct IO_MGR *pIOMgr, IN u16 wMbVal);
 
-       extern void IO_SM_init(void);
+	extern void IO_SM_init(void);
 
 /*
  *  ========PrintDspTraceBuffer ========
  *      Print DSP tracebuffer.
  */
-       extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
-                                               *hWmdContext);
+	extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
+						*hWmdContext);
 
 #endif				/* IOSM_ */
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +2 -2
index b213b82..397361c 100644
@@ -54,7 +54,7 @@ union Trapped_Args {
 	} ARGS_MGR_UNREGISTEROBJECT;
 
 	struct {
-		struct DSP_NOTIFICATION  __user*__user *aNotifications;
+		struct DSP_NOTIFICATION  __user *__user *aNotifications;
 		u32 uCount;
 		u32 __user *puIndex;
 		u32 uTimeout;
@@ -111,7 +111,7 @@ union Trapped_Args {
 	struct {
 		DSP_HPROCESSOR hProcessor;
 		s32 iArgc;
-		char __user*__user *aArgv;
+		char __user *__user *aArgv;
 		char *__user *aEnvp;
 	} ARGS_PROC_LOAD;
 
drivers/dsp/bridge/dynload/reloc.c +16 -13
index d4457c5..b9e2a9b 100644
@@ -195,20 +195,22 @@ void dload_relocate(struct dload_state *dlthis, TgtAU_t *data,
 		rx = HASH_L(rop_map2[rx]);
 		if (rx < 0) {
 #if TMS32060
-		switch (rp->r_type) {
-		case R_C60ALIGN:
-		case R_C60NOCMP:
-		case R_C60FPHEAD:
-		    /* Ignore these reloc types and return */
-		    break;
-		default:
-		    /* Unknown reloc type, print error and return */
-		    dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
-	    }
+			switch (rp->r_type) {
+			case R_C60ALIGN:
+			case R_C60NOCMP:
+			case R_C60FPHEAD:
+				/* Ignore these reloc types and return */
+				break;
+			default:
+				/* Unknown reloc type, print error and return */
+				dload_error(dlthis, "Bad coff operator 0x%x",
+						rp->r_type);
+			}
 #else
-	    dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
+			dload_error(dlthis, "Bad coff operator 0x%x",
+					rp->r_type);
 #endif
-	    return;
+			return;
 		}
 	}
 	rx = HASH_I(rop_map2[rx]);
@@ -216,7 +218,8 @@ void dload_relocate(struct dload_state *dlthis, TgtAU_t *data,
 	   && (rx < (sizeof(rop_info)/sizeof(uint_least16_t))) && (rx > 0)) {
 		reloc_action = rop_action[rx]; reloc_info = rop_info[rx];
 	} else {
-	    dload_error(dlthis, "Buffer Overflow - Array Index Out of Bounds");
+		dload_error(dlthis, "Buffer Overflow - Array Index Out "
+				"of Bounds");
 	}
 
 	/* Compute the relocation amount for the referenced symbol, if any */
drivers/dsp/bridge/gen/_gt_para.c +1 -1
index 9f8246b..dd22f77 100644
@@ -77,7 +77,7 @@ static void error(char *fmt, ...)
 
 	va_end(va);
 
-	printk("ERROR: ");
+	printk(KERN_ERR "ERROR: ");
 	printk(fmt, arg1, arg2, arg3, arg4, arg5, arg6);
 
 #if defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)
drivers/dsp/bridge/gen/gs.c +1 -2
index 5a5684c..7d6c278 100644
@@ -87,7 +87,6 @@ void GS_init(void)
 {
 	static bool curInit;
 
-	if (curInit == false) {
+	if (curInit == false)
 		curInit = MEM_Init(); /* which can't fail currently. */
-	}
 }
drivers/dsp/bridge/hw/GlobalTypes.h +2 -2
index 6f54589..73a2d93 100644
@@ -101,7 +101,7 @@
  * DESCRIPTION: Returns a 32 bit value given a 16 bit lower value and a 16
  *		bit upper value
  */
-#define RETURN_32BITS_FROM_16LOWER_AND_16UPPER(lower16Bits,upper16Bits)\
+#define RETURN_32BITS_FROM_16LOWER_AND_16UPPER(lower16Bits, upper16Bits)\
     (((((u32)lower16Bits)  & LOWER_16BIT_MASK)) | \
      (((((u32)upper16Bits) & LOWER_16BIT_MASK) << UPPER_16BIT_SHIFT)))
 
@@ -111,7 +111,7 @@
  * DESCRIPTION:  Returns a 16 bit value given a 8 bit lower value and a 8
  *	       bit upper value
  */
-#define RETURN_16BITS_FROM_8LOWER_AND_8UPPER(lower8Bits,upper8Bits)\
+#define RETURN_16BITS_FROM_8LOWER_AND_8UPPER(lower8Bits, upper8Bits)\
     (((((u32)lower8Bits)  & LOWER_8BIT_MASK)) | \
      (((((u32)upper8Bits) & LOWER_8BIT_MASK) << UPPER_8BIT_OF16_SHIFT)))
 
drivers/dsp/bridge/hw/PRCMRegAcM.h +12 -12
index 280a812..4c9d732 100644
@@ -51,7 +51,7 @@
       __raw_readl(((u32)(baseAddress))+CM_ICLKEN_PER_OFFSET))
 
 
-#define CM_FCLKEN_PER_GPT5WriteRegister32(baseAddress,value)\
+#define CM_FCLKEN_PER_GPT5WriteRegister32(baseAddress, value)\
 {\
     const u32 offset = CM_FCLKEN_PER_OFFSET;\
     register u32 data = \
@@ -66,7 +66,7 @@
 }
 
 
-#define CM_FCLKEN_PER_GPT6WriteRegister32(baseAddress,value)\
+#define CM_FCLKEN_PER_GPT6WriteRegister32(baseAddress, value)\
 {\
     const u32 offset = CM_FCLKEN_PER_OFFSET;\
     register u32 data =\
@@ -81,7 +81,7 @@
 }
 
 
-#define CM_ICLKEN_PER_GPT5WriteRegister32(baseAddress,value)\
+#define CM_ICLKEN_PER_GPT5WriteRegister32(baseAddress, value)\
 {\
     const u32 offset = CM_ICLKEN_PER_OFFSET;\
     register u32 data = \
@@ -96,7 +96,7 @@
 }
 
 
-#define CM_ICLKEN_PER_GPT6WriteRegister32(baseAddress,value)\
+#define CM_ICLKEN_PER_GPT6WriteRegister32(baseAddress, value)\
 {\
     const u32 offset = CM_ICLKEN_PER_OFFSET;\
     register u32 data = \
@@ -116,7 +116,7 @@
       __raw_readl(((u32)(baseAddress))+CM_FCLKEN1_CORE_OFFSET))
 
 
-#define PRCMCM_FCLKEN1_COREEN_GPT8Write32(baseAddress,value)\
+#define PRCMCM_FCLKEN1_COREEN_GPT8Write32(baseAddress, value)\
 {\
     const u32 offset = PRCM_CM_FCLKEN1_CORE_OFFSET;\
     register u32 data = \
@@ -131,7 +131,7 @@
 }
 
 
-#define PRCMCM_FCLKEN1_COREEN_GPT7Write32(baseAddress,value)\
+#define PRCMCM_FCLKEN1_COREEN_GPT7Write32(baseAddress, value)\
 {\
     const u32 offset = PRCM_CM_FCLKEN1_CORE_OFFSET;\
     register u32 data = \
@@ -360,7 +360,7 @@
       PRCM_CM_CLKSEL1_PLL_APLLs_Clkin_OFFSET))
 
 
-#define CM_FCLKEN_IVA2EN_DSPWrite32(baseAddress,value)\
+#define CM_FCLKEN_IVA2EN_DSPWrite32(baseAddress, value)\
 {\
     const u32 offset = CM_FCLKEN_IVA2_OFFSET;\
     register u32 data = \
@@ -426,7 +426,7 @@
 }
 
 
-#define PRCMCM_CLKSEL_DSPSYNC_DSPWrite32(baseAddress,value)\
+#define PRCMCM_CLKSEL_DSPSYNC_DSPWrite32(baseAddress, value)\
 {\
     const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;\
     register u32 data = \
@@ -514,7 +514,7 @@
       __raw_readl(((baseAddress))+PRCM_RM_RSTCTRL_DSP_OFFSET))
 
 
-#define PRM_RSTCTRL_IVA2RST1_DSPWrite32(baseAddress,value)\
+#define PRM_RSTCTRL_IVA2RST1_DSPWrite32(baseAddress, value)\
 {\
     const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;\
     register u32 data =\
@@ -529,7 +529,7 @@
 }
 
 
-#define PRM_RSTCTRL_IVA2RST2_DSPWrite32(baseAddress,value)\
+#define PRM_RSTCTRL_IVA2RST2_DSPWrite32(baseAddress, value)\
 {\
     const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;\
     register u32 data =\
@@ -544,7 +544,7 @@
 }
 
 
-#define PRM_RSTCTRL_IVA2RST3_DSPWrite32(baseAddress,value)\
+#define PRM_RSTCTRL_IVA2RST3_DSPWrite32(baseAddress, value)\
 {\
     const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;\
     register u32 data =\
@@ -564,7 +564,7 @@
       __raw_readl(((baseAddress))+PRCM_RM_RSTST_DSP_OFFSET))
 
 
-#define PRCMRM_RSTST_DSPWriteRegister32(baseAddress,value)\
+#define PRCMRM_RSTST_DSPWriteRegister32(baseAddress, value)\
 {\
     const u32 offset = PRCM_RM_RSTST_DSP_OFFSET;\
     register u32 newValue = ((u32)(value));\
drivers/dsp/bridge/hw/hw_mbox.h +16 -28

74 lines not on this page · raw message

drivers/dsp/bridge/pmgr/cmm.c +2 -3
index 556749f..63d1dec 100644
@@ -1044,11 +1044,10 @@ DSP_STATUS CMM_XlatorDelete(struct CMM_XLATOROBJECT *hXlator, bool bForce)
 
 	DBC_Require(cRefs > 0);
 
-	if (MEM_IsValidHandle(pXlator, CMMXLATESIGNATURE)) {
+	if (MEM_IsValidHandle(pXlator, CMMXLATESIGNATURE))
 		MEM_FreeObject(pXlator);
-	} else {
+	else
 		status = DSP_EHANDLE;
-	}
 
 	return status;
 }
drivers/dsp/bridge/pmgr/cod.c +2 -2
index 0bbee3c..979778d 100644
@@ -368,7 +368,7 @@ DSP_STATUS COD_GetBaseName(struct COD_MANAGER *hManager, char *pszName,
 	DBC_Require(pszName != NULL);
 
 	if (uSize <= COD_MAXPATHLENGTH)
-               strncpy(pszName, hManager->szZLFile, uSize);
+		strncpy(pszName, hManager->szZLFile, uSize);
 	else
 		status = DSP_EFAIL;
 
@@ -401,7 +401,7 @@ DSP_STATUS COD_GetEntry(struct COD_MANAGER *hManager, u32 *pulEntry)
  *      Get handle to the DBLL loader.
  */
 DSP_STATUS COD_GetLoader(struct COD_MANAGER *hManager,
-			       struct DBLL_TarObj **phLoader)
+				struct DBLL_TarObj **phLoader)
 {
 	DSP_STATUS status = DSP_SOK;
 
drivers/dsp/bridge/pmgr/dbll.c +23 -22

126 lines not on this page · raw message

drivers/dsp/bridge/pmgr/dev.c +1 -1
index a9cce95..5c5e056 100644
@@ -441,7 +441,7 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_OBJECT *hDevObject)
 
 		/* Call the driver's WMD_DEV_Destroy() function: */
 		/* Require of DevDestroy */
-		if(pDevObject->hWmdContext) {
+		if (pDevObject->hWmdContext) {
 			status = (*pDevObject->intfFxns.pfnDevDestroy)
 				(pDevObject->hWmdContext);
 			pDevObject->hWmdContext = NULL;
drivers/dsp/bridge/rmgr/disp.c +2 -2
index 3b4286b..6ea15b4 100644
@@ -766,8 +766,8 @@ static DSP_STATUS FillStreamDef(RMS_WORD *pdwBuf, u32 *ptotal, u32 offset,
 		 *  1 from total.
 		 */
 		total += sizeof(struct RMS_StrmDef) / sizeof(RMS_WORD) - 1;
-               DBC_Require(strmDef.szDevice);
-               dwLength = strlen(strmDef.szDevice) + 1;
+		DBC_Require(strmDef.szDevice);
+		dwLength = strlen(strmDef.szDevice) + 1;
 
 		/* Number of RMS_WORDS needed to hold device name */
 		uNameLen = (dwLength + uCharsInRMSWord - 1) / uCharsInRMSWord;
drivers/dsp/bridge/rmgr/drv.c +12 -12
index 7ec1ccc..d455c5b 100644
@@ -888,7 +888,7 @@ DSP_STATUS DRV_Init(void)
  *      Insert a DevObject into the list of Manager object.
  */
 DSP_STATUS DRV_InsertDevObject(struct DRV_OBJECT *hDRVObject,
-			       struct DEV_OBJECT *hDevObject)
+				struct DEV_OBJECT *hDevObject)
 {
 	DSP_STATUS status = DSP_SOK;
 	struct DRV_OBJECT *pDRVObject = (struct DRV_OBJECT *)hDRVObject;
@@ -919,7 +919,7 @@ DSP_STATUS DRV_InsertDevObject(struct DRV_OBJECT *hDRVObject,
  *      objects.
  */
 DSP_STATUS DRV_RemoveDevObject(struct DRV_OBJECT *hDRVObject,
-			       struct DEV_OBJECT *hDevObject)
+				struct DEV_OBJECT *hDevObject)
 {
 	DSP_STATUS status = DSP_EFAIL;
 	struct DRV_OBJECT *pDRVObject = (struct DRV_OBJECT *)hDRVObject;
@@ -1001,7 +1001,7 @@ DSP_STATUS DRV_RequestResources(u32 dwContext, u32 *pDevNodeString)
 		*pDevNodeString = 0;
 	}
 
-       if (!(strcmp((char *) dwContext, "TIOMAP1510"))) {
+	if (!(strcmp((char *) dwContext, "TIOMAP1510"))) {
 		GT_0trace(curTrace, GT_1CLASS,
 			  " Allocating resources for UMA \n");
 		status = RequestBridgeResourcesDSP(dwContext, DRV_ASSIGN);
@@ -1034,7 +1034,7 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct DRV_OBJECT *hDrvObject)
 
 	GT_0trace(curTrace, GT_ENTER, "Entering DRV_Release Resources\n");
 
-       if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
+	if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
 	   "TIOMAP1510"))) {
 		GT_0trace(curTrace, GT_1CLASS,
 			 " Releasing DSP-Bridge resources \n");
@@ -1149,10 +1149,10 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest)
 				iounmap(pResources->dwDmmuBase);
 			if (pResources->dwPerBase)
 				iounmap(pResources->dwPerBase);
-                       if (pResources->dwPerPmBase)
-                               iounmap((void *)pResources->dwPerPmBase);
-                       if (pResources->dwCorePmBase)
-                               iounmap((void *)pResources->dwCorePmBase);
+			if (pResources->dwPerPmBase)
+				iounmap((void *)pResources->dwPerPmBase);
+			if (pResources->dwCorePmBase)
+				iounmap((void *)pResources->dwCorePmBase);
 			if (pResources->dwSysCtrlBase) {
 				iounmap(pResources->dwSysCtrlBase);
 				/* don't set pResources->dwSysCtrlBase to null
@@ -1284,10 +1284,10 @@ static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 bRequest)
 							OMAP_DSP_MEM3_SIZE);
 		pResources->dwPerBase = ioremap(OMAP_PER_CM_BASE,
 							OMAP_PER_CM_SIZE);
-               pResources->dwPerPmBase = ioremap(OMAP_PER_PRM_BASE,
-                                                       OMAP_PER_PRM_SIZE);
-               pResources->dwCorePmBase = (u32)ioremap(OMAP_CORE_PRM_BASE,
-                                                       OMAP_CORE_PRM_SIZE);
+		pResources->dwPerPmBase = ioremap(OMAP_PER_PRM_BASE,
+							OMAP_PER_PRM_SIZE);
+		pResources->dwCorePmBase = (u32)ioremap(OMAP_CORE_PRM_BASE,
+							OMAP_CORE_PRM_SIZE);
 		pResources->dwDmmuBase = ioremap(OMAP_DMMU_BASE,
 							OMAP_DMMU_SIZE);
 		pResources->dwWdTimerDspBase = NULL;
drivers/dsp/bridge/rmgr/drv_interface.c +6 -6
index 030bf14..09f212e 100644
@@ -169,7 +169,7 @@ static char *driver_name = DRIVER_NAME;
 static struct GT_Mask driverTrace;
 #endif /* CONFIG_BRIDGE_DEBUG */
 
-static struct file_operations bridge_fops = {
+static const struct file_operations bridge_fops = {
 	.open		= bridge_open,
 	.release	= bridge_release,
 	.unlocked_ioctl	= bridge_ioctl,
@@ -653,7 +653,7 @@ DSP_STATUS DRV_RemoveAllResources(HANDLE hPCtxt)
  * sysfs
  */
 static ssize_t drv_state_show(struct kobject *kobj, struct kobj_attribute *attr,
-                        char *buf)
+				char *buf)
 {
 	struct WMD_DEV_CONTEXT *dwContext;
 	struct DEV_OBJECT *hDevObject = NULL;
@@ -670,18 +670,18 @@ static ssize_t drv_state_show(struct kobject *kobj, struct kobj_attribute *attr,
 		drv_state = dwContext->dwBrdState;
 	}
 
-        return sprintf(buf, "%d\n", drv_state);
+	return sprintf(buf, "%d\n", drv_state);
 }
 
 static struct kobj_attribute drv_state_attr = __ATTR_RO(drv_state);
 
 static struct attribute *attrs[] = {
-        &drv_state_attr.attr,
-        NULL,
+	&drv_state_attr.attr,
+	NULL,
 };
 
 static struct attribute_group attr_group = {
-        .attrs = attrs,
+	.attrs = attrs,
 };
 
 static void bridge_create_sysfs(void)
drivers/dsp/bridge/rmgr/nldr.c +14 -14
index 336a2fd..8f5139c 100644
@@ -93,15 +93,15 @@
 #define FLAGBIT	 7	/* 7th bit is pref./req. flag */
 #define SEGMASK	 0x3f	/* Bits 0 - 5 */
 
-#define CREATEBIT       0	/* Create segid starts at bit 0 */
-#define DELETEBIT       8	/* Delete segid starts at bit 8 */
+#define CREATEBIT	0	/* Create segid starts at bit 0 */
+#define DELETEBIT	8	/* Delete segid starts at bit 8 */
 #define EXECUTEBIT      16	/* Execute segid starts at bit 16 */
 
 /*
  *  Masks that define memory type.  Must match defines in dynm.cdb.
  */
-#define DYNM_CODE       0x2
-#define DYNM_DATA       0x4
+#define DYNM_CODE	0x2
+#define DYNM_DATA	0x4
 #define DYNM_CODEDATA   (DYNM_CODE | DYNM_DATA)
 #define DYNM_INTERNAL   0x8
 #define DYNM_EXTERNAL   0x10
@@ -151,7 +151,7 @@
 	((uuid1).usData3 == (uuid2).usData3) && \
 	((uuid1).ucData4 == (uuid2).ucData4) && \
 	((uuid1).ucData5 == (uuid2).ucData5) && \
-       (strncmp((void *)(uuid1).ucData6, (void *)(uuid2).ucData6, 6)) == 0)
+	(strncmp((void *)(uuid1).ucData6, (void *)(uuid2).ucData6, 6)) == 0)
 
     /*
      *  ======== MemInfo ========
@@ -1005,9 +1005,9 @@ static DSP_STATUS AddOvlyInfo(void *handle, struct DBLL_SectInfo *sectInfo,
 	/* Find the node it belongs to */
 	for (i = 0; i < hNldr->nOvlyNodes; i++) {
 		pNodeName = hNldr->ovlyTable[i].pNodeName;
-               DBC_Require(pNodeName);
-               if (strncmp(pNodeName, pSectName + 1,
-                               strlen(pNodeName)) == 0) {
+		DBC_Require(pNodeName);
+		if (strncmp(pNodeName, pSectName + 1,
+				strlen(pNodeName)) == 0) {
 				/* Found the node */
 				break;
 		}
@@ -1021,14 +1021,14 @@ static DSP_STATUS AddOvlyInfo(void *handle, struct DBLL_SectInfo *sectInfo,
 
 	if (*pch) {
 		pch++;	/* Skip over the ':' */
-               if (strncmp(pch, PCREATE, strlen(PCREATE)) == 0) {
+		if (strncmp(pch, PCREATE, strlen(PCREATE)) == 0) {
 			status = AddOvlySect(hNldr, &hNldr->ovlyTable[i].
 				pCreateSects, sectInfo, &fExists, addr, nBytes);
 			if (DSP_SUCCEEDED(status) && !fExists)
 				hNldr->ovlyTable[i].nCreateSects++;
 
 		} else
-               if (strncmp(pch, PDELETE, strlen(PDELETE)) == 0) {
+		if (strncmp(pch, PDELETE, strlen(PDELETE)) == 0) {
 			status = AddOvlySect(hNldr, &hNldr->ovlyTable[i].
 					    pDeleteSects, sectInfo, &fExists,
 					    addr, nBytes);
@@ -1036,7 +1036,7 @@ static DSP_STATUS AddOvlyInfo(void *handle, struct DBLL_SectInfo *sectInfo,
 				hNldr->ovlyTable[i].nDeleteSects++;
 
 		} else
-               if (strncmp(pch, PEXECUTE, strlen(PEXECUTE)) == 0) {
+		if (strncmp(pch, PEXECUTE, strlen(PEXECUTE)) == 0) {
 			status = AddOvlySect(hNldr, &hNldr->ovlyTable[i].
 					    pExecuteSects, sectInfo, &fExists,
 					    addr, nBytes);
@@ -1086,14 +1086,14 @@ static DSP_STATUS AddOvlyNode(struct DSP_UUID *pUuid,
 		} else {
 			/* Add node to table */
 			hNldr->ovlyTable[hNldr->nNode].uuid = *pUuid;
-                       DBC_Require(objDef.objData.nodeObj.ndbProps.acName);
-                       uLen = strlen(objDef.objData.nodeObj.ndbProps.acName);
+			DBC_Require(objDef.objData.nodeObj.ndbProps.acName);
+			uLen = strlen(objDef.objData.nodeObj.ndbProps.acName);
 			pNodeName = objDef.objData.nodeObj.ndbProps.acName;
 			pBuf = MEM_Calloc(uLen + 1, MEM_PAGED);
 			if (pBuf == NULL) {
 				status = DSP_EMEMORY;
 			} else {
-                               strncpy(pBuf, pNodeName, uLen);
+				strncpy(pBuf, pNodeName, uLen);
 				hNldr->ovlyTable[hNldr->nNode].pNodeName = pBuf;
 				hNldr->nNode++;
 			}
drivers/dsp/bridge/rmgr/node.c +103 -106

411 lines not on this page · raw message

drivers/dsp/bridge/rmgr/proc.c +7 -7
index bfffb38..29860a0 100644
@@ -294,8 +294,8 @@ static DSP_STATUS GetExecFile(struct CFG_DEVNODE *hDevNode,
 		return CFG_GetExecFile(hDevNode, size, execFile);
 	} else if (devType == IVA_UNIT) {
 		if (iva_img) {
-                       len = strlen(iva_img);
-                       strncpy(execFile, iva_img, len + 1);
+			len = strlen(iva_img);
+			strncpy(execFile, iva_img, len + 1);
 			return DSP_SOK;
 		}
 	}
@@ -537,8 +537,8 @@ DSP_STATUS PROC_Detach(struct PROCESS_CONTEXT *pr_ctxt)
  *      on a DSP processor.
  */
 DSP_STATUS PROC_EnumNodes(DSP_HPROCESSOR hProcessor, OUT DSP_HNODE *aNodeTab,
-               IN u32 uNodeTabSize, OUT u32 *puNumNodes,
-               OUT u32 *puAllocated)
+		IN u32 uNodeTabSize, OUT u32 *puNumNodes,
+		OUT u32 *puAllocated)
 {
 	DSP_STATUS status = DSP_EFAIL;
 	struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
@@ -1092,13 +1092,13 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hProcessor, IN CONST s32 iArgc,
 				DBC_Assert(pProcObject->g_pszLastCoff == NULL);
 				/* Allocate memory for pszLastCoff */
 				pProcObject->g_pszLastCoff = MEM_Calloc(
-                                       (strlen((char *)aArgv[0]) + 1),
+					(strlen((char *)aArgv[0]) + 1),
 					MEM_PAGED);
 				/* If memory allocated, save COFF file name*/
 				if (pProcObject->g_pszLastCoff) {
-                                       strncpy(pProcObject->g_pszLastCoff,
+					strncpy(pProcObject->g_pszLastCoff,
 						(char *)aArgv[0],
-                                       (strlen((char *)aArgv[0]) + 1));
+						(strlen((char *)aArgv[0]) + 1));
 				}
 			}
 		}
drivers/dsp/bridge/services/cfg.c +9 -9
index 9667a08..fcdf682 100644
@@ -113,7 +113,7 @@ DSP_STATUS CFG_GetDevObject(struct CFG_DEVNODE *hDevNode, OUT u32 *pdwValue)
 	if (DSP_SUCCEEDED(status)) {
 
 		/* check the device string and then call the REG_SetValue*/
-               if (!(strcmp((char *)((struct DRV_EXT *)hDevNode)->szString,
+		if (!(strcmp((char *)((struct DRV_EXT *)hDevNode)->szString,
 							"TIOMAP1510"))) {
 			GT_0trace(CFG_debugMask, GT_1CLASS,
 				  "Fetching DSP Device from "
@@ -152,13 +152,13 @@ DSP_STATUS CFG_GetDSPResources(struct CFG_DEVNODE *hDevNode,
 		  "Entered CFG_GetDSPResources, args: "
 		  "\n\thDevNode:  0x%x\n\tpDSPResTable:  0x%x\n",
 		  hDevNode, pDSPResTable);
-	if (!hDevNode) {
+	if (!hDevNode)
 		status = CFG_E_INVALIDHDEVNODE;
-	} else if (!pDSPResTable) {
+	else if (!pDSPResTable)
 		status = CFG_E_INVALIDPOINTER;
-	} else {
-		status = REG_GetValue(DSPRESOURCES, (u8 *)pDSPResTable,						&dwResSize);
-	}
+	else
+		status = REG_GetValue(DSPRESOURCES, (u8 *)pDSPResTable,
+					&dwResSize);
 	if (DSP_SUCCEEDED(status)) {
 		GT_0trace(CFG_debugMask, GT_1CLASS,
 			  "CFG_GetDSPResources SUCCESS\n");
@@ -217,7 +217,7 @@ DSP_STATUS CFG_GetExecFile(struct CFG_DEVNODE *hDevNode, u32 ulBufSize,
 	}
 #endif
 	DBC_Ensure(((status == DSP_SOK) &&
-                 (strlen(pstrExecFile) <= ulBufSize)) || (status != DSP_SOK));
+		(strlen(pstrExecFile) <= ulBufSize)) || (status != DSP_SOK));
 	return status;
 }
 
@@ -348,11 +348,11 @@ DSP_STATUS CFG_SetDevObject(struct CFG_DEVNODE *hDevNode, u32 dwValue)
 	if (DSP_SUCCEEDED(status)) {
 		/* Store the WCD device object in the Registry */
 
-               if (!(strcmp((char *)hDevNode, "TIOMAP1510"))) {
+		if (!(strcmp((char *)hDevNode, "TIOMAP1510"))) {
 			GT_0trace(CFG_debugMask, GT_1CLASS,
 				  "Registering the DSP Device \n");
 			status = REG_SetValue("DEVICE_DSP", (u8 *)&dwValue,
-					      dwBuffSize);
+						dwBuffSize);
 		} else {
 			GT_0trace(CFG_debugMask, GT_6CLASS,
 				  "Failed to Register Device \n");
drivers/dsp/bridge/services/clk.c +3 -2
index ae317c5..a56f01e 100644
@@ -220,7 +220,7 @@ DSP_STATUS CLK_Set_32KHz(IN enum SERVICES_ClkId clk_id)
 	pClk = SERVICES_Clks[clk_id].clk_handle;
 	if (pClk) {
 		if (!(clk_set_parent(pClk, pClkParent) == 0x0)) {
-		       GT_2trace(CLK_debugMask, GT_7CLASS, "CLK_Set_32KHz: "
+			GT_2trace(CLK_debugMask, GT_7CLASS, "CLK_Set_32KHz: "
 				"Failed to set to 32KHz %s, CLK dev id = %s\n",
 				SERVICES_Clks[clk_id].clk_name,
 				SERVICES_Clks[clk_id].dev);
@@ -323,7 +323,8 @@ s32 CLK_Get_UseCnt(IN enum SERVICES_ClkId clk_id)
 	pClk = SERVICES_Clks[clk_id].clk_handle;
 
 	if (pClk) {
-		useCount =  pClk->usecount; /* FIXME: usecount shouldn't be used */
+		/* FIXME: usecount shouldn't be used */
+		useCount = pClk->usecount;
 	} else {
 		GT_2trace(CLK_debugMask, GT_7CLASS,
 			 "CLK_GetRate: failed to get CLK %s, "
drivers/dsp/bridge/services/dbg.c +1 -1
index bc57fa8..bc5c8cd 100644
@@ -33,7 +33,7 @@
 static struct GT_Mask DBG_debugMask = { NULL, NULL };	/* GT trace var. */
 #endif
 
-#if (defined(DEBUG) || defined (DDSP_DEBUG_PRODUCT)) && GT_TRACE
+#if (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
 
 /*
  *  ======== DBG_Init ========
drivers/dsp/bridge/services/regsup.c +7 -7
index 5c2421b..4376b36 100644
@@ -129,7 +129,7 @@ DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 *dataSize)
 	/*  Need to search through the entries looking for the right one.  */
 	for (i = 0; i < pRegKey->numValueEntries; i++) {
 		/*  See if the name matches.  */
-               if (strncmp(pRegKey->values[i].name, valName,
+		if (strncmp(pRegKey->values[i].name, valName,
 		    BRIDGE_MAX_NAME_SIZE) == 0) {
 
 			/*  We have a match!  Copy out the data.  */
@@ -171,7 +171,7 @@ DSP_STATUS regsupSetValue(char *valName, void *pBuf, u32 dataSize)
 	/*  Need to search through the entries looking for the right one.  */
 	for (i = 0; i < pRegKey->numValueEntries; i++) {
 		/*  See if the name matches.  */
-               if (strncmp(pRegKey->values[i].name, valName,
+		if (strncmp(pRegKey->values[i].name, valName,
 		    BRIDGE_MAX_NAME_SIZE) == 0) {
 			/*  Make sure the new data size is the same.  */
 			if (dataSize != pRegKey->values[i].dataSize) {
@@ -247,16 +247,16 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char *pstrKey,
 	/*  Need to search through the entries looking for the right one.  */
 	for (i = 0; i < pRegKey->numValueEntries; i++) {
 		/*  See if the name matches.  */
-               if ((strncmp(pRegKey->values[i].name, pstrKey,
+		if ((strncmp(pRegKey->values[i].name, pstrKey,
 		    dwKeyLen) == 0) && count++ == dwIndex) {
 			/*  We have a match!  Copy out the data.  */
 			memcpy(pstrData, pRegKey->values[i].pData,
 				pRegKey->values[i].dataSize);
 			/*  Get the size for the caller.  */
 			*pdwDataSize = pRegKey->values[i].dataSize;
-                       *pdwValueSize = strlen(&(pRegKey->
+			*pdwValueSize = strlen(&(pRegKey->
 						values[i].name[dwKeyLen]));
-                       strncpy(pstrValue,
+			strncpy(pstrValue,
 				    &(pRegKey->values[i].name[dwKeyLen]),
 				    *pdwValueSize + 1);
 			GT_3trace(REG_debugMask, GT_2CLASS,
@@ -285,7 +285,7 @@ DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue)
 	for (i = 0; ((i < BRIDGE_MAX_NUM_REG_ENTRIES) &&
 	    (i < pRegKey->numValueEntries)); i++) {
 		/*  See if the name matches...  */
-               if (strncmp(pRegKey->values[i].name, pstrValue,
+		if (strncmp(pRegKey->values[i].name, pstrValue,
 		    BRIDGE_MAX_NAME_SIZE) == 0) {
 			/* We have a match!  Delete this key.  To delete a
 			 * key, we free all resources associated with this
@@ -301,7 +301,7 @@ DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue)
 				pRegKey->values[i].pData = NULL;
 			} else {
 				/* move the last one here */
-                               strncpy(pRegKey->values[i].name, pRegKey->
+				strncpy(pRegKey->values[i].name, pRegKey->
 				    values[pRegKey->numValueEntries - 1].name,
 				    BRIDGE_MAX_NAME_SIZE);
 				pRegKey->values[i].dataSize =
drivers/dsp/bridge/wmd/_tiomap.h +24 -24

66 lines not on this page · raw message

drivers/dsp/bridge/wmd/chnl_sm.c +1 -1
index 61dc84f..a3ea624 100644
@@ -861,7 +861,7 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL_OBJECT **phChnl,
 			pChnl->uMode = uMode;
 			pChnl->hUserEvent = hSyncEvent;	/* for Linux */
 			pChnl->hSyncEvent = hSyncEvent;
-                       /* get the process handle */
+			/* Get the process handle */
 			pChnl->hProcess = current->tgid;
 			pChnl->pCBArg = 0;
 			pChnl->cBytesMoved = 0;
drivers/dsp/bridge/wmd/io_sm.c +195 -201

551 lines not on this page · raw message

drivers/dsp/bridge/wmd/mmu_fault.c +2 -1
index b6cbbb3..bb98e56 100644
@@ -140,7 +140,8 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext)
 		DBG_Trace(DBG_LEVEL7, "**Failed to get Host Resources in "
 			 "MMU_CheckIfFault **\n");
 
-	hwStatus = HW_MMU_EventStatus(pDevContext->dwDSPMmuBase, &dmmuEventMask);
+	hwStatus = HW_MMU_EventStatus(pDevContext->dwDSPMmuBase,
+					&dmmuEventMask);
 	if (dmmuEventMask  ==  HW_MMU_TRANSLATION_FAULT) {
 		HW_MMU_FaultAddrRead(pDevContext->dwDSPMmuBase, &faultAddr);
 		DBG_Trace(DBG_LEVEL1, "WMD_DEH_Notify: DSP_MMUFAULT, fault "
drivers/dsp/bridge/wmd/msg_sm.c +38 -39

152 lines not on this page · raw message

drivers/dsp/bridge/wmd/tiomap3430.c +14 -9
index c73cea7..cfa8868 100644
@@ -340,12 +340,14 @@ static DSP_STATUS WMD_BRD_Monitor(struct WMD_DEV_CONTEXT *hDevContext)
 					  HW_PWR_DOMAIN_DSP,
 					  HW_PWR_STATE_ON);
 		/* Set the SW supervised state transition */
-		HW_PWR_CLKCTRL_IVA2RegSet(pDevContext->cmbase, HW_SW_SUP_WAKEUP);
+		HW_PWR_CLKCTRL_IVA2RegSet(pDevContext->cmbase,
+							HW_SW_SUP_WAKEUP);
 		/* Wait until the state has moved to ON */
 		HW_PWR_IVA2StateGet(pDevContext->prmbase, HW_PWR_DOMAIN_DSP,
 				     &pwrState);
 		/* Disable Automatic transition */
-		HW_PWR_CLKCTRL_IVA2RegSet(pDevContext->cmbase, HW_AUTOTRANS_DIS);
+		HW_PWR_CLKCTRL_IVA2RegSet(pDevContext->cmbase,
+							HW_AUTOTRANS_DIS);
 	}
 	DBG_Trace(DBG_LEVEL6, "WMD_BRD_Monitor - Middle ****** \n");
 	GetHWRegs(pDevContext->prmbase, pDevContext->cmbase);
@@ -490,7 +492,7 @@ static DSP_STATUS WMD_BRD_Start(struct WMD_DEV_CONTEXT *hDevContext,
 		if (dsp_debug) {
 			/* Set the bootmode to self loop  */
 			DBG_Trace(DBG_LEVEL7,
-					"Set boot mode to self loop for IVA2 Device\n");
+				"Set boot mode to self loop for IVA2 Device\n");
 			HW_DSPSS_BootModeSet(pDevContext->sysctrlbase,
 				HW_DSPSYSC_SELFLOOPBOOT, dwDSPAddr);
 		} else {
@@ -540,8 +542,8 @@ static DSP_STATUS WMD_BRD_Start(struct WMD_DEV_CONTEXT *hDevContext,
 		}		/* end for */
 
 		/*
-		 * Lock the above TLB entries and get the BIOS and load monitor timer
-		 * information
+		 * Lock the above TLB entries and get the BIOS and load
+		 * monitor timer information
 		 */
 		HW_MMU_NumLockedSet(pDevContext->dwDSPMmuBase, itmpEntryNdx);
 		HW_MMU_VictimNumSet(pDevContext->dwDSPMmuBase, itmpEntryNdx);
@@ -559,10 +561,11 @@ static DSP_STATUS WMD_BRD_Start(struct WMD_DEV_CONTEXT *hDevContext,
 
 		/* Enable the BIOS clock  */
 		(void)DEV_GetSymbol(pDevContext->hDevObject,
-					BRIDGEINIT_BIOSGPTIMER, &ulBiosGpTimer);
+				BRIDGEINIT_BIOSGPTIMER, &ulBiosGpTimer);
 		DBG_Trace(DBG_LEVEL7, "BIOS GPTimer : 0x%x\n", ulBiosGpTimer);
 		(void)DEV_GetSymbol(pDevContext->hDevObject,
-				BRIDGEINIT_LOADMON_GPTIMER, &ulLoadMonitorTimer);
+				BRIDGEINIT_LOADMON_GPTIMER,
+				&ulLoadMonitorTimer);
 		DBG_Trace(DBG_LEVEL7, "Load Monitor Timer : 0x%x\n",
 			  ulLoadMonitorTimer);
 
@@ -575,7 +578,8 @@ static DSP_STATUS WMD_BRD_Start(struct WMD_DEV_CONTEXT *hDevContext,
 			DSPPeripheralClkCtrl(pDevContext, &uClkCmd);
 
 			extClkId = uClkCmd & MBX_PM_CLK_IDMASK;
-			for (tmpIndex = 0; tmpIndex < MBX_PM_MAX_RESOURCES; tmpIndex++) {
+			for (tmpIndex = 0; tmpIndex < MBX_PM_MAX_RESOURCES;
+			     tmpIndex++) {
 				if (extClkId == BPWR_CLKID[tmpIndex]) {
 					clkIdIndex = tmpIndex;
 					break;
@@ -583,7 +587,8 @@ static DSP_STATUS WMD_BRD_Start(struct WMD_DEV_CONTEXT *hDevContext,
 			}
 
 			if (clkIdIndex < MBX_PM_MAX_RESOURCES)
-				status = CLK_Set_32KHz(BPWR_Clks[clkIdIndex].funClk);
+				status =
+				    CLK_Set_32KHz(BPWR_Clks[clkIdIndex].funClk);
 			else
 				status = DSP_EFAIL;
 
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +16 -8
index dc20684..f5eb21c 100644
@@ -547,14 +547,18 @@ DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext,
 			status = CLK_Disable(BPWR_Clks[clkIdx].intClk);
 			if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
 				/* clear MCBSP1_CLKS, on McBSP1 OFF */
-				value = __raw_readl(pDevContext->sysctrlbase + 0x274);
+				value = __raw_readl(pDevContext->sysctrlbase
+								+ 0x274);
 				value &= ~(1 << 2);
-				__raw_writel(value, pDevContext->sysctrlbase + 0x274);
+				__raw_writel(value, pDevContext->sysctrlbase
+								+ 0x274);
 			} else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
 				/* clear MCBSP2_CLKS, on McBSP2 OFF */
-				value = __raw_readl(pDevContext->sysctrlbase + 0x274);
+				value = __raw_readl(pDevContext->sysctrlbase
+								+ 0x274);
 				value &= ~(1 << 6);
-				__raw_writel(value, pDevContext->sysctrlbase + 0x274);
+				__raw_writel(value, pDevContext->sysctrlbase
+								+ 0x274);
 			}
 			if (DSP_FAILED(status)) {
 				DBG_Trace(DBG_LEVEL7,
@@ -590,14 +594,18 @@ DSP_STATUS DSP_PeripheralClocks_Enable(struct WMD_DEV_CONTEXT *pDevContext,
 			int_clk_status = CLK_Enable(BPWR_Clks[clkIdx].intClk);
 			if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
 				/* set MCBSP1_CLKS, on McBSP1 ON */
-				value = __raw_readl(pDevContext->sysctrlbase + 0x274);
+				value = __raw_readl(pDevContext->sysctrlbase
+								+ 0x274);
 				value |= 1 << 2;
-				__raw_writel(value, pDevContext->sysctrlbase + 0x274);
+				__raw_writel(value, pDevContext->sysctrlbase
+								+ 0x274);
 			} else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
 				/* set MCBSP2_CLKS, on McBSP2 ON */
-				value = __raw_readl(pDevContext->sysctrlbase + 0x274);
+				value = __raw_readl(pDevContext->sysctrlbase
+								+ 0x274);
 				value |= 1 << 6;
-				__raw_writel(value, pDevContext->sysctrlbase + 0x274);
+				__raw_writel(value, pDevContext->sysctrlbase
+								+ 0x274);
 			}
 			/* Enable the functional clock of the periphearl */
 			fun_clk_status = CLK_Enable(BPWR_Clks[clkIdx].funClk);
drivers/dsp/bridge/wmd/tiomap_sm.c +6 -5
index fb0b661..b74ce68 100644
@@ -65,9 +65,9 @@ DSP_STATUS CHNLSM_EnableInterrupt(struct WMD_DEV_CONTEXT *pDevContext)
 			numMbxMsg--;
 			udelay(10);
 
-			HW_MBOX_EventAck(pDevContext->dwMailBoxBase, MBOX_ARM2DSP,
-					 HW_MBOX_U1_DSP1,
-					 HW_MBOX_INT_NEW_MSG);
+			HW_MBOX_EventAck(pDevContext->dwMailBoxBase,
+					MBOX_ARM2DSP, HW_MBOX_U1_DSP1,
+					HW_MBOX_INT_NEW_MSG);
 		}
 		/* Enable the new message events on this IRQ line */
 		HW_MBOX_EventEnable(pDevContext->dwMailBoxBase,
@@ -158,10 +158,11 @@ bool CHNLSM_ISR(struct WMD_DEV_CONTEXT *pDevContext, bool *pfSchedDPC,
 	HW_MBOX_NumMsgGet(pDevContext->dwMailBoxBase, MBOX_DSP2ARM, &numMbxMsg);
 
 	if (numMbxMsg > 0) {
-		HW_MBOX_MsgRead(pDevContext->dwMailBoxBase, MBOX_DSP2ARM, &mbxValue);
+		HW_MBOX_MsgRead(pDevContext->dwMailBoxBase, MBOX_DSP2ARM,
+				&mbxValue);
 
 		HW_MBOX_EventAck(pDevContext->dwMailBoxBase, MBOX_DSP2ARM,
-				 HW_MBOX_U0_ARM, HW_MBOX_INT_NEW_MSG);
+				HW_MBOX_U0_ARM, HW_MBOX_INT_NEW_MSG);
 
 		DBG_Trace(DBG_LEVEL3, "Read %x from Mailbox\n", mbxValue);
 		*pwIntrVal = (u16) mbxValue;
drivers/dsp/bridge/wmd/ue_deh.c +15 -14
index 658cd73..6d6c76b 100644
@@ -107,11 +107,11 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 			pDehMgr->errInfo.dwVal2 = 0L;
 			pDehMgr->errInfo.dwVal3 = 0L;
 			/* Install ISR function for DSP MMU fault */
-                       if ((request_irq(INT_DSP_MMU_IRQ, MMU_FaultIsr, 0,
-                                           "DspBridge\tiommu fault", (void *)pDehMgr)) == 0)
-                               status = DSP_SOK;
-                       else
-                               status = DSP_EFAIL;
+			if ((request_irq(INT_DSP_MMU_IRQ, MMU_FaultIsr, 0,
+			   "DspBridge\tiommu fault", (void *)pDehMgr)) == 0)
+				status = DSP_SOK;
+			else
+				status = DSP_EFAIL;
 		}
 	}
 	if (DSP_FAILED(status)) {
@@ -120,8 +120,7 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 		*phDehMgr = NULL;
 	} else {
 		*phDehMgr = (struct DEH_MGR *)pDehMgr;
-               DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
-                                        pDehMgr);
+		DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n", pDehMgr);
 	}
 	DBG_Trace(DBG_LEVEL1, "Exiting DEH_Create.\n");
 	return status;
@@ -144,7 +143,7 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
 		if (pDehMgr->hNtfy)
 			(void)NTFY_Delete(pDehMgr->hNtfy);
 		/* Disable DSP MMU fault */
-               free_irq(INT_DSP_MMU_IRQ, pDehMgr);
+		free_irq(INT_DSP_MMU_IRQ, pDehMgr);
 		(void)DPC_Destroy(pDehMgr->hMmuFaultDpc);
 		/* Deallocate the DEH manager object */
 		MEM_FreeObject(pDehMgr);
@@ -249,14 +248,16 @@ DBG_Trace(DBG_LEVEL6, "WMD_DEH_Notify: DSP_MMUFAULT, "
 				 "PA: 0x%x\n", pDevContext->
 				numTLBEntries, faultAddr, memPhysical);
 			if (DSP_SUCCEEDED(status)) {
-				hwStatus = HW_MMU_TLBAdd(pDevContext->dwDSPMmuBase,
-					memPhysical, faultAddr,
-					HW_PAGE_SIZE_4KB, 1, &mapAttrs,
-					HW_SET, HW_SET);
+				hwStatus =
+					HW_MMU_TLBAdd(pDevContext->dwDSPMmuBase,
+						memPhysical, faultAddr,
+						HW_PAGE_SIZE_4KB, 1, &mapAttrs,
+						HW_SET, HW_SET);
 			}
 			/* send an interrupt to DSP */
-			HW_MBOX_MsgWrite(pDevContext->dwMailBoxBase, MBOX_ARM2DSP,
-					 MBX_DEH_CLASS | MBX_DEH_EMMU);
+			HW_MBOX_MsgWrite(pDevContext->dwMailBoxBase,
+					MBOX_ARM2DSP,
+					MBX_DEH_CLASS | MBX_DEH_EMMU);
 			/* Clear MMU interrupt */
 			HW_MMU_EventAck(pDevContext->dwDSPMmuBase,
 					 HW_MMU_TRANSLATION_FAULT);
Signature · 1 line
1.6.2.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 4/9 DSPBRIDGE: Use _IOxx macro to define ioctls

Use standard convention to define ioctls.

Currently 'DB' is used as identifier for dspbridge.

*** NOTE: An update in api ioctl definitions is required. ***

---
 arch/arm/plat-omap/include/dspbridge/wcdioctl.h |  142 ++++++++++-------------
 drivers/dsp/bridge/pmgr/wcd.c                   |  116 +++++++++----------
 2 files changed, 117 insertions(+), 141 deletions(-)
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +63 -79
index 397361c..8aaa1ec 100644
@@ -391,83 +391,67 @@ union Trapped_Args {
 	} ARGS_UTIL_TESTDLL;
 } ;
 
-#define CMD_BASE		    101
-
-/* MGR module offsets */
-#define CMD_MGR_BASE_OFFSET	     CMD_BASE
-#define CMD_MGR_ENUMNODE_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 0)
-#define CMD_MGR_ENUMPROC_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 1)
-#define CMD_MGR_REGISTEROBJECT_OFFSET   (CMD_MGR_BASE_OFFSET + 2)
-#define CMD_MGR_UNREGISTEROBJECT_OFFSET (CMD_MGR_BASE_OFFSET + 3)
-#define CMD_MGR_WAIT_OFFSET	     (CMD_MGR_BASE_OFFSET + 4)
-
-#ifndef RES_CLEANUP_DISABLE
-#define CMD_MGR_RESOUCES_OFFSET	 (CMD_MGR_BASE_OFFSET + 5)
-#define CMD_MGR_END_OFFSET	      CMD_MGR_RESOUCES_OFFSET
-#else
-#define CMD_MGR_END_OFFSET	      CMD_MGR_WAIT_OFFSET
-#endif
-
-#define CMD_PROC_BASE_OFFSET	    (CMD_MGR_END_OFFSET + 1)
-#define CMD_PROC_ATTACH_OFFSET	  (CMD_PROC_BASE_OFFSET + 0)
-#define CMD_PROC_CTRL_OFFSET	    (CMD_PROC_BASE_OFFSET + 1)
-#define CMD_PROC_DETACH_OFFSET	  (CMD_PROC_BASE_OFFSET + 2)
-#define CMD_PROC_ENUMNODE_OFFSET	(CMD_PROC_BASE_OFFSET + 3)
-#define CMD_PROC_ENUMRESOURCES_OFFSET   (CMD_PROC_BASE_OFFSET + 4)
-#define CMD_PROC_GETSTATE_OFFSET	(CMD_PROC_BASE_OFFSET + 5)
-#define CMD_PROC_GETTRACE_OFFSET	(CMD_PROC_BASE_OFFSET + 6)
-#define CMD_PROC_LOAD_OFFSET	    (CMD_PROC_BASE_OFFSET + 7)
-#define CMD_PROC_REGISTERNOTIFY_OFFSET  (CMD_PROC_BASE_OFFSET + 8)
-#define CMD_PROC_START_OFFSET	   (CMD_PROC_BASE_OFFSET + 9)
-#define CMD_PROC_RSVMEM_OFFSET	  (CMD_PROC_BASE_OFFSET + 10)
-#define CMD_PROC_UNRSVMEM_OFFSET	(CMD_PROC_BASE_OFFSET + 11)
-#define CMD_PROC_MAPMEM_OFFSET	  (CMD_PROC_BASE_OFFSET + 12)
-#define CMD_PROC_UNMAPMEM_OFFSET	(CMD_PROC_BASE_OFFSET + 13)
-#define CMD_PROC_FLUSHMEMORY_OFFSET      (CMD_PROC_BASE_OFFSET + 14)
-#define CMD_PROC_STOP_OFFSET	    (CMD_PROC_BASE_OFFSET + 15)
-#define CMD_PROC_INVALIDATEMEMORY_OFFSET (CMD_PROC_BASE_OFFSET + 16)
-#define CMD_PROC_END_OFFSET	     CMD_PROC_INVALIDATEMEMORY_OFFSET
-
-
-#define CMD_NODE_BASE_OFFSET	    (CMD_PROC_END_OFFSET + 1)
-#define CMD_NODE_ALLOCATE_OFFSET	(CMD_NODE_BASE_OFFSET + 0)
-#define CMD_NODE_ALLOCMSGBUF_OFFSET     (CMD_NODE_BASE_OFFSET + 1)
-#define CMD_NODE_CHANGEPRIORITY_OFFSET  (CMD_NODE_BASE_OFFSET + 2)
-#define CMD_NODE_CONNECT_OFFSET	 (CMD_NODE_BASE_OFFSET + 3)
-#define CMD_NODE_CREATE_OFFSET	  (CMD_NODE_BASE_OFFSET + 4)
-#define CMD_NODE_DELETE_OFFSET	  (CMD_NODE_BASE_OFFSET + 5)
-#define CMD_NODE_FREEMSGBUF_OFFSET      (CMD_NODE_BASE_OFFSET + 6)
-#define CMD_NODE_GETATTR_OFFSET	 (CMD_NODE_BASE_OFFSET + 7)
-#define CMD_NODE_GETMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 8)
-#define CMD_NODE_PAUSE_OFFSET	   (CMD_NODE_BASE_OFFSET + 9)
-#define CMD_NODE_PUTMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 10)
-#define CMD_NODE_REGISTERNOTIFY_OFFSET  (CMD_NODE_BASE_OFFSET + 11)
-#define CMD_NODE_RUN_OFFSET	     (CMD_NODE_BASE_OFFSET + 12)
-#define CMD_NODE_TERMINATE_OFFSET       (CMD_NODE_BASE_OFFSET + 13)
-#define CMD_NODE_GETUUIDPROPS_OFFSET    (CMD_NODE_BASE_OFFSET + 14)
-#define CMD_NODE_END_OFFSET	     CMD_NODE_GETUUIDPROPS_OFFSET
-
-#define CMD_STRM_BASE_OFFSET	    (CMD_NODE_END_OFFSET + 1)
-#define CMD_STRM_ALLOCATEBUFFER_OFFSET  (CMD_STRM_BASE_OFFSET + 0)
-#define CMD_STRM_CLOSE_OFFSET	   (CMD_STRM_BASE_OFFSET + 1)
-#define CMD_STRM_FREEBUFFER_OFFSET      (CMD_STRM_BASE_OFFSET + 2)
-#define CMD_STRM_GETEVENTHANDLE_OFFSET  (CMD_STRM_BASE_OFFSET + 3)
-#define CMD_STRM_GETINFO_OFFSET	 (CMD_STRM_BASE_OFFSET + 4)
-#define CMD_STRM_IDLE_OFFSET	    (CMD_STRM_BASE_OFFSET + 5)
-#define CMD_STRM_ISSUE_OFFSET	   (CMD_STRM_BASE_OFFSET + 6)
-#define CMD_STRM_OPEN_OFFSET	    (CMD_STRM_BASE_OFFSET + 7)
-#define CMD_STRM_RECLAIM_OFFSET	 (CMD_STRM_BASE_OFFSET + 8)
-#define CMD_STRM_REGISTERNOTIFY_OFFSET  (CMD_STRM_BASE_OFFSET + 9)
-#define CMD_STRM_SELECT_OFFSET	  (CMD_STRM_BASE_OFFSET + 10)
-#define CMD_STRM_END_OFFSET	     CMD_STRM_SELECT_OFFSET
-
-/* Communication Memory Manager (UCMM) */
-#define CMD_CMM_BASE_OFFSET	     (CMD_STRM_END_OFFSET + 1)
-#define CMD_CMM_ALLOCBUF_OFFSET	 (CMD_CMM_BASE_OFFSET + 0)
-#define CMD_CMM_FREEBUF_OFFSET	  (CMD_CMM_BASE_OFFSET + 1)
-#define CMD_CMM_GETHANDLE_OFFSET	(CMD_CMM_BASE_OFFSET + 2)
-#define CMD_CMM_GETINFO_OFFSET	  (CMD_CMM_BASE_OFFSET + 3)
-#define CMD_CMM_END_OFFSET	      CMD_CMM_GETINFO_OFFSET
-
-#define CMD_BASE_END_OFFSET	CMD_CMM_END_OFFSET
+/* MGR module */
+#define MGR_ENUMNODE_INFO	_IOWR('DB', 0, unsigned long)
+#define MGR_ENUMPROC_INFO	_IOWR('DB', 1, unsigned long)
+#define MGR_REGISTEROBJECT	_IOWR('DB', 2, unsigned long)
+#define MGR_UNREGISTEROBJECT	_IOWR('DB', 3, unsigned long)	/* Deprecated */
+#define MGR_WAIT		_IOWR('DB', 4, unsigned long)
+#define MGR_GET_PROC_RES	_IOR('DB', 5, unsigned long)	/* Deprecated */
+
+/* PROC Module */
+#define PROC_ATTACH		_IOWR('DB', 6, unsigned long)
+#define PROC_CTRL		_IOR('DB', 7, unsigned long)
+#define PROC_DETACH		_IOR('DB', 8, unsigned long)	/* Deprecated */
+#define PROC_ENUMNODE		_IOWR('DB', 9, unsigned long)
+#define PROC_ENUMRESOURCES	_IOWR('DB', 10, unsigned long)
+#define PROC_GET_STATE		_IOWR('DB', 11, unsigned long)
+#define PROC_GET_TRACE		_IOWR('DB', 12, unsigned long)
+#define PROC_LOAD		_IOW('DB', 13, unsigned long)
+#define PROC_REGISTERNOTIFY	_IOWR('DB', 14, unsigned long)
+#define PROC_START		_IOW('DB', 15, unsigned long)
+#define PROC_RSVMEM		_IOWR('DB', 16, unsigned long)
+#define PROC_UNRSVMEM		_IOW('DB', 17, unsigned long)
+#define PROC_MAPMEM		_IOWR('DB', 18, unsigned long)
+#define PROC_UNMAPMEM		_IOR('DB', 19, unsigned long)
+#define PROC_FLUSHMEMORY	_IOW('DB', 20, unsigned long)
+#define PROC_STOP		_IOWR('DB', 21, unsigned long)
+#define PROC_INVALIDATEMEMORY	_IOW('DB', 22, unsigned long)
+
+/* NODE Module */
+#define NODE_ALLOCATE		_IOWR('DB', 23, unsigned long)
+#define NODE_ALLOCMSGBUF	_IOWR('DB', 24, unsigned long)
+#define NODE_CHANGEPRIORITY	_IOW('DB', 25, unsigned long)
+#define NODE_CONNECT		_IOW('DB', 26, unsigned long)
+#define NODE_CREATE		_IOW('DB', 27, unsigned long)
+#define NODE_DELETE		_IOW('DB', 28, unsigned long)
+#define NODE_FREEMSGBUF		_IOW('DB', 29, unsigned long)
+#define NODE_GETATTR		_IOWR('DB', 30, unsigned long)
+#define NODE_GETMESSAGE		_IOWR('DB', 31, unsigned long)
+#define NODE_PAUSE		_IOW('DB', 32, unsigned long)
+#define NODE_PUTMESSAGE		_IOW('DB', 33, unsigned long)
+#define NODE_REGISTERNOTIFY	_IOWR('DB', 34, unsigned long)
+#define NODE_RUN		_IOW('DB', 35, unsigned long)
+#define NODE_TERMINATE		_IOWR('DB', 36, unsigned long)
+#define NODE_GETUUIDPROPS	_IOWR('DB', 37, unsigned long)
+
+/* STRM Module */
+#define STRM_ALLOCATEBUFFER	_IOWR('DB', 38, unsigned long)
+#define STRM_CLOSE		_IOW('DB', 39, unsigned long)
+#define STRM_FREEBUFFER		_IOWR('DB', 40, unsigned long)
+#define STRM_GETEVENTHANDLE	_IO('DB', 41)			/* Not Impl'd */
+#define STRM_GETINFO		_IOWR('DB', 42, unsigned long)
+#define STRM_IDLE		_IOW('DB', 43, unsigned long)
+#define STRM_ISSUE		_IOW('DB', 44, unsigned long)
+#define STRM_OPEN		_IOWR('DB', 45, unsigned long)
+#define STRM_RECLAIM		_IOWR('DB', 46, unsigned long)
+#define STRM_REGISTERNOTIFY	_IOWR('DB', 47, unsigned long)
+#define STRM_SELECT		_IOWR('DB', 48, unsigned long)
+
+/* CMM Module */
+#define CMM_ALLOCBUF		_IO('DB', 49)			/* Not Impl'd */
+#define CMM_FREEBUF		_IO('DB', 50)			/* Not Impl'd */
+#define CMM_GETHANDLE		_IOR('DB', 51, unsigned long)
+#define CMM_GETINFO		_IOR('DB', 52, unsigned long)
+
 #endif				/* WCDIOCTL_ */
drivers/dsp/bridge/pmgr/wcd.c +54 -62

141 lines not on this page · raw message

Signature · 1 line
1.6.2.4
#5 lore raw

PATCH 5/9 DSPBRIDGE: trivial cleanup and indentation for io_sm

Remove duplicate set of braces from if statement and reduce indentation.

---
 drivers/dsp/bridge/wmd/io_sm.c |   96 +++++++++++++++++-----------------------
 1 files changed, 40 insertions(+), 56 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +40 -56
index af31831..96a5aa6 100644
@@ -115,7 +115,7 @@ struct IO_MGR {
 	/* private extnd proc info; mmu setup */
 	struct MGR_PROCESSOREXTINFO extProcInfo;
 	struct CMM_OBJECT *hCmmMgr; 	/* Shared Mem Mngr	      */
-       struct work_struct io_workq;     /*workqueue */
+	struct work_struct io_workq;     /*workqueue */
 	u32 dQuePowerMbxVal[MAX_PM_REQS];
 	u32 iQuePowerHead;
 	u32 iQuePowerTail;
@@ -185,7 +185,7 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 	struct CFG_HOSTRES hostRes;
 	struct CFG_DEVNODE *hDevNode;
 	struct CHNL_MGR *hChnlMgr;
-       static int ref_count;
+	static int ref_count;
 	u32 devType;
 	/* Check requirements:  */
 	if (!phIOMgr || !pMgrAttrs || pMgrAttrs->uWordSize == 0) {
@@ -197,9 +197,10 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 		status = DSP_EHANDLE;
 		goto func_end;
 	}
-	 /*  Message manager will be created when a file is loaded, since
+	/*  Message manager will be created when a file is loaded, since
 	 *  size of message buffer in shared memory is configurable in
-	 *  the base image.  */
+	 *  the base image.
+	 */
 	DEV_GetWMDContext(hDevObject, &hWmdContext);
 	if (!hWmdContext) {
 		status = DSP_EHANDLE;
@@ -209,7 +210,8 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 	/*  DSP shared memory area will get set properly when
 	 *  a program is loaded. They are unknown until a COFF file is
 	 *  loaded. I chose the value -1 because it was less likely to be
-	 *  a valid address than 0.  */
+	 *  a valid address than 0.
+	 */
 	pSharedMem = (struct SHM *) -1;
 	if (DSP_FAILED(status))
 		goto func_cont;
@@ -230,7 +232,7 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 		status = DSP_EMEMORY;
 		goto func_cont;
 	}
-	/*Intializing Work Element*/
+	/* Intializing Work Element */
 	if (ref_count == 0) {
 		INIT_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
 		ref_count = 1;
@@ -319,7 +321,7 @@ DSP_STATUS WMD_IO_Destroy(struct IO_MGR *hIOMgr)
 		SYNC_DeleteCS(hIOMgr->hCSObj); 	/* Leak Fix. */
 		/* Free this IO manager object: */
 		MEM_FreeObject(hIOMgr);
-       } else
+	} else
 		status = DSP_EHANDLE;
 
 	return status;
@@ -445,19 +447,16 @@ func_cont1:
 #endif
 		if (DSP_FAILED(status))
 			status = CHNL_E_NOMEMMAP;
-
 	}
 	if (DSP_SUCCEEDED(status)) {
 		status = COD_GetSymValue(hCodMan, DYNEXTBASE, &ulDynExtBase);
 		if (DSP_FAILED(status))
 			status = CHNL_E_NOMEMMAP;
-
 	}
 	if (DSP_SUCCEEDED(status)) {
 		status = COD_GetSymValue(hCodMan, EXTEND, &ulExtEnd);
 		if (DSP_FAILED(status))
 			status = CHNL_E_NOMEMMAP;
-
 	}
 	if (DSP_SUCCEEDED(status)) {
 		/* Get memory reserved in host resources */
@@ -609,7 +608,7 @@ func_cont1:
 		}
 	}
 
-	 /* Copy remaining entries from CDB. All entries are 1 MB and should not
+	/* Copy remaining entries from CDB. All entries are 1 MB and should not
 	 * conflict with SHM entries on MPU or DSP side */
 	for (i = 3; i < 7 && ndx < WMDIOCTL_NUMOFMMUTLB &&
 	    DSP_SUCCEEDED(status); i++) {
@@ -726,9 +725,9 @@ func_cont:
 			}
 			DBC_Assert(ulShmBase != 0);
 			if (DSP_SUCCEEDED(status)) {
+				/* Register SM */
 				status = registerSHMSegs(hIOMgr, hCodMan,
 					 aEProc[0].ulGppPa);
-				/* Register SM */
 			}
 		}
 	}
@@ -780,7 +779,6 @@ func_cont:
 				 &hIOMgr->ulTraceBufferBegin);
 			if (DSP_FAILED(status))
 				status = CHNL_E_NOMEMMAP;
-
 		}
 		hIOMgr->ulGPPReadPointer = hIOMgr->ulTraceBufferBegin =
 			(ulGppVa + ulSeg1Size + ulPadSize) +
@@ -791,7 +789,6 @@ func_cont:
 				 &hIOMgr->ulTraceBufferEnd);
 			if (DSP_FAILED(status))
 				status = CHNL_E_NOMEMMAP;
-
 		}
 		hIOMgr->ulTraceBufferEnd = (ulGppVa + ulSeg1Size + ulPadSize) +
 					   (hIOMgr->ulTraceBufferEnd - ulDspVa);
@@ -802,7 +799,6 @@ func_cont:
 				 &hIOMgr->ulTraceBufferCurrent);
 			if (DSP_FAILED(status))
 				status = CHNL_E_NOMEMMAP;
-
 		}
 		hIOMgr->ulTraceBufferCurrent = (ulGppVa + ulSeg1Size +
 						ulPadSize) + (hIOMgr->
@@ -957,9 +953,7 @@ static void IO_DispatchPM(struct work_struct *work)
 		pIOMgr->iQuePowerTail++;
 		if (pIOMgr->iQuePowerTail >= MAX_PM_REQS)
 			pIOMgr->iQuePowerTail = 0;
-
 	}
-
 }
 
 /*
@@ -988,7 +982,6 @@ void IO_DPC(IN OUT void *pRefData)
 		/* notify DSP/BIOS exception */
 		if (hDehMgr)
 			WMD_DEH_Notify(hDehMgr, DSP_SYSERROR, pIOMgr->wIntrVal);
-
 	}
 	IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
 #ifdef CHNL_MESSAGES
@@ -1002,15 +995,10 @@ void IO_DPC(IN OUT void *pRefData)
 			PrintDSPDebugTrace(pIOMgr);
 	}
 #endif
-
-#ifndef DSP_TRACEBUF_DISABLED
-	PrintDSPDebugTrace(pIOMgr);
-#endif
 func_end:
 	return;
 }
 
-
 /*
  *  ======== IO_ISR ========
  *      Main interrupt handler for the shared memory IO manager.
@@ -1028,29 +1016,28 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
 
 	/* Call WMD's CHNLSM_ISR() to see if interrupt is ours, and process. */
 	if (IO_CALLISR(hIOMgr->hWmdContext, &fSchedDPC, &hIOMgr->wIntrVal)) {
-		{
-			DBG_Trace(DBG_LEVEL3, "IO_ISR %x\n", hIOMgr->wIntrVal);
-			if (hIOMgr->wIntrVal & MBX_PM_CLASS) {
-				hIOMgr->dQuePowerMbxVal[hIOMgr->iQuePowerHead] =
-					hIOMgr->wIntrVal;
-				hIOMgr->iQuePowerHead++;
-				if (hIOMgr->iQuePowerHead >= MAX_PM_REQS)
-					hIOMgr->iQuePowerHead = 0;
-
-				queue_work(bridge_workqueue, &hIOMgr->io_workq);
-			}
-			if (hIOMgr->wIntrVal == MBX_DEH_RESET) {
-				DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
-				hIOMgr->wIntrVal = 0;
-			} else if (fSchedDPC) {
-				/* PROC-COPY defer i/o  */
-				DPC_Schedule(hIOMgr->hDPC);
-			}
+		DBG_Trace(DBG_LEVEL3, "IO_ISR %x\n", hIOMgr->wIntrVal);
+		if (hIOMgr->wIntrVal & MBX_PM_CLASS) {
+			hIOMgr->dQuePowerMbxVal[hIOMgr->iQuePowerHead] =
+				hIOMgr->wIntrVal;
+			hIOMgr->iQuePowerHead++;
+			if (hIOMgr->iQuePowerHead >= MAX_PM_REQS)
+				hIOMgr->iQuePowerHead = 0;
+
+			queue_work(bridge_workqueue, &hIOMgr->io_workq);
+		}
+		if (hIOMgr->wIntrVal == MBX_DEH_RESET) {
+			DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
+			hIOMgr->wIntrVal = 0;
+		} else if (fSchedDPC) {
+			/* PROC-COPY defer i/o  */
+			DPC_Schedule(hIOMgr->hDPC);
 		}
-       } else
+	} else
 		/* Ensure that, if WMD didn't claim it, the IRQ is shared. */
 		DBC_Ensure(hIOMgr->fSharedIRQ);
-       return IRQ_HANDLED;
+
+	return IRQ_HANDLED;
 }
 
 /*
@@ -1131,7 +1118,6 @@ static u32 FindReadyOutput(struct CHNL_MGR *pChnlMgr,
 				uRetval = id;
 				if (pChnl == NULL)
 					pChnlMgr->dwLastOutput = id;
-
 				break;
 			}
 			id = id + 1;
@@ -1362,8 +1348,7 @@ static void InputMsg(struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr)
 		CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
 	}
 func_end:
-       return;
-
+	return;
 }
 
 /*
@@ -1380,10 +1365,10 @@ static void NotifyChnlComplete(struct CHNL_OBJECT *pChnl,
 	   !pChnl->pIOCompletions || !pChirp)
 		goto func_end;
 
-	 /*  Note: we signal the channel event only if the queue of IO
-	  *  completions is empty.  If it is not empty, the event is sure to be
-	  *  signalled by the only IO completion list consumer:
-	  *  WMD_CHNL_GetIOC().  */
+	/*  Note: we signal the channel event only if the queue of IO
+	 *  completions is empty.  If it is not empty, the event is sure to be
+	 *  signalled by the only IO completion list consumer:
+	 *  WMD_CHNL_GetIOC().  */
 	fSignalEvent = LST_IsEmpty(pChnl->pIOCompletions);
 	/* Enqueue the IO completion info for the client: */
 	LST_PutTail(pChnl->pIOCompletions, (struct LST_ELEM *) pChirp);
@@ -1434,7 +1419,7 @@ static void OutputChnl(struct IO_MGR *pIOMgr, struct CHNL_OBJECT *pChnl,
 		goto func_end;
 
 	pChnl = pChnlMgr->apChannel[chnlId];
-       if (!pChnl || !pChnl->pIORequests) {
+	if (!pChnl || !pChnl->pIORequests) {
 		/* Shouldn't get here: */
 		goto func_end;
 	}
@@ -1570,8 +1555,7 @@ static void OutputMsg(struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr)
 		}
 	}
 func_end:
-       return;
-
+	return;
 }
 
 /*
@@ -1711,7 +1695,7 @@ static u32 ReadData(struct WMD_DEV_CONTEXT *hDevContext, void *pDest,
  *      Copies buffers from the host side buffer to the shared memory.
  */
 static u32 WriteData(struct WMD_DEV_CONTEXT *hDevContext, void *pDest,
-		       void *pSrc, u32 uSize)
+			void *pSrc, u32 uSize)
 {
 	memcpy(pDest, pSrc, uSize);
 	return uSize;
@@ -1814,7 +1798,7 @@ void PrintDSPDebugTrace(struct IO_MGR *hIOMgr)
 {
 	u32 ulNewMessageLength = 0, ulGPPCurPointer;
 
-       GT_0trace(dsp_trace_mask, GT_ENTER, "Entering PrintDSPDebugTrace\n");
+	GT_0trace(dsp_trace_mask, GT_ENTER, "Entering PrintDSPDebugTrace\n");
 
 	while (true) {
 		/* Get the DSP current pointer */
@@ -1832,7 +1816,7 @@ void PrintDSPDebugTrace(struct IO_MGR *hIOMgr)
 					     ulGPPReadPointer;
 
 			memcpy(hIOMgr->pMsg, (char *)hIOMgr->ulGPPReadPointer,
-			       ulNewMessageLength);
+				ulNewMessageLength);
 			hIOMgr->pMsg[ulNewMessageLength] = '\0';
 			/* Advance the GPP trace pointer to DSP current
 			 * pointer */
Signature · 1 line
1.6.2.4
#6 lore raw

PATCH 6/9 DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

Remove DPC wrappers and replace with direct Linux calls.

These changes apply to IO DPC and MMUfault DPC

---
 arch/arm/plat-omap/include/dspbridge/dpc.h |   90 +++--------------
 drivers/dsp/bridge/services/dpc.c          |  144 +---------------------------
 drivers/dsp/bridge/wmd/io_sm.c             |   73 +++++++++++++-
 drivers/dsp/bridge/wmd/mmu_fault.c         |   24 ++++-
 drivers/dsp/bridge/wmd/ue_deh.c            |   31 ++++++-
 5 files changed, 132 insertions(+), 230 deletions(-)
arch/arm/plat-omap/include/dspbridge/dpc.h +16 -74
index 870a1b2..0c60342 100644
@@ -19,8 +19,6 @@
 #ifndef DPC_
 #define DPC_
 
-	struct DPC_OBJECT;
-
 /*
  *  ======== DPC_PROC ========
  *  Purpose:
@@ -40,64 +38,22 @@
  */
        typedef void(*DPC_PROC) (void *pRefData);
 
-/*
- *  ======== DPC_Cancel ========
- *  Purpose:
- *      Cancel a DPC previously scheduled by DPC_Schedule.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:
- *      DSP_SOK:        Scheduled DPC, if any, is cancelled.
- *      DSP_SFALSE:     No DPC is currently scheduled for execution.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *  Ensures:
- *      If the DPC has already executed, is executing, or was not yet
- *      scheduled, this function will have no effect.
- */
-       extern DSP_STATUS DPC_Cancel(IN struct DPC_OBJECT *hDPC);
+/* The DPC object, passed to our priority event callback routine: */
+struct DPC_OBJECT {
+	u32 dwSignature;	/* Used for object validation.   */
+	void *pRefData;		/* Argument for client's DPC.    */
+	DPC_PROC pfnDPC;	/* Client's DPC.                 */
+	u32 numRequested;	/* Number of requested DPC's.      */
+	u32 numScheduled;	/* Number of executed DPC's.      */
+	struct tasklet_struct dpc_tasklet;
 
-/*
- *  ======== DPC_Create ========
- *  Purpose:
- *      Create a DPC object, allowing a client's own DPC procedure to be
- *      scheduled for a call with client reference data.
- *  Parameters:
- *      phDPC:          Pointer to location to store DPC object.
- *      pfnDPC:         Client's DPC procedure.
- *      pRefData:       Pointer to user-defined reference data.
- *  Returns:
- *      DSP_SOK:        DPC object created.
- *      DSP_EPOINTER:   phDPC == NULL or pfnDPC == NULL.
- *      DSP_EMEMORY:    Insufficient memory.
- *  Requires:
- *      Must not be called at interrupt time.
- *  Ensures:
- *      DSP_SOK: DPC object is created;
- *      else: *phDPC is set to NULL.
- */
-       extern DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC,
-					   IN DPC_PROC pfnDPC,
-					   IN void *pRefData);
+#ifdef DEBUG
+	u32 cEntryCount;	/* Number of times DPC reentered. */
+	u32 numRequestedMax;	/* Keep track of max pending DPC's. */
+#endif
 
-/*
- *  ======== DPC_Destroy ========
- *  Purpose:
- *      Cancel the last scheduled DPC, and deallocate a DPC object previously
- *      allocated with DPC_Create().Frees the Object only if the thread and
- *      the events are terminated successfuly.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:
- *      DSP_SOK:        Success.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *      All DPC's scheduled for the DPC object must have completed their
- *      processing.
- *  Ensures:
- *      (SUCCESS && hDPC is NULL) or DSP_EFAILED status
- */
-       extern DSP_STATUS DPC_Destroy(IN struct DPC_OBJECT *hDPC);
+	spinlock_t dpc_lock;
+};
 
 /*
  *  ======== DPC_Exit ========
@@ -125,21 +81,7 @@
  */
        extern bool DPC_Init(void);
 
-/*
- *  ======== DPC_Schedule ========
- *  Purpose:
- *      Schedule a deferred procedure call to be executed at a later time.
- *      Latency and order of DPC execution is platform specific.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:
- *      DSP_SOK:        An event is scheduled for deferred processing.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *      See requirements for DPC_PROC.
- *  Ensures:
- *      DSP_SOK:        The DPC will not be called before this function returns.
- */
-       extern DSP_STATUS DPC_Schedule(IN struct DPC_OBJECT *hDPC);
+/*  ----------------------------------- Function Prototypes */
+ void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
 
 #endif				/* DPC_ */
drivers/dsp/bridge/services/dpc.c +1 -143

166 lines not on this page · raw message

drivers/dsp/bridge/wmd/io_sm.c +67 -6

106 lines not on this page · raw message

drivers/dsp/bridge/wmd/mmu_fault.c +20 -4
index bb98e56..0e03cd1 100644
@@ -76,7 +76,7 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)pRefData;
 	struct WMD_DEV_CONTEXT *pDevContext;
 	DSP_STATUS status = DSP_SOK;
-
+	unsigned long flags;
 
 	DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
        DBC_Require(irq == INT_DSP_MMU_IRQ);
@@ -94,14 +94,30 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 				"0x%x\n", dmmuEventMask);
 			printk(KERN_INFO "***** DSPMMU FAULT ***** faultAddr "
 				"0x%x\n", faultAddr);
-			/* Disable the MMU events, else once we clear it will
-			 * start to raise INTs again */
 			/*
 			 * Schedule a DPC directly. In the future, it may be
 			 * necessary to check if DSP MMU fault is intended for
 			 * Bridge.
 			 */
-			DPC_Schedule(pDehMgr->hMmuFaultDpc);
+			/* Increment count of DPC's pending. */
+			spin_lock_irqsave(&pDehMgr->hMmuFaultDpc->dpc_lock,
+						flags);
+			pDehMgr->hMmuFaultDpc->numRequested++;
+			spin_unlock_irqrestore(&pDehMgr->hMmuFaultDpc->dpc_lock,
+						flags);
+
+			/* Schedule DPC */
+			tasklet_schedule(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+#ifdef DEBUG
+			if (pDehMgr->hMmuFaultDpc->numRequested >
+			   pDehMgr->hMmuFaultDpc->numScheduled +
+			   pDehMgr->hMmuFaultDpc->numRequestedMax) {
+				pDehMgr->hMmuFaultDpc->numRequestedMax =
+					pDehMgr->hMmuFaultDpc->numRequested -
+					pDehMgr->hMmuFaultDpc->numScheduled;
+			}
+#endif
+
 			/* Reset errInfo structure before use. */
 			pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
 			pDehMgr->errInfo.dwVal1 = faultAddr >> 16;
drivers/dsp/bridge/wmd/ue_deh.c +28 -3
index 6d6c76b..12f73e7 100644
@@ -91,8 +91,27 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 			status = NTFY_Create(&pDehMgr->hNtfy);
 
 		/* Create a DPC object. */
-		status = DPC_Create(&pDehMgr->hMmuFaultDpc, MMU_FaultDpc,
-				   (void *)pDehMgr);
+		MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
+				SIGNATURE);
+		if (pDehMgr->hMmuFaultDpc) {
+			tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
+				DPC_DeferredProcedure,
+				(u32)pDehMgr->hMmuFaultDpc);
+			/* Fill out DPC Object */
+			pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
+			pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;
+			pDehMgr->hMmuFaultDpc->numRequested = 0;
+			pDehMgr->hMmuFaultDpc->numScheduled = 0;
+#ifdef DEBUG
+			pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
+			pDehMgr->hMmuFaultDpc->cEntryCount = 0;
+#endif
+			spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
+		} else {
+			DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
+			status = DSP_EMEMORY;
+		}
+
 		if (DSP_SUCCEEDED(status))
 			status = DEV_GetDevNode(hDevObject, &hDevNode);
 
@@ -144,7 +163,13 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
 			(void)NTFY_Delete(pDehMgr->hNtfy);
 		/* Disable DSP MMU fault */
 		free_irq(INT_DSP_MMU_IRQ, pDehMgr);
-		(void)DPC_Destroy(pDehMgr->hMmuFaultDpc);
+
+		/* Free DPC object */
+		tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+		MEM_FreeObject(pDehMgr->hMmuFaultDpc);
+		pDehMgr->hMmuFaultDpc = NULL;
+		DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
+
 		/* Deallocate the DEH manager object */
 		MEM_FreeObject(pDehMgr);
 	}
Signature · 1 line
1.6.2.4
#7 lore raw

PATCH 7/9 DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault

Remove DeferredProcedure which is used as a wrapper to call either IO or MMUfault DPCs. This also removes a custom typedef.

---
 arch/arm/plat-omap/include/dspbridge/dpc.h   |   23 ------------
 arch/arm/plat-omap/include/dspbridge/io_sm.h |    2 +-
 drivers/dsp/bridge/services/dpc.c            |   36 ------------------
 drivers/dsp/bridge/wmd/io_sm.c               |   50 ++++++++++++++++---------
 drivers/dsp/bridge/wmd/mmu_fault.c           |    2 +-
 drivers/dsp/bridge/wmd/mmu_fault.h           |    2 +-
 drivers/dsp/bridge/wmd/ue_deh.c              |    5 +--
 7 files changed, 36 insertions(+), 84 deletions(-)
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -23
index 0c60342..b22140f 100644
@@ -19,30 +19,10 @@
 #ifndef DPC_
 #define DPC_
 
-/*
- *  ======== DPC_PROC ========
- *  Purpose:
- *      Deferred processing routine.  Typically scheduled from an ISR to
- *      complete I/O processing.
- *  Parameters:
- *      pRefData:   Ptr to user data: passed in via ISR_ScheduleDPC.
- *  Returns:
- *  Requires:
- *      The DPC should not block, or otherwise acquire resources.
- *      Interrupts to the processor are enabled.
- *      DPC_PROC executes in a critical section.
- *  Ensures:
- *      This DPC will not be reenterred on the same thread.
- *      However, the DPC may take hardware interrupts during execution.
- *      Interrupts to the processor are enabled.
- */
-       typedef void(*DPC_PROC) (void *pRefData);
-
 /* The DPC object, passed to our priority event callback routine: */
 struct DPC_OBJECT {
 	u32 dwSignature;	/* Used for object validation.   */
 	void *pRefData;		/* Argument for client's DPC.    */
-	DPC_PROC pfnDPC;	/* Client's DPC.                 */
 	u32 numRequested;	/* Number of requested DPC's.      */
 	u32 numScheduled;	/* Number of executed DPC's.      */
 	struct tasklet_struct dpc_tasklet;
@@ -81,7 +61,4 @@ struct DPC_OBJECT {
  */
        extern bool DPC_Init(void);
 
-/*  ----------------------------------- Function Prototypes */
- void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
-
 #endif				/* DPC_ */
arch/arm/plat-omap/include/dspbridge/io_sm.h +1 -1
index 77f9e25..67e3834 100644
@@ -77,7 +77,7 @@
  *  Ensures:
  *      Non-preemptible (but interruptible).
  */
-	extern void IO_DPC(IN OUT void *pRefData);
+	extern void IO_DPC(IN OUT unsigned long pRefData);
 
 /*
  *  ======== IO_ISR ========
drivers/dsp/bridge/services/dpc.c +0 -36
index 10bd792..bbb2d47 100644
@@ -66,39 +66,3 @@ bool DPC_Init(void)
 	return true;
 }
 
-/*
- *  ======== DeferredProcedure ========
- *  Purpose:
- *      Main DPC routine.  This is called by host OS DPC callback
- *      mechanism with interrupts enabled.
- */
-void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
-{
-	struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
-	/* read numRequested in local variable */
-	u32 requested;
-	u32 serviced;
-
-	DBC_Require(pDPCObject != NULL);
-	requested = pDPCObject->numRequested;
-	serviced = pDPCObject->numScheduled;
-
-	GT_1trace(DPC_DebugMask, GT_ENTER, "> DPC_DeferredProcedure "
-		  "pDeferredContext=%x\n", pDeferredContext);
-	/* Rollover taken care of using != instead of < */
-	if (serviced != requested) {
-		if (pDPCObject->pfnDPC != NULL) {
-			/* Process pending DPC's: */
-			do {
-				/* Call client's DPC: */
-				(*(pDPCObject->pfnDPC))(pDPCObject->pRefData);
-				serviced++;
-			} while (serviced != requested);
-		}
-		pDPCObject->numScheduled = requested;
-	}
-	GT_2trace(DPC_DebugMask, GT_ENTER,
-		  "< DPC_DeferredProcedure requested %d"
-		  " serviced %d\n", requested, serviced);
-}
-
drivers/dsp/bridge/wmd/io_sm.c +32 -18

78 lines not on this page · raw message

drivers/dsp/bridge/wmd/mmu_fault.c +1 -1
index 0e03cd1..b3f0719 100644
@@ -54,7 +54,7 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
  *  ======== MMU_FaultDpc ========
  *      Deferred procedure call to handle DSP MMU fault.
  */
-void MMU_FaultDpc(IN void *pRefData)
+void MMU_FaultDpc(IN unsigned long pRefData)
 {
 	struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
 	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
drivers/dsp/bridge/wmd/mmu_fault.h +1 -1
index bed466c..d3849b5 100644
@@ -23,7 +23,7 @@
  *  ======== MMU_FaultDpc ========
  *      Deferred procedure call to handle DSP MMU fault.
  */
-	void MMU_FaultDpc(IN void *pRefData);
+	void MMU_FaultDpc(IN unsigned long pRefData);
 
 /*
  *  ======== MMU_FaultIsr ========
drivers/dsp/bridge/wmd/ue_deh.c +1 -4
index 12f73e7..4d0bcf2 100644
@@ -95,11 +95,8 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 				SIGNATURE);
 		if (pDehMgr->hMmuFaultDpc) {
 			tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
-				DPC_DeferredProcedure,
-				(u32)pDehMgr->hMmuFaultDpc);
+				MMU_FaultDpc, (u32)pDehMgr);
 			/* Fill out DPC Object */
-			pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
-			pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;
 			pDehMgr->hMmuFaultDpc->numRequested = 0;
 			pDehMgr->hMmuFaultDpc->numScheduled = 0;
 #ifdef DEBUG
Signature · 1 line
1.6.2.4
#8 lore raw

PATCH 8/9 DSPBRIDGE: Remove DPC module from SERVICES layer

This patch removes init and exit functions for DPC module. It also deletes dpc source file and takes out the module from Makefile.

---
 arch/arm/plat-omap/include/dspbridge/dpc.h |   26 -----------
 drivers/dsp/bridge/Makefile                |    3 +-
 drivers/dsp/bridge/services/dpc.c          |   68 ----------------------------
 drivers/dsp/bridge/services/services.c     |    9 +---
 4 files changed, 3 insertions(+), 103 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/dpc.c
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -26
index b22140f..aee910d 100644
@@ -35,30 +35,4 @@ struct DPC_OBJECT {
 	spinlock_t dpc_lock;
 };
 
-/*
- *  ======== DPC_Exit ========
- *  Purpose:
- *      Discontinue usage of the DPC module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      DPC_Init(void) was previously called.
- *  Ensures:
- *      Resources acquired in DPC_Init(void) are freed.
- */
-       extern void DPC_Exit(void);
-
-/*
- *  ======== DPC_Init ========
- *  Purpose:
- *      Initialize the DPC module's private state.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occured.
- *  Requires:
- *  Ensures:
- *      A requirement for each of the other public DPC functions.
- */
-       extern bool DPC_Init(void);
-
 #endif				/* DPC_ */
drivers/dsp/bridge/Makefile +1 -2
index cb6d1ce..df870c9 100644
@@ -1,8 +1,7 @@
 obj-$(CONFIG_MPU_BRIDGE)	+= bridgedriver.o
 
 libgen = gen/gb.o gen/gt.o gen/gs.o gen/gh.o gen/_gt_para.o gen/uuidutil.o
-libservices = services/mem.o services/list.o services/dpc.o \
-		services/sync.o \
+libservices = services/mem.o services/list.o services/sync.o \
 		services/clk.o services/cfg.o services/reg.o \
                services/regsup.o services/ntfy.o \
 		services/dbg.o services/services.o
drivers/dsp/bridge/services/dpc.c deleted +0 -68

68 lines not on this page · raw message

drivers/dsp/bridge/services/services.c +2 -7
index dc9bfad..0b7d623 100644
@@ -68,7 +68,6 @@ void SERVICES_Exit(void)
 		CLK_Exit();
 		REG_Exit();
 		LST_Exit();
-		DPC_Exit();
 		DBG_Exit();
 		CFG_Exit();
 		MEM_Exit();
@@ -87,7 +86,7 @@ void SERVICES_Exit(void)
 bool SERVICES_Init(void)
 {
 	bool fInit = true;
-	bool fCFG, fDBG, fDPC, fLST, fMEM;
+	bool fCFG, fDBG, fLST, fMEM;
 	bool fREG, fSYNC, fCLK, fNTFY;
 
 	DBC_Require(cRefs >= 0);
@@ -106,12 +105,11 @@ bool SERVICES_Init(void)
 		fREG = REG_Init();
 		fCFG = CFG_Init();
 		fDBG = DBG_Init();
-		fDPC = DPC_Init();
 		fLST = LST_Init();
 		fCLK  = CLK_Init();
 		fNTFY = NTFY_Init();
 
-		fInit = fCFG && fDBG && fDPC &&
+		fInit = fCFG && fDBG &&
 			fLST && fMEM && fREG && fSYNC && fCLK;
 
 		if (!fInit) {
@@ -130,9 +128,6 @@ bool SERVICES_Init(void)
 			if (fLST)
 				LST_Exit();
 
-			if (fDPC)
-				DPC_Exit();
-
 			if (fDBG)
 				DBG_Exit();
 
Signature · 1 line
1.6.2.4
#9 lore raw

PATCH 9/9 DSPBRIDGE: Remove DPC object structure

Remove DPC object structure and declare required members for each tasklet inside their correspondent modules.

Remove dpc header file.

---
 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |    1 -
 arch/arm/plat-omap/include/dspbridge/dpc.h      |   38 -----------
 drivers/dsp/bridge/pmgr/chnl.c                  |    1 -
 drivers/dsp/bridge/services/services.c          |    1 -
 drivers/dsp/bridge/wmd/_deh.h                   |    5 +-
 drivers/dsp/bridge/wmd/io_sm.c                  |   80 ++++++++---------------
 drivers/dsp/bridge/wmd/mmu_fault.c              |   24 +------
 drivers/dsp/bridge/wmd/ue_deh.c                 |   25 +------
 8 files changed, 35 insertions(+), 140 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
arch/arm/plat-omap/include/dspbridge/_chnl_sm.h +0 -1
index f22b2cb..eb5adc2 100644
@@ -25,7 +25,6 @@
 
 #include <dspbridge/wcd.h>
 #include <dspbridge/wmd.h>
-#include <dspbridge/dpc.h>
 
 #include <dspbridge/list.h>
 #include <dspbridge/ntfy.h>
arch/arm/plat-omap/include/dspbridge/dpc.h deleted +0 -38
deleted file mode 100644
index aee910d..0000000
@@ -1,38 +0,0 @@
-/*
- * dpc.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Deferred Procedure Call(DPC) Services.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef DPC_
-#define DPC_
-
-/* The DPC object, passed to our priority event callback routine: */
-struct DPC_OBJECT {
-	u32 dwSignature;	/* Used for object validation.   */
-	void *pRefData;		/* Argument for client's DPC.    */
-	u32 numRequested;	/* Number of requested DPC's.      */
-	u32 numScheduled;	/* Number of executed DPC's.      */
-	struct tasklet_struct dpc_tasklet;
-
-#ifdef DEBUG
-	u32 cEntryCount;	/* Number of times DPC reentered. */
-	u32 numRequestedMax;	/* Keep track of max pending DPC's. */
-#endif
-
-	spinlock_t dpc_lock;
-};
-
-#endif				/* DPC_ */
drivers/dsp/bridge/pmgr/chnl.c +0 -1
index f4d0fc1..fd487f0 100644
@@ -31,7 +31,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
 #include <dspbridge/list.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/sync.h>
drivers/dsp/bridge/services/services.c +0 -1
index 0b7d623..5590634 100644
@@ -29,7 +29,6 @@
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/cfg.h>
 #include <dspbridge/dbg.h>
-#include <dspbridge/dpc.h>
 #include <dspbridge/list.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/ntfy.h>
drivers/dsp/bridge/wmd/_deh.h +3 -2
index 2b364b5..aadb9fa 100644
@@ -19,7 +19,6 @@
 #ifndef _DEH_
 #define _DEH_
 
-#include <dspbridge/dpc.h>
 #include <dspbridge/ntfy.h>
 #include <dspbridge/wmd.h>
 
@@ -30,8 +29,10 @@ struct DEH_MGR {
 	u32 dwSignature;	/* Used for object validation.  */
 	struct WMD_DEV_CONTEXT *hWmdContext;	/* WMD device context. */
 	struct NTFY_OBJECT *hNtfy;	/* NTFY object                  */
-	struct DPC_OBJECT *hMmuFaultDpc;	/* DPC object handle.  */
 	struct DSP_ERRORINFO errInfo;	/* DSP exception info.          */
+
+	/* MMU Fault DPC */
+	struct tasklet_struct dpc_tasklet;
 } ;
 
 #endif				/* _DEH_ */
drivers/dsp/bridge/wmd/io_sm.c +27 -53

138 lines not on this page · raw message

drivers/dsp/bridge/wmd/mmu_fault.c +2 -22
index b3f0719..b184250 100644
@@ -27,7 +27,6 @@
 #include <dspbridge/dbg.h>
 
 /*  ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/dpc.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/drv.h>
 
@@ -57,11 +56,10 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
 void MMU_FaultDpc(IN unsigned long pRefData)
 {
 	struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
-	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
 
 	DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Enter: 0x%x\n", pRefData);
 
-	if (pDehMgr)
+	if (hDehMgr)
 		WMD_DEH_Notify(hDehMgr, DSP_MMUFAULT, 0L);
 
 	DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Exit: 0x%x\n", pRefData);
@@ -76,7 +74,6 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)pRefData;
 	struct WMD_DEV_CONTEXT *pDevContext;
 	DSP_STATUS status = DSP_SOK;
-	unsigned long flags;
 
 	DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
        DBC_Require(irq == INT_DSP_MMU_IRQ);
@@ -99,24 +96,7 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 			 * necessary to check if DSP MMU fault is intended for
 			 * Bridge.
 			 */
-			/* Increment count of DPC's pending. */
-			spin_lock_irqsave(&pDehMgr->hMmuFaultDpc->dpc_lock,
-						flags);
-			pDehMgr->hMmuFaultDpc->numRequested++;
-			spin_unlock_irqrestore(&pDehMgr->hMmuFaultDpc->dpc_lock,
-						flags);
-
-			/* Schedule DPC */
-			tasklet_schedule(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
-#ifdef DEBUG
-			if (pDehMgr->hMmuFaultDpc->numRequested >
-			   pDehMgr->hMmuFaultDpc->numScheduled +
-			   pDehMgr->hMmuFaultDpc->numRequestedMax) {
-				pDehMgr->hMmuFaultDpc->numRequestedMax =
-					pDehMgr->hMmuFaultDpc->numRequested -
-					pDehMgr->hMmuFaultDpc->numScheduled;
-			}
-#endif
+			tasklet_schedule(&pDehMgr->dpc_tasklet);
 
 			/* Reset errInfo structure before use. */
 			pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
drivers/dsp/bridge/wmd/ue_deh.c +3 -22
index 4d0bcf2..6a1314f 100644
@@ -30,7 +30,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/ntfy.h>
 #include <dspbridge/drv.h>
@@ -90,24 +89,8 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 		if (DSP_SUCCEEDED(status))
 			status = NTFY_Create(&pDehMgr->hNtfy);
 
-		/* Create a DPC object. */
-		MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
-				SIGNATURE);
-		if (pDehMgr->hMmuFaultDpc) {
-			tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
-				MMU_FaultDpc, (u32)pDehMgr);
-			/* Fill out DPC Object */
-			pDehMgr->hMmuFaultDpc->numRequested = 0;
-			pDehMgr->hMmuFaultDpc->numScheduled = 0;
-#ifdef DEBUG
-			pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
-			pDehMgr->hMmuFaultDpc->cEntryCount = 0;
-#endif
-			spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
-		} else {
-			DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
-			status = DSP_EMEMORY;
-		}
+		/* Create a MMUfault DPC */
+		tasklet_init(&pDehMgr->dpc_tasklet, MMU_FaultDpc, (u32)pDehMgr);
 
 		if (DSP_SUCCEEDED(status))
 			status = DEV_GetDevNode(hDevObject, &hDevNode);
@@ -162,9 +145,7 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
 		free_irq(INT_DSP_MMU_IRQ, pDehMgr);
 
 		/* Free DPC object */
-		tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
-		MEM_FreeObject(pDehMgr->hMmuFaultDpc);
-		pDehMgr->hMmuFaultDpc = NULL;
+		tasklet_kill(&pDehMgr->dpc_tasklet);
 		DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
 
 		/* Deallocate the DEH manager object */
Signature · 1 line
1.6.2.4
#10 lore raw

Re: [PATCH 7/9] DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault

In reply to Omar Ramirez Luna

Cosmetic comments follow:

Omar Ramirez Luna had written, on 11/23/2009 06:50 PM, the following:

Quoted 32 lines

Remove DeferredProcedure which is used as a wrapper to call either IO or MMUfault DPCs. This also removes a custom typedef.

---
 arch/arm/plat-omap/include/dspbridge/dpc.h   |   23 ------------
 arch/arm/plat-omap/include/dspbridge/io_sm.h |    2 +-
 drivers/dsp/bridge/services/dpc.c            |   36 ------------------
 drivers/dsp/bridge/wmd/io_sm.c               |   50 ++++++++++++++++---------
 drivers/dsp/bridge/wmd/mmu_fault.c           |    2 +-
 drivers/dsp/bridge/wmd/mmu_fault.h           |    2 +-
 drivers/dsp/bridge/wmd/ue_deh.c              |    5 +--
 7 files changed, 36 insertions(+), 84 deletions(-)
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -10
index 0c60342..b22140f 100644
@@ -19,30 +19,10 @@
 #ifndef DPC_
 #define DPC_
 
-/*
- *  ======== DPC_PROC ========
- *  Purpose:
- *      Deferred processing routine.  Typically scheduled from an ISR to
- *      complete I/O processing.
- *  Parameters:
- *      pRefData:   Ptr to user data: passed in via ISR_ScheduleDPC.
- *  Returns:
- *  Requires:
- *      The DPC should not block, or otherwise acquire resources.

arch/arm/plat-omap/include/dspbridge/dpc.h line 22

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -9
- *      Interrupts to the processor are enabled.
- *      DPC_PROC executes in a critical section.
- *  Ensures:
- *      This DPC will not be reenterred on the same thread.
- *      However, the DPC may take hardware interrupts during execution.
- *      Interrupts to the processor are enabled.
- */
-       typedef void(*DPC_PROC) (void *pRefData);
-
 /* The DPC object, passed to our priority event callback routine: */

Use kernel coding style

Quoted 20 lines
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -4
 struct DPC_OBJECT {
 	u32 dwSignature;	/* Used for object validation.   */
 	void *pRefData;		/* Argument for client's DPC.    */
-	DPC_PROC pfnDPC;	/* Client's DPC.                 */
 	u32 numRequested;	/* Number of requested DPC's.      */
 	u32 numScheduled;	/* Number of executed DPC's.      */
 	struct tasklet_struct dpc_tasklet;
@@ -81,7 +61,4 @@ struct DPC_OBJECT {
  */
        extern bool DPC_Init(void);
 
-/*  ----------------------------------- Function Prototypes */
- void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
-
 #endif				/* DPC_ */
arch/arm/plat-omap/include/dspbridge/io_sm.h +0 -0
index 77f9e25..67e3834 100644

arch/arm/plat-omap/include/dspbridge/io_sm.h line 80

Quoted 5 lines
arch/arm/plat-omap/include/dspbridge/io_sm.h +1 -1
@@ -77,7 +77,7 @@
  *  Ensures:
  *      Non-preemptible (but interruptible).
  */
-	extern void IO_DPC(IN OUT void *pRefData);
+	extern void IO_DPC(IN OUT unsigned long pRefData);

remove IN OUT

Quoted 99 lines
arch/arm/plat-omap/include/dspbridge/io_sm.h +0 -0
 /*
  *  ======== IO_ISR ========
drivers/dsp/bridge/services/dpc.c +0 -36
index 10bd792..bbb2d47 100644
@@ -66,39 +66,3 @@ bool DPC_Init(void)
 	return true;
 }
 
-/*
- *  ======== DeferredProcedure ========
- *  Purpose:
- *      Main DPC routine.  This is called by host OS DPC callback
- *      mechanism with interrupts enabled.
- */
-void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
-{
-	struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
-	/* read numRequested in local variable */
-	u32 requested;
-	u32 serviced;
-
-	DBC_Require(pDPCObject != NULL);
-	requested = pDPCObject->numRequested;
-	serviced = pDPCObject->numScheduled;
-
-	GT_1trace(DPC_DebugMask, GT_ENTER, "> DPC_DeferredProcedure "
-		  "pDeferredContext=%x\n", pDeferredContext);
-	/* Rollover taken care of using != instead of < */
-	if (serviced != requested) {
-		if (pDPCObject->pfnDPC != NULL) {
-			/* Process pending DPC's: */
-			do {
-				/* Call client's DPC: */
-				(*(pDPCObject->pfnDPC))(pDPCObject->pRefData);
-				serviced++;
-			} while (serviced != requested);
-		}
-		pDPCObject->numScheduled = requested;
-	}
-	GT_2trace(DPC_DebugMask, GT_ENTER,
-		  "< DPC_DeferredProcedure requested %d"
-		  " serviced %d\n", requested, serviced);
-}
-
drivers/dsp/bridge/wmd/io_sm.c +13 -11
index 60dbc62..1e855ce 100644
@@ -255,10 +255,8 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 				IO_MGRSIGNATURE);
 		if (pIOMgr->hDPC) {
 			tasklet_init(&pIOMgr->hDPC->dpc_tasklet,
-				DPC_DeferredProcedure, (u32)pIOMgr->hDPC);
+				IO_DPC, (u32)pIOMgr);
 			/* Fill out our DPC Object: */
-			pIOMgr->hDPC->pRefData = (void *)pIOMgr;
-			pIOMgr->hDPC->pfnDPC = IO_DPC;
 			pIOMgr->hDPC->numRequested = 0;
 			pIOMgr->hDPC->numScheduled = 0;
 #ifdef DEBUG
@@ -986,12 +984,14 @@ static void IO_DispatchPM(struct work_struct *work)
  *      out the dispatch of I/O as a non-preemptible event.It can only be
  *      pre-empted      by an ISR.
  */
-void IO_DPC(IN OUT void *pRefData)
+void IO_DPC(IN OUT unsigned long pRefData)
 {
 	struct IO_MGR *pIOMgr = (struct IO_MGR *)pRefData;
 	struct CHNL_MGR *pChnlMgr;
 	struct MSG_MGR *pMsgMgr;
 	struct DEH_MGR *hDehMgr;
+	u32 requested;
+	u32 serviced;
 
 	if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
 		goto func_end;
@@ -1001,24 +1001,38 @@ void IO_DPC(IN OUT void *pRefData)
 	if (!MEM_IsValidHandle(pChnlMgr, CHNL_MGRSIGNATURE))
 		goto func_end;
 	DBG_Trace(DBG_LEVEL7, "Entering IO_DPC(0x%x)\n", pRefData);
-	/* Check value of interrupt register to ensure it is a valid error */
-	if ((pIOMgr->wIntrVal > DEH_BASE) && (pIOMgr->wIntrVal < DEH_LIMIT)) {
-		/* notify DSP/BIOS exception */
-		if (hDehMgr)
-			WMD_DEH_Notify(hDehMgr, DSP_SYSERROR, pIOMgr->wIntrVal);
-	}
-	IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
+
+	requested = pIOMgr->hDPC->numRequested;
+	serviced = pIOMgr->hDPC->numScheduled;
+
+	if (serviced == requested)
+		goto func_end;
+
+	/* Process pending DPC's */
+	do {

drivers/dsp/bridge/wmd/io_sm.c void IO_DPC(IN OUT void *pRefData) · line 1022

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +9 -0
+		/* Check value of interrupt reg to ensure it's a valid error */
+		if ((pIOMgr->wIntrVal > DEH_BASE) &&
+		   (pIOMgr->wIntrVal < DEH_LIMIT)) {
+			/* notify DSP/BIOS exception */
+			if (hDehMgr)
+				WMD_DEH_Notify(hDehMgr, DSP_SYSERROR,
+						pIOMgr->wIntrVal);
+		}
+		IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
 #ifdef CHNL_MESSAGES

Unrelated: we need to ensure that dead code dies.. if it is not a Kconfig option, it should probably be removed..

Quoted 28 lines
drivers/dsp/bridge/wmd/io_sm.c +10 -7
-	if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
-		IO_DispatchMsg(pIOMgr, pMsgMgr);
+		if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
+			IO_DispatchMsg(pIOMgr, pMsgMgr);
 #endif
 #ifndef DSP_TRACEBUF_DISABLED
-	if (pIOMgr->wIntrVal & MBX_DBG_CLASS) {
-		/* notify DSP Trace message */
-		if (pIOMgr->wIntrVal & MBX_DBG_SYSPRINTF)
-			PrintDSPDebugTrace(pIOMgr);
-	}
+		if (pIOMgr->wIntrVal & MBX_DBG_CLASS) {
+			/* notify DSP Trace message */
+			if (pIOMgr->wIntrVal & MBX_DBG_SYSPRINTF)
+				PrintDSPDebugTrace(pIOMgr);
+		}
 #endif
+		serviced++;
+	} while (serviced != requested);
+	pIOMgr->hDPC->numScheduled = requested;
 func_end:
 	return;
 }
drivers/dsp/bridge/wmd/mmu_fault.c +0 -0
index 0e03cd1..b3f0719 100644

drivers/dsp/bridge/wmd/mmu_fault.c static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext); · line 57

Quoted 5 lines
drivers/dsp/bridge/wmd/mmu_fault.c +1 -1
@@ -54,7 +54,7 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
  *  ======== MMU_FaultDpc ========
  *      Deferred procedure call to handle DSP MMU fault.
  */
-void MMU_FaultDpc(IN void *pRefData)
+void MMU_FaultDpc(IN unsigned long pRefData)

remove IN

drivers/dsp/bridge/wmd/mmu_fault.h line 26

Quoted 13 lines
drivers/dsp/bridge/wmd/mmu_fault.c +0 -0
 {
 	struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
 	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
drivers/dsp/bridge/wmd/mmu_fault.h +1 -1
index bed466c..d3849b5 100644
@@ -23,7 +23,7 @@
  *  ======== MMU_FaultDpc ========
  *      Deferred procedure call to handle DSP MMU fault.
  */
-	void MMU_FaultDpc(IN void *pRefData);
+	void MMU_FaultDpc(IN unsigned long pRefData);

remove IN

[...]

Signature · 2 lines
Regards,
Nishanth Menon
#11 lore raw

Re: [PATCH 6/9] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

In reply to Omar Ramirez Luna

Hi,

arch/arm/plat-omap/include/dspbridge/dpc.h line 48

Quoted 8 lines · ext Omar Ramirez Luna
arch/arm/plat-omap/include/dspbridge/dpc.h +8 -0
+/* The DPC object, passed to our priority event callback routine: */
+struct DPC_OBJECT {
+       u32 dwSignature;        /* Used for object validation.   */
+       void *pRefData;         /* Argument for client's DPC.    */
+       DPC_PROC pfnDPC;        /* Client's DPC.                 */
+       u32 numRequested;       /* Number of requested DPC's.      */
+       u32 numScheduled;       /* Number of executed DPC's.      */
+       struct tasklet_struct dpc_tasklet;

as a suggestion for upcoming patches... how about removing the variable types from its name and get rid of CaMeLcAsE ?

I mean:

- u32 dwSignature;
+ u32 signature;

Signature · 1 line
balbi
#12 lore raw

RE: [PATCH 6/9] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

Quoted 20 lines

From: Felipe Balbi [mailto:[email protected]]
Subject: Re: [PATCH 6/9] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

Hi,

arch/arm/plat-omap/include/dspbridge/dpc.h line 48

Quoted 8 lines · ext Omar Ramirez Luna
arch/arm/plat-omap/include/dspbridge/dpc.h +8 -0
+/* The DPC object, passed to our priority event callback routine: */
+struct DPC_OBJECT {
+       u32 dwSignature;        /* Used for object validation.   */
+       void *pRefData;         /* Argument for client's DPC.    */
+       DPC_PROC pfnDPC;        /* Client's DPC.                 */
+       u32 numRequested;       /* Number of requested DPC's.      */
+       u32 numScheduled;       /* Number of executed DPC's.      */
+       struct tasklet_struct dpc_tasklet;

as a suggestion for upcoming patches... how about removing the variable types from its name and get rid of CaMeLcAsE ?

I mean:

Review

Quoted 2 lines
(quoted diff) +1 -1
-	u32 dwSignature;
+	u32 signature;

Done for patch DSPBRIDGE: Remove DPC object structure, I removed the structure because it was used only for IO and MMUfault (in future for WDT too), besides not every field were used anyway.

@@ -128,6 +126,12 @@ struct IO_MGR {
u32 ulGppVa;
u32 ulDspVa;
#endif
+ /* IO Dpc */
+ u32 dpc_req; /* Number of requested DPC's. */
+ u32 dpc_sched; /* Number of executed DPC's. */
+ struct tasklet_struct dpc_tasklet;
+ spinlock_t dpc_lock;
+
} ;

- omar

#13 lore raw

Re: [PATCH 6/9] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

In reply to Omar Ramirez Luna

Ramirez Luna, Omar had written, on 11/23/2009 06:50 PM, the following:

Quoted 37 lines

Remove DPC wrappers and replace with direct Linux calls.

These changes apply to IO DPC and MMUfault DPC

---
 arch/arm/plat-omap/include/dspbridge/dpc.h |   90 +++--------------
 drivers/dsp/bridge/services/dpc.c          |  144 +---------------------------
 drivers/dsp/bridge/wmd/io_sm.c             |   73 +++++++++++++-
 drivers/dsp/bridge/wmd/mmu_fault.c         |   24 ++++-
 drivers/dsp/bridge/wmd/ue_deh.c            |   31 ++++++-
 5 files changed, 132 insertions(+), 230 deletions(-)
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -9
index 870a1b2..0c60342 100644
@@ -19,8 +19,6 @@
 #ifndef DPC_
 #define DPC_
 
-       struct DPC_OBJECT;
-
 /*
  *  ======== DPC_PROC ========
  *  Purpose:
@@ -40,64 +38,22 @@
  */
        typedef void(*DPC_PROC) (void *pRefData);
 
-/*
- *  ======== DPC_Cancel ========
- *  Purpose:
- *      Cancel a DPC previously scheduled by DPC_Schedule.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:

arch/arm/plat-omap/include/dspbridge/dpc.h line 41

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/dpc.h +1 -9
- *      DSP_SOK:        Scheduled DPC, if any, is cancelled.
- *      DSP_SFALSE:     No DPC is currently scheduled for execution.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *  Ensures:
- *      If the DPC has already executed, is executing, or was not yet
- *      scheduled, this function will have no effect.
- */
-       extern DSP_STATUS DPC_Cancel(IN struct DPC_OBJECT *hDPC);
+/* The DPC object, passed to our priority event callback routine: */

You may want to follow linux coding style. and not loose info from the comments.

Documentation/kernel-doc-nano-HOWTO.txt
[...]
Example kernel-doc function comment:

/**
* foobar() - short function description of foobar

 * @arg1:       Describe the first argument to foobar.
 * @arg2:       Describe the second argument to foobar.
 *              One can provide multiple line descriptions
 *              for arguments.

*
* A longer description, with more discussion of the function foobar()
* that might be useful to those using or modifying it. Begins with
* empty comment line, and may include additional embedded empty
* comment lines.
*
* The longer description can have multiple paragraphs.
*/
[...]
Example kernel-doc data structure comment.

**
* struct blah - the basic blah structure

* @mem1:       describe the first member of struct blah
* @mem2:       describe the second member of struct blah,
*              perhaps with more lines and words.

*
* Longer description of this structure.
*/

Quoted 7 lines
arch/arm/plat-omap/include/dspbridge/dpc.h +7 -0
+struct DPC_OBJECT {
+       u32 dwSignature;        /* Used for object validation.   */
+       void *pRefData;         /* Argument for client's DPC.    */
+       DPC_PROC pfnDPC;        /* Client's DPC.                 */
+       u32 numRequested;       /* Number of requested DPC's.      */
+       u32 numScheduled;       /* Number of executed DPC's.      */
+       struct tasklet_struct dpc_tasklet;

[...]

Quoted 13 lines
drivers/dsp/bridge/wmd/io_sm.c +4 -1
index 96a5aa6..60dbc62 100644
@@ -251,7 +251,26 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 
        if (devType == DSP_UNIT) {
                /* Create a DPC object: */
-               status = DPC_Create(&pIOMgr->hDPC, IO_DPC, (void *)pIOMgr);
+               MEM_AllocObject(pIOMgr->hDPC, struct DPC_OBJECT,
+                               IO_MGRSIGNATURE);
+               if (pIOMgr->hDPC) {
+                       tasklet_init(&pIOMgr->hDPC->dpc_tasklet,

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 267

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +10 -0
+                               DPC_DeferredProcedure, (u32)pIOMgr->hDPC);
+                       /* Fill out our DPC Object: */
+                       pIOMgr->hDPC->pRefData = (void *)pIOMgr;
+                       pIOMgr->hDPC->pfnDPC = IO_DPC;
+                       pIOMgr->hDPC->numRequested = 0;
+                       pIOMgr->hDPC->numScheduled = 0;
+#ifdef DEBUG
+                       pIOMgr->hDPC->numRequestedMax = 0;
+                       pIOMgr->hDPC->cEntryCount = 0;
+#endif

Do you want to do a memset with 0 instead and fill up the deltas?

Quoted 47 lines
drivers/dsp/bridge/wmd/io_sm.c +22 -4
+                       spin_lock_init(&pIOMgr->hDPC->dpc_lock);
+               } else {
+                       DBG_Trace(GT_6CLASS, "IO DPC Create: DSP_EMEMORY\n");
+                       status = DSP_EMEMORY;
+               }
+
                if (DSP_SUCCEEDED(status))
                        status = DEV_GetDevNode(hDevObject, &hDevNode);
 
@@ -312,8 +331,13 @@ DSP_STATUS WMD_IO_Destroy(struct IO_MGR *hIOMgr)
                destroy_workqueue(bridge_workqueue);
                /* Linux function to uninstall ISR */
                free_irq(INT_MAIL_MPU_IRQ, (void *)hIOMgr);
-               if (hIOMgr->hDPC)
-                       (void)DPC_Destroy(hIOMgr->hDPC);
+
+               /* Free DPC object */
+               tasklet_kill(&hIOMgr->hDPC->dpc_tasklet);
+               MEM_FreeObject(hIOMgr->hDPC);
+               hIOMgr->hDPC = NULL;
+               DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
+
 #ifndef DSP_TRACEBUF_DISABLED
                if (hIOMgr->pMsg)
                        MEM_Free(hIOMgr->pMsg);
@@ -1009,6 +1033,8 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
 {
        struct IO_MGR *hIOMgr = (struct IO_MGR *)pRefData;
        bool fSchedDPC;
+       unsigned long flags;
+
        if (irq != INT_MAIL_MPU_IRQ ||
           !MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
                return IRQ_NONE;
@@ -1030,8 +1056,26 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
                        DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
                        hIOMgr->wIntrVal = 0;
                } else if (fSchedDPC) {
-                       /* PROC-COPY defer i/o  */
-                       DPC_Schedule(hIOMgr->hDPC);
+                       /*
+                        * PROC-COPY defer i/o.
+                        * Increment count of DPC's pending.
+                        */
+                       spin_lock_irqsave(&hIOMgr->hDPC->dpc_lock, flags);
+                       hIOMgr->hDPC->numRequested++;
+                       spin_unlock_irqrestore(&hIOMgr->hDPC->dpc_lock, flags);

drivers/dsp/bridge/wmd/io_sm.c irqreturn_t IO_ISR(int irq, IN void *pRefData) · line 1075

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +10 -0
+
+                       /* Schedule DPC */
+                       tasklet_schedule(&hIOMgr->hDPC->dpc_tasklet);
+#ifdef DEBUG
+                       if (hIOMgr->hDPC->numRequested >
+                          hIOMgr->hDPC->numScheduled +
+                          hIOMgr->hDPC->numRequestedMax) {
+                               hIOMgr->hDPC->numRequestedMax =
+                                       hIOMgr->hDPC->numRequested -
+                                       hIOMgr->hDPC->numScheduled;

a) is this safe?
b) {} for a one liner ? mebbe the level of indentation is too much?

Quoted 2 lines
drivers/dsp/bridge/wmd/io_sm.c +2 -0
+                       }
+#endif

[...]

Quoted 17 lines
drivers/dsp/bridge/wmd/ue_deh.c +9 -2
@@ -91,8 +91,27 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
                        status = NTFY_Create(&pDehMgr->hNtfy);
 
                /* Create a DPC object. */
-               status = DPC_Create(&pDehMgr->hMmuFaultDpc, MMU_FaultDpc,
-                                  (void *)pDehMgr);
+               MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
+                               SIGNATURE);
+               if (pDehMgr->hMmuFaultDpc) {
+                       tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
+                               DPC_DeferredProcedure,
+                               (u32)pDehMgr->hMmuFaultDpc);
+                       /* Fill out DPC Object */
+                       pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
+                       pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;

drivers/dsp/bridge/wmd/ue_deh.c DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr, · line 112

Quoted 10 lines
drivers/dsp/bridge/wmd/ue_deh.c +10 -0
+                       pDehMgr->hMmuFaultDpc->numRequested = 0;
+                       pDehMgr->hMmuFaultDpc->numScheduled = 0;
+#ifdef DEBUG
+                       pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
+                       pDehMgr->hMmuFaultDpc->cEntryCount = 0;
+#endif
+                       spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
+               } else {
+                       DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
+                       status = DSP_EMEMORY;

I think you give up at this point right? why continue the code? wont it be easier if your code did:

if (!pDehMgr->hMmuFaultDpc) {
	DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
	return DSP_EMEMORY;
}

do rest of code..

Quoted 21 lines
drivers/dsp/bridge/wmd/ue_deh.c +9 -2
+               }
+
                if (DSP_SUCCEEDED(status))
                        status = DEV_GetDevNode(hDevObject, &hDevNode);
 
@@ -144,7 +163,13 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
                        (void)NTFY_Delete(pDehMgr->hNtfy);
                /* Disable DSP MMU fault */
                free_irq(INT_DSP_MMU_IRQ, pDehMgr);
-               (void)DPC_Destroy(pDehMgr->hMmuFaultDpc);
+
+               /* Free DPC object */
+               tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+               MEM_FreeObject(pDehMgr->hMmuFaultDpc);
+               pDehMgr->hMmuFaultDpc = NULL;
+               DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
+
                /* Deallocate the DEH manager object */
                MEM_FreeObject(pDehMgr);
        }
--
Signature · 2 lines
Regards,
Nishanth Menon
#14 lore raw

RE: [PATCH 6/9] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

Quoted 7 lines

From: Menon, Nishanth

Quoted 1 line

+/* The DPC object, passed to our priority event callback routine: */

You may want to follow linux coding style. and not loose info from the comments.

Documentation/kernel-doc-nano-HOWTO.txt

This file is removed anyway, I can keep that for later comment cleanups though.

Quoted 10 lines
Quoted 9 lines
arch/arm/plat-omap/include/dspbridge/dpc.h +7 -0
+struct DPC_OBJECT {
+       u32 dwSignature;        /* Used for object validation.   */
+       void *pRefData;         /* Argument for client's DPC.    */
+       DPC_PROC pfnDPC;        /* Client's DPC.                 */
+       u32 numRequested;       /* Number of requested DPC's.      */
+       u32 numScheduled;       /* Number of executed DPC's.      */
+       struct tasklet_struct dpc_tasklet;

[...]

Removed

Quoted 17 lines
Quoted 17 lines
drivers/dsp/bridge/wmd/io_sm.c +8 -1
index 96a5aa6..60dbc62 100644
@@ -251,7 +251,26 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 
        if (devType == DSP_UNIT) {
                /* Create a DPC object: */
-               status = DPC_Create(&pIOMgr->hDPC, IO_DPC, (void *)pIOMgr);
+               MEM_AllocObject(pIOMgr->hDPC, struct DPC_OBJECT,
+                               IO_MGRSIGNATURE);
+               if (pIOMgr->hDPC) {
+                       tasklet_init(&pIOMgr->hDPC->dpc_tasklet,
+                               DPC_DeferredProcedure, (u32)pIOMgr->hDPC);
+                       /* Fill out our DPC Object: */
+                       pIOMgr->hDPC->pRefData = (void *)pIOMgr;
+                       pIOMgr->hDPC->pfnDPC = IO_DPC;
Quoted 8 lines

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 267

Quoted 6 lines
drivers/dsp/bridge/wmd/io_sm.c +6 -0
+                       pIOMgr->hDPC->numRequested = 0;
+                       pIOMgr->hDPC->numScheduled = 0;
+#ifdef DEBUG
+                       pIOMgr->hDPC->numRequestedMax = 0;
+                       pIOMgr->hDPC->cEntryCount = 0;
+#endif

Do you want to do a memset with 0 instead and fill up the deltas?

This was an intermediate step before removing the dpc thing, in the last patch this looks like [snip]
+ /* Create an IO DPC */
+ tasklet_init(&pIOMgr->dpc_tasklet, IO_DPC, (u32)pIOMgr);
+
+ /* Initialize DPC counters */
+ pIOMgr->dpc_req = 0;
+ pIOMgr->dpc_sched = 0;
+
+ spin_lock_init(&pIOMgr->dpc_lock);
[snip]

Quoted 9 lines

drivers/dsp/bridge/wmd/io_sm.c irqreturn_t IO_ISR(int irq, IN void *pRefData) · line 1075

Quoted 7 lines
drivers/dsp/bridge/wmd/io_sm.c +7 -0
+#ifdef DEBUG
+                       if (hIOMgr->hDPC->numRequested >
+                          hIOMgr->hDPC->numScheduled +
+                          hIOMgr->hDPC->numRequestedMax) {
+                               hIOMgr->hDPC->numRequestedMax =
+                                       hIOMgr->hDPC->numRequested -
+                                       hIOMgr->hDPC->numScheduled;

a) is this safe?
b) {} for a one liner ? mebbe the level of indentation is too much?

This was removed.

Quoted 34 lines
Quoted 3 lines
drivers/dsp/bridge/wmd/io_sm.c +2 -0
+                       }
+#endif

[...]

Quoted 17 lines
drivers/dsp/bridge/wmd/ue_deh.c +9 -2
@@ -91,8 +91,27 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
                        status = NTFY_Create(&pDehMgr->hNtfy);
 
                /* Create a DPC object. */
-               status = DPC_Create(&pDehMgr->hMmuFaultDpc, MMU_FaultDpc,
-                                  (void *)pDehMgr);
+               MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
+                               SIGNATURE);
+               if (pDehMgr->hMmuFaultDpc) {
+                       tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
+                               DPC_DeferredProcedure,
+                               (u32)pDehMgr->hMmuFaultDpc);
+                       /* Fill out DPC Object */
+                       pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
+                       pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;

drivers/dsp/bridge/wmd/ue_deh.c DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr, · line 112

Quoted 10 lines
drivers/dsp/bridge/wmd/ue_deh.c +10 -0
+                       pDehMgr->hMmuFaultDpc->numRequested = 0;
+                       pDehMgr->hMmuFaultDpc->numScheduled = 0;
+#ifdef DEBUG
+                       pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
+                       pDehMgr->hMmuFaultDpc->cEntryCount = 0;
+#endif
+                       spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
+               } else {
+                       DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
+                       status = DSP_EMEMORY;

I think you give up at this point right? why continue the code? wont it be easier if your code did:

Quoted 6 lines
if (!pDehMgr->hMmuFaultDpc) {
	DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
	return DSP_EMEMORY;
}

do rest of code..

In the end (patch 9) this looks like:
+ /* Create a MMUfault DPC */
+ tasklet_init(&pDehMgr->dpc_tasklet, MMU_FaultDpc, (u32)pDehMgr);

I tried to split the changes to be cut and paste versions, and then cleaning up from there... like removing DeferredProcedure and replacing it for the actual DPC (IO_DPC or MMUfault), then removing DPC structure to avoid x->y->z things, I was trying to avoid a big patch with all the changes.

Thanks for the comments.

- omar

#15 lore raw

Re: [PATCH 5/9] DSPBRIDGE: trivial cleanup and indentation for io_sm

In reply to Omar Ramirez Luna
Quoted 13 lines · ext Omar Ramirez Luna

Remove duplicate set of braces from if statement and reduce indentation.

---
drivers/dsp/bridge/wmd/io_sm.c | 96 +++++++++++++++++-----------------------

1 files changed, 40 insertions(+), 56 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +0 -0
index af31831..96a5aa6 100644

drivers/dsp/bridge/wmd/io_sm.c struct IO_MGR { · line 118

Quoted 5 lines
drivers/dsp/bridge/wmd/io_sm.c +1 -1
@@ -115,7 +115,7 @@ struct IO_MGR {
 	/* private extnd proc info; mmu setup */
 	struct MGR_PROCESSOREXTINFO extProcInfo;
 	struct CMM_OBJECT *hCmmMgr; 	/* Shared Mem Mngr	      */
-       struct work_struct io_workq;     /*workqueue */
+	struct work_struct io_workq;     /*workqueue */

while at that: /* workqueue */

add the missing space.

Quoted 13 lines
drivers/dsp/bridge/wmd/io_sm.c +1 -1
 	u32 dQuePowerMbxVal[MAX_PM_REQS];
 	u32 iQuePowerHead;
 	u32 iQuePowerTail;
@@ -185,7 +185,7 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 	struct CFG_HOSTRES hostRes;
 	struct CFG_DEVNODE *hDevNode;
 	struct CHNL_MGR *hChnlMgr;
-       static int ref_count;
+	static int ref_count;
 	u32 devType;
 	/* Check requirements:  */
 	if (!phIOMgr || !pMgrAttrs || pMgrAttrs->uWordSize == 0) {

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 203

Quoted 9 lines
drivers/dsp/bridge/wmd/io_sm.c +3 -2
@@ -197,9 +197,10 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 		status = DSP_EHANDLE;
 		goto func_end;
 	}
-	 /*  Message manager will be created when a file is loaded, since
+	/*  Message manager will be created when a file is loaded, since
 	 *  size of message buffer in shared memory is configurable in
-	 *  the base image.  */
+	 *  the base image.
+	 */

same here... it should be:

/* multi-line comment start here and has only one
* space after the * character.
* If you could remove the extra space above would
* be nice.
*/

Signature · 1 line
balbi
#16 lore raw

RE: [PATCH 5/9] DSPBRIDGE: trivial cleanup and indentation for io_sm

Quoted 25 lines

From: Felipe Balbi [mailto:[email protected]]
Subject: Re: [PATCH 5/9] DSPBRIDGE: trivial cleanup and indentation for io_sm

Quoted 13 lines · ext Omar Ramirez Luna

Remove duplicate set of braces from if statement and reduce indentation.

---
drivers/dsp/bridge/wmd/io_sm.c | 96 +++++++++++++++++-----------------------

1 files changed, 40 insertions(+), 56 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +0 -0
index af31831..96a5aa6 100644

drivers/dsp/bridge/wmd/io_sm.c struct IO_MGR { · line 118

Quoted 5 lines
drivers/dsp/bridge/wmd/io_sm.c +1 -1
@@ -115,7 +115,7 @@ struct IO_MGR {
 	/* private extnd proc info; mmu setup */
 	struct MGR_PROCESSOREXTINFO extProcInfo;
 	struct CMM_OBJECT *hCmmMgr; 	/* Shared Mem Mngr	      */
-       struct work_struct io_workq;     /*workqueue */
+	struct work_struct io_workq;     /*workqueue */

while at that: /* workqueue */

Quoted 1 line

add the missing space.

Agree.

Quoted 26 lines
Quoted 14 lines
drivers/dsp/bridge/wmd/io_sm.c +1 -1
 	u32 dQuePowerMbxVal[MAX_PM_REQS];
 	u32 iQuePowerHead;
 	u32 iQuePowerTail;
@@ -185,7 +185,7 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 	struct CFG_HOSTRES hostRes;
 	struct CFG_DEVNODE *hDevNode;
 	struct CHNL_MGR *hChnlMgr;
-       static int ref_count;
+	static int ref_count;
 	u32 devType;
 	/* Check requirements:  */
 	if (!phIOMgr || !pMgrAttrs || pMgrAttrs->uWordSize == 0) {

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 203

Quoted 9 lines
drivers/dsp/bridge/wmd/io_sm.c +3 -2
@@ -197,9 +197,10 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 		status = DSP_EHANDLE;
 		goto func_end;
 	}
-	 /*  Message manager will be created when a file is loaded, since
+	/*  Message manager will be created when a file is loaded, since
 	 *  size of message buffer in shared memory is configurable in
-	 *  the base image.  */
+	 *  the base image.
+	 */

same here... it should be:

Quoted 6 lines

/* multi-line comment start here and has only one
* space after the * character.
* If you could remove the extra space above would
* be nice.
*/

Agree.

- omar

#17 lore raw

Re: [PATCH 5/9] DSPBRIDGE: trivial cleanup and indentation for io_sm

In reply to Felipe Balbi
Quoted 49 lines · Felipe Balbi
Quoted 13 lines · ext Omar Ramirez Luna

Remove duplicate set of braces from if statement and reduce indentation.

---
drivers/dsp/bridge/wmd/io_sm.c | 96 +++++++++++++++++-----------------------

1 files changed, 40 insertions(+), 56 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +0 -0
index af31831..96a5aa6 100644

drivers/dsp/bridge/wmd/io_sm.c struct IO_MGR { · line 118

Quoted 5 lines
drivers/dsp/bridge/wmd/io_sm.c +1 -1
@@ -115,7 +115,7 @@ struct IO_MGR {
 	/* private extnd proc info; mmu setup */
 	struct MGR_PROCESSOREXTINFO extProcInfo;
 	struct CMM_OBJECT *hCmmMgr; 	/* Shared Mem Mngr	      */
-       struct work_struct io_workq;     /*workqueue */
+	struct work_struct io_workq;     /*workqueue */

while at that: /* workqueue */

add the missing space.

Quoted 13 lines
drivers/dsp/bridge/wmd/io_sm.c +1 -1
 	u32 dQuePowerMbxVal[MAX_PM_REQS];
 	u32 iQuePowerHead;
 	u32 iQuePowerTail;
@@ -185,7 +185,7 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 	struct CFG_HOSTRES hostRes;
 	struct CFG_DEVNODE *hDevNode;
 	struct CHNL_MGR *hChnlMgr;
-       static int ref_count;
+	static int ref_count;
 	u32 devType;
 	/* Check requirements:  */
 	if (!phIOMgr || !pMgrAttrs || pMgrAttrs->uWordSize == 0) {

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 203

Quoted 9 lines
drivers/dsp/bridge/wmd/io_sm.c +3 -2
@@ -197,9 +197,10 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 		status = DSP_EHANDLE;
 		goto func_end;
 	}
-	 /*  Message manager will be created when a file is loaded, since
+	/*  Message manager will be created when a file is loaded, since
 	 *  size of message buffer in shared memory is configurable in
-	 *  the base image.  */
+	 *  the base image.
+	 */

same here... it should be:

Quoted 5 lines

/* multi-line comment start here and has only one
* space after the * character.
* If you could remove the extra space above would
* be nice.
*/

Then strictly speaking it should be

/*
* Mulit-line comment start here.
*/

Grep for "The preferred style for long (multi-line) comments is" in Documentation/CodingStyle.

Signature · 7 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#18 lore raw

Re: [PATCH 5/9] DSPBRIDGE: trivial cleanup and indentation for io_sm

In reply to Omar Ramirez Luna

Ramirez Luna, Omar had written, on 11/23/2009 06:50 PM, the following:

Quoted 12 lines

Remove duplicate set of braces from if statement and reduce indentation.

---
 drivers/dsp/bridge/wmd/io_sm.c |   96 +++++++++++++++++-----------------------
 1 files changed, 40 insertions(+), 56 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +0 -0
index af31831..96a5aa6 100644

[...]

Quoted 33 lines
drivers/dsp/bridge/wmd/io_sm.c +11 -18
@@ -1028,29 +1016,28 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
 
 	/* Call WMD's CHNLSM_ISR() to see if interrupt is ours, and process. */
 	if (IO_CALLISR(hIOMgr->hWmdContext, &fSchedDPC, &hIOMgr->wIntrVal)) {
-		{
-			DBG_Trace(DBG_LEVEL3, "IO_ISR %x\n", hIOMgr->wIntrVal);
-			if (hIOMgr->wIntrVal & MBX_PM_CLASS) {
-				hIOMgr->dQuePowerMbxVal[hIOMgr->iQuePowerHead] =
-					hIOMgr->wIntrVal;
-				hIOMgr->iQuePowerHead++;
-				if (hIOMgr->iQuePowerHead >= MAX_PM_REQS)
-					hIOMgr->iQuePowerHead = 0;
-
-				queue_work(bridge_workqueue, &hIOMgr->io_workq);
-			}
-			if (hIOMgr->wIntrVal == MBX_DEH_RESET) {
-				DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
-				hIOMgr->wIntrVal = 0;
-			} else if (fSchedDPC) {
-				/* PROC-COPY defer i/o  */
-				DPC_Schedule(hIOMgr->hDPC);
-			}
+		DBG_Trace(DBG_LEVEL3, "IO_ISR %x\n", hIOMgr->wIntrVal);
+		if (hIOMgr->wIntrVal & MBX_PM_CLASS) {
+			hIOMgr->dQuePowerMbxVal[hIOMgr->iQuePowerHead] =
+				hIOMgr->wIntrVal;
+			hIOMgr->iQuePowerHead++;
+			if (hIOMgr->iQuePowerHead >= MAX_PM_REQS)
+				hIOMgr->iQuePowerHead = 0;
+
+			queue_work(bridge_workqueue, &hIOMgr->io_workq);
+		}
+		if (hIOMgr->wIntrVal == MBX_DEH_RESET) {

drivers/dsp/bridge/wmd/io_sm.c irqreturn_t IO_ISR(int irq, IN void *pRefData) · line 1038

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +6 -1
+			DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
+			hIOMgr->wIntrVal = 0;
+		} else if (fSchedDPC) {
+			/* PROC-COPY defer i/o  */
+			DPC_Schedule(hIOMgr->hDPC);
 		}
-       } else
+	} else
 		/* Ensure that, if WMD didn't claim it, the IRQ is shared. */
 		DBC_Ensure(hIOMgr->fSharedIRQ);

Style comment } else { needed.

Signature · 2 lines
Regards,
Nishanth Menon
#19 lore raw

Re: [PATCH 4/9] DSPBRIDGE: Use _IOxx macro to define ioctls

In reply to Omar Ramirez Luna

Ramirez Luna, Omar had written, on 11/23/2009 06:50 PM, the following:

Quoted 5 lines

Use standard convention to define ioctls.

Currently 'DB' is used as identifier for dspbridge.

*** NOTE: An update in api ioctl definitions is required. ***

Definitely YES ;)

Quoted 85 lines
---
 arch/arm/plat-omap/include/dspbridge/wcdioctl.h |  142 ++++++++++-------------
 drivers/dsp/bridge/pmgr/wcd.c                   |  116 +++++++++----------
 2 files changed, 117 insertions(+), 141 deletions(-)
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +0 -70
index 397361c..8aaa1ec 100644
@@ -391,83 +391,67 @@ union Trapped_Args {
        } ARGS_UTIL_TESTDLL;
 } ;
 
-#define CMD_BASE                   101
-
-/* MGR module offsets */
-#define CMD_MGR_BASE_OFFSET         CMD_BASE
-#define CMD_MGR_ENUMNODE_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 0)
-#define CMD_MGR_ENUMPROC_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 1)
-#define CMD_MGR_REGISTEROBJECT_OFFSET   (CMD_MGR_BASE_OFFSET + 2)
-#define CMD_MGR_UNREGISTEROBJECT_OFFSET (CMD_MGR_BASE_OFFSET + 3)
-#define CMD_MGR_WAIT_OFFSET         (CMD_MGR_BASE_OFFSET + 4)
-
-#ifndef RES_CLEANUP_DISABLE
-#define CMD_MGR_RESOUCES_OFFSET         (CMD_MGR_BASE_OFFSET + 5)
-#define CMD_MGR_END_OFFSET           CMD_MGR_RESOUCES_OFFSET
-#else
-#define CMD_MGR_END_OFFSET           CMD_MGR_WAIT_OFFSET
-#endif
-
-#define CMD_PROC_BASE_OFFSET       (CMD_MGR_END_OFFSET + 1)
-#define CMD_PROC_ATTACH_OFFSET   (CMD_PROC_BASE_OFFSET + 0)
-#define CMD_PROC_CTRL_OFFSET       (CMD_PROC_BASE_OFFSET + 1)
-#define CMD_PROC_DETACH_OFFSET   (CMD_PROC_BASE_OFFSET + 2)
-#define CMD_PROC_ENUMNODE_OFFSET       (CMD_PROC_BASE_OFFSET + 3)
-#define CMD_PROC_ENUMRESOURCES_OFFSET   (CMD_PROC_BASE_OFFSET + 4)
-#define CMD_PROC_GETSTATE_OFFSET       (CMD_PROC_BASE_OFFSET + 5)
-#define CMD_PROC_GETTRACE_OFFSET       (CMD_PROC_BASE_OFFSET + 6)
-#define CMD_PROC_LOAD_OFFSET       (CMD_PROC_BASE_OFFSET + 7)
-#define CMD_PROC_REGISTERNOTIFY_OFFSET  (CMD_PROC_BASE_OFFSET + 8)
-#define CMD_PROC_START_OFFSET     (CMD_PROC_BASE_OFFSET + 9)
-#define CMD_PROC_RSVMEM_OFFSET   (CMD_PROC_BASE_OFFSET + 10)
-#define CMD_PROC_UNRSVMEM_OFFSET       (CMD_PROC_BASE_OFFSET + 11)
-#define CMD_PROC_MAPMEM_OFFSET   (CMD_PROC_BASE_OFFSET + 12)
-#define CMD_PROC_UNMAPMEM_OFFSET       (CMD_PROC_BASE_OFFSET + 13)
-#define CMD_PROC_FLUSHMEMORY_OFFSET      (CMD_PROC_BASE_OFFSET + 14)
-#define CMD_PROC_STOP_OFFSET       (CMD_PROC_BASE_OFFSET + 15)
-#define CMD_PROC_INVALIDATEMEMORY_OFFSET (CMD_PROC_BASE_OFFSET + 16)
-#define CMD_PROC_END_OFFSET         CMD_PROC_INVALIDATEMEMORY_OFFSET
-
-
-#define CMD_NODE_BASE_OFFSET       (CMD_PROC_END_OFFSET + 1)
-#define CMD_NODE_ALLOCATE_OFFSET       (CMD_NODE_BASE_OFFSET + 0)
-#define CMD_NODE_ALLOCMSGBUF_OFFSET     (CMD_NODE_BASE_OFFSET + 1)
-#define CMD_NODE_CHANGEPRIORITY_OFFSET  (CMD_NODE_BASE_OFFSET + 2)
-#define CMD_NODE_CONNECT_OFFSET         (CMD_NODE_BASE_OFFSET + 3)
-#define CMD_NODE_CREATE_OFFSET   (CMD_NODE_BASE_OFFSET + 4)
-#define CMD_NODE_DELETE_OFFSET   (CMD_NODE_BASE_OFFSET + 5)
-#define CMD_NODE_FREEMSGBUF_OFFSET      (CMD_NODE_BASE_OFFSET + 6)
-#define CMD_NODE_GETATTR_OFFSET         (CMD_NODE_BASE_OFFSET + 7)
-#define CMD_NODE_GETMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 8)
-#define CMD_NODE_PAUSE_OFFSET     (CMD_NODE_BASE_OFFSET + 9)
-#define CMD_NODE_PUTMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 10)
-#define CMD_NODE_REGISTERNOTIFY_OFFSET  (CMD_NODE_BASE_OFFSET + 11)
-#define CMD_NODE_RUN_OFFSET         (CMD_NODE_BASE_OFFSET + 12)
-#define CMD_NODE_TERMINATE_OFFSET       (CMD_NODE_BASE_OFFSET + 13)
-#define CMD_NODE_GETUUIDPROPS_OFFSET    (CMD_NODE_BASE_OFFSET + 14)
-#define CMD_NODE_END_OFFSET         CMD_NODE_GETUUIDPROPS_OFFSET
-
-#define CMD_STRM_BASE_OFFSET       (CMD_NODE_END_OFFSET + 1)
-#define CMD_STRM_ALLOCATEBUFFER_OFFSET  (CMD_STRM_BASE_OFFSET + 0)
-#define CMD_STRM_CLOSE_OFFSET     (CMD_STRM_BASE_OFFSET + 1)
-#define CMD_STRM_FREEBUFFER_OFFSET      (CMD_STRM_BASE_OFFSET + 2)
-#define CMD_STRM_GETEVENTHANDLE_OFFSET  (CMD_STRM_BASE_OFFSET + 3)
-#define CMD_STRM_GETINFO_OFFSET         (CMD_STRM_BASE_OFFSET + 4)
-#define CMD_STRM_IDLE_OFFSET       (CMD_STRM_BASE_OFFSET + 5)
-#define CMD_STRM_ISSUE_OFFSET     (CMD_STRM_BASE_OFFSET + 6)
-#define CMD_STRM_OPEN_OFFSET       (CMD_STRM_BASE_OFFSET + 7)
-#define CMD_STRM_RECLAIM_OFFSET         (CMD_STRM_BASE_OFFSET + 8)
-#define CMD_STRM_REGISTERNOTIFY_OFFSET  (CMD_STRM_BASE_OFFSET + 9)
-#define CMD_STRM_SELECT_OFFSET   (CMD_STRM_BASE_OFFSET + 10)
-#define CMD_STRM_END_OFFSET         CMD_STRM_SELECT_OFFSET
-

arch/arm/plat-omap/include/dspbridge/wcdioctl.h union Trapped_Args { · line 394

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +1 -9
-/* Communication Memory Manager (UCMM) */
-#define CMD_CMM_BASE_OFFSET         (CMD_STRM_END_OFFSET + 1)
-#define CMD_CMM_ALLOCBUF_OFFSET         (CMD_CMM_BASE_OFFSET + 0)
-#define CMD_CMM_FREEBUF_OFFSET   (CMD_CMM_BASE_OFFSET + 1)
-#define CMD_CMM_GETHANDLE_OFFSET       (CMD_CMM_BASE_OFFSET + 2)
-#define CMD_CMM_GETINFO_OFFSET   (CMD_CMM_BASE_OFFSET + 3)
-#define CMD_CMM_END_OFFSET           CMD_CMM_GETINFO_OFFSET
-
-#define CMD_BASE_END_OFFSET    CMD_CMM_END_OFFSET
+/* MGR module */

Documentation/CodingStyle again:
" Chapter 12: Macros, Enums and RTL
[..]

Enums are preferred when defining several related constants.
"
here is a perfect example of this.
using an enum will ensure that any mistakes you might do gets flagged as well.

arch/arm/plat-omap/include/dspbridge/wcdioctl.h union Trapped_Args { · line 398

Quoted 4 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +4 -0
+#define MGR_ENUMNODE_INFO      _IOWR('DB', 0, unsigned long)
+#define MGR_ENUMPROC_INFO      _IOWR('DB', 1, unsigned long)
+#define MGR_REGISTEROBJECT     _IOWR('DB', 2, unsigned long)
+#define MGR_UNREGISTEROBJECT   _IOWR('DB', 3, unsigned long)   /* Deprecated */

cant you use __deprecated to flag instead of putting a Deprecated comment which is never read?

Quoted 34 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +34 -0
+#define MGR_WAIT               _IOWR('DB', 4, unsigned long)
+#define MGR_GET_PROC_RES       _IOR('DB', 5, unsigned long)    /* Deprecated */
+
+/* PROC Module */
+#define PROC_ATTACH            _IOWR('DB', 6, unsigned long)
+#define PROC_CTRL              _IOR('DB', 7, unsigned long)
+#define PROC_DETACH            _IOR('DB', 8, unsigned long)    /* Deprecated */
+#define PROC_ENUMNODE          _IOWR('DB', 9, unsigned long)
+#define PROC_ENUMRESOURCES     _IOWR('DB', 10, unsigned long)
+#define PROC_GET_STATE         _IOWR('DB', 11, unsigned long)
+#define PROC_GET_TRACE         _IOWR('DB', 12, unsigned long)
+#define PROC_LOAD              _IOW('DB', 13, unsigned long)
+#define PROC_REGISTERNOTIFY    _IOWR('DB', 14, unsigned long)
+#define PROC_START             _IOW('DB', 15, unsigned long)
+#define PROC_RSVMEM            _IOWR('DB', 16, unsigned long)
+#define PROC_UNRSVMEM          _IOW('DB', 17, unsigned long)
+#define PROC_MAPMEM            _IOWR('DB', 18, unsigned long)
+#define PROC_UNMAPMEM          _IOR('DB', 19, unsigned long)
+#define PROC_FLUSHMEMORY       _IOW('DB', 20, unsigned long)
+#define PROC_STOP              _IOWR('DB', 21, unsigned long)
+#define PROC_INVALIDATEMEMORY  _IOW('DB', 22, unsigned long)
+
+/* NODE Module */
+#define NODE_ALLOCATE          _IOWR('DB', 23, unsigned long)
+#define NODE_ALLOCMSGBUF       _IOWR('DB', 24, unsigned long)
+#define NODE_CHANGEPRIORITY    _IOW('DB', 25, unsigned long)
+#define NODE_CONNECT           _IOW('DB', 26, unsigned long)
+#define NODE_CREATE            _IOW('DB', 27, unsigned long)
+#define NODE_DELETE            _IOW('DB', 28, unsigned long)
+#define NODE_FREEMSGBUF                _IOW('DB', 29, unsigned long)
+#define NODE_GETATTR           _IOWR('DB', 30, unsigned long)
+#define NODE_GETMESSAGE                _IOWR('DB', 31, unsigned long)
+#define NODE_PAUSE             _IOW('DB', 32, unsigned long)
+#define NODE_PUTMESSAGE                _IOW('DB', 33, unsigned long)

arch/arm/plat-omap/include/dspbridge/wcdioctl.h union Trapped_Args { · line 442

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +10 -0
+#define NODE_REGISTERNOTIFY    _IOWR('DB', 34, unsigned long)
+#define NODE_RUN               _IOW('DB', 35, unsigned long)
+#define NODE_TERMINATE         _IOWR('DB', 36, unsigned long)
+#define NODE_GETUUIDPROPS      _IOWR('DB', 37, unsigned long)
+
+/* STRM Module */
+#define STRM_ALLOCATEBUFFER    _IOWR('DB', 38, unsigned long)
+#define STRM_CLOSE             _IOW('DB', 39, unsigned long)
+#define STRM_FREEBUFFER                _IOWR('DB', 40, unsigned long)
+#define STRM_GETEVENTHANDLE    _IO('DB', 41)                   /* Not Impl'd */

Then why present?

arch/arm/plat-omap/include/dspbridge/wcdioctl.h union Trapped_Args { · line 453

Quoted 11 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +11 -0
+#define STRM_GETINFO           _IOWR('DB', 42, unsigned long)
+#define STRM_IDLE              _IOW('DB', 43, unsigned long)
+#define STRM_ISSUE             _IOW('DB', 44, unsigned long)
+#define STRM_OPEN              _IOWR('DB', 45, unsigned long)
+#define STRM_RECLAIM           _IOWR('DB', 46, unsigned long)
+#define STRM_REGISTERNOTIFY    _IOWR('DB', 47, unsigned long)
+#define STRM_SELECT            _IOWR('DB', 48, unsigned long)
+
+/* CMM Module */
+#define CMM_ALLOCBUF           _IO('DB', 49)                   /* Not Impl'd */
+#define CMM_FREEBUF            _IO('DB', 50)                   /* Not Impl'd */

then why present?

drivers/dsp/bridge/pmgr/wcd.c static u32 WCD_cRefs; · line 97

Quoted 11 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +3 -0
+#define CMM_GETHANDLE          _IOR('DB', 51, unsigned long)
+#define CMM_GETINFO            _IOR('DB', 52, unsigned long)
+
 #endif                         /* WCDIOCTL_ */
drivers/dsp/bridge/pmgr/wcd.c +0 -0
index 0d0ba8e..8ba98af 100644
@@ -96,65 +96,65 @@ static u32 WCD_cRefs;
  */
 static struct WCD_Cmd WCD_cmdTable[] = {

please please remove this structure.. trying to use a switch based handling is so much easier..

you can even do segregated handling based on:

case _IOC_TYPE('DB') :

	ioctl_handler_for_db(...);
	break;
Quoted 117 lines
drivers/dsp/bridge/pmgr/wcd.c +53 -53
        /* MGR module */
-       {MGRWRAP_EnumNode_Info, CMD_MGR_ENUMNODE_INFO_OFFSET},
-       {MGRWRAP_EnumProc_Info, CMD_MGR_ENUMPROC_INFO_OFFSET},
-       {MGRWRAP_RegisterObject, CMD_MGR_REGISTEROBJECT_OFFSET},
-       {MGRWRAP_UnregisterObject, CMD_MGR_UNREGISTEROBJECT_OFFSET},
-       {MGRWRAP_WaitForBridgeEvents, CMD_MGR_WAIT_OFFSET},
+       {MGRWRAP_EnumNode_Info},                /* MGR_ENUMNODE_INFO */
+       {MGRWRAP_EnumProc_Info},                /* MGR_ENUMPROC_INFO */
+       {MGRWRAP_RegisterObject},               /* MGR_REGISTEROBJECT */
+       {MGRWRAP_UnregisterObject},             /* MGR_UNREGISTEROBJECT */
+       {MGRWRAP_WaitForBridgeEvents},          /* MGR_WAIT */
 #ifndef RES_CLEANUP_DISABLE
-       {MGRWRAP_GetProcessResourcesInfo, CMD_MGR_RESOUCES_OFFSET},
+       {MGRWRAP_GetProcessResourcesInfo},      /* MGR_GET_PROC_RES */
 #endif
        /* PROC Module */
-       {PROCWRAP_Attach, CMD_PROC_ATTACH_OFFSET},
-       {PROCWRAP_Ctrl, CMD_PROC_CTRL_OFFSET},
-       {PROCWRAP_Detach, CMD_PROC_DETACH_OFFSET},
-       {PROCWRAP_EnumNode_Info, CMD_PROC_ENUMNODE_OFFSET},
-       {PROCWRAP_EnumResources, CMD_PROC_ENUMRESOURCES_OFFSET},
-       {PROCWRAP_GetState, CMD_PROC_GETSTATE_OFFSET},
-       {PROCWRAP_GetTrace, CMD_PROC_GETTRACE_OFFSET},
-       {PROCWRAP_Load, CMD_PROC_LOAD_OFFSET},
-       {PROCWRAP_RegisterNotify, CMD_PROC_REGISTERNOTIFY_OFFSET},
-       {PROCWRAP_Start, CMD_PROC_START_OFFSET},
-       {PROCWRAP_ReserveMemory, CMD_PROC_RSVMEM_OFFSET},
-       {PROCWRAP_UnReserveMemory, CMD_PROC_UNRSVMEM_OFFSET},
-       {PROCWRAP_Map, CMD_PROC_MAPMEM_OFFSET},
-       {PROCWRAP_UnMap, CMD_PROC_UNMAPMEM_OFFSET},
-       {PROCWRAP_FlushMemory, CMD_PROC_FLUSHMEMORY_OFFSET},
-       {PROCWRAP_Stop, CMD_PROC_STOP_OFFSET},
-       {PROCWRAP_InvalidateMemory, CMD_PROC_INVALIDATEMEMORY_OFFSET},
+       {PROCWRAP_Attach},                      /* PROC_ATTACH */
+       {PROCWRAP_Ctrl},                        /* PROC_CTRL */
+       {PROCWRAP_Detach},                      /* PROC_DETACH */
+       {PROCWRAP_EnumNode_Info},               /* PROC_ENUMNODE */
+       {PROCWRAP_EnumResources},               /* PROC_ENUMRESOURCES */
+       {PROCWRAP_GetState},                    /* PROC_GET_STATE */
+       {PROCWRAP_GetTrace},                    /* PROC_GET_TRACE */
+       {PROCWRAP_Load},                        /* PROC_LOAD */
+       {PROCWRAP_RegisterNotify},              /* PROC_REGISTERNOTIFY */
+       {PROCWRAP_Start},                       /* PROC_START */
+       {PROCWRAP_ReserveMemory},               /* PROC_RSVMEM */
+       {PROCWRAP_UnReserveMemory},             /* PROC_UNRSVMEM */
+       {PROCWRAP_Map},                         /* PROC_MAPMEM */
+       {PROCWRAP_UnMap},                       /* PROC_UNMAPMEM */
+       {PROCWRAP_FlushMemory},                 /* PROC_FLUSHMEMORY */
+       {PROCWRAP_Stop},                        /* PROC_STOP */
+       {PROCWRAP_InvalidateMemory},            /* PROC_INVALIDATEMEMORY */
        /* NODE Module */
-       {NODEWRAP_Allocate, CMD_NODE_ALLOCATE_OFFSET},
-       {NODEWRAP_AllocMsgBuf, CMD_NODE_ALLOCMSGBUF_OFFSET},
-       {NODEWRAP_ChangePriority, CMD_NODE_CHANGEPRIORITY_OFFSET},
-       {NODEWRAP_Connect, CMD_NODE_CONNECT_OFFSET},
-       {NODEWRAP_Create, CMD_NODE_CREATE_OFFSET},
-       {NODEWRAP_Delete, CMD_NODE_DELETE_OFFSET},
-       {NODEWRAP_FreeMsgBuf, CMD_NODE_FREEMSGBUF_OFFSET},
-       {NODEWRAP_GetAttr, CMD_NODE_GETATTR_OFFSET},
-       {NODEWRAP_GetMessage, CMD_NODE_GETMESSAGE_OFFSET},
-       {NODEWRAP_Pause, CMD_NODE_PAUSE_OFFSET},
-       {NODEWRAP_PutMessage, CMD_NODE_PUTMESSAGE_OFFSET},
-       {NODEWRAP_RegisterNotify, CMD_NODE_REGISTERNOTIFY_OFFSET},
-       {NODEWRAP_Run, CMD_NODE_RUN_OFFSET},
-       {NODEWRAP_Terminate, CMD_NODE_TERMINATE_OFFSET},
-       {NODEWRAP_GetUUIDProps, CMD_NODE_GETUUIDPROPS_OFFSET},
+       {NODEWRAP_Allocate},                    /* NODE_ALLOCATE */
+       {NODEWRAP_AllocMsgBuf},                 /* NODE_ALLOCMSGBUF */
+       {NODEWRAP_ChangePriority},              /* NODE_CHANGEPRIORITY */
+       {NODEWRAP_Connect},                     /* NODE_CONNECT */
+       {NODEWRAP_Create},                      /* NODE_CREATE */
+       {NODEWRAP_Delete},                      /* NODE_DELETE */
+       {NODEWRAP_FreeMsgBuf},                  /* NODE_FREEMSGBUF */
+       {NODEWRAP_GetAttr},                     /* NODE_GETATTR */
+       {NODEWRAP_GetMessage},                  /* NODE_GETMESSAGE */
+       {NODEWRAP_Pause},                       /* NODE_PAUSE */
+       {NODEWRAP_PutMessage},                  /* NODE_PUTMESSAGE */
+       {NODEWRAP_RegisterNotify},              /* NODE_REGISTERNOTIFY */
+       {NODEWRAP_Run},                         /* NODE_RUN */
+       {NODEWRAP_Terminate},                   /* NODE_TERMINATE */
+       {NODEWRAP_GetUUIDProps},                /* NODE_GETUUIDPROPS */
        /* STRM wrapper functions */
-       {STRMWRAP_AllocateBuffer, CMD_STRM_ALLOCATEBUFFER_OFFSET},
-       {STRMWRAP_Close, CMD_STRM_CLOSE_OFFSET},
-       {STRMWRAP_FreeBuffer, CMD_STRM_FREEBUFFER_OFFSET},
-       {STRMWRAP_GetEventHandle, CMD_STRM_GETEVENTHANDLE_OFFSET},
-       {STRMWRAP_GetInfo, CMD_STRM_GETINFO_OFFSET},
-       {STRMWRAP_Idle, CMD_STRM_IDLE_OFFSET},
-       {STRMWRAP_Issue, CMD_STRM_ISSUE_OFFSET},
-       {STRMWRAP_Open, CMD_STRM_OPEN_OFFSET},
-       {STRMWRAP_Reclaim, CMD_STRM_RECLAIM_OFFSET},
-       {STRMWRAP_RegisterNotify, CMD_STRM_REGISTERNOTIFY_OFFSET},
-       {STRMWRAP_Select, CMD_STRM_SELECT_OFFSET},
+       {STRMWRAP_AllocateBuffer},              /* STRM_ALLOCATEBUFFER */
+       {STRMWRAP_Close},                       /* STRM_CLOSE */
+       {STRMWRAP_FreeBuffer},                  /* STRM_FREEBUFFER */
+       {STRMWRAP_GetEventHandle},              /* STRM_GETEVENTHANDLE */
+       {STRMWRAP_GetInfo},                     /* STRM_GETINFO */
+       {STRMWRAP_Idle},                        /* STRM_IDLE */
+       {STRMWRAP_Issue},                       /* STRM_ISSUE */
+       {STRMWRAP_Open},                        /* STRM_OPEN */
+       {STRMWRAP_Reclaim},                     /* STRM_RECLAIM */
+       {STRMWRAP_RegisterNotify},              /* STRM_REGISTERNOTIFY */
+       {STRMWRAP_Select},                      /* STRM_SELECT */
        /* CMM module */
-       {CMMWRAP_CallocBuf, CMD_CMM_ALLOCBUF_OFFSET},
-       {CMMWRAP_FreeBuf, CMD_CMM_FREEBUF_OFFSET},
-       {CMMWRAP_GetHandle, CMD_CMM_GETHANDLE_OFFSET},
-       {CMMWRAP_GetInfo, CMD_CMM_GETINFO_OFFSET}
+       {CMMWRAP_CallocBuf},                    /* CMM_ALLOCBUF */
+       {CMMWRAP_FreeBuf},                      /* CMM_FREEBUF */
+       {CMMWRAP_GetHandle},                    /* CMM_GETHANDLE */
+       {CMMWRAP_GetInfo},                      /* CMM_GETINFO */
 };
 
 static inline void __cp_fm_usr(void *to, const void __user *from,

drivers/dsp/bridge/pmgr/wcd.c static inline void __cp_to_usr(void __user *to, const void *from, · line 208

Quoted 9 lines
drivers/dsp/bridge/pmgr/wcd.c +1 -2
@@ -202,8 +202,7 @@ static inline void __cp_to_usr(void __user *to, const void *from,
 inline DSP_STATUS WCD_CallDevIOCtl(u32 cmd, union Trapped_Args *args,
                                    u32 *pResult, void *pr_ctxt)
 {
-       cmd -= CMD_BASE;
-
+       cmd = _IOC_NR(cmd);
        if (cmd < ARRAY_SIZE(WCD_cmdTable)) {
                /* make the fxn call via the cmd table */
                *pResult = (*WCD_cmdTable[cmd].fxn) (args, pr_ctxt);

see previous description.

drivers/dsp/bridge/pmgr/wcd.c bool WCD_Init(void) · line 262

Quoted 12 lines
drivers/dsp/bridge/pmgr/wcd.c +0 -7
@@ -252,14 +251,7 @@ bool WCD_Init(void)
        bool fInit = true;
        bool fDRV, fDEV, fCOD, fSERVICES, fCHNL, fMSG, fIO;
        bool fMGR, fPROC, fNODE, fDISP, fNTFY, fSTRM, fRMM;
-#ifdef DEBUG
-       /* runtime check of Device IOCtl array. */
-       u32 i;
-       int cmdtable = ARRAY_SIZE(WCD_cmdTable);
 
-       for (i = 0; i < cmdtable; i++)
-               DBC_Assert(WCD_cmdTable[i].dwIndex == i + CMD_BASE);
-#endif

Thanks.. though your patch commit message was was not saying about this ;)

Signature · 2 lines
Regards,
Nishanth Menon
#20 lore raw

Re: [PATCH 2/9] DSPBRIDGE: trivial checkpatch fixes

In reply to Omar Ramirez Luna

Ramirez Luna, Omar had written, on 11/23/2009 06:50 PM, the following:

Quoted 1 line

Quick fixes like:

General comment: please do white space changes as a separate patch. this massive patch is pretty difficult to review otherwise.. might have been as simple as doing scripts/Lindent on all files and refixing with scripts/checkpatch.pl ..

[...]

arch/arm/plat-omap/include/dspbridge/dbc.h line 39

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/dbc.h +1 -1
index e9cb548..13b1ff6 100644
@@ -36,7 +36,7 @@
 
 #define DBC_Assert(exp) \
     if (!(exp)) \
-       printk("%s, line %d: Assertion (" #exp ") failed.\n", \
+       printk(KERN_ERR "%s, line %d: Assertion (" #exp ") failed.\n", \

Not in the context of this patch, but we definitely need another series killing these printks into pr_xxxx family..

Quoted 47 lines
arch/arm/plat-omap/include/dspbridge/dbc.h +0 -0
        __FILE__, __LINE__)
 #define DBC_Require DBC_Assert /* Function Precondition.  */
 #define DBC_Ensure  DBC_Assert /* Function Postcondition. */
arch/arm/plat-omap/include/dspbridge/dbdefs.h +4 -4
index bae19e7..1a7d5fa 100644
@@ -21,9 +21,9 @@
 
 #include <linux/types.h>
 
-#include <dspbridge/dbtype.h>          /* GPP side type definitions           */
-#include <dspbridge/std.h>             /* DSP/BIOS type definitions           */
-#include <dspbridge/rms_sh.h>          /* Types shared between GPP and DSP    */
+#include <dspbridge/dbtype.h>          /* GPP side type definitions */
+#include <dspbridge/std.h>             /* DSP/BIOS type definitions */
+#include <dspbridge/rms_sh.h>          /* Types shared between GPP and DSP */
 
 #define PG_SIZE_4K 4096
 #define PG_MASK(pg_size) (~((pg_size)-1))
@@ -553,7 +553,7 @@ bit 6 - MMU element size = 64bit (valid only for non mixed page entries)
 #define AUTOSTART      "AutoStart"             /* Statically load flag */
 #define CURRENTCONFIG  "CurrentConfig"         /* Current resources */
 #define SHMSIZE                "SHMSize"               /* Size of SHM reservd on MPU */
-#define TCWORDSWAP     "TCWordSwap"            /* Traffic Contoller Word Swap */
+#define TCWORDSWAP     "TCWordSwap"            /* Traffic Controller WordSwp */
 #define DSPRESOURCES   "DspTMSResources"       /* C55 DSP resurces on OMAP */
 
 #endif                         /* DBDEFS_ */
arch/arm/plat-omap/include/dspbridge/gt.h +1 -1
index b43b1e7..c110234 100644
@@ -232,7 +232,7 @@ extern struct GT_Config _GT_params;
 
 #define GT_assert(mask, expr) \
        (!(expr) ? \
-           printk("assertion violation: %s, line %d\n", \
+           printk(KERN_ERR "assertion violation: %s, line %d\n", \
                            __FILE__, __LINE__), NULL : NULL)
 
 #define GT_config(config)     (_GT_params = *(config))
arch/arm/plat-omap/include/dspbridge/io_sm.h +0 -0
index b8f4fb7..77f9e25 100644

arch/arm/plat-omap/include/dspbridge/io_sm.h line 299

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/io_sm.h +1 -1
@@ -291,13 +291,13 @@
 
        extern void IO_IntrDSP2(IN struct IO_MGR *pIOMgr, IN u16 wMbVal);
 
-       extern void IO_SM_init(void);
+       extern void IO_SM_init(void);
 
 /*
  *  ========PrintDspTraceBuffer ========
  *      Print DSP tracebuffer.
  */

no comments ;)

Quoted 11 lines
arch/arm/plat-omap/include/dspbridge/io_sm.h +2 -2
-       extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
-                                               *hWmdContext);
+       extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
+                                               *hWmdContext);
 
 #endif                         /* IOSM_ */
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +0 -0
index b213b82..397361c 100644

arch/arm/plat-omap/include/dspbridge/wcdioctl.h union Trapped_Args { · line 57

Quoted 5 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +1 -1
@@ -54,7 +54,7 @@ union Trapped_Args {
        } ARGS_MGR_UNREGISTEROBJECT;
 
        struct {
-               struct DSP_NOTIFICATION  __user*__user *aNotifications;
+               struct DSP_NOTIFICATION  __user *__user *aNotifications;

include/linux/compiler.h

# define __user         __attribute__((noderef, address_space(1)))

Trying to understand this seemingly interesting double usage of __user

Quoted 17 lines
arch/arm/plat-omap/include/dspbridge/wcdioctl.h +1 -1
                u32 uCount;
                u32 __user *puIndex;
                u32 uTimeout;
@@ -111,7 +111,7 @@ union Trapped_Args {
        struct {
                DSP_HPROCESSOR hProcessor;
                s32 iArgc;
-               char __user*__user *aArgv;
+               char __user *__user *aArgv;
                char *__user *aEnvp;
        } ARGS_PROC_LOAD;
 
drivers/dsp/bridge/dynload/reloc.c +0 -0
index d4457c5..b9e2a9b 100644

drivers/dsp/bridge/dynload/reloc.c void dload_relocate(struct dload_state *dlthis, TgtAU_t *data, · line 197

Quoted 3 lines
drivers/dsp/bridge/dynload/reloc.c +0 -0
@@ -195,20 +195,22 @@ void dload_relocate(struct dload_state *dlthis, TgtAU_t *data,
                rx = HASH_L(rop_map2[rx]);
                if (rx < 0) {
 #if TMS32060

???? do we support others now?

Quoted 10 lines
drivers/dsp/bridge/dynload/reloc.c +0 -10
-               switch (rp->r_type) {
-               case R_C60ALIGN:
-               case R_C60NOCMP:
-               case R_C60FPHEAD:
-                   /* Ignore these reloc types and return */
-                   break;
-               default:
-                   /* Unknown reloc type, print error and return */
-                   dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
-           }

drivers/dsp/bridge/dynload/reloc.c void dload_relocate(struct dload_state *dlthis, TgtAU_t *data, · line 207

Quoted 10 lines
drivers/dsp/bridge/dynload/reloc.c +10 -0
+                       switch (rp->r_type) {
+                       case R_C60ALIGN:
+                       case R_C60NOCMP:
+                       case R_C60FPHEAD:
+                               /* Ignore these reloc types and return */
+                               break;
+                       default:
+                               /* Unknown reloc type, print error and return */
+                               dload_error(dlthis, "Bad coff operator 0x%x",
+                                               rp->r_type);

we probably need to remove these custom print messages.

drivers/dsp/bridge/gen/_gt_para.c static void error(char *fmt, ...)

Quoted 26 lines
drivers/dsp/bridge/dynload/reloc.c +6 -3
+                       }
 #else
-           dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
+                       dload_error(dlthis, "Bad coff operator 0x%x",
+                                       rp->r_type);
 #endif
-           return;
+                       return;
                }
        }
        rx = HASH_I(rop_map2[rx]);
@@ -216,7 +218,8 @@ void dload_relocate(struct dload_state *dlthis, TgtAU_t *data,
           && (rx < (sizeof(rop_info)/sizeof(uint_least16_t))) && (rx > 0)) {
                reloc_action = rop_action[rx]; reloc_info = rop_info[rx];
        } else {
-           dload_error(dlthis, "Buffer Overflow - Array Index Out of Bounds");
+               dload_error(dlthis, "Buffer Overflow - Array Index Out "
+                               "of Bounds");
        }
 
        /* Compute the relocation amount for the referenced symbol, if any */
drivers/dsp/bridge/gen/_gt_para.c +0 -0
index 9f8246b..dd22f77 100644
@@ -77,7 +77,7 @@ static void error(char *fmt, ...)

error: Dont think we should have custom error reporting mechanisms.

drivers/dsp/bridge/gen/_gt_para.c static void error(char *fmt, ...) · line 80

Quoted 5 lines
drivers/dsp/bridge/gen/_gt_para.c +1 -1
        va_end(va);
 
-       printk("ERROR: ");
+       printk(KERN_ERR "ERROR: ");

Nak.

Quoted 2 lines
drivers/dsp/bridge/gen/_gt_para.c +0 -0
        printk(fmt, arg1, arg2, arg3, arg4, arg5, arg6);
 

[...]

Quoted 13 lines
drivers/dsp/bridge/pmgr/cod.c +1 -1
index 0bbee3c..979778d 100644
@@ -368,7 +368,7 @@ DSP_STATUS COD_GetBaseName(struct COD_MANAGER *hManager, char *pszName,
        DBC_Require(pszName != NULL);
 
        if (uSize <= COD_MAXPATHLENGTH)
-               strncpy(pszName, hManager->szZLFile, uSize);
+               strncpy(pszName, hManager->szZLFile, uSize);
        else
                status = DSP_EFAIL;
 

[...]

drivers/dsp/bridge/pmgr/cod.c static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf, · line 1475

Quoted 9 lines
        struct DBLLAlloc *pAlloc = (struct DBLLAlloc *)this;
        struct DBLL_LibraryObj *lib;
drivers/dsp/bridge/pmgr/cod.c +2 -1
@@ -1471,13 +1471,14 @@ static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf,
 
        DBC_Require(this != NULL);
        lib = pInit->lib;
-       DBC_Require(MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE));
+       if (!MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE))
+               return false;

int returning function getting false?? should'nt u be using something like -EINVALID or -ENOMEM?

drivers/dsp/bridge/pmgr/cod.c static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf, · line 1477

Quoted 2 lines
drivers/dsp/bridge/pmgr/cod.c +2 -0
+
+       pTarget = lib->pTarget;

HUH?? you just introduced a bug! if lib was NULL?? BOOM..

drivers/dsp/bridge/pmgr/cod.c static int writeMem(struct Dynamic_Loader_Initialize *this, void *buf, · line 1480

Quoted 7 lines
drivers/dsp/bridge/pmgr/cod.c +1 -3
        memType = (DLOAD_SECTION_TYPE(info->type) == DLOAD_TEXT) ? DBLL_CODE :
                  DBLL_DATA;
-       if ((lib != NULL) &&
-           ((pTarget = lib->pTarget) != NULL) &&
-           (pTarget->attrs.write != NULL)) {
+       if (lib && pTarget && pTarget->attrs.write) {

note: the logic changes with your implementation.. unfortunately in favor of a buggy one.

Quoted 23 lines
drivers/dsp/bridge/rmgr/drv.c +2 -2
index 7ec1ccc..d455c5b 100644
@@ -888,7 +888,7 @@ DSP_STATUS DRV_Init(void)
  *      Insert a DevObject into the list of Manager object.
  */
 DSP_STATUS DRV_InsertDevObject(struct DRV_OBJECT *hDRVObject,
-                              struct DEV_OBJECT *hDevObject)
+                               struct DEV_OBJECT *hDevObject)
 {
        DSP_STATUS status = DSP_SOK;
        struct DRV_OBJECT *pDRVObject = (struct DRV_OBJECT *)hDRVObject;
@@ -919,7 +919,7 @@ DSP_STATUS DRV_InsertDevObject(struct DRV_OBJECT *hDRVObject,
  *      objects.
  */
 DSP_STATUS DRV_RemoveDevObject(struct DRV_OBJECT *hDRVObject,
-                              struct DEV_OBJECT *hDevObject)
+                               struct DEV_OBJECT *hDevObject)
 {
        DSP_STATUS status = DSP_EFAIL;
        struct DRV_OBJECT *pDRVObject = (struct DRV_OBJECT *)hDRVObject;

drivers/dsp/bridge/rmgr/drv.c DSP_STATUS DRV_RequestResources(u32 dwContext, u32 *pDevNodeString) · line 1004

Quoted 5 lines
drivers/dsp/bridge/rmgr/drv.c +1 -1
@@ -1001,7 +1001,7 @@ DSP_STATUS DRV_RequestResources(u32 dwContext, u32 *pDevNodeString)
                *pDevNodeString = 0;
        }
 
-       if (!(strcmp((char *) dwContext, "TIOMAP1510"))) {
+       if (!(strcmp((char *) dwContext, "TIOMAP1510"))) {

Do we really support these?? but my comment is out of scope here though..

Quoted 14 lines
drivers/dsp/bridge/rmgr/drv.c +1 -1
                GT_0trace(curTrace, GT_1CLASS,
                          " Allocating resources for UMA \n");
                status = RequestBridgeResourcesDSP(dwContext, DRV_ASSIGN);
@@ -1034,7 +1034,7 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct DRV_OBJECT *hDrvObject)
 
        GT_0trace(curTrace, GT_ENTER, "Entering DRV_Release Resources\n");
 
-       if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
+       if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
           "TIOMAP1510"))) {
                GT_0trace(curTrace, GT_1CLASS,
                         " Releasing DSP-Bridge resources \n");
@@ -1149,10 +1149,10 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest)
                                iounmap(pResources->dwDmmuBase);

drivers/dsp/bridge/rmgr/drv.c static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest) · line 1155

Quoted 10 lines
drivers/dsp/bridge/rmgr/drv.c +4 -4
                        if (pResources->dwPerBase)
                                iounmap(pResources->dwPerBase);
-                       if (pResources->dwPerPmBase)
-                               iounmap((void *)pResources->dwPerPmBase);
-                       if (pResources->dwCorePmBase)
-                               iounmap((void *)pResources->dwCorePmBase);
+                       if (pResources->dwPerPmBase)
+                               iounmap((void *)pResources->dwPerPmBase);
+                       if (pResources->dwCorePmBase)
+                               iounmap((void *)pResources->dwCorePmBase);

I assume something white space changed here...

Quoted 5 lines
drivers/dsp/bridge/rmgr/drv.c +0 -0
                        if (pResources->dwSysCtrlBase) {
                                iounmap(pResources->dwSysCtrlBase);
                                /* don't set pResources->dwSysCtrlBase to null
@@ -1284,10 +1284,10 @@ static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 bRequest)
                                                        OMAP_DSP_MEM3_SIZE);

drivers/dsp/bridge/rmgr/drv.c static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 bRequest) · line 1290

Quoted 10 lines
drivers/dsp/bridge/rmgr/drv.c +4 -4
                pResources->dwPerBase = ioremap(OMAP_PER_CM_BASE,
                                                        OMAP_PER_CM_SIZE);
-               pResources->dwPerPmBase = ioremap(OMAP_PER_PRM_BASE,
-                                                       OMAP_PER_PRM_SIZE);
-               pResources->dwCorePmBase = (u32)ioremap(OMAP_CORE_PRM_BASE,
-                                                       OMAP_CORE_PRM_SIZE);
+               pResources->dwPerPmBase = ioremap(OMAP_PER_PRM_BASE,
+                                                       OMAP_PER_PRM_SIZE);
+               pResources->dwCorePmBase = (u32)ioremap(OMAP_CORE_PRM_BASE,
+                                                       OMAP_CORE_PRM_SIZE);

(casting) is evil usually.. should'nt you be chaning dwCorePmBase to __iomem * instead?

[...]

Quoted 5 lines
drivers/dsp/bridge/rmgr/node.c +0 -0
index cf9c9a1..0b4e202 100644

drivers/dsp/bridge/rmgr/node.c static void FreeStream(struct NODE_MGR *hNodeMgr, struct STREAM stream); · line 262

Quoted 9 lines
drivers/dsp/bridge/rmgr/node.c +3 -3
@@ -257,9 +257,9 @@ static void FreeStream(struct NODE_MGR *hNodeMgr, struct STREAM stream);
 static DSP_STATUS GetFxnAddress(struct NODE_OBJECT *hNode, u32 *pulFxnAddr,
                                u32 uPhase);
 static DSP_STATUS GetNodeProps(struct DCD_MANAGER *hDcdMgr,
-                              struct NODE_OBJECT *hNode,
-                              CONST struct DSP_UUID *pNodeId,
-                              struct DCD_GENERICOBJ *pdcdProps);
+                               struct NODE_OBJECT *hNode,
+                               CONST struct DSP_UUID *pNodeId,
+                               struct DCD_GENERICOBJ *pdcdProps);

Might have been nice if you had posted patches for each step -> e.g. removal of CONST... it is easier to review in that sense..

Quoted 10 lines
drivers/dsp/bridge/rmgr/node.c +0 -3
 static DSP_STATUS GetProcProps(struct NODE_MGR *hNodeMgr,
                              struct DEV_OBJECT *hDevObject);
 static DSP_STATUS GetRMSFxns(struct NODE_MGR *hNodeMgr);
@@ -293,14 +293,13 @@ static struct NLDR_FXNS nldrFxns = {
 
 enum NODE_STATE NODE_GetState(HANDLE hNode)
 {
-       struct NODE_OBJECT *pNode = (struct NODE_OBJECT *)hNode;
-       if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE)) {
-               GT_1trace(NODE_debugMask, GT_5CLASS,

drivers/dsp/bridge/rmgr/node.c static struct NLDR_FXNS nldrFxns = { · line 300

Quoted 10 lines
drivers/dsp/bridge/rmgr/node.c +5 -5
-                "NODE_GetState:hNode 0x%x\n", pNode);
-               return  -1;
-       } else
-               return pNode->nState;
-
+       struct NODE_OBJECT *pNode = (struct NODE_OBJECT *)hNode;
+       if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE)) {
+               GT_1trace(NODE_debugMask, GT_5CLASS,
+                               "NODE_GetState:hNode 0x%x\n", pNode);
+               return  -1;

Generic: use -Exxxx series please..

[...]

Quoted 2 lines
drivers/dsp/bridge/wmd/io_sm.c +0 -0

[...]

Quoted 6 lines
drivers/dsp/bridge/wmd/io_sm.c +0 -2
@@ -232,12 +230,12 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
                status = DSP_EMEMORY;
                goto func_cont;
        }
-       /*Intializing Work Element*/
-       if (ref_count == 0) {

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 238

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +6 -4
-               INIT_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
-               ref_count = 1;
-       } else
-               PREPARE_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
+       /*Intializing Work Element*/
+       if (ref_count == 0) {
+               INIT_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
+               ref_count = 1;
+       } else
+               PREPARE_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);

} else {
PREPARE_WORK - Ref: Documentation/CodingStyle
}
Quote:
Also, note that this brace-placement also minimizes the number of empty (or almost empty) lines, without any loss of readability. Thus, as the supply of new-lines on your screen is not a renewable resource (think 25-line terminal screens here), you have more empty lines to put comments on.

Do not unnecessarily use braces where a single statement will do.

if (condition)

        action();

This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches.

if (condition) {
        do_this();
        do_that();
} else {
        otherwise();
}
Quoted 18 lines
drivers/dsp/bridge/wmd/io_sm.c +6 -5
        /* Initialize CHNL_MGR object:    */
 #ifndef DSP_TRACEBUF_DISABLED
@@ -269,18 +267,15 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
                if (devType == DSP_UNIT) {
                        HW_MBOX_initSettings(hostRes.dwMboxBase);
                        /* Plug the channel ISR:. */
-                       if ((request_irq(INT_MAIL_MPU_IRQ, IO_ISR, 0,
-                               "DspBridge\tmailbox", (void *)pIOMgr)) == 0)
-                               status = DSP_SOK;
-                       else
-                               status = DSP_EFAIL;
+                       if ((request_irq(INT_MAIL_MPU_IRQ, IO_ISR, 0,
+                         "DspBridge\tmailbox", (void *)pIOMgr)) == 0) {
+                               status = DSP_SOK;
+                               DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
+                                               pIOMgr);
+                       } else

drivers/dsp/bridge/wmd/io_sm.c DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr, · line 279

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +2 -6
+                               status = CHNL_E_ISR;
                }
-       if (DSP_SUCCEEDED(status))
-               DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
-                               pIOMgr);
-       else
-               status = CHNL_E_ISR;
-       } else
+       } else
                status = CHNL_E_ISR;

same here.

[..]

Quoted 8 lines
drivers/dsp/bridge/wmd/io_sm.c +0 -4
@@ -1516,13 +1509,13 @@ static void OutputMsg(struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr)
                pMsgOutput = pIOMgr->pMsgOutput;
                /* Copy uMsgs messages into shared memory */
                for (i = 0; i < uMsgs; i++) {
-                       if (!hMsgMgr->msgUsedList) {
-                               DBG_Trace(DBG_LEVEL3, "msgUsedList is NULL\n");
-                               pMsg = NULL;
-                               goto func_end;

drivers/dsp/bridge/wmd/io_sm.c static void OutputMsg(struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr) · line 1518

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +7 -3
-                       } else
-                               pMsg = (struct MSG_FRAME *)LST_GetHead(
-                                       hMsgMgr->msgUsedList);
+                       if (!hMsgMgr->msgUsedList) {
+                               DBG_Trace(DBG_LEVEL3, "msgUsedList is NULL\n");
+                               pMsg = NULL;
+                               goto func_end;
+                       } else
+                               pMsg = (struct MSG_FRAME *)LST_GetHead(
+                                       hMsgMgr->msgUsedList);

Ditto.
[...]

Quoted 14 lines
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +3 -2
index dc20684..f5eb21c 100644
@@ -547,14 +547,18 @@ DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext,
                        status = CLK_Disable(BPWR_Clks[clkIdx].intClk);
                        if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
                                /* clear MCBSP1_CLKS, on McBSP1 OFF */
-                               value = __raw_readl(pDevContext->sysctrlbase + 0x274);
+                               value = __raw_readl(pDevContext->sysctrlbase
+                                                               + 0x274);
                                value &= ~(1 << 2);
-                               __raw_writel(value, pDevContext->sysctrlbase + 0x274);
+                               __raw_writel(value, pDevContext->sysctrlbase

drivers/dsp/bridge/wmd/tiomap3430_pwr.c DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext, · line 561

Quoted 10 lines
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +5 -2
+                                                               + 0x274);
                        } else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
                                /* clear MCBSP2_CLKS, on McBSP2 OFF */
-                               value = __raw_readl(pDevContext->sysctrlbase + 0x274);
+                               value = __raw_readl(pDevContext->sysctrlbase
+                                                               + 0x274);
                                value &= ~(1 << 6);
-                               __raw_writel(value, pDevContext->sysctrlbase + 0x274);
+                               __raw_writel(value, pDevContext->sysctrlbase
+                                                               + 0x274);

Flags go up.. are we hitting ARM's clock registers directly? could'nt we use the clk framework?? just query.. how do you ensure that ARM usage of McBSP2 does not conflict with DSP McBSP2?

[...]

Quoted 5 lines
drivers/dsp/bridge/wmd/ue_deh.c +0 -0
index 658cd73..6d6c76b 100644

drivers/dsp/bridge/wmd/ue_deh.c DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr, · line 111

Quoted 10 lines
drivers/dsp/bridge/wmd/ue_deh.c +2 -5
@@ -107,11 +107,11 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
                        pDehMgr->errInfo.dwVal2 = 0L;
                        pDehMgr->errInfo.dwVal3 = 0L;
                        /* Install ISR function for DSP MMU fault */
-                       if ((request_irq(INT_DSP_MMU_IRQ, MMU_FaultIsr, 0,
-                                           "DspBridge\tiommu fault", (void *)pDehMgr)) == 0)
-                               status = DSP_SOK;
-                       else
-                               status = DSP_EFAIL;
+                       if ((request_irq(INT_DSP_MMU_IRQ, MMU_FaultIsr, 0,
+                          "DspBridge\tiommu fault", (void *)pDehMgr)) == 0)

Try using !(request_irq) instead of request_irq == 0 perhaps?

drivers/dsp/bridge/wmd/ue_deh.c DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr, · line 114

Quoted 3 lines
drivers/dsp/bridge/wmd/ue_deh.c +3 -0
+                               status = DSP_SOK;
+                       else
+                               status = DSP_EFAIL;

:( makes me wonder about why errno.h.. then I tell myself.. legacy luggage..

phew.. reached the end.. :)..

Signature · 2 lines
Regards,
Nishanth Menon
#21 lore raw

RE: [PATCH 2/9] DSPBRIDGE: trivial checkpatch fixes

Quoted 12 lines

From: Menon, Nishanth
Subject: Re: [PATCH 2/9] DSPBRIDGE: trivial checkpatch fixes

Ramirez Luna, Omar had written, on 11/23/2009 06:50 PM, the following:

Quoted 1 line

Quick fixes like:

General comment: please do white space changes as a separate patch. this massive patch is pretty difficult to review otherwise.. might have been as simple as doing scripts/Lindent on all files and refixing with scripts/checkpatch.pl ..

[...]

Will do that... I guess you won't like to read patch 3 ;) as I mixed spacing changes with do while for multiline macros (will split them and resend)

- omar

#22 lore raw

Re: [PATCH 2/9] DSPBRIDGE: trivial checkpatch fixes

In reply to Nishanth Menon

Hi Omar,

From: ext Nishanth Menon <[email protected]>
Subject: Re: [PATCH 2/9] DSPBRIDGE: trivial checkpatch fixes
Date: Wed, 25 Nov 2009 22:37:24 +0100

Quoted 6 lines

Ramirez Luna, Omar had written, on 11/23/2009 06:50 PM, the following:

Quoted 1 line

Quick fixes like:

General comment: please do white space changes as a separate patch. this massive patch is pretty difficult to review otherwise.. might have been as simple as doing scripts/Lindent on all files and refixing with scripts/checkpatch.pl ..

In addition to the above two scripts,

- make C=1 for sparse
- scripts/cleanpatch
- scripts/cleanfile
or
- "whitespace-cleanup" in emacs

Automatic checkings with the those scripts may be useful too. They could save most of trivial coding style discussions here.

#23 lore raw
In reply to Omar Ramirez Luna
Quoted 13 lines · Omar Ramirez Luna

Following patches are cleanups, removing history of files, tab spacing and also remove DPC layer.

Omar Ramirez Luna (8):
DSPBRIDGE: trivial checkpatch fixes
DSPBRIDGE: Fix multiline macros to use do while
DSPBRIDGE: Use _IOxx macro to define ioctls
DSPBRIDGE: trivial cleanup and indentation for io_sm
DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
DSPBRIDGE: Remove DPC module from SERVICES layer
DSPBRIDGE: Remove DPC object structure
DSPBRIDGE: trivial file history cleanup

Look like good clean-ups to me! Although I did not look at the patches very carefully, just briefly walked through.

I think if you keep doing this, we could add dspbrige to -staging even!

Signature · 7 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#24 lore raw
Quoted 2 lines · Artem Bityutskiy
Quoted 1 line · Omar Ramirez Luna

  DSPBRIDGE: trivial file history cleanup

It seems this patch (1/9) didn't reach linux-omap. But looks like it was about time for it :)

Quoted 4 lines

Look like good clean-ups to me! Although I did not look at the patches very carefully, just briefly walked through.

I think if you keep doing this, we could add dspbrige to -staging even!

Yay!

Signature · 5 lines
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#25 lore raw
Quoted 10 lines

From: Felipe Contreras [mailto:[email protected]]
Subject: Re: [PATCH 0/9] dspbridge cleanup patches

Quoted 2 lines · Artem Bityutskiy
Quoted 1 line · Omar Ramirez Luna

  DSPBRIDGE: trivial file history cleanup

It seems this patch (1/9) didn't reach linux-omap. But looks like it was about time for it :)

Yes, it seems patch 1 and 3 were too big, I have them on dspbridge-next (while waiting for comments)

1. http://dev.omapzoom.org/?p=tidspbridge/kernel-dspbridge.git;a=commit;h=b6b7bc5b620596790b2ea26225908b3cf62c36be

3. http://dev.omapzoom.org/?p=tidspbridge/kernel-dspbridge.git;a=commit;h=b4d73d15bd2b1c7dd1cc89ca9e81a98946ddf241

- omar
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#26 lore raw

Ramirez Luna, Omar had written, on 11/25/2009 02:49 PM, the following:

Quoted 5 lines
Quoted 5 lines

From: Felipe Contreras [mailto:[email protected]]
Subject: Re: [PATCH 0/9] dspbridge cleanup patches

Quoted 1 line · Artem Bityutskiy

On Mon, 2009-11-23 at 18:50 -0600, Omar Ramirez Luna wrote:

Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

DSPBRIDGE: trivial file history cleanup

It seems this patch (1/9) didn't reach linux-omap. But looks like it was about time for it :)

Yes, it seems patch 1 and 3 were too big, I have them on dspbridge-next (while waiting for comments)

1. http://dev.omapzoom.org/?p=tidspbridge/kernel-dspbridge.git;a=commit;h=b6b7bc5b620596790b2ea26225908b3cf62c36be

How about the discussion in http://marc.info/?l=linux-omap&m=123728293826758&w=2 ? same arguments seem valid now..

Quoted 2 lines

3. http://dev.omapzoom.org/?p=tidspbridge/kernel-dspbridge.git;a=commit;h=b4d73d15bd2b1c7dd1cc89ca9e81a98946ddf241

printk(KERN_ERR ?? why not use the pr_err/warning/info family?

Quoted 6 lines

- omar
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Regards,
Nishanth Menon
#27 lore raw
Quoted 10 lines

From: Menon, Nishanth
Subject: Re: [PATCH 0/9] dspbridge cleanup patches

Quoted 1 line

1. http://dev.omapzoom.org/?p=tidspbridge/kernel-

dspbridge.git;a=commit;h=b6b7bc5b620596790b2ea26225908b3cf62c36be

How about the discussion in
http://marc.info/?l=linux-omap&m=123728293826758&w=2 ? same arguments seem valid now..

Opps, sorry about that, seems like I stole/redid your patch Felipe, I'll diff it (to see nothing is missing), fix author and add my signed off.

Nishant,

I actually removed the history because one of your comments:
[snip]

Quoted 9 lines
Quoted 2 lines

+ * GPIO Module disable when not in use - Charulatha V
+ <[email protected]>

Please stop adding history here.. git commit is supposed to contain it. No stats are generated from looking at file history anymore and there is definitely the risk of getting as big as
http://dev.omapzoom.org/?p=tidspbridge/kernel-
dspbridge.git;a=blob;f=drivers/dsp/bridge/rmgr/mgr.c;h=943cf932a35b75f 709f
554deb3c51c47088d8b78;hb=refs/heads/dspbridge#l26

[snip]

Personally, If any folk mentioned on the removed history disagrees, it is welcome to send a mail to this mailing list detailing his contributions and I guess someone (me, most likely) will check on it. For now a line thanking "vp", "rr", "sp" etc. for their initial work will be added to the patch.

Quoted 5 lines
Quoted 2 lines

3. http://dev.omapzoom.org/?p=tidspbridge/kernel-

dspbridge.git;a=commit;h=b4d73d15bd2b1c7dd1cc89ca9e81a98946ddf241 printk(KERN_ERR ?? why not use the pr_err/warning/info family?

My git:

 drivers/dsp/bridge/rmgr/dbdcd.c         |  165 +++-----
 drivers/dsp/bridge/rmgr/disp.c          |  254 ++++-------
 drivers/dsp/bridge/rmgr/drv.c           |  399 +++++++----------
 drivers/dsp/bridge/rmgr/drv_interface.c |   92 ++---
 drivers/dsp/bridge/rmgr/dspdrv.c        |   34 +-
 drivers/dsp/bridge/rmgr/proc.c          |  754 ++++++++++++++-----------------
 drivers/dsp/bridge/rmgr/rmm.c           |   46 +--
 drivers/dsp/bridge/rmgr/strm.c          |  144 +++----
 8 files changed, 791 insertions(+), 1097 deletions(-)

(now): Removing GT_Trace wrappers and replacing for pr_debug

- omar

#28 lore raw

Ramirez Luna, Omar had written, on 11/25/2009 03:52 PM, the following:

Quoted 17 lines
Quoted 10 lines

From: Menon, Nishanth
Subject: Re: [PATCH 0/9] dspbridge cleanup patches

Quoted 1 line

1. http://dev.omapzoom.org/?p=tidspbridge/kernel-

dspbridge.git;a=commit;h=b6b7bc5b620596790b2ea26225908b3cf62c36be

How about the discussion in
http://marc.info/?l=linux-omap&m=123728293826758&w=2 ? same arguments seem valid now..

Opps, sorry about that, seems like I stole/redid your patch Felipe, I'll diff it (to see nothing is missing), fix author and add my signed off.

Nishant,

I actually removed the history because one of your comments:
[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

+ * GPIO Module disable when not in use - Charulatha V
+ <[email protected]>

Please stop adding history here.. git commit is supposed to contain it. No stats are generated from looking at file history anymore and there is definitely the risk of getting as big as
http://dev.omapzoom.org/?p=tidspbridge/kernel-
dspbridge.git;a=blob;f=drivers/dsp/bridge/rmgr/mgr.c;h=943cf932a35b75f
709f
554deb3c51c47088d8b78;hb=refs/heads/dspbridge#l26

[snip]

lets not mix things up. GPIO does not come with the legacy burden of 10 years that DSPBridge has.
http://marc.info/?l=linux-omap&m=123729745613662&w=2 summarizes my views on DSPBridge.

Quoted 4 lines

Personally, If any folk mentioned on the removed history disagrees, it is welcome to send a mail to this mailing list detailing his contributions and I guess someone (me, most likely) will check on it. For now a line thanking "vp", "rr", "sp" etc. for their initial work will be added to the patch.

I doubt if many folks even are there on the linux-omap mailing list.. might be good for us to check OR at least note:
Anonymous contributors (vp,vr etc..).. I think this was previously discussed in the chain.

Quoted 17 lines
Quoted 5 lines
Quoted 2 lines

3. http://dev.omapzoom.org/?p=tidspbridge/kernel-

dspbridge.git;a=commit;h=b4d73d15bd2b1c7dd1cc89ca9e81a98946ddf241 printk(KERN_ERR ?? why not use the pr_err/warning/info family?

My git:

 drivers/dsp/bridge/rmgr/dbdcd.c         |  165 +++-----
 drivers/dsp/bridge/rmgr/disp.c          |  254 ++++-------
 drivers/dsp/bridge/rmgr/drv.c           |  399 +++++++----------
 drivers/dsp/bridge/rmgr/drv_interface.c |   92 ++---
 drivers/dsp/bridge/rmgr/dspdrv.c        |   34 +-
 drivers/dsp/bridge/rmgr/proc.c          |  754 ++++++++++++++-----------------
 drivers/dsp/bridge/rmgr/rmm.c           |   46 +--
 drivers/dsp/bridge/rmgr/strm.c          |  144 +++----
 8 files changed, 791 insertions(+), 1097 deletions(-)
Quoted 1 line

(now): Removing GT_Trace wrappers and replacing for pr_debug

Throughout please.. no more printks.. thanks..

Signature · 2 lines
Regards,
Nishanth Menon
#29 lore raw
In reply to Omar Ramirez Luna
Quoted 2 lines · Omar Ramirez Luna

Following patches are cleanups, removing history of files, tab spacing and also remove DPC layer.

Any plans for the first release?

MODULE_VERSION("0.1");

Signature · 1 line
Felipe Contreras