From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: Ameya Palande <ameya.palande@nokia.com>,
Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
Felipe Contreras <felipe.contreras@nokia.com>,
Nishanth Menon <nm@ti.com>,
Omar Ramirez Luna <omar.ramirez@ti.com>
Subject: [PATCH 3/5] DSPBRIDGE: Remove multiple initializations of MEM module
Date: Fri, 22 Jan 2010 21:33:22 -0600 [thread overview]
Message-ID: <1264217604-8021-4-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1264217604-8021-3-git-send-email-omar.ramirez@ti.com>
MEM module should be only initialized by services layer,
removed reference counter for it.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
drivers/dsp/bridge/gen/gs.c | 8 ++------
drivers/dsp/bridge/pmgr/dbll.c | 15 ++-------------
drivers/dsp/bridge/rmgr/dbdcd.c | 8 +-------
drivers/dsp/bridge/rmgr/rmm.c | 17 ++---------------
drivers/dsp/bridge/services/mem.c | 36 ++++++------------------------------
5 files changed, 13 insertions(+), 71 deletions(-)
diff --git a/drivers/dsp/bridge/gen/gs.c b/drivers/dsp/bridge/gen/gs.c
index 5a5684c..1197829 100644
--- a/drivers/dsp/bridge/gen/gs.c
+++ b/drivers/dsp/bridge/gen/gs.c
@@ -52,7 +52,7 @@ void *GS_alloc(u32 size)
*/
void GS_exit(void)
{
- MEM_Exit();
+ /* Do nothing */
}
/*
@@ -85,9 +85,5 @@ void GS_frees(void *ptr, u32 size)
*/
void GS_init(void)
{
- static bool curInit;
-
- if (curInit == false) {
- curInit = MEM_Init(); /* which can't fail currently. */
- }
+ /* Do nothing */
}
diff --git a/drivers/dsp/bridge/pmgr/dbll.c b/drivers/dsp/bridge/pmgr/dbll.c
index 5422d21..80ca4d4 100644
--- a/drivers/dsp/bridge/pmgr/dbll.c
+++ b/drivers/dsp/bridge/pmgr/dbll.c
@@ -317,7 +317,6 @@ void DBLL_exit(void)
cRefs);
if (cRefs == 0) {
- MEM_Exit();
GH_exit();
#if GT_TRACE
DBLL_debugMask.flags = NULL;
@@ -468,30 +467,20 @@ DSP_STATUS DBLL_getSect(struct DBLL_LibraryObj *lib, char *name, u32 *pAddr,
*/
bool DBLL_init(void)
{
- bool retVal = true;
-
DBC_Require(cRefs >= 0);
if (cRefs == 0) {
DBC_Assert(!DBLL_debugMask.flags);
GT_create(&DBLL_debugMask, "DL"); /* "DL" for dbDL */
GH_init();
- retVal = MEM_Init();
- if (!retVal)
- MEM_Exit();
-
}
- if (retVal)
- cRefs++;
-
+ cRefs++;
GT_1trace(DBLL_debugMask, GT_5CLASS, "DBLL_init(), ref count: 0x%x\n",
cRefs);
- DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
-
- return retVal;
+ return true;
}
/*
diff --git a/drivers/dsp/bridge/rmgr/dbdcd.c b/drivers/dsp/bridge/rmgr/dbdcd.c
index 3d50952..cb244f4 100644
--- a/drivers/dsp/bridge/rmgr/dbdcd.c
+++ b/drivers/dsp/bridge/rmgr/dbdcd.c
@@ -352,7 +352,6 @@ void DCD_Exit(void)
if (cRefs == 0) {
REG_Exit();
COD_Exit();
- MEM_Exit();
}
DBC_Ensure(cRefs >= 0);
@@ -822,7 +821,6 @@ DSP_STATUS DCD_GetLibraryName(IN struct DCD_MANAGER *hDcdMgr,
*/
bool DCD_Init(void)
{
- bool fInitMEM;
bool fInitREG;
bool fInitCOD;
bool fInit = true;
@@ -834,17 +832,13 @@ bool DCD_Init(void)
if (cRefs == 0) {
/* Initialize required modules. */
- fInitMEM = MEM_Init();
fInitCOD = COD_Init();
fInitREG = REG_Init();
- if (!fInitMEM || !fInitCOD || !fInitREG) {
+ if (!fInitCOD || !fInitREG) {
fInit = false;
GT_0trace(curTrace, GT_6CLASS, "DCD_Init failed\n");
/* Exit initialized modules. */
- if (fInitMEM)
- MEM_Exit();
-
if (fInitCOD)
COD_Exit();
diff --git a/drivers/dsp/bridge/rmgr/rmm.c b/drivers/dsp/bridge/rmgr/rmm.c
index cdd987a..5c484bc 100644
--- a/drivers/dsp/bridge/rmgr/rmm.c
+++ b/drivers/dsp/bridge/rmgr/rmm.c
@@ -335,9 +335,6 @@ void RMM_exit(void)
GT_1trace(RMM_debugMask, GT_5CLASS, "RMM_exit() ref count: 0x%x\n",
cRefs);
- if (cRefs == 0)
- MEM_Exit();
-
DBC_Ensure(cRefs >= 0);
}
@@ -396,31 +393,21 @@ bool RMM_free(struct RMM_TargetObj *target, u32 segid, u32 addr, u32 size,
*/
bool RMM_init(void)
{
- bool retVal = true;
-
DBC_Require(cRefs >= 0);
if (cRefs == 0) {
DBC_Assert(!RMM_debugMask.flags);
GT_create(&RMM_debugMask, "RM"); /* "RM" for RMm */
- retVal = MEM_Init();
-
- if (!retVal)
- MEM_Exit();
-
}
- if (retVal)
- cRefs++;
+ cRefs++;
GT_1trace(RMM_debugMask, GT_5CLASS,
"RMM_init(), ref count: 0x%x\n",
cRefs);
- DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
-
- return retVal;
+ return true;
}
/*
diff --git a/drivers/dsp/bridge/services/mem.c b/drivers/dsp/bridge/services/mem.c
index 4d01917..cee646a 100644
--- a/drivers/dsp/bridge/services/mem.c
+++ b/drivers/dsp/bridge/services/mem.c
@@ -45,8 +45,6 @@
static struct GT_Mask MEM_debugMask = { NULL, NULL }; /* GT trace variable */
#endif
-static u32 cRefs; /* module reference count */
-
static bool extPhysMemPoolEnabled;
struct extPhysMemPool {
@@ -307,8 +305,6 @@ void *MEM_AllocPhysMem(u32 cBytes, u32 ulAlign, OUT u32 *pPhysicalAddress)
void *pVaMem = NULL;
dma_addr_t paMem;
- DBC_Require(cRefs > 0);
-
GT_2trace(MEM_debugMask, GT_ENTER,
"MEM_AllocPhysMem: cBytes 0x%x\tulAlign"
"0x%x\n", cBytes, ulAlign);
@@ -414,17 +410,9 @@ void *MEM_Calloc(u32 cBytes, enum MEM_POOLATTRS type)
*/
void MEM_Exit(void)
{
- DBC_Require(cRefs > 0);
-
- GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Exit: cRefs 0x%x\n", cRefs);
-
- cRefs--;
#ifdef MEM_CHECK
- if (cRefs == 0)
- MEM_Check();
-
+ MEM_Check();
#endif
- DBC_Ensure(cRefs >= 0);
}
/*
@@ -434,7 +422,7 @@ void MEM_Exit(void)
*/
void MEM_FlushCache(void *pMemBuf, u32 cBytes, s32 FlushType)
{
- if (cRefs <= 0 || !pMemBuf)
+ if (!pMemBuf)
return;
switch (FlushType) {
@@ -546,7 +534,6 @@ void MEM_Free(IN void *pMemBuf)
void MEM_FreePhysMem(void *pVirtualAddress, u32 pPhysicalAddress,
u32 cBytes)
{
- DBC_Require(cRefs > 0);
DBC_Require(pVirtualAddress != NULL);
GT_1trace(MEM_debugMask, GT_ENTER, "MEM_FreePhysMem: pVirtualAddress "
@@ -564,24 +551,13 @@ void MEM_FreePhysMem(void *pVirtualAddress, u32 pPhysicalAddress,
*/
bool MEM_Init(void)
{
- DBC_Require(cRefs >= 0);
-
- if (cRefs == 0) {
- GT_create(&MEM_debugMask, "MM"); /* MM for MeM module */
+ GT_create(&MEM_debugMask, "MM"); /* MM for MeM module */
#ifdef MEM_CHECK
- mMan.lst.head.next = &mMan.lst.head;
- mMan.lst.head.prev = &mMan.lst.head;
- spin_lock_init(&mMan.lock);
+ mMan.lst.head.next = &mMan.lst.head;
+ mMan.lst.head.prev = &mMan.lst.head;
+ spin_lock_init(&mMan.lock);
#endif
- }
-
- cRefs++;
-
- GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Init: cRefs 0x%x\n", cRefs);
-
- DBC_Ensure(cRefs > 0);
-
return true;
}
--
1.6.2.4
next prev parent reply other threads:[~2010-01-23 3:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-23 3:33 [PATCH 0/5] DSPBRIDGE: centralized services initialization Omar Ramirez Luna
2010-01-23 3:33 ` [PATCH 1/5] DSPBRIDGE: Avoid multiple calls to SERVICES_[Init|Exit] Omar Ramirez Luna
2010-01-23 3:33 ` [PATCH 2/5] DSPBRIDGE: remove crefs for SERVICES[Init|Exit] Omar Ramirez Luna
2010-01-23 3:33 ` Omar Ramirez Luna [this message]
2010-01-23 3:33 ` [PATCH 4/5] DSPBRIDGE: Remove multiple initializations of REG module Omar Ramirez Luna
2010-01-23 3:33 ` [PATCH 5/5] DSPBRIDGE: Remove multiple initializations of NTFY module Omar Ramirez Luna
2010-01-26 1:57 ` [RESEND][PATCH 4/5] DSPBRIDGE: Remove multiple initializations of REG module Omar Ramirez Luna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1264217604-8021-4-git-send-email-omar.ramirez@ti.com \
--to=omar.ramirez@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=ameya.palande@nokia.com \
--cc=felipe.contreras@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.