[PATCH 4/4] dspbridge: Change LST_ELEM to list_head entirely

2009-09-04 Thread Andy Shevchenko
From: Andy Shevchenko ext-andriy.shevche...@nokia.com

* Change struct LST_ELEM to struct list_head in whole dsp bridge driver
* Remove useless commentaries
* Minor change in the services/mem.c:
  ...
struct list_head *last = mMan.lst.head;
struct list_head *curr = last-next; /* was: mMan.lst.head.next */
  ...

Signed-off-by: Andy Shevchenko ext-andriy.shevche...@nokia.com
---
 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |2 +-
 arch/arm/plat-omap/include/dspbridge/list.h |1 -
 arch/arm/plat-omap/include/dspbridge/proc.h |2 +-
 drivers/dsp/bridge/pmgr/cmm.c   |   55 +++
 drivers/dsp/bridge/pmgr/dev.c   |8 ++--
 drivers/dsp/bridge/rmgr/drv.c   |   14 +++---
 drivers/dsp/bridge/rmgr/node.c  |   10 ++--
 drivers/dsp/bridge/rmgr/rmm.c   |   16 +++---
 drivers/dsp/bridge/services/cfg.c   |2 +-
 drivers/dsp/bridge/services/mem.c   |   26 +-
 drivers/dsp/bridge/services/ntfy.c  |   12 +++---
 drivers/dsp/bridge/wmd/_msg_sm.h|4 +-
 drivers/dsp/bridge/wmd/chnl_sm.c|   12 +++---
 drivers/dsp/bridge/wmd/io_sm.c  |   10 ++--
 drivers/dsp/bridge/wmd/msg_sm.c |   21 -
 15 files changed, 96 insertions(+), 99 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h 
b/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
index 28af799..cc768c9 100644
--- a/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
+++ b/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
@@ -197,7 +197,7 @@ struct loadMonStruct {
 
 /* I/O Request/completion packet: */
struct CHNL_IRP {
-   struct LST_ELEM link;   /* Link to next CHIRP in queue. */
+   struct list_head link;  /* Link to next CHIRP in queue.  */
/* Buffer to be filled/emptied. (User)   */
u8 *pHostUserBuf;
/* Buffer to be filled/emptied. (System) */
diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 867f5ac..27e7ca9 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -53,7 +53,6 @@
 #include linux/slab.h
 #include linux/list.h
 
-#define LST_ELEMlist_head
 #define LST_IsEmpty(l)  list_empty((l)-head)
 
 struct LST_LIST {
diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index d4896d5..eaf36a6 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -68,7 +68,7 @@
 
 /* The PROC_OBJECT structure.   */
 struct PROC_OBJECT {
-   struct LST_ELEM link;   /* Link to next PROC_OBJECT */
+   struct list_head link;  /* Link to next PROC_OBJECT */
u32 dwSignature;/* Used for object validation */
struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
u32 hProcess;   /* Process owning this Processor */
diff --git a/drivers/dsp/bridge/pmgr/cmm.c b/drivers/dsp/bridge/pmgr/cmm.c
index 9b19be2..571aa12 100644
--- a/drivers/dsp/bridge/pmgr/cmm.c
+++ b/drivers/dsp/bridge/pmgr/cmm.c
@@ -199,7 +199,7 @@ static struct CMM_XLATORATTRS CMM_DFLTXLATORATTRS = {
 
 /* SM node representing a block of memory. */
 struct CMM_MNODE {
-   struct LST_ELEM link;   /* must be 1st element */
+   struct list_head link;  /* must be 1st element */
u32 dwPA;   /* Phys addr */
u32 dwVA;   /* Virtual address in device process context */
u32 ulSize; /* SM block size in bytes */
@@ -289,7 +289,7 @@ void *CMM_CallocBuf(struct CMM_OBJECT *hCmmMgr, u32 uSize,
 
/* put our node on InUse list */
LST_PutTail(pAllocator-pInUseListHead,
-  (struct LST_ELEM *)pNode);
+  (struct list_head *)pNode);
pBufPA = (void *)pNode-dwPA;   /* physical address */
/* clear mem */
pByte = (u8 *)pNode-dwVA;
@@ -428,8 +428,6 @@ DSP_STATUS CMM_Destroy(struct CMM_OBJECT *hCmmMgr, bool 
bForce)
if (pCmmMgr-pNodeFreeListHead != NULL) {
/* Free the free nodes */
while (!LST_IsEmpty(pCmmMgr-pNodeFreeListHead)) {
-   /* (struct LST_ELEM*) pNode =
-* LST_GetHead(pCmmMgr-pNodeFreeListHead);*/
pNode = (struct CMM_MNODE *)LST_GetHead(pCmmMgr-
 pNodeFreeListHead);
MEM_Free(pNode);
@@ -496,7 +494,7 @@ DSP_STATUS CMM_FreeBuf(struct CMM_OBJECT *hCmmMgr, void 
*pBufPA, u32 ulSegId)
if ((u32)pBufPA == pCurNode-dwPA) {
/* 

[PATCH 4/4] dspbridge: Change LST_ELEM to list_head entirely

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko ext-andriy.shevche...@nokia.com

* Change struct LST_ELEM to struct list_head in whole dsp bridge driver
* Remove useless commentaries
* Minor change in the services/mem.c:
  ...
struct list_head *last = mMan.lst.head;
struct list_head *curr = last-next; /* was: mMan.lst.head.next */
  ...

Signed-off-by: Andy Shevchenko ext-andriy.shevche...@nokia.com
---
 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |2 +-
 arch/arm/plat-omap/include/dspbridge/list.h |1 -
 arch/arm/plat-omap/include/dspbridge/proc.h |2 +-
 drivers/dsp/bridge/pmgr/cmm.c   |   55 +++
 drivers/dsp/bridge/pmgr/dev.c   |8 ++--
 drivers/dsp/bridge/rmgr/drv.c   |   14 +++---
 drivers/dsp/bridge/rmgr/node.c  |   10 ++--
 drivers/dsp/bridge/rmgr/rmm.c   |   16 +++---
 drivers/dsp/bridge/services/cfg.c   |2 +-
 drivers/dsp/bridge/services/mem.c   |   24 +-
 drivers/dsp/bridge/services/ntfy.c  |   12 +++---
 drivers/dsp/bridge/wmd/_msg_sm.h|4 +-
 drivers/dsp/bridge/wmd/chnl_sm.c|8 ++--
 drivers/dsp/bridge/wmd/io_sm.c  |   10 ++--
 drivers/dsp/bridge/wmd/msg_sm.c |   18 
 15 files changed, 92 insertions(+), 94 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h 
b/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
index 28af799..cc768c9 100644
--- a/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
+++ b/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
@@ -197,7 +197,7 @@ struct loadMonStruct {
 
 /* I/O Request/completion packet: */
struct CHNL_IRP {
-   struct LST_ELEM link;   /* Link to next CHIRP in queue. */
+   struct list_head link;  /* Link to next CHIRP in queue.  */
/* Buffer to be filled/emptied. (User)   */
u8 *pHostUserBuf;
/* Buffer to be filled/emptied. (System) */
diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 9efbe9c..2e9eee5 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -53,7 +53,6 @@
 #include linux/slab.h
 #include linux/list.h
 
-#define LST_ELEMlist_head
 #define LST_IsEmpty(l)  list_empty((l)-head)
 
 struct LST_LIST {
diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index 1936a4e..3a6f820 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -68,7 +68,7 @@
 
 /* The PROC_OBJECT structure.   */
 struct PROC_OBJECT {
-   struct LST_ELEM link;   /* Link to next PROC_OBJECT */
+   struct list_head link;  /* Link to next PROC_OBJECT */
u32 dwSignature;/* Used for object validation */
struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
u32 hProcess;   /* Process owning this Processor */
diff --git a/drivers/dsp/bridge/pmgr/cmm.c b/drivers/dsp/bridge/pmgr/cmm.c
index 7dea18c..56a69f5 100644
--- a/drivers/dsp/bridge/pmgr/cmm.c
+++ b/drivers/dsp/bridge/pmgr/cmm.c
@@ -199,7 +199,7 @@ static struct CMM_XLATORATTRS CMM_DFLTXLATORATTRS = {
 
 /* SM node representing a block of memory. */
 struct CMM_MNODE {
-   struct LST_ELEM link;   /* must be 1st element */
+   struct list_head link;  /* must be 1st element */
u32 dwPA;   /* Phys addr */
u32 dwVA;   /* Virtual address in device process context */
u32 ulSize; /* SM block size in bytes */
@@ -289,7 +289,7 @@ void *CMM_CallocBuf(struct CMM_OBJECT *hCmmMgr, u32 uSize,
 
/* put our node on InUse list */
LST_PutTail(pAllocator-pInUseListHead,
-  (struct LST_ELEM *)pNode);
+  (struct list_head *) pNode);
pBufPA = (void *)pNode-dwPA;   /* physical address */
/* clear mem */
pByte = (u8 *)pNode-dwVA;
@@ -428,8 +428,6 @@ DSP_STATUS CMM_Destroy(struct CMM_OBJECT *hCmmMgr, bool 
bForce)
if (pCmmMgr-pNodeFreeListHead != NULL) {
/* Free the free nodes */
while (!LST_IsEmpty(pCmmMgr-pNodeFreeListHead)) {
-   /* (struct LST_ELEM*) pNode =
-* LST_GetHead(pCmmMgr-pNodeFreeListHead);*/
pNode = (struct CMM_MNODE *)LST_GetHead(pCmmMgr-
 pNodeFreeListHead);
MEM_Free(pNode);
@@ -496,7 +494,7 @@ DSP_STATUS CMM_FreeBuf(struct CMM_OBJECT *hCmmMgr, void 
*pBufPA, u32 ulSegId)
if ((u32)pBufPA == pCurNode-dwPA) {
/* 

Re: [PATCH 4/4] dspbridge: Change LST_ELEM to list_head entirely

2009-09-03 Thread Artem Bityutskiy
On Thu, 2009-09-03 at 12:06 +0300, Andy Shevchenko wrote:
 @@ -590,7 +589,7 @@ DSP_STATUS CMM_GetInfo(struct CMM_OBJECT *hCmmMgr,
   /* next node. */
   pCurNode = (struct CMM_MNODE *)LST_Next(pAltr-
   pInUseListHead,
 - (struct LST_ELEM *)pCurNode);
 + (struct list_head *) pCurNode);

I do not completely agree with this change. Please do not put space
between the cast and the variable. The cast kind of belongs to the
variable, so it is nicer to have no space there.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] dspbridge: Change LST_ELEM to list_head entirely

2009-09-03 Thread Andy Shevchenko
On Thu, Sep 3, 2009 at 12:17 PM, Artem Bityutskiydedeki...@gmail.com wrote:
 On Thu, 2009-09-03 at 12:06 +0300, Andy Shevchenko wrote:
 @@ -590,7 +589,7 @@ DSP_STATUS CMM_GetInfo(struct CMM_OBJECT *hCmmMgr,
                               /* next node. */
                               pCurNode = (struct CMM_MNODE *)LST_Next(pAltr-
                                       pInUseListHead,
 -                                     (struct LST_ELEM *)pCurNode);
 +                                     (struct list_head *) pCurNode);

 I do not completely agree with this change. Please do not put space
 between the cast and the variable. The cast kind of belongs to the
 variable, so it is nicer to have no space there.
Partially code is written in  way w/o spaces, partially in way with
space. The style of whole driver is awful.
Just for information, in our kernel:
sh-3.2$ git grep -n 'list_head *)[^ ]' | wc
110 5198630
sh-3.2$ git grep -n 'list_head *) ' | wc
 43 2363345

So, probably I will agree with you.

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] dspbridge: Change LST_ELEM to list_head entirely

2009-09-03 Thread Andy Shevchenko
On Thu, Sep 3, 2009 at 12:31 PM, Andy
Shevchenkoandy.shevche...@gmail.com wrote:
 On Thu, Sep 3, 2009 at 12:17 PM, Artem Bityutskiydedeki...@gmail.com wrote:
 On Thu, 2009-09-03 at 12:06 +0300, Andy Shevchenko wrote:
 @@ -590,7 +589,7 @@ DSP_STATUS CMM_GetInfo(struct CMM_OBJECT *hCmmMgr,
                               /* next node. */
                               pCurNode = (struct CMM_MNODE 
 *)LST_Next(pAltr-
                                       pInUseListHead,
 -                                     (struct LST_ELEM *)pCurNode);
 +                                     (struct list_head *) pCurNode);

 I do not completely agree with this change. Please do not put space
 between the cast and the variable. The cast kind of belongs to the
 variable, so it is nicer to have no space there.
 Partially code is written in  way w/o spaces, partially in way with
 space. The style of whole driver is awful.
 Just for information, in our kernel:
 sh-3.2$ git grep -n 'list_head *)[^ ]' | wc
    110     519    8630
 sh-3.2$ git grep -n 'list_head *) ' | wc
     43     236    3345
Oh, wrong regexp :-)

sh-3.2$ git grep -n 'list_head \*) ' | wc
 80 4506440
sh-3.2$ git grep -n 'list_head \*)[^ ]' | wc
 28 1702202

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html