staging: tidspbridge: remove cmm_init() and cmm_exit()
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 9 Mar 2012 00:03:46 +0000 (01:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Mar 2012 21:21:07 +0000 (13:21 -0800)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/tidspbridge/include/dspbridge/cmm.h
drivers/staging/tidspbridge/pmgr/cmm.c
drivers/staging/tidspbridge/pmgr/dev.c

index aff22051cf57ed8a9ff2bbba39fdfc466c13b3db..c66bcf7ea90cb865c6cfd45933232ff99f9bc334 100644 (file)
@@ -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:
@@ -110,20 +109,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:
@@ -184,19 +169,6 @@ extern int cmm_get_handle(void *hprocessor,
 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:
@@ -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:
index 3366e601009d3ad5a95a2d9b2752606c8e9d4475..4a800dadd7036bda258a808d0e957b5d42be39c6 100644 (file)
@@ -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);
@@ -316,17 +313,6 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force)
        return status;
 }
 
-/*
- *  ======== cmm_exit ========
- *  Purpose:
- *      Discontinue usage of module; free resources when reference count
- *      reaches 0.
- */
-void cmm_exit(void)
-{
-       refs--;
-}
-
 /*
  *  ======== cmm_free_buf ========
  *  Purpose:
@@ -445,21 +431,6 @@ int cmm_get_info(struct cmm_object *hcmm_mgr,
        return status;
 }
 
-/*
- *  ======== 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:
index 883765e3c8510b50ff9a115e7ea1dda3501810dc..734d47ed9a802aa9a9b2e5e7236ec4e7ce54ca15 100644 (file)
@@ -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++;