linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] staging: tidspbridge: remove unused references counting
@ 2012-03-09  0:03 Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 01/17] staging: tidspbridge: remove drv_init() and drv_exit() Víctor Manuel Jáquez Leal
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

Almos all the modules in tidspbridge have a _init() and a _exit()
functions, whose only purpose is to keep a reference counting. But that
reference counting, in most of the cases, is utterly useless.

This patch series removes most of the _init() and _exit() function in
the tidspbridge modules, where no functional changes were implied.

Víctor Manuel Jáquez Leal (17):
  staging: tidspbridge: remove drv_init() and drv_exit()
  staging: tidspbridge: remove cod_init() and cod_exit()
  staging: tidspbridge: remove proc_init() and proc_exit()
  staging: tidspbridge: remove node_init() and node_exit()
  staging: tidspbridge: remove disp_init() and disp_exit()
  staging: tidspbridge: remove strm_init() and strm_exit()
  staging: tidspbridge: remove rmm_init() and rmm_exit()
  staging: tidspbridge: remove chnl_init() and chnl_exit()
  staging: tidspbridge: remove msg_mod_init() and msg_exit()
  staging: tidspbridge: remove io_init() and io_exit()
  staging: tidspbridge: remove cmm_init() and cmm_exit()
  staging: tidspbridge: remove dmm_init() and dmm_exit()
  staging: tidspbridge: remove dev_init() and dev_exit()
  staging: tidspbridge: simplify mgr_init()
  staging: tidspbridge: remove gh_init() and gh_exit()
  staging: tidspbridge: remove ref counting in nldr.c
  staging: tidspbridge: remove nldr_init() and nldr_exit()

 drivers/staging/tidspbridge/gen/gh.c               |   18 -----
 .../staging/tidspbridge/include/dspbridge/chnl.h   |   29 --------
 .../staging/tidspbridge/include/dspbridge/cmm.h    |   30 --------
 .../staging/tidspbridge/include/dspbridge/cod.h    |   29 --------
 .../staging/tidspbridge/include/dspbridge/dev.h    |   27 -------
 .../staging/tidspbridge/include/dspbridge/disp.h   |   31 --------
 .../staging/tidspbridge/include/dspbridge/dmm.h    |    4 -
 .../staging/tidspbridge/include/dspbridge/drv.h    |   23 ------
 drivers/staging/tidspbridge/include/dspbridge/gh.h |    2 -
 drivers/staging/tidspbridge/include/dspbridge/io.h |   29 --------
 .../staging/tidspbridge/include/dspbridge/msg.h    |   27 -------
 .../staging/tidspbridge/include/dspbridge/nldr.h   |    2 -
 .../tidspbridge/include/dspbridge/nldrdefs.h       |   34 ---------
 .../staging/tidspbridge/include/dspbridge/node.h   |   41 -----------
 .../tidspbridge/include/dspbridge/nodepriv.h       |    1 -
 .../staging/tidspbridge/include/dspbridge/proc.h   |   28 -------
 .../staging/tidspbridge/include/dspbridge/rmm.h    |   25 -------
 .../staging/tidspbridge/include/dspbridge/strm.h   |   38 +----------
 drivers/staging/tidspbridge/pmgr/chnl.c            |   28 -------
 drivers/staging/tidspbridge/pmgr/cmm.c             |   29 --------
 drivers/staging/tidspbridge/pmgr/cod.c             |   29 --------
 drivers/staging/tidspbridge/pmgr/dbll.c            |   12 +---
 drivers/staging/tidspbridge/pmgr/dev.c             |   50 -------------
 drivers/staging/tidspbridge/pmgr/dmm.c             |   32 --------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   75 +------------------
 drivers/staging/tidspbridge/pmgr/io.c              |   28 -------
 drivers/staging/tidspbridge/pmgr/msg.c             |   21 ------
 drivers/staging/tidspbridge/rmgr/dbdcd.c           |   15 +----
 drivers/staging/tidspbridge/rmgr/disp.c            |   25 -------
 drivers/staging/tidspbridge/rmgr/drv.c             |   26 -------
 drivers/staging/tidspbridge/rmgr/mgr.c             |    9 +--
 drivers/staging/tidspbridge/rmgr/nldr.c            |   28 -------
 drivers/staging/tidspbridge/rmgr/node.c            |   31 --------
 drivers/staging/tidspbridge/rmgr/proc.c            |   28 -------
 drivers/staging/tidspbridge/rmgr/rmm.c             |   20 -----
 drivers/staging/tidspbridge/rmgr/strm.c            |   28 -------
 36 files changed, 10 insertions(+), 922 deletions(-)

-- 
1.7.9.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 01/17] staging: tidspbridge: remove drv_init() and drv_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 02/17] staging: tidspbridge: remove cod_init() and cod_exit() Víctor Manuel Jáquez Leal
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The drv module has a drv_init() and a drv_exit() whose only purpose is
to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/drv.h    |   23 -----------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    8 +----
 drivers/staging/tidspbridge/rmgr/drv.c             |   26 --------------------
 3 files changed, 2 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/drv.h b/drivers/staging/tidspbridge/include/dspbridge/drv.h
index 9cdbd95..b0c7708 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/drv.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/drv.h
@@ -199,17 +199,6 @@ extern int drv_create(struct drv_object **drv_obj);
 extern int drv_destroy(struct drv_object *driver_obj);
 
 /*
- *  ======== drv_exit ========
- *  Purpose:
- *      Exit the DRV module, freeing any modules initialized in drv_init.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  Ensures:
- */
-extern void drv_exit(void);
-
-/*
  *  ======== drv_get_first_dev_object ========
  *  Purpose:
  *      Returns the Ptr to the FirstDev Object in the List
@@ -294,18 +283,6 @@ extern u32 drv_get_next_dev_object(u32 hdev_obj);
 extern u32 drv_get_next_dev_extension(u32 dev_extension);
 
 /*
- *  ======== drv_init ========
- *  Purpose:
- *      Initialize the DRV module.
- *  Parameters:
- *  Returns:
- *      TRUE if success; FALSE otherwise.
- *  Requires:
- *  Ensures:
- */
-extern int drv_init(void);
-
-/*
  *  ======== drv_insert_dev_object ========
  *  Purpose:
  *      Insert a DeviceObject into the list of Driver object.
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 2788946..dcf1dab 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -278,7 +278,6 @@ void api_exit(void)
 		proc_exit();
 		mgr_exit();
 		rmm_exit();
-		drv_exit();
 	}
 }
 
@@ -290,12 +289,11 @@ void api_exit(void)
 bool api_init(void)
 {
 	bool ret = true;
-	bool fdrv, fdev, fcod, fchnl, fmsg, fio;
+	bool fdev, fcod, fchnl, fmsg, fio;
 	bool fmgr, fproc, fnode, fdisp, fstrm, frmm;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
-		fdrv = drv_init();
 		fmgr = mgr_init();
 		fproc = proc_init();
 		fnode = node_init();
@@ -307,11 +305,9 @@ bool api_init(void)
 		fio = io_init();
 		fdev = dev_init();
 		fcod = cod_init();
-		ret = fdrv && fdev && fchnl && fcod && fmsg && fio;
+		ret = fdev && fchnl && fcod && fmsg && fio;
 		ret = ret && fmgr && fproc && frmm;
 		if (!ret) {
-			if (fdrv)
-				drv_exit();
 
 			if (fmgr)
 				mgr_exit();
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index b34dba7..6795205 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -51,7 +51,6 @@ struct drv_ext {
 };
 
 /*  ----------------------------------- Globals */
-static s32 refs;
 static bool ext_phys_mem_pool_enabled;
 struct ext_phys_mem_pool {
 	u32 phys_mem_base;
@@ -332,16 +331,6 @@ int drv_create(struct drv_object **drv_obj)
 }
 
 /*
- *  ======== drv_exit ========
- *  Purpose:
- *      Discontinue usage of the DRV module.
- */
-void drv_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== = drv_destroy ======== =
  *  purpose:
  *      Invoked during bridge de-initialization
@@ -499,21 +488,6 @@ u32 drv_get_next_dev_extension(u32 dev_extension)
 }
 
 /*
- *  ======== drv_init ========
- *  Purpose:
- *      Initialize DRV module private state.
- */
-int drv_init(void)
-{
-	s32 ret = 1;		/* function return value */
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== drv_insert_dev_object ========
  *  Purpose:
  *      Insert a DevObject into the list of Manager object.
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/17] staging: tidspbridge: remove cod_init() and cod_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 01/17] staging: tidspbridge: remove drv_init() and drv_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 03/17] staging: tidspbridge: remove proc_init() and proc_exit() Víctor Manuel Jáquez Leal
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The cod module has a cod_init() and a cod_exit() whose only purpose is
to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/cod.h    |   29 --------------------
 drivers/staging/tidspbridge/pmgr/cod.c             |   29 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    9 +-----
 drivers/staging/tidspbridge/rmgr/dbdcd.c           |   15 +---------
 4 files changed, 3 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/cod.h b/drivers/staging/tidspbridge/include/dspbridge/cod.h
index cb684c1..ba2005d 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/cod.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/cod.h
@@ -100,21 +100,6 @@ extern int cod_create(struct cod_manager **mgr,
 extern void cod_delete(struct cod_manager *cod_mgr_obj);
 
 /*
- *  ======== cod_exit ========
- *  Purpose:
- *      Discontinue usage of the COD module.
- *  Parameters:
- *      None.
- *  Returns:
- *      None.
- *  Requires:
- *      COD initialized.
- *  Ensures:
- *      Resources acquired in cod_init(void) are freed.
- */
-extern void cod_exit(void);
-
-/*
  *  ======== cod_get_base_lib ========
  *  Purpose:
  *      Get handle to the base image DBL library.
@@ -243,20 +228,6 @@ extern int cod_get_sym_value(struct cod_manager *cod_mgr_obj,
 				    char *str_sym, u32 * pul_value);
 
 /*
- *  ======== cod_init ========
- *  Purpose:
- *      Initialize the COD module's private state.
- *  Parameters:
- *      None.
- *  Returns:
- *      TRUE if initialized; FALSE if error occurred.
- *  Requires:
- *  Ensures:
- *      A requirement for each of the other public COD functions.
- */
-extern bool cod_init(void);
-
-/*
  *  ======== cod_load_base ========
  *  Purpose:
  *      Load the initial program image, optionally with command-line arguments,
diff --git a/drivers/staging/tidspbridge/pmgr/cod.c b/drivers/staging/tidspbridge/pmgr/cod.c
index d01fb8e..4007826 100644
--- a/drivers/staging/tidspbridge/pmgr/cod.c
+++ b/drivers/staging/tidspbridge/pmgr/cod.c
@@ -58,8 +58,6 @@ struct cod_libraryobj {
 	struct cod_manager *cod_mgr;
 };
 
-static u32 refs = 0L;
-
 static struct dbll_fxns ldr_fxns = {
 	(dbll_close_fxn) dbll_close,
 	(dbll_create_fxn) dbll_create,
@@ -268,17 +266,6 @@ void cod_delete(struct cod_manager *cod_mgr_obj)
 }
 
 /*
- *  ======== cod_exit ========
- *  Purpose:
- *      Discontinue usage of the COD module.
- *
- */
-void cod_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== cod_get_base_lib ========
  *  Purpose:
  *      Get handle to the base image DBL library.
@@ -395,22 +382,6 @@ int cod_get_sym_value(struct cod_manager *cod_mgr_obj, char *str_sym,
 }
 
 /*
- *  ======== cod_init ========
- *  Purpose:
- *      Initialize the COD module's private state.
- *
- */
-bool cod_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== cod_load_base ========
  *  Purpose:
  *      Load the initial program image, optionally with command-line arguments,
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index dcf1dab..971e839 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -267,7 +267,6 @@ void api_exit(void)
 
 	if (api_c_refs == 0) {
 		/* Release all modules initialized in api_init(). */
-		cod_exit();
 		dev_exit();
 		chnl_exit();
 		msg_exit();
@@ -289,7 +288,7 @@ void api_exit(void)
 bool api_init(void)
 {
 	bool ret = true;
-	bool fdev, fcod, fchnl, fmsg, fio;
+	bool fdev, fchnl, fmsg, fio;
 	bool fmgr, fproc, fnode, fdisp, fstrm, frmm;
 
 	if (api_c_refs == 0) {
@@ -304,8 +303,7 @@ bool api_init(void)
 		fmsg = msg_mod_init();
 		fio = io_init();
 		fdev = dev_init();
-		fcod = cod_init();
-		ret = fdev && fchnl && fcod && fmsg && fio;
+		ret = fdev && fchnl && fmsg && fio;
 		ret = ret && fmgr && fproc && frmm;
 		if (!ret) {
 
@@ -336,9 +334,6 @@ bool api_init(void)
 			if (fdev)
 				dev_exit();
 
-			if (fcod)
-				cod_exit();
-
 			if (frmm)
 				rmm_exit();
 
diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index 8378b7b..12a1d34 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -289,7 +289,6 @@ void dcd_exit(void)
 
 	refs--;
 	if (refs == 0) {
-		cod_exit();
 		list_for_each_entry_safe(rv, rv_tmp, &reg_key_list, link) {
 			list_del(&rv->link);
 			kfree(rv->path);
@@ -738,22 +737,10 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
  */
 bool dcd_init(void)
 {
-	bool init_cod;
 	bool ret = true;
 
-	if (refs == 0) {
-		/* Initialize required modules. */
-		init_cod = cod_init();
-
-		if (!init_cod) {
-			ret = false;
-			/* Exit initialized modules. */
-			if (init_cod)
-				cod_exit();
-		}
-
+	if (refs == 0)
 		INIT_LIST_HEAD(&reg_key_list);
-	}
 
 	if (ret)
 		refs++;
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/17] staging: tidspbridge: remove proc_init() and proc_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 01/17] staging: tidspbridge: remove drv_init() and drv_exit() Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 02/17] staging: tidspbridge: remove cod_init() and cod_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 04/17] staging: tidspbridge: remove node_init() and node_exit() Víctor Manuel Jáquez Leal
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The proc module has a proc_init() and a proc_exit() whose only purpose
is to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/proc.h   |   28 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    9 +-----
 drivers/staging/tidspbridge/rmgr/proc.c            |   28 --------------------
 3 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/proc.h b/drivers/staging/tidspbridge/include/dspbridge/proc.h
index f00dffd..a82380e 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/proc.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/proc.h
@@ -189,20 +189,6 @@ extern int proc_get_resource_info(void *hprocessor,
 					 u32 resource_info_size);
 
 /*
- *  ======== proc_exit ========
- *  Purpose:
- *      Decrement reference count, and free resources when reference count is
- *      0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      PROC is initialized.
- *  Ensures:
- *      When reference count == 0, PROC's private resources are freed.
- */
-extern void proc_exit(void);
-
-/*
  * ======== proc_get_dev_object =========
  *  Purpose:
  *      Returns the DEV Hanlde for a given Processor handle
@@ -223,20 +209,6 @@ extern int proc_get_dev_object(void *hprocessor,
 				      struct dev_object **device_obj);
 
 /*
- *  ======== proc_init ========
- *  Purpose:
- *      Initialize PROC's private state, keeping a reference count on each
- *      call.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occurred.
- *  Requires:
- *  Ensures:
- *      TRUE: A requirement for the other public PROC functions.
- */
-extern bool proc_init(void);
-
-/*
  *  ======== proc_get_state ========
  *  Purpose:
  *      Report the state of the specified DSP processor.
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 971e839..7c20a0f 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -274,7 +274,6 @@ void api_exit(void)
 		strm_exit();
 		disp_exit();
 		node_exit();
-		proc_exit();
 		mgr_exit();
 		rmm_exit();
 	}
@@ -289,12 +288,11 @@ bool api_init(void)
 {
 	bool ret = true;
 	bool fdev, fchnl, fmsg, fio;
-	bool fmgr, fproc, fnode, fdisp, fstrm, frmm;
+	bool fmgr, fnode, fdisp, fstrm, frmm;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fproc = proc_init();
 		fnode = node_init();
 		fdisp = disp_init();
 		fstrm = strm_init();
@@ -304,7 +302,7 @@ bool api_init(void)
 		fio = io_init();
 		fdev = dev_init();
 		ret = fdev && fchnl && fmsg && fio;
-		ret = ret && fmgr && fproc && frmm;
+		ret = ret && fmgr && frmm;
 		if (!ret) {
 
 			if (fmgr)
@@ -313,9 +311,6 @@ bool api_init(void)
 			if (fstrm)
 				strm_exit();
 
-			if (fproc)
-				proc_exit();
-
 			if (fnode)
 				node_exit();
 
diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index b865d64..7e4f12f 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -98,8 +98,6 @@ struct proc_object {
 	struct list_head proc_list;
 };
 
-static u32 refs;
-
 DEFINE_MUTEX(proc_lock);	/* For critical sections */
 
 /*  ----------------------------------- Function Prototypes */
@@ -909,17 +907,6 @@ func_end:
 }
 
 /*
- *  ======== proc_exit ========
- *  Purpose:
- *      Decrement reference count, and free resources when reference count is
- *      0.
- */
-void proc_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== proc_get_dev_object ========
  *  Purpose:
  *      Return the Dev Object handle for a given Processor.
@@ -1010,21 +997,6 @@ int proc_get_trace(void *hprocessor, u8 * pbuf, u32 max_size)
 }
 
 /*
- *  ======== proc_init ========
- *  Purpose:
- *      Initialize PROC's private state, keeping a reference count on each call
- */
-bool proc_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== proc_load ========
  *  Purpose:
  *      Reset a processor and load a new base program image.
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/17] staging: tidspbridge: remove node_init() and node_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (2 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 03/17] staging: tidspbridge: remove proc_init() and proc_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 05/17] staging: tidspbridge: remove disp_init() and disp_exit() Víctor Manuel Jáquez Leal
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The node module has a node_init() and a node_exit() whose only purpose
is to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/node.h   |   41 --------------------
 .../tidspbridge/include/dspbridge/nodepriv.h       |    1 -
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    7 +---
 drivers/staging/tidspbridge/rmgr/node.c            |   24 -----------
 4 files changed, 1 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/node.h b/drivers/staging/tidspbridge/include/dspbridge/node.h
index 16371d8..7397b7a 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/node.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/node.h
@@ -47,7 +47,6 @@
  *      -EPERM:          A failure occurred, unable to allocate node.
  *      -EBADR:    Proccessor is not in the running state.
  *  Requires:
- *      node_init(void) called.
  *      hprocessor != NULL.
  *      node_uuid != NULL.
  *      noderes != NULL.
@@ -81,7 +80,6 @@ extern int node_allocate(struct proc_object *hprocessor,
  *      -EPERM:      General Failure.
  *      -EINVAL:      Invalid Size.
  *  Requires:
- *      node_init(void) called.
  *      pbuffer != NULL.
  *  Ensures:
  */
@@ -106,7 +104,6 @@ extern int node_alloc_msg_buf(struct node_object *hnode,
  *                          or NODE_RUNNING state.
  *      -ETIME:       A timeout occurred before the DSP responded.
  *  Requires:
- *      node_init(void) called.
  *  Ensures:
  *      0 && (Node's current priority == prio)
  */
@@ -157,7 +154,6 @@ extern int node_change_priority(struct node_object *hnode, s32 prio);
  *                              Device node to device node, or device node to
  *                              GPP), the two nodes are on different DSPs.
  *  Requires:
- *      node_init(void) called.
  *  Ensures:
  */
 extern int node_connect(struct node_object *node1,
@@ -185,7 +181,6 @@ extern int node_connect(struct node_object *node1,
  *      -ETIME:       A timeout occurred before the DSP responded.
  *      -EPERM:          A failure occurred, unable to create node.
  *  Requires:
- *      node_init(void) called.
  *  Ensures:
  */
 extern int node_create(struct node_object *hnode);
@@ -206,7 +201,6 @@ extern int node_create(struct node_object *hnode);
  *      -ENOMEM:    Insufficient memory for requested resources.
  *      -EPERM:      General failure.
  *  Requires:
- *      node_init(void) called.
  *      node_man != NULL.
  *      hdev_obj != NULL.
  *  Ensures:
@@ -234,7 +228,6 @@ extern int node_create_mgr(struct node_mgr **node_man,
  *      -EPERM:          A failure occurred in deleting the node.
  *      -ESPIPE:        Delete function not found in the COFF file.
  *  Requires:
- *      node_init(void) called.
  *  Ensures:
  *      0:            hnode is invalid.
  */
@@ -250,7 +243,6 @@ extern int node_delete(struct node_res_object *noderes,
  *  Returns:
  *      0:        Success.
  *  Requires:
- *      node_init(void) called.
  *      Valid hnode_mgr.
  *  Ensures:
  */
@@ -287,20 +279,6 @@ extern int node_enum_nodes(struct node_mgr *hnode_mgr,
 				  u32 *pu_allocated);
 
 /*
- *  ======== node_exit ========
- *  Purpose:
- *      Discontinue usage of NODE module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      node_init(void) successfully called before.
- *  Ensures:
- *      Any resources acquired in node_init(void) will be freed when last NODE
- *      client calls node_exit(void).
- */
-extern void node_exit(void);
-
-/*
  *  ======== node_free_msg_buf ========
  *  Purpose:
  *      Free a message buffer previously allocated with node_alloc_msg_buf.
@@ -313,7 +291,6 @@ extern void node_exit(void);
  *      -EFAULT:    Invalid node handle.
  *      -EPERM:      Failure to free the buffer.
  *  Requires:
- *      node_init(void) called.
  *      pbuffer != NULL.
  *  Ensures:
  */
@@ -336,7 +313,6 @@ extern int node_free_msg_buf(struct node_object *hnode,
  *      0:        Success.
  *      -EFAULT:    Invalid hnode.
  *  Requires:
- *      node_init(void) called.
  *      pattr != NULL.
  *  Ensures:
  *      0:        *pattrs contains the node's current attributes.
@@ -363,7 +339,6 @@ extern int node_get_attr(struct node_object *hnode,
  *              Error occurred while trying to retrieve a message.
  *      -ETIME:   Timeout occurred and no message is available.
  *  Requires:
- *      node_init(void) called.
  *      message != NULL.
  *  Ensures:
  */
@@ -386,17 +361,6 @@ extern int node_get_nldr_obj(struct node_mgr *hnode_mgr,
 				    struct nldr_object **nldr_ovlyobj);
 
 /*
- *  ======== node_init ========
- *  Purpose:
- *      Initialize the NODE module.
- *  Parameters:
- *  Returns:
- *      TRUE if initialization succeeded, FALSE otherwise.
- *  Ensures:
- */
-extern bool node_init(void);
-
-/*
  *  ======== node_on_exit ========
  *  Purpose:
  *      Gets called when RMS_EXIT is received for a node. PROC needs to pass
@@ -425,7 +389,6 @@ void node_on_exit(struct node_object *hnode, s32 node_status);
  *      -ETIME:       A timeout occurred before the DSP responded.
  *      DSP_EWRONGSTSATE:   Node is not in NODE_RUNNING state.
  *  Requires:
- *      node_init(void) called.
  *  Ensures:
  */
 extern int node_pause(struct node_object *hnode);
@@ -449,7 +412,6 @@ extern int node_pause(struct node_object *hnode);
  *      -ETIME:       Timeout occurred before message could be set.
  *      -EBADR:    Node is in invalid state for sending messages.
  *  Requires:
- *      node_init(void) called.
  *      pmsg != NULL.
  *  Ensures:
  */
@@ -473,7 +435,6 @@ extern int node_put_message(struct node_object *hnode,
  *      -ENOSYS:   Notification type specified by notify_type is not
  *                      supported.
  *  Requires:
- *      node_init(void) called.
  *      hnotification != NULL.
  *  Ensures:
  */
@@ -500,7 +461,6 @@ extern int node_register_notify(struct node_object *hnode,
  *      DSP_EWRONGSTSATE:   Node is not in NODE_PAUSED or NODE_CREATED state.
  *      -ESPIPE:        Execute function not found in the COFF file.
  *  Requires:
- *      node_init(void) called.
  *  Ensures:
  */
 extern int node_run(struct node_object *hnode);
@@ -523,7 +483,6 @@ extern int node_run(struct node_object *hnode);
  *              Unable to terminate the node.
  *      -EBADR:    Operation not valid for the current node state.
  *  Requires:
- *      node_init(void) called.
  *      pstatus != NULL.
  *  Ensures:
  */
diff --git a/drivers/staging/tidspbridge/include/dspbridge/nodepriv.h b/drivers/staging/tidspbridge/include/dspbridge/nodepriv.h
index 9c1e067..d5b54bb 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/nodepriv.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/nodepriv.h
@@ -96,7 +96,6 @@ struct node_createargs {
  *      -EINVAL:     The node's stream corresponding to index and dir
  *                      is not a stream to or from the host.
  *  Requires:
- *      node_init(void) called.
  *      Valid dir.
  *      chan_id != NULL.
  *  Ensures:
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 7c20a0f..a5f1f65 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -273,7 +273,6 @@ void api_exit(void)
 		io_exit();
 		strm_exit();
 		disp_exit();
-		node_exit();
 		mgr_exit();
 		rmm_exit();
 	}
@@ -288,12 +287,11 @@ bool api_init(void)
 {
 	bool ret = true;
 	bool fdev, fchnl, fmsg, fio;
-	bool fmgr, fnode, fdisp, fstrm, frmm;
+	bool fmgr, fdisp, fstrm, frmm;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fnode = node_init();
 		fdisp = disp_init();
 		fstrm = strm_init();
 		frmm = rmm_init();
@@ -311,9 +309,6 @@ bool api_init(void)
 			if (fstrm)
 				strm_exit();
 
-			if (fnode)
-				node_exit();
-
 			if (fdisp)
 				disp_exit();
 
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index 1b24589..908cd1e 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -261,8 +261,6 @@ static u32 ovly(void *priv_ref, u32 dsp_run_addr, u32 dsp_load_addr,
 static u32 mem_write(void *priv_ref, u32 dsp_add, void *pbuf,
 		     u32 ul_num_bytes, u32 mem_space);
 
-static u32 refs;		/* module reference count */
-
 /* Dynamic loader functions. */
 static struct node_ldr_fxns nldr_fxns = {
 	nldr_allocate,
@@ -1569,16 +1567,6 @@ func_end:
 }
 
 /*
- *  ======== node_exit ========
- *  Purpose:
- *      Discontinue usage of NODE module.
- */
-void node_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== node_free_msg_buf ========
  *  Purpose:
  *      Frees the message buffer.
@@ -1852,18 +1840,6 @@ enum node_type node_get_type(struct node_object *hnode)
 }
 
 /*
- *  ======== node_init ========
- *  Purpose:
- *      Initialize the NODE module.
- */
-bool node_init(void)
-{
-	refs++;
-
-	return true;
-}
-
-/*
  *  ======== node_on_exit ========
  *  Purpose:
  *      Gets called when RMS_EXIT is received for a node.
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/17] staging: tidspbridge: remove disp_init() and disp_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (3 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 04/17] staging: tidspbridge: remove node_init() and node_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 06/17] staging: tidspbridge: remove strm_init() and strm_exit() Víctor Manuel Jáquez Leal
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The disp module has a disp_init() and a disp_exit() whose only purpose
is to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/disp.h   |   31 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    7 +----
 drivers/staging/tidspbridge/rmgr/disp.c            |   25 ----------------
 3 files changed, 1 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/disp.h b/drivers/staging/tidspbridge/include/dspbridge/disp.h
index 5dfdc8c..39d3cea 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/disp.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/disp.h
@@ -53,7 +53,6 @@ struct disp_attr {
  *      -ENOMEM:            Insufficient memory for requested resources.
  *      -EPERM:              Unable to create dispatcher.
  *  Requires:
- *      disp_init(void) called.
  *      disp_attrs != NULL.
  *      hdev_obj != NULL.
  *      dispatch_obj != NULL.
@@ -73,7 +72,6 @@ extern int disp_create(struct disp_object **dispatch_obj,
  *      disp_obj:  Node Dispatcher object.
  *  Returns:
  *  Requires:
- *      disp_init(void) called.
  *      Valid disp_obj.
  *  Ensures:
  *      disp_obj is invalid.
@@ -81,31 +79,6 @@ extern int disp_create(struct disp_object **dispatch_obj,
 extern void disp_delete(struct disp_object *disp_obj);
 
 /*
- *  ======== disp_exit ========
- *  Discontinue usage of DISP module.
- *
- *  Parameters:
- *  Returns:
- *  Requires:
- *      disp_init(void) previously called.
- *  Ensures:
- *      Any resources acquired in disp_init(void) will be freed when last DISP
- *      client calls disp_exit(void).
- */
-extern void disp_exit(void);
-
-/*
- *  ======== disp_init ========
- *  Initialize the DISP module.
- *
- *  Parameters:
- *  Returns:
- *      TRUE if initialization succeeded, FALSE otherwise.
- *  Ensures:
- */
-extern bool disp_init(void);
-
-/*
  *  ======== disp_node_change_priority ========
  *  Change the priority of a node currently running on the target.
  *
@@ -120,7 +93,6 @@ extern bool disp_init(void);
  *      0:                Success.
  *      -ETIME:           A timeout occurred before the DSP responded.
  *  Requires:
- *      disp_init(void) called.
  *      Valid disp_obj.
  *      hnode != NULL.
  *  Ensures:
@@ -148,7 +120,6 @@ extern int disp_node_change_priority(struct disp_object
  *      -ETIME:   A timeout occurred before the DSP responded.
  *      -EPERM:      A failure occurred, unable to create node.
  *  Requires:
- *      disp_init(void) called.
  *      Valid disp_obj.
  *      pargs != NULL.
  *      hnode != NULL.
@@ -178,7 +149,6 @@ extern int disp_node_create(struct disp_object *disp_obj,
  *      0:        Success.
  *      -ETIME:   A timeout occurred before the DSP responded.
  *  Requires:
- *      disp_init(void) called.
  *      Valid disp_obj.
  *      hnode != NULL.
  *  Ensures:
@@ -204,7 +174,6 @@ extern int disp_node_delete(struct disp_object *disp_obj,
  *      0:        Success.
  *      -ETIME:   A timeout occurred before the DSP responded.
  *  Requires:
- *      disp_init(void) called.
  *      Valid disp_obj.
  *      hnode != NULL.
  *  Ensures:
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index a5f1f65..b1a99f7 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -272,7 +272,6 @@ void api_exit(void)
 		msg_exit();
 		io_exit();
 		strm_exit();
-		disp_exit();
 		mgr_exit();
 		rmm_exit();
 	}
@@ -287,12 +286,11 @@ bool api_init(void)
 {
 	bool ret = true;
 	bool fdev, fchnl, fmsg, fio;
-	bool fmgr, fdisp, fstrm, frmm;
+	bool fmgr, fstrm, frmm;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fdisp = disp_init();
 		fstrm = strm_init();
 		frmm = rmm_init();
 		fchnl = chnl_init();
@@ -309,9 +307,6 @@ bool api_init(void)
 			if (fstrm)
 				strm_exit();
 
-			if (fdisp)
-				disp_exit();
-
 			if (fchnl)
 				chnl_exit();
 
diff --git a/drivers/staging/tidspbridge/rmgr/disp.c b/drivers/staging/tidspbridge/rmgr/disp.c
index e510bb2..4af51b7 100644
--- a/drivers/staging/tidspbridge/rmgr/disp.c
+++ b/drivers/staging/tidspbridge/rmgr/disp.c
@@ -69,8 +69,6 @@ struct disp_object {
 	u32 data_mau_size;	/* Size of DSP Data MAU */
 };
 
-static u32 refs;
-
 static void delete_disp(struct disp_object *disp_obj);
 static int fill_stream_def(rms_word *pdw_buf, u32 *ptotal, u32 offset,
 				  struct node_strmdef strm_def, u32 max,
@@ -173,29 +171,6 @@ void disp_delete(struct disp_object *disp_obj)
 }
 
 /*
- *  ======== disp_exit ========
- *  Discontinue usage of DISP module.
- */
-void disp_exit(void)
-{
-	refs--;
-}
-
-/*
- *  ======== disp_init ========
- *  Initialize the DISP module.
- */
-bool disp_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== disp_node_change_priority ========
  *  Change the priority of a node currently running on the target.
  */
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/17] staging: tidspbridge: remove strm_init() and strm_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (4 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 05/17] staging: tidspbridge: remove disp_init() and disp_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 07/17] staging: tidspbridge: remove rmm_init() and rmm_exit() Víctor Manuel Jáquez Leal
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The strm module has a strm_init() and a strm_exit() whose only purpose
is to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/strm.h   |   38 +-------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    7 +---
 drivers/staging/tidspbridge/rmgr/strm.c            |   28 --------------
 3 files changed, 2 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/strm.h b/drivers/staging/tidspbridge/include/dspbridge/strm.h
index 613fe53..dacf0c23 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/strm.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/strm.h
@@ -40,7 +40,6 @@
  *      -EPERM:      Failure occurred, unable to allocate buffers.
  *      -EINVAL:      usize must be > 0 bytes.
  *  Requires:
- *      strm_init(void) called.
  *      ap_buffer != NULL.
  *  Ensures:
  */
@@ -63,7 +62,6 @@ extern int strm_allocate_buffer(struct strm_res_object *strmres,
  *                      been reclaimed.
  *      -EPERM:      Failure to close stream.
  *  Requires:
- *      strm_init(void) called.
  *  Ensures:
  */
 extern int strm_close(struct strm_res_object *strmres,
@@ -83,7 +81,6 @@ extern int strm_close(struct strm_res_object *strmres,
  *      -ENOMEM:    Insufficient memory for requested resources.
  *      -EPERM:      General failure.
  *  Requires:
- *      strm_init(void) called.
  *      strm_man != NULL.
  *      dev_obj != NULL.
  *  Ensures:
@@ -101,7 +98,6 @@ extern int strm_create(struct strm_mgr **strm_man,
  *      strm_mgr_obj:       Handle to STRM manager object from strm_create.
  *  Returns:
  *  Requires:
- *      strm_init(void) called.
  *      Valid strm_mgr_obj.
  *  Ensures:
  *      strm_mgr_obj is not valid.
@@ -109,18 +105,6 @@ extern int strm_create(struct strm_mgr **strm_man,
 extern void strm_delete(struct strm_mgr *strm_mgr_obj);
 
 /*
- *  ======== strm_exit ========
- *  Purpose:
- *      Discontinue usage of STRM module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      strm_init(void) successfully called before.
- *  Ensures:
- */
-extern void strm_exit(void);
-
-/*
  *  ======== strm_free_buffer ========
  *  Purpose:
  *      Free buffer(s) allocated with strm_allocate_buffer.
@@ -133,7 +117,6 @@ extern void strm_exit(void);
  *      -EFAULT:    Invalid stream handle.
  *      -EPERM:      Failure occurred, unable to free buffers.
  *  Requires:
- *      strm_init(void) called.
  *      ap_buffer != NULL.
  *  Ensures:
  */
@@ -156,7 +139,6 @@ extern int strm_free_buffer(struct strm_res_object *strmres,
  *      -EINVAL:          stream_info_size < sizeof(dsp_streaminfo).
  *      -EPERM:          Unable to get stream info.
  *  Requires:
- *      strm_init(void) called.
  *      stream_info != NULL.
  *  Ensures:
  */
@@ -184,24 +166,11 @@ extern int strm_get_info(struct strm_object *stream_obj,
  *      -ETIME:   A timeout occurred before the stream could be idled.
  *      -EPERM:      Unable to idle stream.
  *  Requires:
- *      strm_init(void) called.
  *  Ensures:
  */
 extern int strm_idle(struct strm_object *stream_obj, bool flush_data);
 
 /*
- *  ======== strm_init ========
- *  Purpose:
- *      Initialize the STRM module.
- *  Parameters:
- *  Returns:
- *      TRUE if initialization succeeded, FALSE otherwise.
- *  Requires:
- *  Ensures:
- */
-extern bool strm_init(void);
-
-/*
  *  ======== strm_issue ========
  *  Purpose:
  *      Send a buffer of data to a stream.
@@ -217,8 +186,7 @@ extern bool strm_init(void);
  *      -ENOSR:    The stream is full.
  *      -EPERM:          Failure occurred, unable to issue buffer.
  *  Requires:
- *      strm_init(void) called.
- *      pbuf != NULL.
+*      pbuf != NULL.
  *  Ensures:
  */
 extern int strm_issue(struct strm_object *stream_obj, u8 * pbuf,
@@ -244,7 +212,6 @@ extern int strm_issue(struct strm_object *stream_obj, u8 * pbuf,
  *              Unable to open stream.
  *      -EINVAL:     Invalid index.
  *  Requires:
- *      strm_init(void) called.
  *      strmres != NULL.
  *      pattr != NULL.
  *  Ensures:
@@ -275,7 +242,6 @@ extern int strm_open(struct node_object *hnode, u32 dir,
  *                      retrieved.
  *      -EPERM:      Failure occurred, unable to reclaim buffer.
  *  Requires:
- *      strm_init(void) called.
  *      buf_ptr != NULL.
  *      nbytes != NULL.
  *      pdw_arg != NULL.
@@ -302,7 +268,6 @@ extern int strm_reclaim(struct strm_object *stream_obj,
  *      -ENOSYS:   Notification type specified by notify_type is not
  *                      supported.
  *  Requires:
- *      strm_init(void) called.
  *      hnotification != NULL.
  *  Ensures:
  */
@@ -328,7 +293,6 @@ extern int strm_register_notify(struct strm_object *stream_obj,
  *      -ETIME:   A timeout occurred before a stream became ready.
  *      -EPERM:      Failure occurred, unable to select a stream.
  *  Requires:
- *      strm_init(void) called.
  *      strm_tab != NULL.
  *      strms > 0.
  *      pmask != NULL.
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index b1a99f7..06e3b24 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -271,7 +271,6 @@ void api_exit(void)
 		chnl_exit();
 		msg_exit();
 		io_exit();
-		strm_exit();
 		mgr_exit();
 		rmm_exit();
 	}
@@ -286,12 +285,11 @@ bool api_init(void)
 {
 	bool ret = true;
 	bool fdev, fchnl, fmsg, fio;
-	bool fmgr, fstrm, frmm;
+	bool fmgr, frmm;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fstrm = strm_init();
 		frmm = rmm_init();
 		fchnl = chnl_init();
 		fmsg = msg_mod_init();
@@ -304,9 +302,6 @@ bool api_init(void)
 			if (fmgr)
 				mgr_exit();
 
-			if (fstrm)
-				strm_exit();
-
 			if (fchnl)
 				chnl_exit();
 
diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c
index bd684f1..34cc934 100644
--- a/drivers/staging/tidspbridge/rmgr/strm.c
+++ b/drivers/staging/tidspbridge/rmgr/strm.c
@@ -81,9 +81,6 @@ struct strm_object {
 	struct cmm_xlatorobject *xlator;
 };
 
-/*  ----------------------------------- Globals */
-static u32 refs;		/* module reference count */
-
 /*  ----------------------------------- Function Prototypes */
 static int delete_strm(struct strm_object *stream_obj);
 
@@ -222,16 +219,6 @@ void strm_delete(struct strm_mgr *strm_mgr_obj)
 }
 
 /*
- *  ======== strm_exit ========
- *  Purpose:
- *      Discontinue usage of STRM module.
- */
-void strm_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== strm_free_buffer ========
  *  Purpose:
  *      Frees the buffers allocated for a stream.
@@ -350,21 +337,6 @@ int strm_idle(struct strm_object *stream_obj, bool flush_data)
 }
 
 /*
- *  ======== strm_init ========
- *  Purpose:
- *      Initialize the STRM module.
- */
-bool strm_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== strm_issue ========
  *  Purpose:
  *      Issues a buffer on a stream
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/17] staging: tidspbridge: remove rmm_init() and rmm_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (5 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 06/17] staging: tidspbridge: remove strm_init() and strm_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 08/17] staging: tidspbridge: remove chnl_init() and chnl_exit() Víctor Manuel Jáquez Leal
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The rmm module has a rmm_init() and a rmm_exit() whose only purpose is
to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/rmm.h    |   25 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   10 +------
 drivers/staging/tidspbridge/rmgr/nldr.c            |    6 ----
 drivers/staging/tidspbridge/rmgr/rmm.c             |   20 ----------------
 4 files changed, 2 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/rmm.h b/drivers/staging/tidspbridge/include/dspbridge/rmm.h
index baea536..f7a4dc8 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/rmm.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/rmm.h
@@ -115,18 +115,6 @@ extern int rmm_create(struct rmm_target_obj **target_obj,
 extern void rmm_delete(struct rmm_target_obj *target);
 
 /*
- *  ======== rmm_exit ========
- *  Exit the RMM module
- *
- *  Parameters:
- *  Returns:
- *  Requires:
- *      rmm_init successfully called.
- *  Ensures:
- */
-extern void rmm_exit(void);
-
-/*
  *  ======== rmm_free ========
  *  Free or unreserve memory allocated through rmm_alloc().
  *
@@ -148,19 +136,6 @@ extern bool rmm_free(struct rmm_target_obj *target, u32 segid, u32 dsp_addr,
 		     u32 size, bool reserved);
 
 /*
- *  ======== rmm_init ========
- *  Initialize the RMM module
- *
- *  Parameters:
- *  Returns:
- *      TRUE:   Success.
- *      FALSE:  Failure.
- *  Requires:
- *  Ensures:
- */
-extern bool rmm_init(void);
-
-/*
  *  ======== rmm_stat ========
  *  Obtain  memory segment status
  *
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 06e3b24..0a55465 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -272,7 +272,6 @@ void api_exit(void)
 		msg_exit();
 		io_exit();
 		mgr_exit();
-		rmm_exit();
 	}
 }
 
@@ -285,18 +284,17 @@ bool api_init(void)
 {
 	bool ret = true;
 	bool fdev, fchnl, fmsg, fio;
-	bool fmgr, frmm;
+	bool fmgr;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		frmm = rmm_init();
 		fchnl = chnl_init();
 		fmsg = msg_mod_init();
 		fio = io_init();
 		fdev = dev_init();
 		ret = fdev && fchnl && fmsg && fio;
-		ret = ret && fmgr && frmm;
+		ret = ret && fmgr;
 		if (!ret) {
 
 			if (fmgr)
@@ -313,10 +311,6 @@ bool api_init(void)
 
 			if (fdev)
 				dev_exit();
-
-			if (frmm)
-				rmm_exit();
-
 		}
 	}
 	if (ret)
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index 5cff46f..a9d7a32 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -628,9 +628,6 @@ void nldr_delete(struct nldr_object *nldr_obj)
 void nldr_exit(void)
 {
 	refs--;
-
-	if (refs == 0)
-		rmm_exit();
 }
 
 /*
@@ -746,9 +743,6 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
  */
 bool nldr_init(void)
 {
-	if (refs == 0)
-		rmm_init();
-
 	refs++;
 
 	return true;
diff --git a/drivers/staging/tidspbridge/rmgr/rmm.c b/drivers/staging/tidspbridge/rmgr/rmm.c
index 55acfcd..52187bd 100644
--- a/drivers/staging/tidspbridge/rmgr/rmm.c
+++ b/drivers/staging/tidspbridge/rmgr/rmm.c
@@ -80,8 +80,6 @@ struct rmm_target_obj {
 	struct list_head ovly_list;	/* List of overlay memory in use */
 };
 
-static u32 refs;		/* module reference count */
-
 static bool alloc_block(struct rmm_target_obj *target, u32 segid, u32 size,
 			u32 align, u32 *dsp_address);
 static bool free_block(struct rmm_target_obj *target, u32 segid, u32 addr,
@@ -260,14 +258,6 @@ void rmm_delete(struct rmm_target_obj *target)
 }
 
 /*
- *  ======== rmm_exit ========
- */
-void rmm_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== rmm_free ========
  */
 bool rmm_free(struct rmm_target_obj *target, u32 segid, u32 dsp_addr, u32 size,
@@ -300,16 +290,6 @@ bool rmm_free(struct rmm_target_obj *target, u32 segid, u32 dsp_addr, u32 size,
 }
 
 /*
- *  ======== rmm_init ========
- */
-bool rmm_init(void)
-{
-	refs++;
-
-	return true;
-}
-
-/*
  *  ======== rmm_stat ========
  */
 bool rmm_stat(struct rmm_target_obj *target, enum dsp_memtype segid,
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/17] staging: tidspbridge: remove chnl_init() and chnl_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (6 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 07/17] staging: tidspbridge: remove rmm_init() and rmm_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 09/17] staging: tidspbridge: remove msg_mod_init() and msg_exit() Víctor Manuel Jáquez Leal
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The chnl module has a chnl_init() and a chnl_exit() whose only purpose
is to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/chnl.h   |   29 --------------------
 drivers/staging/tidspbridge/pmgr/chnl.c            |   28 -------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    9 +-----
 3 files changed, 2 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/chnl.h b/drivers/staging/tidspbridge/include/dspbridge/chnl.h
index 92f6a13..9b018b1 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/chnl.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/chnl.h
@@ -48,7 +48,6 @@
  *      -ECHRNG:     This manager cannot handle this many channels.
  *      -EEXIST:       Channel manager already exists for this device.
  *  Requires:
- *      chnl_init(void) called.
  *      channel_mgr != NULL.
  *      mgr_attrts != NULL.
  *  Ensures:
@@ -70,7 +69,6 @@ extern int chnl_create(struct chnl_mgr **channel_mgr,
  *      0:            Success.
  *      -EFAULT:        hchnl_mgr was invalid.
  *  Requires:
- *      chnl_init(void) called.
  *  Ensures:
  *      0:            Cancels I/O on each open channel.
  *                          Closes each open channel.
@@ -79,31 +77,4 @@ extern int chnl_create(struct chnl_mgr **channel_mgr,
  */
 extern int chnl_destroy(struct chnl_mgr *hchnl_mgr);
 
-/*
- *  ======== chnl_exit ========
- *  Purpose:
- *      Discontinue usage of the CHNL module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      chnl_init(void) previously called.
- *  Ensures:
- *      Resources, if any acquired in chnl_init(void), are freed when the last
- *      client of CHNL calls chnl_exit(void).
- */
-extern void chnl_exit(void);
-
-/*
- *  ======== chnl_init ========
- *  Purpose:
- *      Initialize the CHNL module's private state.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occurred.
- *  Requires:
- *  Ensures:
- *      A requirement for each of the other public CHNL functions.
- */
-extern bool chnl_init(void);
-
 #endif /* CHNL_ */
diff --git a/drivers/staging/tidspbridge/pmgr/chnl.c b/drivers/staging/tidspbridge/pmgr/chnl.c
index 825be20..4bd8686 100644
--- a/drivers/staging/tidspbridge/pmgr/chnl.c
+++ b/drivers/staging/tidspbridge/pmgr/chnl.c
@@ -38,9 +38,6 @@
 /*  ----------------------------------- This */
 #include <dspbridge/chnl.h>
 
-/*  ----------------------------------- Globals */
-static u32 refs;
-
 /*
  *  ======== chnl_create ========
  *  Purpose:
@@ -116,28 +113,3 @@ int chnl_destroy(struct chnl_mgr *hchnl_mgr)
 
 	return status;
 }
-
-/*
- *  ======== chnl_exit ========
- *  Purpose:
- *      Discontinue usage of the CHNL module.
- */
-void chnl_exit(void)
-{
-	refs--;
-}
-
-/*
- *  ======== chnl_init ========
- *  Purpose:
- *      Initialize the CHNL module's private state.
- */
-bool chnl_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 0a55465..5b9dcad 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -268,7 +268,6 @@ void api_exit(void)
 	if (api_c_refs == 0) {
 		/* Release all modules initialized in api_init(). */
 		dev_exit();
-		chnl_exit();
 		msg_exit();
 		io_exit();
 		mgr_exit();
@@ -283,26 +282,22 @@ void api_exit(void)
 bool api_init(void)
 {
 	bool ret = true;
-	bool fdev, fchnl, fmsg, fio;
+	bool fdev, fmsg, fio;
 	bool fmgr;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fchnl = chnl_init();
 		fmsg = msg_mod_init();
 		fio = io_init();
 		fdev = dev_init();
-		ret = fdev && fchnl && fmsg && fio;
+		ret = fdev && fmsg && fio;
 		ret = ret && fmgr;
 		if (!ret) {
 
 			if (fmgr)
 				mgr_exit();
 
-			if (fchnl)
-				chnl_exit();
-
 			if (fmsg)
 				msg_exit();
 
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/17] staging: tidspbridge: remove msg_mod_init() and msg_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (7 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 08/17] staging: tidspbridge: remove chnl_init() and chnl_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 10/17] staging: tidspbridge: remove io_init() and io_exit() Víctor Manuel Jáquez Leal
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The msg module has a msg_mod_init() and a msg_exit() whose only
purpose is to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/msg.h    |   27 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |    9 +-----
 drivers/staging/tidspbridge/pmgr/msg.c             |   21 ---------------
 3 files changed, 2 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/msg.h b/drivers/staging/tidspbridge/include/dspbridge/msg.h
index 95778bc..2c8712c 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/msg.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/msg.h
@@ -34,7 +34,6 @@
  *      msg_callback:        Called whenever an RMS_EXIT message is received.
  *  Returns:
  *  Requires:
- *      msg_mod_init(void) called.
  *      msg_man != NULL.
  *      hdev_obj != NULL.
  *      msg_callback != NULL.
@@ -52,35 +51,9 @@ extern int msg_create(struct msg_mgr **msg_man,
  *      hmsg_mgr:            Handle returned from msg_create().
  *  Returns:
  *  Requires:
- *      msg_mod_init(void) called.
  *      Valid hmsg_mgr.
  *  Ensures:
  */
 extern void msg_delete(struct msg_mgr *hmsg_mgr);
 
-/*
- *  ======== msg_exit ========
- *  Purpose:
- *      Discontinue usage of msg_ctrl module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      msg_mod_init(void) successfully called before.
- *  Ensures:
- *      Any resources acquired in msg_mod_init(void) will be freed when last
- *      msg_ctrl client calls msg_exit(void).
- */
-extern void msg_exit(void);
-
-/*
- *  ======== msg_mod_init ========
- *  Purpose:
- *      Initialize the msg_ctrl module.
- *  Parameters:
- *  Returns:
- *      TRUE if initialization succeeded, FALSE otherwise.
- *  Ensures:
- */
-extern bool msg_mod_init(void);
-
 #endif /* MSG_ */
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 5b9dcad..5201bed 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -268,7 +268,6 @@ void api_exit(void)
 	if (api_c_refs == 0) {
 		/* Release all modules initialized in api_init(). */
 		dev_exit();
-		msg_exit();
 		io_exit();
 		mgr_exit();
 	}
@@ -282,25 +281,21 @@ void api_exit(void)
 bool api_init(void)
 {
 	bool ret = true;
-	bool fdev, fmsg, fio;
+	bool fdev, fio;
 	bool fmgr;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fmsg = msg_mod_init();
 		fio = io_init();
 		fdev = dev_init();
-		ret = fdev && fmsg && fio;
+		ret = fdev && fio;
 		ret = ret && fmgr;
 		if (!ret) {
 
 			if (fmgr)
 				mgr_exit();
 
-			if (fmsg)
-				msg_exit();
-
 			if (fio)
 				io_exit();
 
diff --git a/drivers/staging/tidspbridge/pmgr/msg.c b/drivers/staging/tidspbridge/pmgr/msg.c
index 077c118..f093cfb 100644
--- a/drivers/staging/tidspbridge/pmgr/msg.c
+++ b/drivers/staging/tidspbridge/pmgr/msg.c
@@ -33,9 +33,6 @@
 #include <msgobj.h>
 #include <dspbridge/msg.h>
 
-/*  ----------------------------------- Globals */
-static u32 refs;		/* module reference count */
-
 /*
  *  ======== msg_create ========
  *  Purpose:
@@ -92,21 +89,3 @@ void msg_delete(struct msg_mgr *hmsg_mgr)
 			__func__, hmsg_mgr);
 	}
 }
-
-/*
- *  ======== msg_exit ========
- */
-void msg_exit(void)
-{
-	refs--;
-}
-
-/*
- *  ======== msg_mod_init ========
- */
-bool msg_mod_init(void)
-{
-	refs++;
-
-	return true;
-}
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/17] staging: tidspbridge: remove io_init() and io_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (8 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 09/17] staging: tidspbridge: remove msg_mod_init() and msg_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 11/17] staging: tidspbridge: remove cmm_init() and cmm_exit() Víctor Manuel Jáquez Leal
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The io module has a io_init() and a io_exit() whose only purpose is to
keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/include/dspbridge/io.h |   29 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   10 +-----
 drivers/staging/tidspbridge/pmgr/io.c              |   28 -------------------
 3 files changed, 2 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/io.h b/drivers/staging/tidspbridge/include/dspbridge/io.h
index 500bbd7..7505718 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/io.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/io.h
@@ -55,7 +55,6 @@ struct io_attrs {
  *      -EINVAL: Invalid DSP word size (must be > 0).
  *               Invalid base address for DSP communications.
  *  Requires:
- *      io_init(void) called.
  *      io_man != NULL.
  *      mgr_attrts != NULL.
  *  Ensures:
@@ -74,36 +73,8 @@ extern int io_create(struct io_mgr **io_man,
  *      0:        Success.
  *      -EFAULT:    hio_mgr was invalid.
  *  Requires:
- *      io_init(void) called.
  *  Ensures:
  */
 extern int io_destroy(struct io_mgr *hio_mgr);
 
-/*
- *  ======== io_exit ========
- *  Purpose:
- *      Discontinue usage of the IO module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      io_init(void) previously called.
- *  Ensures:
- *      Resources, if any acquired in io_init(void), are freed when the last
- *      client of IO calls io_exit(void).
- */
-extern void io_exit(void);
-
-/*
- *  ======== io_init ========
- *  Purpose:
- *      Initialize the IO module's private state.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occurred.
- *  Requires:
- *  Ensures:
- *      A requirement for each of the other public CHNL functions.
- */
-extern bool io_init(void);
-
 #endif /* CHNL_ */
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 5201bed..b9ca24c 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -268,7 +268,6 @@ void api_exit(void)
 	if (api_c_refs == 0) {
 		/* Release all modules initialized in api_init(). */
 		dev_exit();
-		io_exit();
 		mgr_exit();
 	}
 }
@@ -281,24 +280,19 @@ void api_exit(void)
 bool api_init(void)
 {
 	bool ret = true;
-	bool fdev, fio;
+	bool fdev;
 	bool fmgr;
 
 	if (api_c_refs == 0) {
 		/* initialize driver and other modules */
 		fmgr = mgr_init();
-		fio = io_init();
 		fdev = dev_init();
-		ret = fdev && fio;
-		ret = ret && fmgr;
+		ret = fdev && fmgr;
 		if (!ret) {
 
 			if (fmgr)
 				mgr_exit();
 
-			if (fio)
-				io_exit();
-
 			if (fdev)
 				dev_exit();
 		}
diff --git a/drivers/staging/tidspbridge/pmgr/io.c b/drivers/staging/tidspbridge/pmgr/io.c
index a56b085..4073c9c 100644
--- a/drivers/staging/tidspbridge/pmgr/io.c
+++ b/drivers/staging/tidspbridge/pmgr/io.c
@@ -30,9 +30,6 @@
 #include <ioobj.h>
 #include <dspbridge/io.h>
 
-/*  ----------------------------------- Globals */
-static u32 refs;
-
 /*
  *  ======== io_create ========
  *  Purpose:
@@ -94,28 +91,3 @@ int io_destroy(struct io_mgr *hio_mgr)
 
 	return status;
 }
-
-/*
- *  ======== io_exit ========
- *  Purpose:
- *      Discontinue usage of the IO module.
- */
-void io_exit(void)
-{
-	refs--;
-}
-
-/*
- *  ======== io_init ========
- *  Purpose:
- *      Initialize the IO module's private state.
- */
-bool io_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 11/17] staging: tidspbridge: remove cmm_init() and cmm_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (9 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 10/17] staging: tidspbridge: remove io_init() and io_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 12/17] staging: tidspbridge: remove dmm_init() and dmm_exit() Víctor Manuel Jáquez Leal
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The cmm module has a cmm_init() and a cmm_exit() whose only purpose is
to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/cmm.h    |   30 --------------------
 drivers/staging/tidspbridge/pmgr/cmm.c             |   29 -------------------
 drivers/staging/tidspbridge/pmgr/dev.c             |   23 ++------------
 3 files changed, 4 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/cmm.h b/drivers/staging/tidspbridge/include/dspbridge/cmm.h
index aff2205..c66bcf7 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/cmm.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/cmm.h
@@ -79,7 +79,6 @@ extern void *cmm_calloc_buf(struct cmm_object *hcmm_mgr,
  *      -EPERM:      Failed to initialize critical sect sync object.
  *
  *  Requires:
- *      cmm_init(void) called.
  *      ph_cmm_mgr != NULL.
  *      mgr_attrts->min_block_size >= 4 bytes.
  *  Ensures:
@@ -111,20 +110,6 @@ extern int cmm_create(struct cmm_object **ph_cmm_mgr,
 extern int cmm_destroy(struct cmm_object *hcmm_mgr, bool force);
 
 /*
- *  ======== cmm_exit ========
- *  Purpose:
- *     Discontinue usage of module. Cleanup CMM module if CMM cRef reaches zero.
- *  Parameters:
- *     n/a
- *  Returns:
- *     n/a
- *  Requires:
- *     CMM is initialized.
- *  Ensures:
- */
-extern void cmm_exit(void);
-
-/*
  *  ======== cmm_free_buf ========
  *  Purpose:
  *      Free the given buffer.
@@ -185,19 +170,6 @@ extern int cmm_get_info(struct cmm_object *hcmm_mgr,
 			       struct cmm_info *cmm_info_obj);
 
 /*
- *  ======== cmm_init ========
- *  Purpose:
- *      Initializes private state of CMM module.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occurred.
- *  Requires:
- *  Ensures:
- *      CMM initialized.
- */
-extern bool cmm_init(void);
-
-/*
  *  ======== cmm_register_gppsm_seg ========
  *  Purpose:
  *      Register a block of SM with the CMM.
@@ -333,7 +305,6 @@ extern int cmm_xlator_free_buf(struct cmm_xlatorobject *xlator,
  *      0:        Success.
  *      -EFAULT:    Bad translator handle.
  *  Requires:
- *      (refs > 0)
  *      (paddr != NULL)
  *      (ul_size > 0)
  *  Ensures:
@@ -355,7 +326,6 @@ extern int cmm_xlator_info(struct cmm_xlatorobject *xlator,
  *  Returns:
  *     Valid address on success, else NULL.
  *  Requires:
- *      refs > 0
  *      paddr != NULL
  *      xtype >= CMM_VA2PA) && (xtype <= CMM_DSPPA2PA)
  *  Ensures:
diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c
index 3366e60..4a800da 100644
--- a/drivers/staging/tidspbridge/pmgr/cmm.c
+++ b/drivers/staging/tidspbridge/pmgr/cmm.c
@@ -131,9 +131,6 @@ struct cmm_mnode {
 	u32 client_proc;	/* Process that allocated this mem block */
 };
 
-/*  ----------------------------------- Globals */
-static u32 refs;		/* module reference count */
-
 /*  ----------------------------------- Function Prototypes */
 static void add_to_free_list(struct cmm_allocator *allocator,
 			     struct cmm_mnode *pnode);
@@ -317,17 +314,6 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force)
 }
 
 /*
- *  ======== cmm_exit ========
- *  Purpose:
- *      Discontinue usage of module; free resources when reference count
- *      reaches 0.
- */
-void cmm_exit(void)
-{
-	refs--;
-}
-
-/*
  *  ======== cmm_free_buf ========
  *  Purpose:
  *      Free the given buffer.
@@ -446,21 +432,6 @@ int cmm_get_info(struct cmm_object *hcmm_mgr,
 }
 
 /*
- *  ======== cmm_init ========
- *  Purpose:
- *      Initializes private state of CMM module.
- */
-bool cmm_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== cmm_register_gppsm_seg ========
  *  Purpose:
  *      Register a block of SM with the CMM to be used for later GPP SM
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index 883765e..734d47e 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -658,10 +658,8 @@ void dev_exit(void)
 {
 	refs--;
 
-	if (refs == 0) {
-		cmm_exit();
+	if (refs == 0)
 		dmm_exit();
-	}
 }
 
 /*
@@ -671,23 +669,10 @@ void dev_exit(void)
  */
 bool dev_init(void)
 {
-	bool cmm_ret, dmm_ret, ret = true;
-
-	if (refs == 0) {
-		cmm_ret = cmm_init();
-		dmm_ret = dmm_init();
-
-		ret = cmm_ret && dmm_ret;
-
-		if (!ret) {
-			if (cmm_ret)
-				cmm_exit();
+	bool ret = true;
 
-			if (dmm_ret)
-				dmm_exit();
-
-		}
-	}
+	if (refs == 0)
+		dmm_init();
 
 	if (ret)
 		refs++;
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 12/17] staging: tidspbridge: remove dmm_init() and dmm_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (10 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 11/17] staging: tidspbridge: remove cmm_init() and cmm_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 13/17] staging: tidspbridge: remove dev_init() and dev_exit() Víctor Manuel Jáquez Leal
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The dmm module has a dmm_init() and a dmm_exit() whose only purpose is
to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/dmm.h    |    4 --
 drivers/staging/tidspbridge/pmgr/dev.c             |    6 ----
 drivers/staging/tidspbridge/pmgr/dmm.c             |   32 --------------------
 3 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/dmm.h b/drivers/staging/tidspbridge/include/dspbridge/dmm.h
index 6c58335..c3487be 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dmm.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dmm.h
@@ -61,10 +61,6 @@ extern int dmm_create(struct dmm_object **dmm_manager,
 			     struct dev_object *hdev_obj,
 			     const struct dmm_mgrattrs *mgr_attrts);
 
-extern bool dmm_init(void);
-
-extern void dmm_exit(void);
-
 extern int dmm_create_tables(struct dmm_object *dmm_mgr,
 				    u32 addr, u32 size);
 
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index 734d47e..c5e627c 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -657,9 +657,6 @@ int dev_get_bridge_context(struct dev_object *hdev_obj,
 void dev_exit(void)
 {
 	refs--;
-
-	if (refs == 0)
-		dmm_exit();
 }
 
 /*
@@ -671,9 +668,6 @@ bool dev_init(void)
 {
 	bool ret = true;
 
-	if (refs == 0)
-		dmm_init();
-
 	if (ret)
 		refs++;
 
diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c
index 83faff8..7c9f839 100644
--- a/drivers/staging/tidspbridge/pmgr/dmm.c
+++ b/drivers/staging/tidspbridge/pmgr/dmm.c
@@ -51,8 +51,6 @@ struct dmm_object {
 	spinlock_t dmm_lock;	/* Lock to access dmm mgr */
 };
 
-/*  ----------------------------------- Globals */
-static u32 refs;		/* module reference count */
 struct map_page {
 	u32 region_size:15;
 	u32 mapped_size:15;
@@ -172,18 +170,6 @@ int dmm_delete_tables(struct dmm_object *dmm_mgr)
 }
 
 /*
- *  ======== dmm_exit ========
- *  Purpose:
- *      Discontinue usage of module; free resources when reference count
- *      reaches 0.
- */
-void dmm_exit(void)
-{
-
-	refs--;
-}
-
-/*
  *  ======== dmm_get_handle ========
  *  Purpose:
  *      Return the dynamic memory manager object for this device.
@@ -206,24 +192,6 @@ int dmm_get_handle(void *hprocessor, struct dmm_object **dmm_manager)
 }
 
 /*
- *  ======== dmm_init ========
- *  Purpose:
- *      Initializes private state of DMM module.
- */
-bool dmm_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	virtual_mapping_table = NULL;
-	table_size = 0;
-
-	return ret;
-}
-
-/*
  *  ======== dmm_map_memory ========
  *  Purpose:
  *      Add a mapping block to the reserved chunk. DMM assumes that this block
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 13/17] staging: tidspbridge: remove dev_init() and dev_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (11 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 12/17] staging: tidspbridge: remove dmm_init() and dmm_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 14/17] staging: tidspbridge: simplify mgr_init() Víctor Manuel Jáquez Leal
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The dev module has a dev_init() and a dev_exit() whose only purpose is
to keep a reference counting which is not used at all.

This patch removes these functions and the reference count variable.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/dev.h    |   27 ------------------
 drivers/staging/tidspbridge/pmgr/dev.c             |   29 --------------------
 drivers/staging/tidspbridge/pmgr/dspapi.c          |   22 ++-------------
 3 files changed, 3 insertions(+), 75 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/dev.h b/drivers/staging/tidspbridge/include/dspbridge/dev.h
index f92b4be..fa2d79e 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dev.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dev.h
@@ -478,33 +478,6 @@ extern int dev_get_bridge_context(struct dev_object *hdev_obj,
 				      **phbridge_context);
 
 /*
- *  ======== dev_exit ========
- *  Purpose:
- *      Decrement reference count, and free resources when reference count is
- *      0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      DEV is initialized.
- *  Ensures:
- *      When reference count == 0, DEV's private resources are freed.
- */
-extern void dev_exit(void);
-
-/*
- *  ======== dev_init ========
- *  Purpose:
- *      Initialize DEV's private state, keeping a reference count on each call.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occurred.
- *  Requires:
- *  Ensures:
- *      TRUE: A requirement for the other public DEV functions.
- */
-extern bool dev_init(void);
-
-/*
  *  ======== dev_insert_proc_object ========
  *  Purpose:
  *      Inserts the Processor Object into the List of PROC Objects
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index c5e627c..6234ffb 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -81,9 +81,6 @@ struct drv_ext {
 	char sz_string[MAXREGPATHLENGTH];
 };
 
-/*  ----------------------------------- Globals */
-static u32 refs;		/* Module reference count */
-
 /*  ----------------------------------- Function Prototypes */
 static int fxn_not_implemented(int arg, ...);
 static int init_cod_mgr(struct dev_object *dev_obj);
@@ -649,32 +646,6 @@ int dev_get_bridge_context(struct dev_object *hdev_obj,
 }
 
 /*
- *  ======== dev_exit ========
- *  Purpose:
- *      Decrement reference count, and free resources when reference count is
- *      0.
- */
-void dev_exit(void)
-{
-	refs--;
-}
-
-/*
- *  ======== dev_init ========
- *  Purpose:
- *      Initialize DEV's private state, keeping a reference count on each call.
- */
-bool dev_init(void)
-{
-	bool ret = true;
-
-	if (ret)
-		refs++;
-
-	return ret;
-}
-
-/*
  *  ======== dev_notify_clients ========
  *  Purpose:
  *      Notify all clients of this device of a change in device status.
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index b9ca24c..9ef1ad9 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -265,11 +265,8 @@ void api_exit(void)
 {
 	api_c_refs--;
 
-	if (api_c_refs == 0) {
-		/* Release all modules initialized in api_init(). */
-		dev_exit();
+	if (api_c_refs == 0)
 		mgr_exit();
-	}
 }
 
 /*
@@ -280,23 +277,10 @@ void api_exit(void)
 bool api_init(void)
 {
 	bool ret = true;
-	bool fdev;
-	bool fmgr;
-
-	if (api_c_refs == 0) {
-		/* initialize driver and other modules */
-		fmgr = mgr_init();
-		fdev = dev_init();
-		ret = fdev && fmgr;
-		if (!ret) {
 
-			if (fmgr)
-				mgr_exit();
+	if (api_c_refs == 0)
+		ret = mgr_init();
 
-			if (fdev)
-				dev_exit();
-		}
-	}
 	if (ret)
 		api_c_refs++;
 
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 14/17] staging: tidspbridge: simplify mgr_init()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (12 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 13/17] staging: tidspbridge: remove dev_init() and dev_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 15/17] staging: tidspbridge: remove gh_init() and gh_exit() Víctor Manuel Jáquez Leal
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

No functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/mgr.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index 938eea5..8a1e928 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -319,14 +319,9 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
 bool mgr_init(void)
 {
 	bool ret = true;
-	bool init_dcd = false;
 
-	if (refs == 0) {
-		init_dcd = dcd_init();	/*  DCD Module */
-
-		if (!init_dcd)
-			ret = false;
-	}
+	if (refs == 0)
+		ret = dcd_init();	/*  DCD Module */
 
 	if (ret)
 		refs++;
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 15/17] staging: tidspbridge: remove gh_init() and gh_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (13 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 14/17] staging: tidspbridge: simplify mgr_init() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 16/17] staging: tidspbridge: remove ref counting in nldr.c Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 17/17] staging: tidspbridge: remove nldr_init() and nldr_exit() Víctor Manuel Jáquez Leal
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The gh module has a gh_init() and a gh_exit(), but they don't do
anything, they are just noops.

This patch removes these functions.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/gen/gh.c               |   18 ------------------
 drivers/staging/tidspbridge/include/dspbridge/gh.h |    2 --
 drivers/staging/tidspbridge/pmgr/dbll.c            |   12 ++----------
 3 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/tidspbridge/gen/gh.c b/drivers/staging/tidspbridge/gen/gh.c
index 60aa7b0..25eaef7 100644
--- a/drivers/staging/tidspbridge/gen/gh.c
+++ b/drivers/staging/tidspbridge/gen/gh.c
@@ -95,15 +95,6 @@ void gh_delete(struct gh_t_hash_tab *hash_tab)
 }
 
 /*
- *  ======== gh_exit ========
- */
-
-void gh_exit(void)
-{
-	/* Do nothing */
-}
-
-/*
  *  ======== gh_find ========
  */
 
@@ -122,15 +113,6 @@ void *gh_find(struct gh_t_hash_tab *hash_tab, void *key)
 }
 
 /*
- *  ======== gh_init ========
- */
-
-void gh_init(void)
-{
-	/* Do nothing */
-}
-
-/*
  *  ======== gh_insert ========
  */
 
diff --git a/drivers/staging/tidspbridge/include/dspbridge/gh.h b/drivers/staging/tidspbridge/include/dspbridge/gh.h
index 9de291d..da85079 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/gh.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/gh.h
@@ -23,9 +23,7 @@ extern struct gh_t_hash_tab *gh_create(u16 max_bucket, u16 val_size,
 				       bool(*match) (void *, void *),
 				       void (*delete) (void *));
 extern void gh_delete(struct gh_t_hash_tab *hash_tab);
-extern void gh_exit(void);
 extern void *gh_find(struct gh_t_hash_tab *hash_tab, void *key);
-extern void gh_init(void);
 extern void *gh_insert(struct gh_t_hash_tab *hash_tab, void *key, void *value);
 #ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
 void gh_iterate(struct gh_t_hash_tab *hash_tab,
diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
index 071ee86..9f07036 100644
--- a/drivers/staging/tidspbridge/pmgr/dbll.c
+++ b/drivers/staging/tidspbridge/pmgr/dbll.c
@@ -187,8 +187,6 @@ static u16 name_hash(void *key, u16 max_bucket);
 static bool name_match(void *key, void *sp);
 static void sym_delete(void *value);
 
-static u32 refs;		/* module reference count */
-
 /* Symbol Redefinition */
 static int redefined_symbol;
 static int gbl_search = 1;
@@ -268,10 +266,7 @@ void dbll_delete(struct dbll_tar_obj *target)
  */
 void dbll_exit(void)
 {
-	refs--;
-
-	if (refs == 0)
-		gh_exit();
+	/* do nothing */
 }
 
 /*
@@ -394,10 +389,7 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
  */
 bool dbll_init(void)
 {
-	if (refs == 0)
-		gh_init();
-
-	refs++;
+	/* do nothing */
 
 	return true;
 }
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 16/17] staging: tidspbridge: remove ref counting in nldr.c
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (14 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 15/17] staging: tidspbridge: remove gh_init() and gh_exit() Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  2012-03-09  0:03 ` [PATCH 17/17] staging: tidspbridge: remove nldr_init() and nldr_exit() Víctor Manuel Jáquez Leal
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The nldr module has a nldr_init() and a nldr_exit() whose only purpose
is to keep a reference counting which is not used at all.

This patch only removes the reference count variable, but not the
functions, because they are used through an interface.

There is no functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 drivers/staging/tidspbridge/rmgr/nldr.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index a9d7a32..46086b5 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -263,8 +263,6 @@ static struct dbll_fxns ldr_fxns = {
 	(dbll_unload_fxn) dbll_unload,
 };
 
-static u32 refs;		/* module reference count */
-
 static int add_ovly_info(void *handle, struct dbll_sect_info *sect_info,
 				u32 addr, u32 bytes);
 static int add_ovly_node(struct dsp_uuid *uuid_obj,
@@ -627,7 +625,7 @@ void nldr_delete(struct nldr_object *nldr_obj)
  */
 void nldr_exit(void)
 {
-	refs--;
+	/* do nothing */
 }
 
 /*
@@ -743,8 +741,7 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
  */
 bool nldr_init(void)
 {
-	refs++;
-
+	/* do nothing */
 	return true;
 }
 
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 17/17] staging: tidspbridge: remove nldr_init() and nldr_exit()
  2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
                   ` (15 preceding siblings ...)
  2012-03-09  0:03 ` [PATCH 16/17] staging: tidspbridge: remove ref counting in nldr.c Víctor Manuel Jáquez Leal
@ 2012-03-09  0:03 ` Víctor Manuel Jáquez Leal
  16 siblings, 0 replies; 18+ messages in thread
From: Víctor Manuel Jáquez Leal @ 2012-03-09  0:03 UTC (permalink / raw)
  To: Omar Ramirez Luna, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Felipe Contreras, linux-omap

The dynamic loader was called by node.c with an interface. This interface was
also modified to avoid the use of nldr_init() and nldr_exit().

There is not functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
---
 .../staging/tidspbridge/include/dspbridge/nldr.h   |    2 -
 .../tidspbridge/include/dspbridge/nldrdefs.h       |   34 --------------------
 drivers/staging/tidspbridge/rmgr/nldr.c            |   19 -----------
 drivers/staging/tidspbridge/rmgr/node.c            |    7 ----
 4 files changed, 0 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/nldr.h b/drivers/staging/tidspbridge/include/dspbridge/nldr.h
index d9653ee..c5e48ca 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/nldr.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/nldr.h
@@ -36,7 +36,6 @@ extern int nldr_create(struct nldr_object **nldr,
 			      const struct nldr_attrs *pattrs);
 
 extern void nldr_delete(struct nldr_object *nldr_obj);
-extern void nldr_exit(void);
 
 extern int nldr_get_fxn_addr(struct nldr_nodeobject *nldr_node_obj,
 				    char *str_fxn, u32 * addr);
@@ -44,7 +43,6 @@ extern int nldr_get_fxn_addr(struct nldr_nodeobject *nldr_node_obj,
 extern int nldr_get_rmm_manager(struct nldr_object *nldr,
 				       struct rmm_target_obj **rmm_mgr);
 
-extern bool nldr_init(void);
 extern int nldr_load(struct nldr_nodeobject *nldr_node_obj,
 			    enum nldr_phase phase);
 extern int nldr_unload(struct nldr_nodeobject *nldr_node_obj,
diff --git a/drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h b/drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h
index ee3a85f..7e3c7f5 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h
@@ -119,7 +119,6 @@ enum nldr_phase {
  *      0:        Success.
  *      -ENOMEM:    Insufficient memory on GPP.
  *  Requires:
- *      nldr_init(void) called.
  *      Valid nldr_obj.
  *      node_props != NULL.
  *      nldr_nodeobj != NULL.
@@ -148,7 +147,6 @@ typedef int(*nldr_allocatefxn) (struct nldr_object *nldr_obj,
  *      0:        Success;
  *      -ENOMEM:    Insufficient memory for requested resources.
  *  Requires:
- *      nldr_init(void) called.
  *      nldr != NULL.
  *      hdev_obj != NULL.
  *	pattrs != NULL.
@@ -168,7 +166,6 @@ typedef int(*nldr_createfxn) (struct nldr_object **nldr,
  *      nldr_obj:          Node manager object.
  *  Returns:
  *  Requires:
- *      nldr_init(void) called.
  *      Valid nldr_obj.
  *  Ensures:
  *	nldr_obj invalid
@@ -176,20 +173,6 @@ typedef int(*nldr_createfxn) (struct nldr_object **nldr,
 typedef void (*nldr_deletefxn) (struct nldr_object *nldr_obj);
 
 /*
- *  ======== nldr_exit ========
- *  Discontinue usage of NLDR module.
- *
- *  Parameters:
- *  Returns:
- *  Requires:
- *      nldr_init(void) successfully called before.
- *  Ensures:
- *      Any resources acquired in nldr_init(void) will be freed when last NLDR
- *      client calls nldr_exit(void).
- */
-typedef void (*nldr_exitfxn) (void);
-
-/*
  *  ======== NLDR_Free ========
  *  Free resources allocated in nldr_allocate.
  *
@@ -197,7 +180,6 @@ typedef void (*nldr_exitfxn) (void);
  *      nldr_node_obj:      Handle returned from nldr_allocate().
  *  Returns:
  *  Requires:
- *      nldr_init(void) called.
  *      Valid nldr_node_obj.
  *  Ensures:
  */
@@ -216,7 +198,6 @@ typedef void (*nldr_freefxn) (struct nldr_nodeobject *nldr_node_obj);
  *      0:        Success.
  *      -ESPIPE:    Address of function not found.
  *  Requires:
- *      nldr_init(void) called.
  *      Valid nldr_node_obj.
  *      addr != NULL;
  *      str_fxn != NULL;
@@ -227,17 +208,6 @@ typedef int(*nldr_getfxnaddrfxn) (struct nldr_nodeobject
 					 char *str_fxn, u32 * addr);
 
 /*
- *  ======== nldr_init ========
- *  Initialize the NLDR module.
- *
- *  Parameters:
- *  Returns:
- *      TRUE if initialization succeeded, FALSE otherwise.
- *  Ensures:
- */
-typedef bool(*nldr_initfxn) (void);
-
-/*
  *  ======== nldr_load ========
  *  Load create, delete, or execute phase function of a node on the DSP.
  *
@@ -251,7 +221,6 @@ typedef bool(*nldr_initfxn) (void);
  *                              is already in use.
  *      -EILSEQ:           Failure in dynamic loader library.
  *  Requires:
- *      nldr_init(void) called.
  *      Valid nldr_node_obj.
  *  Ensures:
  */
@@ -269,7 +238,6 @@ typedef int(*nldr_loadfxn) (struct nldr_nodeobject *nldr_node_obj,
  *      0:        Success.
  *      -ENOMEM:    Insufficient memory on GPP.
  *  Requires:
- *      nldr_init(void) called.
  *      Valid nldr_node_obj.
  *  Ensures:
  */
@@ -283,9 +251,7 @@ struct node_ldr_fxns {
 	nldr_allocatefxn allocate;
 	nldr_createfxn create;
 	nldr_deletefxn delete;
-	nldr_exitfxn exit;
 	nldr_getfxnaddrfxn get_fxn_addr;
-	nldr_initfxn init;
 	nldr_loadfxn load;
 	nldr_unloadfxn unload;
 };
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index 46086b5..30d5480 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -620,15 +620,6 @@ void nldr_delete(struct nldr_object *nldr_obj)
 }
 
 /*
- *  ======== nldr_exit ========
- *  Discontinue usage of NLDR module.
- */
-void nldr_exit(void)
-{
-	/* do nothing */
-}
-
-/*
  *  ======== nldr_get_fxn_addr ========
  */
 int nldr_get_fxn_addr(struct nldr_nodeobject *nldr_node_obj,
@@ -736,16 +727,6 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
 }
 
 /*
- *  ======== nldr_init ========
- *  Initialize the NLDR module.
- */
-bool nldr_init(void)
-{
-	/* do nothing */
-	return true;
-}
-
-/*
  *  ======== nldr_load ========
  */
 int nldr_load(struct nldr_nodeobject *nldr_node_obj,
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index 908cd1e..7fb426c 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -159,7 +159,6 @@ struct node_mgr {
 	/* Loader properties */
 	struct nldr_object *nldr_obj;	/* Handle to loader */
 	struct node_ldr_fxns nldr_fxns;	/* Handle to loader functions */
-	bool loader_init;	/* Loader Init function succeeded? */
 };
 
 /*
@@ -266,9 +265,7 @@ static struct node_ldr_fxns nldr_fxns = {
 	nldr_allocate,
 	nldr_create,
 	nldr_delete,
-	nldr_exit,
 	nldr_get_fxn_addr,
-	nldr_init,
 	nldr_load,
 	nldr_unload,
 };
@@ -1337,7 +1334,6 @@ int node_create_mgr(struct node_mgr **node_man,
 	nldr_attrs_obj.write = mem_write;
 	nldr_attrs_obj.dsp_word_size = node_mgr_obj->dsp_word_size;
 	nldr_attrs_obj.dsp_mau_size = node_mgr_obj->dsp_mau_size;
-	node_mgr_obj->loader_init = node_mgr_obj->nldr_fxns.init();
 	status = node_mgr_obj->nldr_fxns.create(&node_mgr_obj->nldr_obj,
 			hdev_obj,
 			&nldr_attrs_obj);
@@ -2507,9 +2503,6 @@ static void delete_node_mgr(struct node_mgr *hnode_mgr)
 		if (hnode_mgr->nldr_obj)
 			hnode_mgr->nldr_fxns.delete(hnode_mgr->nldr_obj);
 
-		if (hnode_mgr->loader_init)
-			hnode_mgr->nldr_fxns.exit();
-
 		kfree(hnode_mgr);
 	}
 }
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-03-09  0:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09  0:03 [PATCH 00/17] staging: tidspbridge: remove unused references counting Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 01/17] staging: tidspbridge: remove drv_init() and drv_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 02/17] staging: tidspbridge: remove cod_init() and cod_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 03/17] staging: tidspbridge: remove proc_init() and proc_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 04/17] staging: tidspbridge: remove node_init() and node_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 05/17] staging: tidspbridge: remove disp_init() and disp_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 06/17] staging: tidspbridge: remove strm_init() and strm_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 07/17] staging: tidspbridge: remove rmm_init() and rmm_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 08/17] staging: tidspbridge: remove chnl_init() and chnl_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 09/17] staging: tidspbridge: remove msg_mod_init() and msg_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 10/17] staging: tidspbridge: remove io_init() and io_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 11/17] staging: tidspbridge: remove cmm_init() and cmm_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 12/17] staging: tidspbridge: remove dmm_init() and dmm_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 13/17] staging: tidspbridge: remove dev_init() and dev_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 14/17] staging: tidspbridge: simplify mgr_init() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 15/17] staging: tidspbridge: remove gh_init() and gh_exit() Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 16/17] staging: tidspbridge: remove ref counting in nldr.c Víctor Manuel Jáquez Leal
2012-03-09  0:03 ` [PATCH 17/17] staging: tidspbridge: remove nldr_init() and nldr_exit() Víctor Manuel Jáquez Leal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).