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 2/5] DSPBRIDGE: remove crefs for SERVICES[Init|Exit]
Date: Fri, 22 Jan 2010 21:33:21 -0600 [thread overview]
Message-ID: <1264217604-8021-3-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1264217604-8021-2-git-send-email-omar.ramirez@ti.com>
No point in having a module counter if these are called
only once.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
drivers/dsp/bridge/services/services.c | 92 +++++++++++++-------------------
1 files changed, 37 insertions(+), 55 deletions(-)
diff --git a/drivers/dsp/bridge/services/services.c b/drivers/dsp/bridge/services/services.c
index c3e11b4..efcb0a1 100644
--- a/drivers/dsp/bridge/services/services.c
+++ b/drivers/dsp/bridge/services/services.c
@@ -43,8 +43,6 @@
static struct GT_Mask SERVICES_debugMask = { NULL, NULL }; /* GT trace var. */
#endif
-static u32 cRefs; /* SERVICES module reference count */
-
/*
* ======== SERVICES_Exit ========
* Purpose:
@@ -53,26 +51,21 @@ static u32 cRefs; /* SERVICES module reference count */
*/
void SERVICES_Exit(void)
{
- DBC_Require(cRefs > 0);
+
GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Exit: cRefs 0x%x\n",
cRefs);
- cRefs--;
- if (cRefs == 0) {
- /* Uninitialize all SERVICES modules here */
- NTFY_Exit();
- SYNC_Exit();
- CLK_Exit();
- REG_Exit();
- DBG_Exit();
- CFG_Exit();
- MEM_Exit();
-
- GT_exit();
- }
+ /* Uninitialize all SERVICES modules here */
+ NTFY_Exit();
+ SYNC_Exit();
+ CLK_Exit();
+ REG_Exit();
+ DBG_Exit();
+ CFG_Exit();
+ MEM_Exit();
- DBC_Ensure(cRefs >= 0);
+ GT_exit();
}
/*
@@ -86,61 +79,50 @@ bool SERVICES_Init(void)
bool fCFG, fDBG, fMEM;
bool fREG, fSYNC, fCLK, fNTFY;
- DBC_Require(cRefs >= 0);
-
- if (cRefs == 0) {
+ GT_init();
+ GT_create(&SERVICES_debugMask, "OS"); /* OS for OSal */
- GT_init();
- GT_create(&SERVICES_debugMask, "OS"); /* OS for OSal */
-
- GT_0trace(SERVICES_debugMask, GT_ENTER,
+ GT_0trace(SERVICES_debugMask, GT_ENTER,
"SERVICES_Init: entered\n");
- /* Perform required initialization of SERVICES modules. */
- fMEM = MEM_Init();
- fREG = REG_Init();
- fCFG = CFG_Init();
- fDBG = DBG_Init();
- fSYNC = SYNC_Init();
- fCLK = CLK_Init();
- fNTFY = NTFY_Init();
+ /* Perform required initialization of SERVICES modules. */
+ fMEM = MEM_Init();
+ fREG = REG_Init();
+ fCFG = CFG_Init();
+ fDBG = DBG_Init();
+ fSYNC = SYNC_Init();
+ fCLK = CLK_Init();
+ fNTFY = NTFY_Init();
- fInit = fCFG && fDBG &&
- fMEM && fREG && fSYNC && fCLK;
+ fInit = fCFG && fDBG && fMEM && fREG && fSYNC && fCLK;
- if (!fInit) {
- if (fNTFY)
- NTFY_Exit();
+ if (!fInit) {
+ if (fNTFY)
+ NTFY_Exit();
- if (fSYNC)
- SYNC_Exit();
+ if (fSYNC)
+ SYNC_Exit();
- if (fCLK)
- CLK_Exit();
+ if (fCLK)
+ CLK_Exit();
- if (fREG)
- REG_Exit();
+ if (fREG)
+ REG_Exit();
- if (fDBG)
- DBG_Exit();
+ if (fDBG)
+ DBG_Exit();
- if (fCFG)
- CFG_Exit();
+ if (fCFG)
+ CFG_Exit();
- if (fMEM)
- MEM_Exit();
+ if (fMEM)
+ MEM_Exit();
- }
}
- if (fInit)
- cRefs++;
-
GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Init: cRefs 0x%x\n",
cRefs);
- DBC_Ensure((fInit && (cRefs > 0)) || (!fInit && (cRefs >= 0)));
-
return fInit;
}
--
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 ` Omar Ramirez Luna [this message]
2010-01-23 3:33 ` [PATCH 3/5] DSPBRIDGE: Remove multiple initializations of MEM module Omar Ramirez Luna
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-3-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.