dspbridge: OSAL: Simplify so called 'registry'
Subsystems (2)
v2 cover dspbridge: OSAL: Simplify so called 'registry'
From: Andy Shevchenko <[email protected]>
There are several patches which simplify registry API and code.
Andy Shevchenko (5):
DSPBRIDGE: OSAL: Simplify REG API
DSPBRIDGE: OSAL: Remove unused registry variables
DSPBRIDGE: OSAL: Clean up dbreg.h and move it
DSPBRIDGE: OSAL: Implement registry as linked list
DSPBRIDGE: OSAL: Remove printS()
arch/arm/plat-omap/include/dspbridge/dbdefs.h | 26 +++ arch/arm/plat-omap/include/dspbridge/dbreg.h | 113 ------------ arch/arm/plat-omap/include/dspbridge/reg.h | 102 ++--------- drivers/dsp/bridge/pmgr/dev.c | 1 - drivers/dsp/bridge/rmgr/dbdcd.c | 22 +-- drivers/dsp/bridge/rmgr/drv.c | 25 +-- drivers/dsp/bridge/rmgr/drv_interface.c | 37 +--- drivers/dsp/bridge/rmgr/dspdrv.c | 3 - drivers/dsp/bridge/rmgr/mgr.c | 1 - drivers/dsp/bridge/rmgr/node.c | 1 - drivers/dsp/bridge/rmgr/proc.c | 1 - drivers/dsp/bridge/rmgr/strm.c | 1 - drivers/dsp/bridge/services/cfg.c | 53 ++---- drivers/dsp/bridge/services/reg.c | 29 +-- drivers/dsp/bridge/services/regsup.c | 243 +++++++----------------- drivers/dsp/bridge/services/regsup.h | 7 +- drivers/dsp/bridge/wmd/io_sm.c | 1 - drivers/dsp/bridge/wmd/tiomap3430.c | 5 +- 18 files changed, 164 insertions(+), 507 deletions(-) delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbreg.h
PATCH v2 1/5 DSPBRIDGE: OSAL: Simplify REG API
From: Andy Shevchenko <[email protected]>
Simplify REG API by removing useless input parameters.
--- arch/arm/plat-omap/include/dspbridge/reg.h | 102 ++++------------------------ drivers/dsp/bridge/rmgr/dbdcd.c | 22 +++---- drivers/dsp/bridge/rmgr/drv.c | 22 ++---- drivers/dsp/bridge/rmgr/drv_interface.c | 33 ++++----- drivers/dsp/bridge/services/cfg.c | 49 +++++--------- drivers/dsp/bridge/services/reg.c | 26 ++----- drivers/dsp/bridge/services/regsup.c | 3 +- drivers/dsp/bridge/services/regsup.h | 4 +- drivers/dsp/bridge/wmd/tiomap3430.c | 4 +- 9 files changed, 75 insertions(+), 190 deletions(-)
arch/arm/plat-omap/include/dspbridge/reg.h +13 -89
@@ -22,7 +22,6 @@* * Public Functions: * REG_DeleteValue -* REG_EnumKey * REG_EnumValue * REG_Exit * REG_GetValue
@@ -53,23 +52,6 @@#include <linux/types.h> -/* ------------------------- Defines, Data Structures, Typedefs for Linux */ -#ifndef UNDER_CE - -#ifndef REG_SZ -#define REG_SZ 1 -#endif - -#ifndef REG_BINARY -#define REG_BINARY 3 -#endif - -#ifndef REG_DWORD -#define REG_DWORD 4 -#endif - -#endif /* UNDER_CE */ -#define REG_MAXREGPATHLENGTH 255/*
@@ -78,57 +60,18 @@* Deletes a registry entry. NOTE: A registry entry is not the same as * a registry key. * Parameters: -* phKey: Currently reserved; must be NULL. -* pstrSubkey: Path to key to open. * pstrValue: Name of entry to delete. * Returns: * DSP_SOK: Success. * DSP_EFAIL: General failure. * Requires: * - REG initialized. -* - pstrSubkey & pstrValue are non-NULL values. -* - phKey is NULL. -* - length of pstrSubkey < REG_MAXREGPATHLENGTH. +* - pstrValue is non-NULL value. * - length of pstrValue < REG_MAXREGPATHLENGTH. * Ensures: * Details: */ - extern DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey, - IN CONST char *pstrSubkey, - IN CONST char *pstrValue); - -/* -* ======== REG_EnumKey ======== -* Purpose: -* Enumerates subkeys of the specified path to the registry key -* Retrieves the name of the subkey(given the index) and -* appends with the orignal path to form the full path. -* Parameters: -* phKey: Currently reserved; must be NULL. -* pstrKey The name of the registry key to be enumerated. -* dwIndex Specifies the index of the subkey to retrieve. -* pstrSubkey: Pointer to buffer that receives full path name of the -* specified key + the sub-key -* pdwValueSize: Specifies bytes of memory pstrSubkey points to on input, -* on output, specifies actual memory bytes written into. -* If there is no sub key,pdwValueSize returns NULL. -* Returns: -* DSP_SOK: Success. -* DSP_EFAIL: General failure. -* Requires: -* - REG initialized. -* - pstrKey is non-NULL value. -* - pdwValueSize is a valid pointer. -* - phKey is NULL. -* - length of pstrKey < REG_MAXREGPATHLENGTH. -* Ensures: -* - strlen(pstrSubkey) is > strlen(pstrKey) && -* - strlen(pstrSubkey) is < REG_MAXREGPATHLENGTH -*/ - extern DSP_STATUS REG_EnumKey(OPTIONAL IN HANDLE *phKey, - IN u32 dwIndex, IN CONST char *pstrKey, - IN OUT char *pstrSubkey, - IN OUT u32 *pdwValueSize); +extern DSP_STATUS REG_DeleteValue(IN CONST char *pstrValue);/* * ======== REG_EnumValue ========
@@ -136,7 +79,6 @@* Enumerates values of a specified key. Retrieves each value name and * the data associated with the value. * Parameters: -* phKey: Currently reserved; must be NULL. * dwIndex: Specifies the index of the value to retrieve. * pstrKey: The name of the registry key to be enumerated. * pstrValue: Pointer to buffer that receives the name of the value.
@@ -152,19 +94,16 @@* DSP_EFAIL: General failure. * Requires: * REG initialized. -* phKey is NULL. * pstrKey is a non-NULL value. * pstrValue, pstrData, pdwValueSize and pdwDataSize are valid pointers. * Length of pstrKey is less than REG_MAXREGPATHLENGTH. * Ensures: */ - extern DSP_STATUS REG_EnumValue(IN HANDLE *phKey, - IN u32 dwIndex, - IN CONST char *pstrKey, - IN OUT char *pstrValue, - IN OUT u32 *pdwValueSize, - IN OUT char *pstrData, - IN OUT u32 *pdwDataSize); +extern DSP_STATUS REG_EnumValue(IN u32 dwIndex, IN CONST char *pstrKey, + IN OUT char *pstrValue, + IN OUT u32 *pdwValueSize, + IN OUT char *pstrData, + IN OUT u32 *pdwDataSize);/* * ======== REG_Exit ========
@@ -185,8 +124,6 @@* Purpose: * Retrieve a value from the registry. * Parameters: -* phKey: Currently reserved; must be NULL. -* pstrSubkey: Path to key to open. * pstrEntry: Name of entry to retrieve. * pbValue: Upon return, points to retrieved value. * pdwValueSize: Specifies bytes of memory pbValue points to on input,
@@ -198,18 +135,13 @@* DSP_EFAIL: General failure. * Requires: * - REG initialized. -* - pstrSubkey & pstrEntry are non-NULL values. +* - pstrEntry is non-NULL value. * - pbValue is a valid pointer. -* - phKey is NULL. -* - length of pstrSubkey < REG_MAXREGPATHLENGTH. * - length of pstrEntry < REG_MAXREGPATHLENGTH. * Ensures: */ - extern DSP_STATUS REG_GetValue(OPTIONAL IN HANDLE *phKey, - IN CONST char *pstrSubkey, - IN CONST char *pstrEntry, - OUT u8 *pbValue, - IN OUT u32 *pdwValueSize); +extern DSP_STATUS REG_GetValue(IN CONST char *pstrEntry, OUT u8 *pbValue, + IN OUT u32 *pdwValueSize);/* * ======== REG_Init ========
@@ -229,10 +161,7 @@* Purpose: * Set a value in the registry. * Parameters: -* phKey: Handle to open reg key, or NULL if pSubkey is full path. -* pstrSubkey: Path to key to open, could be based on phKey. * pstrEntry: Name of entry to set. -* dwType: Data type of new registry value. * pbValue: Points to buffer containing new data. * dwValueSize: Specifies bytes of memory bValue points to. * Returns:
@@ -240,18 +169,13 @@* DSP_EFAIL: General failure. * Requires: * - REG initialized. -* - pstrSubkey & pstrEntry are non-NULL values. +* - pstrEntry is non-NULL value. * - pbValue is a valid pointer. -* - phKey is NULL. * - dwValuSize > 0. -* - length of pstrSubkey < REG_MAXREGPATHLENGTH. * - length of pstrEntry < REG_MAXREGPATHLENGTH. * Ensures: */ - extern DSP_STATUS REG_SetValue(OPTIONAL IN HANDLE *phKey, - IN CONST char *pstrSubKey, - IN CONST char *pstrEntry, - IN CONST u32 dwType, - IN u8 *pbValue, IN u32 dwValueSize); +extern DSP_STATUS REG_SetValue(IN CONST char *pstrEntry, IN u8 *pbValue, + IN u32 dwValueSize);#endif /* _REG_H */
drivers/dsp/bridge/rmgr/dbdcd.c +9 -13
@@ -344,7 +344,7 @@ DSP_STATUS DCD_EnumerateObject(IN s32 cIndex, IN enum DSP_DCDOBJTYPE objType, }if (DSP_SUCCEEDED (status)) { - status =REG_EnumValue (NULL , cIndex, szRegKey, szValue, + status =REG_EnumValue (cIndex, szRegKey, szValue, &dwValueSize, szData, &dwDataSize); }
@@ -529,8 +529,7 @@ DSP_STATUS DCD_GetObjectDef(IN struct DCD_MANAGER *hDcdMgr, dwBufSize =REG_MAXREGPATHLENGTH ; }if (DSP_SUCCEEDED (status)) { - status =REG_GetValue (NULL , szRegKey, szRegKey, (u8 *)szRegData, - &dwBufSize); + status =REG_GetValue (szRegKey, (u8 *)szRegData, &dwBufSize); }if (DSP_FAILED (status)) { status =DSP_EUUID ;
@@ -824,8 +823,7 @@ DSP_STATUS DCD_GetLibraryName(IN struct DCD_MANAGER *hDcdMgr, }if (DSP_SUCCEEDED (status)) {/* Retrieve path from the registry based on DSP_UUID */ - status =REG_GetValue (NULL , szRegKey, szRegKey, - (u8 *)pstrLibName, pdwSize); + status =REG_GetValue (szRegKey, (u8 *)pstrLibName, pdwSize); }/* If can't find, phases might be registered as generic LIBRARYTYPE */
@@ -853,8 +851,7 @@ DSP_STATUS DCD_GetLibraryName(IN struct DCD_MANAGER *hDcdMgr,else status =DSP_EFAIL ; - status =REG_GetValue (NULL , szRegKey, szRegKey, - (u8 *)pstrLibName, pdwSize); + status =REG_GetValue (szRegKey, (u8 *)pstrLibName, pdwSize); }return status;
@@ -999,11 +996,10 @@ DSP_STATUS DCD_RegisterObject(IN struct DSP_UUID *pUuid,if (pszPathName) {/* Add new reg value (UUID+objType) with COFF path info. */ dwPathSize =strlen (pszPathName) +1 ; - status =REG_SetValue (NULL , szRegKey, szRegKey,REG_SZ , - (u8 *)pszPathName, dwPathSize); -GT_3trace (curTrace,GT_6CLASS ,"REG_SetValue REG_SZ=%d, " -"(u8 *)pszPathName=%s, dwPathSize=%d\n" , -REG_SZ , pszPathName, dwPathSize); + status =REG_SetValue (szRegKey, (u8 *)pszPathName, dwPathSize); +GT_3trace (curTrace,GT_6CLASS ,"REG_SetValue " +"(u8 *)pszPathName=%s, dwPathSize=%d\n" , + pszPathName, dwPathSize);if (DSP_FAILED (status)) { status =DSP_EFAIL ; GT_0trace(curTrace, GT_6CLASS,
@@ -1028,7 +1024,7 @@ DSP_STATUS DCD_RegisterObject(IN struct DSP_UUID *pUuid,#endif /* RES_CLEANUP_DISABLE */ }else {/* Deregister an existing object. */ - status =REG_DeleteValue (NULL , szRegKey, szRegKey); + status =REG_DeleteValue (szRegKey);if (DSP_FAILED (status)) { status =DSP_EFAIL ; GT_0trace(curTrace, GT_6CLASS, "DCD_UnregisterObject: "
drivers/dsp/bridge/rmgr/drv.c +8 -14
@@ -1189,8 +1189,8 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest)/* Releasing resources by deleting the registry key */ dwBuffSize =sizeof (struct CFG_HOSTRES ); pResources =MEM_Calloc (dwBuffSize,MEM_NONPAGED ); -if (DSP_FAILED (REG_GetValue (NULL , (char *)driverExt->szString, -CURRENTCONFIG , (u8 *)pResources, &dwBuffSize))) { +if (DSP_FAILED (REG_GetValue (CURRENTCONFIG , (u8 *)pResources, + &dwBuffSize))) { status =CFG_E_RESOURCENOTAVAIL ;GT_0trace (curTrace,GT_1CLASS ,"REG_GetValue Failed \n" );
@@ -1201,8 +1201,8 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest)if (pResources !=NULL ) { dwBuffSize =sizeof (shm_size); - status =REG_GetValue (NULL ,CURRENTCONFIG ,SHMSIZE , - (u8 *)&shm_size, &dwBuffSize); + status =REG_GetValue (SHMSIZE , (u8 *)&shm_size, + &dwBuffSize);if (DSP_SUCCEEDED (status)) {if ((pResources->dwMemBase[1 ]) && (pResources->dwMemPhys[1 ])) {
@@ -1259,8 +1259,7 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest) pResources->dwDmmuBase =NULL ; dwBuffSize =sizeof (struct CFG_HOSTRES ); - status =REG_SetValue (NULL , (char *)driverExt->szString, -CURRENTCONFIG ,REG_BINARY , (u8 *)pResources, + status =REG_SetValue (CURRENTCONFIG , (u8 *)pResources, (u32 )dwBuffSize);/* Set all the other entries to NULL */ MEM_Free (pResources);
@@ -1311,9 +1310,7 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest) pResources->dwNumChnls =CHNL_MAXCHANNELS ; pResources->dwChnlBufSize =0x400 ; dwBuffSize =sizeof (struct CFG_HOSTRES ); - status =REG_SetValue (NULL , (char *) dwContext, -CURRENTCONFIG ,REG_BINARY , - (u8 *)pResources, + status =REG_SetValue (CURRENTCONFIG , (u8 *)pResources,sizeof (struct CFG_HOSTRES ));if (DSP_SUCCEEDED (status)) { GT_0trace(curTrace, GT_1CLASS,
@@ -1404,8 +1401,7 @@ static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 bRequest)GT_1trace (curTrace,GT_2CLASS ,"dwDmmuBase 0x%x\n" , pResources->dwDmmuBase); dwBuffSize =sizeof (shm_size); - status =REG_GetValue (NULL ,CURRENTCONFIG ,SHMSIZE , - (u8 *)&shm_size, &dwBuffSize); + status =REG_GetValue (SHMSIZE , (u8 *)&shm_size, &dwBuffSize);if (DSP_SUCCEEDED (status)) {/* Allocate Physically contiguous, * non-cacheable memory */
@@ -1437,9 +1433,7 @@ static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 bRequest) pResources->dwNumChnls =CHNL_MAXCHANNELS ; pResources->dwChnlBufSize =0x400 ; dwBuffSize =sizeof (struct CFG_HOSTRES ); - status =REG_SetValue (NULL , (char *)dwContext, -CURRENTCONFIG ,REG_BINARY , - (u8 *)pResources, + status =REG_SetValue (CURRENTCONFIG , (u8 *)pResources,sizeof (struct CFG_HOSTRES ));if (DSP_SUCCEEDED (status)) { GT_0trace(curTrace, GT_1CLASS,
drivers/dsp/bridge/rmgr/drv_interface.c +14 -19
@@ -355,22 +355,18 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)if (base_img) { temp = true; -REG_SetValue (NULL ,NULL ,AUTOSTART ,REG_DWORD , (u8 *)&temp, -sizeof (temp)); -REG_SetValue (NULL ,NULL ,DEFEXEC ,REG_SZ , (u8 *)base_img, -strlen (base_img) +1 ); +REG_SetValue (AUTOSTART , (u8 *)&temp,sizeof (temp)); +REG_SetValue (DEFEXEC , (u8 *)base_img,strlen (base_img) +1 ); }else { temp = false; -REG_SetValue (NULL ,NULL ,AUTOSTART ,REG_DWORD , (u8 *)&temp, -sizeof (temp)); -REG_SetValue (NULL ,NULL ,DEFEXEC ,REG_SZ , (u8 *)"\0" , (u32 )2 ); +REG_SetValue (AUTOSTART , (u8 *)&temp,sizeof (temp)); +REG_SetValue (DEFEXEC , (u8 *)"\0" , (u32 )2 ); } -REG_SetValue (NULL ,NULL ,NUMPROCS ,REG_SZ , (u8 *) num_procs, -strlen (num_procs) +1 ); +REG_SetValue (NUMPROCS , (u8 *) num_procs,strlen (num_procs) +1 );if (shm_size >=0x10000 ) {/* 64 KB */ - initStatus =REG_SetValue (NULL ,NULL ,SHMSIZE ,REG_DWORD , - (u8 *)&shm_size,sizeof (shm_size)); + initStatus =REG_SetValue (SHMSIZE , (u8 *)&shm_size, +sizeof (shm_size)); }else { initStatus =DSP_EINVALIDARG ; status =-1 ;
@@ -386,16 +382,16 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev) }if (phys_mempool_base >0x0 ) { - initStatus =REG_SetValue (NULL ,NULL ,PHYSMEMPOOLBASE , -REG_DWORD , (u8 *)&phys_mempool_base, + initStatus =REG_SetValue (PHYSMEMPOOLBASE , + (u8 *)&phys_mempool_base,sizeof (phys_mempool_base)); }GT_1trace (driverTrace,GT_7CLASS ,"phys_mempool_base = 0x%x \n" , phys_mempool_base);if (phys_mempool_size >0x0 ) { - initStatus =REG_SetValue (NULL ,NULL ,PHYSMEMPOOLSIZE , -REG_DWORD , (u8 *)&phys_mempool_size, + initStatus =REG_SetValue (PHYSMEMPOOLSIZE , + (u8 *)&phys_mempool_size,sizeof (phys_mempool_size)); } GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_size = 0x%x\n",
@@ -404,12 +400,11 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)MEM_ExtPhysPoolInit (phys_mempool_base, phys_mempool_size);if (tc_wordswapon) {GT_0trace (driverTrace,GT_7CLASS ,"TC Word Swap is enabled\n" ); -REG_SetValue (NULL ,NULL ,TCWORDSWAP ,REG_DWORD , - (u8 *)&tc_wordswapon,sizeof (tc_wordswapon)); +REG_SetValue (TCWORDSWAP , (u8 *)&tc_wordswapon, +sizeof (tc_wordswapon)); }else {GT_0trace (driverTrace,GT_7CLASS ,"TC Word Swap is disabled\n" ); -REG_SetValue (NULL ,NULL ,TCWORDSWAP , -REG_DWORD , (u8 *)&tc_wordswapon, +REG_SetValue (TCWORDSWAP , (u8 *)&tc_wordswapon,sizeof (tc_wordswapon)); }if (DSP_SUCCEEDED (initStatus)) {
drivers/dsp/bridge/services/cfg.c +18 -31
109 lines not on this page · raw message
drivers/dsp/bridge/services/reg.c +8 -18
@@ -64,19 +64,15 @@ struct GT_Mask REG_debugMask = { NULL, NULL }; /* GT trace var. */* Deletes a registry entry value. NOTE: A registry entry value is not the * same as * a registry key. */ -DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey, - IN CONST char *pstrValue) +DSP_STATUS REG_DeleteValue(IN CONST char *pstrValue) {DSP_STATUS status; -DBC_Require (pstrSubkey && pstrValue); -DBC_Require (phKey ==NULL ); -DBC_Require (strlen (pstrSubkey) <REG_MAXREGPATHLENGTH ); +DBC_Require (pstrValue);DBC_Require (strlen (pstrValue) <REG_MAXREGPATHLENGTH );GT_0trace (REG_debugMask,GT_ENTER ,"REG_DeleteValue: entered\n" ); -/* Note that we don't use phKey */ -if (regsupDeleteValue (pstrSubkey, pstrValue) ==DSP_SOK ) +if (regsupDeleteValue (pstrValue) ==DSP_SOK ) status =DSP_SOK ;else status =DSP_EFAIL ;
@@ -90,7 +86,7 @@ DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,* We will assume the input pdwValueSize is smaller than * REG_MAXREGPATHLENGTH for implementation purposes. */ -DSP_STATUS REG_EnumValue(IN HANDLE *phKey, IN u32 dwIndex, +DSP_STATUS REG_EnumValue(IN u32 dwIndex, IN CONST char *pstrKey, IN OUT char *pstrValue, IN OUT u32 *pdwValueSize, IN OUT char *pstrData, IN OUT u32 *pdwDataSize)
@@ -100,7 +96,6 @@ DSP_STATUS REG_EnumValue(IN HANDLE *phKey, IN u32 dwIndex,DBC_Require (pstrKey && pstrValue && pdwValueSize && pstrData && pdwDataSize);DBC_Require (*pdwValueSize <=REG_MAXREGPATHLENGTH ); -DBC_Require (phKey ==NULL );DBC_Require (strlen (pstrKey) <REG_MAXREGPATHLENGTH );GT_0trace (REG_debugMask,GT_ENTER ,"REG_EnumValue: entered\n" );
@@ -126,15 +121,12 @@ void REG_Exit(void)* ======== REG_GetValue ======== * Retrieve a value from the registry. */ -DSP_STATUS REG_GetValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey, - IN CONST char *pstrValue, OUT u8 *pbData, +DSP_STATUS REG_GetValue(IN CONST char *pstrValue, OUT u8 *pbData, IN OUT u32 *pdwDataSize) {DSP_STATUS status; -DBC_Require (pstrSubkey && pstrValue && pbData); -DBC_Require (phKey ==NULL ); -DBC_Require (strlen (pstrSubkey) <REG_MAXREGPATHLENGTH ); +DBC_Require (pstrValue && pbData);DBC_Require (strlen (pstrValue) <REG_MAXREGPATHLENGTH );GT_0trace (REG_debugMask,GT_ENTER ,"REG_GetValue: entered\n" );
@@ -171,14 +163,12 @@ bool REG_Init(void)* ======== REG_SetValue ======== * Set a value in the registry. */ -DSP_STATUS REG_SetValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey, - IN CONST char *pstrValue, IN CONST u32 dwType, - IN u8 *pbData, IN u32 dwDataSize) +DSP_STATUS REG_SetValue(IN CONST char *pstrValue, IN u8 *pbData, + IN u32 dwDataSize) {DSP_STATUS status;DBC_Require (pstrValue && pbData); -DBC_Require (phKey ==NULL );DBC_Require (dwDataSize >0 );DBC_Require (strlen (pstrValue) <REG_MAXREGPATHLENGTH );
drivers/dsp/bridge/services/regsup.c +1 -2
@@ -318,8 +318,7 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char *pstrKey,/* * ======== regsupDeleteValue ======== */ -DSP_STATUS regsupDeleteValue(IN CONST char *pstrSubkey, - IN CONST char *pstrValue) +DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue) {DSP_STATUS retVal =DSP_EFAIL ;u32 i;
drivers/dsp/bridge/services/regsup.h +2 -2
@@ -38,8 +38,8 @@ extern void regsupExit(void);/* * ======== regsupDeleteValue ======== */ -extern DSP_STATUS regsupDeleteValue(IN CONST char *pstrSubkey, - IN CONST char *pstrValue); +extern DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue); +/* Get the value of the entry having the given name. Returns DSP_SOK */ /* if an entry was found and the value retrieved. Returns DSP_EFAIL * otherwise.*/
drivers/dsp/bridge/wmd/tiomap3430.c +2 -2
@@ -1140,8 +1140,8 @@ static DSP_STATUS WMD_DEV_Create(OUT struct WMD_DEV_CONTEXT **ppDevContext,if (DSP_SUCCEEDED (status)) {/* Set the Endianism Register */ /* Need to set this */ /* Retrieve the TC u16 SWAP Option */ - status =REG_GetValue (NULL ,CURRENTCONFIG ,TCWORDSWAP , - (u8 *)&tcWordSwap, &tcWordSwapSize); + status =REG_GetValue (TCWORDSWAP , (u8 *)&tcWordSwap, + &tcWordSwapSize);/* Save the value */ pDevContext->tcWordSwapOn = tcWordSwap; }
Signature · 1 line
1.5.6.5
PATCH v2 2/5 DSPBRIDGE: OSAL: Remove unused registry variables
From: Andy Shevchenko <[email protected]>
--- arch/arm/plat-omap/include/dspbridge/dbreg.h | 3 --- drivers/dsp/bridge/rmgr/drv_interface.c | 12 ------------ drivers/dsp/bridge/services/cfg.c | 5 ----- 3 files changed, 0 insertions(+), 20 deletions(-)
arch/arm/plat-omap/include/dspbridge/dbreg.h +0 -3
@@ -88,7 +88,6 @@#define WMDFILENAME "MiniDriver"/* WMD entry name */ #define CHIPTYPE "ChipType"/* Chip type */ #define CHIPNUM "NumChips"/* Number of chips */ -#define NUMPROCS "NumOfProcessors"/* Number of processors */ #define DEFEXEC "DefaultExecutable"/* Default executable */ #define AUTOSTART "AutoStart"/* Statically load flag */ #define IVAAUTOSTART "IvaAutoStart"/* Statically load flag */
@@ -107,7 +106,5 @@#define TCWORDSWAP "TCWordSwap"/* Traffic Contoller Word Swap */ #define DSPRESOURCES "DspTMSResources"/* C55 DSP resurces on OMAP */ #define IVA1RESOURCES "ARM7IvaResources"/* ARM7 IVA resurces on OMAP */ -#define PHYSMEMPOOLBASE "PhysicalMemBase"/* Physical mem passed to driver */ -#define PHYSMEMPOOLSIZE "PhysicalMemSize"/* Physical mem passed to driver */ #endif /* DBREG_ */
drivers/dsp/bridge/rmgr/drv_interface.c +0 -12
@@ -129,7 +129,6 @@ static s32 driver_major = DRIVER_MAJOR;static s32 driver_minor =DRIVER_MINOR ;static char *base_img;char *iva_img; -static char *num_procs ="C55=1" ;static s32 shm_size =0x500000 ;/* 5 MB */ static u32 phys_mempool_base;static u32 phys_mempool_size;
@@ -362,7 +361,6 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)REG_SetValue (AUTOSTART , (u8 *)&temp,sizeof (temp));REG_SetValue (DEFEXEC , (u8 *)"\0" , (u32 )2 ); } -REG_SetValue (NUMPROCS , (u8 *) num_procs,strlen (num_procs) +1 );if (shm_size >=0x10000 ) {/* 64 KB */ initStatus = REG_SetValue(SHMSIZE, (u8 *)&shm_size,
@@ -381,19 +379,9 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev) phys_mempool_size = pdata->phys_mempool_size; } -if (phys_mempool_base >0x0 ) { - initStatus =REG_SetValue (PHYSMEMPOOLBASE , - (u8 *)&phys_mempool_base, -sizeof (phys_mempool_base)); - }GT_1trace (driverTrace,GT_7CLASS ,"phys_mempool_base = 0x%x \n" , phys_mempool_base); -if (phys_mempool_size >0x0 ) { - initStatus =REG_SetValue (PHYSMEMPOOLSIZE , - (u8 *)&phys_mempool_size, -sizeof (phys_mempool_size)); - }GT_1trace (driverTrace,GT_7CLASS ,"phys_mempool_size = 0x%x\n" , phys_mempool_base);if ((phys_mempool_base >0x0 ) && (phys_mempool_size >0x0 ))
drivers/dsp/bridge/services/cfg.c +0 -5
@@ -413,11 +413,6 @@ DSP_STATUS CFG_SetDevObject(struct CFG_DEVNODE *hDevNode, u32 dwValue) "Registering the DSP Device \n"); status =REG_SetValue ("DEVICE_DSP" , (u8 *)&dwValue, dwBuffSize); -if (DSP_SUCCEEDED (status)) { - dwBuffSize =sizeof (hDevNode); - status =REG_SetValue ("DEVNODESTRING_DSP" , - (u8 *)&hDevNode, dwBuffSize); - } }else {GT_0trace (CFG_debugMask,GT_6CLASS ,"Failed to Register Device \n" );
Signature · 1 line
1.5.6.5
PATCH v2 3/5 DSPBRIDGE: OSAL: Clean up dbreg.h and move it
From: Andy Shevchenko <[email protected]>
* Clean up dbreg.h - there are plenty of unused definitions
* Move necessary constants to the dbdefs.h
* Remove dbreg.h inclusion from other files
--- arch/arm/plat-omap/include/dspbridge/dbdefs.h | 26 ++++++ arch/arm/plat-omap/include/dspbridge/dbreg.h | 110 ------------------------- drivers/dsp/bridge/pmgr/dev.c | 1 - drivers/dsp/bridge/rmgr/drv.c | 3 - drivers/dsp/bridge/rmgr/drv_interface.c | 2 - drivers/dsp/bridge/rmgr/dspdrv.c | 3 - drivers/dsp/bridge/rmgr/mgr.c | 1 - drivers/dsp/bridge/rmgr/node.c | 1 - drivers/dsp/bridge/rmgr/proc.c | 1 - drivers/dsp/bridge/rmgr/strm.c | 1 - drivers/dsp/bridge/services/cfg.c | 3 - drivers/dsp/bridge/services/reg.c | 3 - drivers/dsp/bridge/services/regsup.c | 1 - drivers/dsp/bridge/wmd/io_sm.c | 1 - drivers/dsp/bridge/wmd/tiomap3430.c | 1 - 15 files changed, 26 insertions(+), 132 deletions(-) delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbreg.h
arch/arm/plat-omap/include/dspbridge/dbdefs.h +26 -0
@@ -589,4 +589,30 @@ bit 6 - MMU element size = 64bit (valid only for non mixed page entries)#define GEM_CACHE_LINE_SIZE 128#define GEM_L1P_PREFETCH_SIZE 128 + +/* +* Definitions from dbreg.h +*/ + +#define DSPPROCTYPE_C64 6410 +#define IVAPROCTYPE_ARM7 470 + +#define REG_MGR_OBJECT 1 +#define REG_DRV_OBJECT 2 + +/* registry */ +#define DRVOBJECT "DrvObject" +#define MGROBJECT "MgrObject" + +/* Max registry path length. Also the max registry value length. */ +#define MAXREGPATHLENGTH 255 + +/* MiniDriver related definitions */ +#define DEFEXEC "DefaultExecutable"/* Default executable */ +#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 DSPRESOURCES "DspTMSResources"/* C55 DSP resurces on OMAP */ +#endif /* DBDEFS_ */
arch/arm/plat-omap/include/dspbridge/dbreg.h deleted +0 -110
110 lines not on this page · raw message
drivers/dsp/bridge/pmgr/dev.c +0 -1
@@ -142,7 +142,6 @@#include <dspbridge/node.h> /* ----------------------------------- Others */ -#include <dspbridge/dbreg.h> #include <dspbridge/wcd.h> /* WCD version info. */ #include <dspbridge/chnl.h>
drivers/dsp/bridge/rmgr/drv.c +0 -3
@@ -108,9 +108,6 @@#include <dspbridge/mem.h> #include <dspbridge/reg.h> -/* ----------------------------------- Others */ -#include <dspbridge/dbreg.h> -/* ----------------------------------- This */ #include <dspbridge/drv.h> #include <dspbridge/dev.h>
drivers/dsp/bridge/rmgr/drv_interface.c +0 -2
@@ -81,7 +81,6 @@#include <dspbridge/wcdioctl.h> #include <dspbridge/_dcd.h> #include <dspbridge/dspdrv.h> -#include <dspbridge/dbreg.h> /* ----------------------------------- Resource Manager */ #include <dspbridge/pwr.h>
@@ -98,7 +97,6 @@#include <dspbridge/dev.h> #include <dspbridge/drvdefs.h> #include <dspbridge/drv.h> -#include <dspbridge/dbreg.h> #endif #include <mach/omap-pm.h>
drivers/dsp/bridge/rmgr/dspdrv.c +0 -3
@@ -116,9 +116,6 @@/* ----------------------------------- Resource Manager */ #include <dspbridge/mgr.h> -/* ----------------------------------- Others */ -#include <dspbridge/dbreg.h> -/* ----------------------------------- This */ #include <dspbridge/dspdrv.h>
drivers/dsp/bridge/rmgr/mgr.c +0 -1
@@ -56,7 +56,6 @@/* ----------------------------------- Others */ #include <dspbridge/dbdcd.h> -#include <dspbridge/dbreg.h> #include <dspbridge/drv.h> #include <dspbridge/dev.h>
drivers/dsp/bridge/rmgr/node.c +0 -1
@@ -146,7 +146,6 @@#ifndef RES_CLEANUP_DISABLE #include <dspbridge/drv.h> #include <dspbridge/drvdefs.h> -#include <dspbridge/dbreg.h> #include <dspbridge/resourcecleanup.h> #endif
drivers/dsp/bridge/rmgr/proc.c +0 -1
@@ -136,7 +136,6 @@/* ----------------------------------- Others */ #include <dspbridge/dbdcd.h> -#include <dspbridge/dbreg.h> #include <dspbridge/msg.h> #include <dspbridge/wmdioctl.h> #include <dspbridge/drv.h>
drivers/dsp/bridge/rmgr/strm.c +0 -1
@@ -91,7 +91,6 @@#ifndef RES_CLEANUP_DISABLE #include <dspbridge/cfg.h> -#include <dspbridge/dbreg.h> #include <dspbridge/resourcecleanup.h> #endif
drivers/dsp/bridge/services/cfg.c +0 -3
@@ -84,9 +84,6 @@/* ----------------------------------- OS Adaptation Layer */ #include <dspbridge/reg.h> -/* ----------------------------------- Others */ -#include <dspbridge/dbreg.h> -/* ----------------------------------- This */ #include <dspbridge/cfg.h> #include <dspbridge/list.h>
drivers/dsp/bridge/services/reg.c +0 -3
@@ -48,9 +48,6 @@/* ----------------------------------- OS Adaptation Layer */ #include <dspbridge/mem.h> -/* ----------------------------------- Others */ -#include <dspbridge/dbreg.h> -/* ----------------------------------- This */ #include <dspbridge/reg.h> #include <regsup.h>
drivers/dsp/bridge/services/regsup.c +0 -1
@@ -35,7 +35,6 @@#include <dspbridge/std.h> #include <dspbridge/dbdefs.h> #include <dspbridge/errbase.h> -#include <dspbridge/dbreg.h> /* ----------------------------------- Trace & Debug */ #include <dspbridge/dbc.h>
drivers/dsp/bridge/wmd/io_sm.c +0 -1
@@ -83,7 +83,6 @@#include <dspbridge/cod.h> #include <dspbridge/dev.h> #include <dspbridge/chnl_sm.h> -#include <dspbridge/dbreg.h> /* ----------------------------------- Others */ #include <dspbridge/rms_sh.h>
drivers/dsp/bridge/wmd/tiomap3430.c +0 -1
@@ -48,7 +48,6 @@/* ----------------------------------- OS Adaptation Layer */ #include <dspbridge/mem.h> #include <dspbridge/reg.h> -#include <dspbridge/dbreg.h> #include <dspbridge/cfg.h> #include <dspbridge/drv.h> #include <dspbridge/sync.h>
Signature · 1 line
1.5.6.5
PATCH v2 4/5 DSPBRIDGE: OSAL: Implement registry as linked list
From: Andy Shevchenko <[email protected]>
Change implementation of registry to a linked list.
In future this will became to some static structures and probably list for DCD_REGKEY array.
--- drivers/dsp/bridge/services/regsup.c | 216 +++++++++++----------------------- drivers/dsp/bridge/services/regsup.h | 3 - 2 files changed, 70 insertions(+), 149 deletions(-)
drivers/dsp/bridge/services/regsup.c +70 -146
@@ -42,27 +42,21 @@/* ----------------------------------- OS Adaptation Layer */ #include <dspbridge/mem.h> +#include <dspbridge/list.h> /* ----------------------------------- This */ #include <regsup.h> -struct RegValueStruct { -char name[BRIDGE_MAX_NAME_SIZE ];/* Name of a given value entry */ +struct RegValue { +struct list_head link;/* Make it linked to a list */ +char name[MAXREGPATHLENGTH ];/* Name of a given value entry */ u32 dataSize;/* Size of the data */ void *pData;/* Pointer to the actual data */ int counter;/* Number of register attempts for this key */ }; -struct RegKeyStruct { -/*The current number of value entries this key has*/ -u32 numValueEntries; -/* Array of value entries */ -struct RegValueStruct values[BRIDGE_MAX_NUM_REG_ENTRIES ]; -}; - -/* Pointer to the registry support key */ -static struct RegKeyStruct *pRegKey; +static struct LST_LIST regKey, *pRegKey = ®Key;#if GT_TRACE extern struct GT_Mask REG_debugMask;/* GT trace var. */
@@ -95,14 +89,7 @@ static inline void printS(void *pBuf)*/ bool regsupInit (void ) { -if (pRegKey !=NULL ) -return true; - -/* Need to allocate and setup our registry. */ - pRegKey =MEM_Calloc (sizeof (struct RegKeyStruct ),MEM_NONPAGED ); -if (pRegKey ==NULL ) -return false; - +INIT_LIST_HEAD (&pRegKey->head);return true; }
@@ -113,41 +100,12 @@ bool regsupInit(void)*/ void regsupExit (void ) { -u32 i; - -/* Make sure data has actually been allocated. */ -if (pRegKey ==NULL ) { -/* Nothing initialized.return! */ -return ; - } - -GT_1trace (REG_debugMask,GT_2CLASS ,"pRegKey->numValueEntries %d\n" , - pRegKey->numValueEntries); -/* Now go through each entry and free all resources. */ -for (i =0 ; ((i <BRIDGE_MAX_NUM_REG_ENTRIES ) && - (i < pRegKey->numValueEntries)); i++) { -if (pRegKey->values[i].name[0 ] !='\0' ) { -/* We have a valid entry.free it up! */ -if (pRegKey->values[i].pData !=NULL ) { -GT_3trace (REG_debugMask,GT_2CLASS , -"E %d\t %s DATA %x " , i, - pRegKey->values[i].name, - *(u32 *)pRegKey->values[i].pData); -printS ((u8 *)(pRegKey->values[i].pData)); -MEM_Free (pRegKey->values[i].pData); - } - pRegKey->values[i].pData =NULL ; - pRegKey->values[i].dataSize =0 ; - pRegKey->values[i].name[0 ] ='\0' ; - } +while (!LST_IsEmpty (pRegKey)) { +struct RegValue *rv = (struct RegValue *)LST_GetHead (pRegKey); +MEM_Free (rv->pData); +MEM_Free (rv); } - -/* Now that all of the resources are freed up, free the main one! */ -MEM_Free (pRegKey); - -/* Don't forget to NULL out the global entry! */ - pRegKey =NULL ; }/*
@@ -158,25 +116,25 @@ void regsupExit(void)DSP_STATUS regsupGetValue (char *valName,void *pBuf,u32 *dataSize) {DSP_STATUS retVal =DSP_EFAIL ; -u32 i; +struct RegValue *rv = (struct RegValue *)LST_First (pRegKey);/* Need to search through the entries looking for the right one. */ -for (i =0 ; i < pRegKey->numValueEntries; i++) { +while (rv) {/* See if the name matches. */ -if (strncmp (pRegKey->values[i].name, valName, -BRIDGE_MAX_NAME_SIZE ) ==0 ) { - +if (strncmp (rv->name, valName,MAXREGPATHLENGTH ) ==0 ) {/* We have a match! Copy out the data. */ -memcpy (pBuf, pRegKey->values[i].pData, - pRegKey->values[i].dataSize); +memcpy (pBuf, rv->pData, rv->dataSize);/* Get the size for the caller. */ - *dataSize = pRegKey->values[i].dataSize; + *dataSize = rv->dataSize;/* Set our status to good and exit. */ retVal =DSP_SOK ;break ; } + + rv = (struct RegValue *)LST_Next (pRegKey, + (struct list_head *)rv); }if (DSP_SUCCEEDED (retVal)) {
@@ -198,69 +156,57 @@ DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 *dataSize)DSP_STATUS regsupSetValue (char *valName,void *pBuf,u32 dataSize) {DSP_STATUS retVal =DSP_EFAIL ; -u32 i; +struct RegValue *rv = (struct RegValue *)LST_First (pRegKey);GT_2trace (REG_debugMask,GT_2CLASS ,"S %s DATA %x " , valName, *(u32 *)pBuf);printS ((u8 *)pBuf);/* Need to search through the entries looking for the right one. */ -for (i =0 ; i < pRegKey->numValueEntries; i++) { +while (rv) {/* See if the name matches. */ -if (strncmp (pRegKey->values[i].name, valName, -BRIDGE_MAX_NAME_SIZE ) ==0 ) { +if (strncmp (rv->name, valName,MAXREGPATHLENGTH ) ==0 ) {/* Make sure the new data size is the same. */ -if (dataSize != pRegKey->values[i].dataSize) { +if (dataSize != rv->dataSize) {/* The caller needs a different data size! */ -MEM_Free (pRegKey->values[i].pData); - pRegKey->values[i].pData =MEM_Alloc (dataSize, -MEM_NONPAGED ); -if (pRegKey->values[i].pData ==NULL ) +MEM_Free (rv->pData); + rv->pData =MEM_Alloc (dataSize,MEM_NONPAGED ); +if (rv->pData ==NULL )break ; }/* We have a match! Copy out the data. */ -memcpy (pRegKey->values[i].pData, pBuf, dataSize); +memcpy (rv->pData, pBuf, dataSize);/* Reset datasize - overwrite if new or same */ - pRegKey->values[i].dataSize = dataSize; + rv->dataSize = dataSize;/* Set our status to good and exit. */ retVal =DSP_SOK ;break ; } + + rv = (struct RegValue *)LST_Next (pRegKey, + (struct list_head *)rv); }/* See if we found a match or if this is a new entry */ -if (i == pRegKey->numValueEntries) { +if (rv) { +/* Increase the counter to track the registered entry */ + rv->counter++; + }else {/* No match, need to make a new entry */ -/* First check to see if we can make any more entries. */ -if (pRegKey->numValueEntries <BRIDGE_MAX_NUM_REG_ENTRIES ) { -char *tmp_name = - pRegKey->values[pRegKey->numValueEntries].name; -strncpy (tmp_name, valName,BRIDGE_MAX_NAME_SIZE -1 ); - tmp_name[BRIDGE_MAX_NAME_SIZE -1 ] ='\0' ; - pRegKey->values[pRegKey->numValueEntries].pData = -MEM_Alloc (dataSize,MEM_NONPAGED ); -if (pRegKey->values[pRegKey->numValueEntries].pData != -NULL ) { -memcpy (pRegKey-> - values[pRegKey->numValueEntries].pData, - pBuf, dataSize); - pRegKey-> - values[pRegKey->numValueEntries].dataSize = - dataSize; - pRegKey->numValueEntries++; - retVal =DSP_SOK ; - } - }else { -GT_0trace (REG_debugMask,GT_7CLASS , -"MAX NUM REG ENTRIES REACHED\n" ); +struct RegValue *new =MEM_Calloc (sizeof (struct RegValue ), +MEM_NONPAGED ); +strncat (new->name, valName,MAXREGPATHLENGTH -1 ); + new->pData =MEM_Alloc (dataSize,MEM_NONPAGED ); +if (new->pData !=NULL ) { +memcpy (new->pData, pBuf, dataSize); + new->dataSize = dataSize; +LST_PutTail (pRegKey, (struct list_head *)new); + retVal =DSP_SOK ; } - }else { -/* Increase the counter to track the registered entry */ - pRegKey->values[i].counter++; }return retVal;
@@ -276,7 +222,7 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char *pstrKey, IN OUT char *pstrData, IN OUT u32 *pdwDataSize) { DSP_STATUS retVal = REG_E_INVALIDSUBKEY; -u32 i; +struct RegValue *rv = (struct RegValue *)LST_First (pRegKey);u32 dwKeyLen;u32 count =0 ;
@@ -284,28 +230,30 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char *pstrKey, dwKeyLen =strlen (pstrKey);/* Need to search through the entries looking for the right one. */ -for (i =0 ; i < pRegKey->numValueEntries; i++) { +while (rv) {/* See if the name matches. */ -if ((strncmp (pRegKey->values[i].name, pstrKey, - dwKeyLen) ==0 ) && count++ == dwIndex) { +if (strncmp (rv->name, pstrKey, dwKeyLen) ==0 && + count++ == dwIndex) {/* We have a match! Copy out the data. */ -memcpy (pstrData, pRegKey->values[i].pData, - pRegKey->values[i].dataSize); +memcpy (pstrData, rv->pData, rv->dataSize); +/* Get the size for the caller. */ - *pdwDataSize = pRegKey->values[i].dataSize; - *pdwValueSize =strlen (&(pRegKey-> - values[i].name[dwKeyLen])); -strncpy (pstrValue, - &(pRegKey->values[i].name[dwKeyLen]), - *pdwValueSize +1 ); + *pdwDataSize = rv->dataSize; + *pdwValueSize =strlen (&(rv->name[dwKeyLen])); +strncpy (pstrValue, &(rv->name[dwKeyLen]), + *pdwValueSize +1 );GT_3trace (REG_debugMask,GT_2CLASS ,"E Key %s, Value %s, Data %x " , pstrKey, pstrValue, *(u32 *)pstrData);printS ((u8 *)pstrData); +/* Set our status to good and exit. */ retVal =DSP_SOK ;break ; } + + rv = (struct RegValue *)LST_Next (pRegKey, + (struct list_head *)rv); }if (count &&DSP_FAILED (retVal))
@@ -320,67 +268,43 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char *pstrKey, DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue) {DSP_STATUS retVal =DSP_EFAIL ; -u32 i; +struct RegValue *rv = (struct RegValue *)LST_First (pRegKey); -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, -BRIDGE_MAX_NAME_SIZE ) ==0 ) { +while (rv) { +/* See if the name matches. */ +if (strncmp (rv->name, pstrValue,MAXREGPATHLENGTH ) ==0 ) {/* * Check if registration counter is > 0, otherwise * delete the key */ -if (pRegKey->values[i].counter >0 ) { +if (rv->counter >0 ) {/* * We do not un-register this entry as another * object needs it. Key Registration counter * takes care of the delta */ - pRegKey->values[i].counter--; + rv->counter--; goto func_cont; }/* * We have a match! Delete this key. To delete a * key, we free all resources associated with this -* key and, if we're not already the last entry in -* the array, we copy that entry into this deleted * key. */ -MEM_Free (pRegKey->values[i].pData); -if ((pRegKey->numValueEntries -1 ) == i) { -/* we're deleting the last one */ - pRegKey->values[i].name[0 ] ='\0' ; - pRegKey->values[i].dataSize =0 ; - pRegKey->values[i].pData =NULL ; - }else { -/* move the last one here */ -strncpy (pRegKey->values[i].name, pRegKey-> - values[pRegKey->numValueEntries -1 ].name, -BRIDGE_MAX_NAME_SIZE ); - pRegKey->values[i].dataSize = - pRegKey-> - values[pRegKey->numValueEntries-1 ].dataSize; - pRegKey->values[i].pData = - pRegKey-> - values[pRegKey->numValueEntries-1 ].pData; -/* don't have to do this, but for -* the paranoid... */ - pRegKey-> - values[pRegKey->numValueEntries-1 ].name[0 ] = -'\0' ; - } - -/* another one bites the dust. */ - pRegKey->numValueEntries--; +LST_RemoveElem (pRegKey, rv); +MEM_Free (rv->pData); +MEM_Free (rv); func_cont:/* Set our status to good and exit... */ retVal =DSP_SOK ;break ; } + + rv = (struct RegValue *)LST_Next (pRegKey, + (struct list_head *)rv); } -return retVal; +return retVal; }
drivers/dsp/bridge/services/regsup.h +0 -3
@@ -25,9 +25,6 @@#ifndef _REGSUP_H_#define _REGSUP_H_ -#define BRIDGE_MAX_NAME_SIZE MAXREGPATHLENGTH -#define BRIDGE_MAX_NUM_REG_ENTRIES 52 -/* Init function. MUST be called BEFORE any calls are */ /* made into this psuedo-registry!!! Returns TRUE/FALSE for SUCCESS/ERROR */ extern bool regsupInit (void );
Signature · 1 line
1.5.6.5
PATCH v2 5/5 DSPBRIDGE: OSAL: Remove printS()
From: Andy Shevchenko <[email protected]>
Remove printS() debuggin method. It's mostly useless and at least dangerous because of absence of boundary check.
--- drivers/dsp/bridge/services/regsup.c | 23 ----------------------- 1 files changed, 0 insertions(+), 23 deletions(-)
drivers/dsp/bridge/services/regsup.c +0 -23
@@ -60,26 +60,6 @@ static struct LST_LIST regKey, *pRegKey = ®Key;#if GT_TRACE extern struct GT_Mask REG_debugMask;/* GT trace var. */ -/* -* ======== printS ======== -* Purpose: -* Displays printable characters in pBuf, if any. -*/ -static inline void printS (void *pBuf) -{ -int pos =0 ; -if (*(REG_debugMask).flags & (GT_2CLASS )) { -while (*(u8 *)((pBuf)+pos) >=' ' && - *(u8 *)((pBuf)+pos) <='~' ) { -GT_1trace (REG_debugMask,GT_2CLASS ,"%c" , - *(u8 *)((pBuf) + pos++)); - } - -GT_0trace (REG_debugMask,GT_2CLASS ,"\n" ); - } -} -#else -#define printS (pBuf)#endif /*
@@ -140,7 +120,6 @@ DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 *dataSize)if (DSP_SUCCEEDED (retVal)) {GT_2trace (REG_debugMask,GT_2CLASS ,"G %s DATA %x " , valName, *(u32 *)pBuf); -printS ((u8 *)pBuf); }else {GT_1trace (REG_debugMask,GT_3CLASS ,"G %s FAILED\n" , valName); }
@@ -160,7 +139,6 @@ DSP_STATUS regsupSetValue(char *valName, void *pBuf, u32 dataSize)GT_2trace (REG_debugMask,GT_2CLASS ,"S %s DATA %x " , valName, *(u32 *)pBuf); -printS ((u8 *)pBuf);/* Need to search through the entries looking for the right one. */ while (rv) {
@@ -245,7 +223,6 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char *pstrKey,GT_3trace (REG_debugMask,GT_2CLASS ,"E Key %s, Value %s, Data %x " , pstrKey, pstrValue, *(u32 *)pstrData); -printS ((u8 *)pstrData);/* Set our status to good and exit. */ retVal =DSP_SOK ;
Signature · 1 line
1.5.6.5
cover dspbridge: OSAL: Simplify REG API
From: Andy Shevchenko <[email protected]>
There are two patches which simplify registry API.
Andy Shevchenko (2):
DSPBRIDGE: OSAL: Simplify REG API
DSPBRIDGE: OSAL: Remove unused registry variables
arch/arm/plat-omap/include/dspbridge/dbreg.h | 3 - arch/arm/plat-omap/include/dspbridge/reg.h | 102 +++---------------------- drivers/dsp/bridge/rmgr/dbdcd.c | 22 ++--- drivers/dsp/bridge/rmgr/drv.c | 22 ++---- drivers/dsp/bridge/rmgr/drv_interface.c | 35 ++------- drivers/dsp/bridge/services/cfg.c | 50 ++++--------- drivers/dsp/bridge/services/reg.c | 26 ++----- drivers/dsp/bridge/services/regsup.c | 3 +- drivers/dsp/bridge/services/regsup.h | 4 +- drivers/dsp/bridge/wmd/tiomap3430.c | 4 +- 10 files changed, 68 insertions(+), 203 deletions(-)