[PATCHv2 1/5] DSPBRIDGE: OSAL: Simplify REG API

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

Simplify REG API by removing useless input parameters.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/reg.h |  102 
 drivers/dsp/bridge/rmgr/dbdcd.c|   22 +++
 drivers/dsp/bridge/rmgr/drv.c  |   22 ++
 drivers/dsp/bridge/rmgr/drv_interface.c|   33 -
 drivers/dsp/bridge/services/cfg.c  |   49 +-
 drivers/dsp/bridge/services/reg.c  |   26 ++-
 drivers/dsp/bridge/services/regsup.c   |3 +-
 drivers/dsp/bridge/services/regsup.h   |4 +-
 drivers/dsp/bridge/wmd/tiomap3430.c|4 +-
 9 files changed, 75 insertions(+), 190 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/reg.h 
b/arch/arm/plat-omap/include/dspbridge/reg.h
index 5b34952..64a8fe8 100644
--- a/arch/arm/plat-omap/include/dspbridge/reg.h
+++ b/arch/arm/plat-omap/include/dspbridge/reg.h
@@ -22,7 +22,6 @@
  *
  *  Public Functions:
  *  REG_DeleteValue
- *  REG_EnumKey
  *  REG_EnumValue
  *  REG_Exit
  *  REG_GetValue
@@ -53,23 +52,6 @@
 
 #include 
 
-/*  - Defines, Data Structures, Typedefs for Linux */
-#ifndef UNDER_CE
-
-#ifndef REG_SZ
-#define REG_SZ  1
-#endif
-
-#ifndef REG_BINARY
-#define REG_BINARY  3
-#endif
-
-#ifndef REG_DWORD
-#define REG_DWORD   4
-#endif
-
-#endif /* UNDER_CE */
-
 #define REG_MAXREGPATHLENGTH255
 
 /*
@@ -78,57 +60,18 @@
  *  Deletes a registry entry. NOTE: A registry entry is not the same as
  *  a registry key.
  *  Parameters:
- *  phKey:  Currently reserved; must be NULL.
- *  pstrSubkey: Path to key to open.
  *  pstrValue:  Name of entry to delete.
  *  Returns:
  *  DSP_SOK:Success.
  *  DSP_EFAIL:  General failure.
  *  Requires:
  *  - REG initialized.
- *  - pstrSubkey & pstrValue are non-NULL values.
- *  - phKey is NULL.
- *  - length of pstrSubkey < REG_MAXREGPATHLENGTH.
+ *  - pstrValue is non-NULL value.
  *  - length of pstrValue < REG_MAXREGPATHLENGTH.
  *  Ensures:
  *  Details:
  */
-   extern DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey,
- IN CONST char *pstrSubkey,
- IN CONST char *pstrValue);
-
-/*
- *   REG_EnumKey 
- *  Purpose:
- *  Enumerates subkeys of the specified path to the  registry key
- *  Retrieves the  name of the subkey(given the index) and
- *  appends with the orignal path to form the full path.
- *  Parameters:
- *  phKey:  Currently reserved; must be NULL.
- *  pstrKey The name of the registry key to be enumerated.
- *  dwIndex Specifies the index of the subkey to retrieve.
- *  pstrSubkey: Pointer to buffer that receives full path name of the
- *  specified key + the sub-key
- *  pdwValueSize:   Specifies bytes of memory pstrSubkey points to on 
input,
- *  on output, specifies actual memory bytes written into.
- *  If there is no sub key,pdwValueSize returns NULL.
- *  Returns:
- *  DSP_SOK:Success.
- *  DSP_EFAIL:  General failure.
- *  Requires:
- *  - REG initialized.
- *  - pstrKey is non-NULL value.
- *  - pdwValueSize is a valid pointer.
- *  - phKey is NULL.
- *  - length of pstrKey < REG_MAXREGPATHLENGTH.
- *  Ensures:
- *  - strlen(pstrSubkey) is > strlen(pstrKey) &&
- *  - strlen(pstrSubkey) is < REG_MAXREGPATHLENGTH
- */
-   extern DSP_STATUS REG_EnumKey(OPTIONAL IN HANDLE *phKey,
- IN u32 dwIndex, IN CONST char *pstrKey,
- IN OUT char *pstrSubkey,
- IN OUT u32 *pdwValueSize);
+extern DSP_STATUS REG_DeleteValue(IN CONST char *pstrValue);
 
 /*
  *   REG_EnumValue 
@@ -136,7 +79,6 @@
  *  Enumerates values of a specified key. Retrieves each value name and
  *  the data associated with the value.
  *  Parameters:
- *  phKey:  Currently reserved; must be NULL.
  *  dwIndex:Specifies the index of the value to retrieve.
  *  pstrKey:The name of the registry key to be enumerated.
  *  pstrValue:  Pointer to buffer that receives the name of the value.
@@ -152,19 +94,16 @@
  *  DSP_EFAIL:  General failure.
  *  Requires:
  *  REG initialized.
- *  phKey is NULL.
  *  pstrKey is a non-NULL value.
  *  pstrValue, pstrData, pdwValueSize and pdwDataSize are valid pointers.
  *  Length of pstrKey is less than REG_MAXREGPATHLENGTH.
  *  Ensures:
  */
-   extern DSP_STATUS REG_EnumValue(IN HANDLE *phKey,
-   IN u32 dwIndex,
-   IN CONST char *pstrKey,
-  

[PATCHv2 2/5] DSPBRIDGE: OSAL: Remove unused registry variables

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/dbreg.h |3 ---
 drivers/dsp/bridge/rmgr/drv_interface.c  |   12 
 drivers/dsp/bridge/services/cfg.c|5 -
 3 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dbreg.h 
b/arch/arm/plat-omap/include/dspbridge/dbreg.h
index d311b88..59b6496 100644
--- a/arch/arm/plat-omap/include/dspbridge/dbreg.h
+++ b/arch/arm/plat-omap/include/dspbridge/dbreg.h
@@ -88,7 +88,6 @@
 #define WMDFILENAME  "MiniDriver"  /* WMD entry name */
 #define CHIPTYPE "ChipType"/* Chip type */
 #define CHIPNUM  "NumChips"/* Number of chips */
-#define NUMPROCS "NumOfProcessors" /* Number of processors */
 #define DEFEXEC  "DefaultExecutable"   /* Default executable */
 #define AUTOSTART"AutoStart"   /* Statically load flag */
 #define IVAAUTOSTART "IvaAutoStart"/* Statically load flag */
@@ -107,7 +106,5 @@
 #define TCWORDSWAP   "TCWordSwap"  /* Traffic Contoller Word Swap */
 #define DSPRESOURCES "DspTMSResources" /* C55 DSP resurces on OMAP */
 #define IVA1RESOURCES"ARM7IvaResources"/* ARM7 IVA resurces on OMAP */
-#define PHYSMEMPOOLBASE  "PhysicalMemBase"   /* Physical mem passed to driver 
*/
-#define PHYSMEMPOOLSIZE  "PhysicalMemSize"   /* Physical mem passed to driver 
*/
 
 #endif /* DBREG_ */
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index b5503c0..152b6fc 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -129,7 +129,6 @@ static s32 driver_major = DRIVER_MAJOR;
 static s32 driver_minor = DRIVER_MINOR;
 static char *base_img;
 char *iva_img;
-static char *num_procs = "C55=1";
 static s32 shm_size = 0x50;/* 5 MB */
 static u32 phys_mempool_base;
 static u32 phys_mempool_size;
@@ -362,7 +361,6 @@ static int __devinit omap34xx_bridge_probe(struct 
platform_device *pdev)
REG_SetValue(AUTOSTART, (u8 *)&temp, sizeof(temp));
REG_SetValue(DEFEXEC, (u8 *) "\0", (u32)2);
}
-   REG_SetValue(NUMPROCS, (u8 *) num_procs, strlen(num_procs) + 1);
 
if (shm_size >= 0x1) {  /* 64 KB */
initStatus = REG_SetValue(SHMSIZE, (u8 *)&shm_size,
@@ -381,19 +379,9 @@ static int __devinit omap34xx_bridge_probe(struct 
platform_device *pdev)
phys_mempool_size = pdata->phys_mempool_size;
}
 
-   if (phys_mempool_base > 0x0) {
-   initStatus = REG_SetValue(PHYSMEMPOOLBASE,
-(u8 *)&phys_mempool_base,
-sizeof(phys_mempool_base));
-   }
GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_base = 0x%x \n",
 phys_mempool_base);
 
-   if (phys_mempool_size > 0x0) {
-   initStatus = REG_SetValue(PHYSMEMPOOLSIZE,
-(u8 *)&phys_mempool_size,
-sizeof(phys_mempool_size));
-   }
GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_size = 0x%x\n",
 phys_mempool_base);
if ((phys_mempool_base > 0x0) && (phys_mempool_size > 0x0))
diff --git a/drivers/dsp/bridge/services/cfg.c 
b/drivers/dsp/bridge/services/cfg.c
index cb4ffea..e3cdda3 100644
--- a/drivers/dsp/bridge/services/cfg.c
+++ b/drivers/dsp/bridge/services/cfg.c
@@ -413,11 +413,6 @@ DSP_STATUS CFG_SetDevObject(struct CFG_DEVNODE *hDevNode, 
u32 dwValue)
  "Registering the DSP Device \n");
status = REG_SetValue("DEVICE_DSP", (u8 *)&dwValue,
  dwBuffSize);
-   if (DSP_SUCCEEDED(status)) {
-   dwBuffSize = sizeof(hDevNode);
-   status = REG_SetValue("DEVNODESTRING_DSP",
-   (u8 *)&hDevNode, dwBuffSize);
-   }
} else {
GT_0trace(CFG_debugMask, GT_6CLASS,
  "Failed to Register Device \n");
-- 
1.5.6.5

--
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


[PATCHv2 5/5] DSPBRIDGE: OSAL: Remove printS()

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

Remove printS() debuggin method. It's mostly useless and at least dangerous
because of absence of boundary check.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/services/regsup.c |   23 ---
 1 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/drivers/dsp/bridge/services/regsup.c 
b/drivers/dsp/bridge/services/regsup.c
index 71651a8..bd45b56 100644
--- a/drivers/dsp/bridge/services/regsup.c
+++ b/drivers/dsp/bridge/services/regsup.c
@@ -60,26 +60,6 @@ static struct LST_LIST regKey, *pRegKey = ®Key;
 
 #if GT_TRACE
 extern struct GT_Mask REG_debugMask;   /* GT trace var. */
-/*
- *   printS 
- *  Purpose:
- *  Displays printable characters in pBuf, if any.
- */
-static inline void printS(void *pBuf)
-{
-   int pos = 0;
-   if (*(REG_debugMask).flags & (GT_2CLASS)) {
-   while (*(u8 *)((pBuf)+pos) >= ' ' &&
-  *(u8 *)((pBuf)+pos) <= '~') {
-   GT_1trace(REG_debugMask, GT_2CLASS, "%c",
-   *(u8 *)((pBuf) + pos++));
-   }
-
-   GT_0trace(REG_debugMask, GT_2CLASS, "\n");
-   }
-}
-#else
-#define printS(pBuf)
 #endif
 
 /*
@@ -140,7 +120,6 @@ DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 
*dataSize)
if (DSP_SUCCEEDED(retVal)) {
GT_2trace(REG_debugMask, GT_2CLASS, "G %s DATA %x ", valName,
  *(u32 *)pBuf);
-   printS((u8 *)pBuf);
} else {
GT_1trace(REG_debugMask, GT_3CLASS, "G %s FAILED\n", valName);
}
@@ -160,7 +139,6 @@ DSP_STATUS regsupSetValue(char *valName, void *pBuf, u32 
dataSize)
 
GT_2trace(REG_debugMask, GT_2CLASS, "S %s DATA %x ", valName,
  *(u32 *)pBuf);
-   printS((u8 *)pBuf);
 
/*  Need to search through the entries looking for the right one.  */
while (rv) {
@@ -245,7 +223,6 @@ DSP_STATUS regsupEnumValue(IN u32 dwIndex, IN CONST char 
*pstrKey,
GT_3trace(REG_debugMask, GT_2CLASS,
  "E Key %s, Value %s, Data %x ",
  pstrKey, pstrValue, *(u32 *)pstrData);
-   printS((u8 *)pstrData);
 
/*  Set our status to good and exit.  */
retVal = DSP_SOK;
-- 
1.5.6.5

--
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


[PATCH] dspbridge: Remove duplicates

2009-09-24 Thread Andy Shevchenko
From: Andy Shevchenko 

includecheck found few duplicates. So, clean up them.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/disp.c  |1 -
 drivers/dsp/bridge/rmgr/drv_interface.c |1 -
 drivers/dsp/bridge/rmgr/proc.c  |1 -
 drivers/dsp/bridge/wmd/io_sm.c  |1 -
 4 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/disp.c b/drivers/dsp/bridge/rmgr/disp.c
index d6ddf6e..0645398 100644
--- a/drivers/dsp/bridge/rmgr/disp.c
+++ b/drivers/dsp/bridge/rmgr/disp.c
@@ -59,7 +59,6 @@
 #include 
 
 /*  --- OS Adaptation Layer */
-#include 
 #include 
 #include 
 
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index f68978a..0f70257 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -93,7 +93,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index c3add40..c720f79 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -138,7 +138,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /*  --- This */
 #include 
diff --git a/drivers/dsp/bridge/wmd/io_sm.c b/drivers/dsp/bridge/wmd/io_sm.c
index 1d478ad..fefa065 100644
--- a/drivers/dsp/bridge/wmd/io_sm.c
+++ b/drivers/dsp/bridge/wmd/io_sm.c
@@ -77,7 +77,6 @@
 #include <_tiomap.h>
 #include 
 #include <_tiomap_pwr.h>
-#include 
 
 /*  --- Platform Manager */
 #include 
-- 
1.5.6.5

--
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: Newbie doubt

2009-11-08 Thread Andy Shevchenko
On Mon, Nov 9, 2009 at 6:59 AM, Niamathullah sharief  wrote:
> Hi,
> I want to know that what are all the OMAP based boards available other
> than beagle board?in that which one will be better for me as a newbie.
As far as I knnow you can use beagle board or ready-to-use devices
such as gumstix.


-- 
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 v2 15/20] DSPBRIDGE: trivial cleanup and indentation for io_sm

2009-11-30 Thread Andy Shevchenko
On Mon, Nov 30, 2009 at 11:54 PM, Omar Ramirez Luna  wrote:
> Remove duplicate set of braces from if statement and reduce
> indentation.

> diff --git a/drivers/dsp/bridge/wmd/io_sm.c b/drivers/dsp/bridge/wmd/io_sm.c
> index af31831..96a5aa6 100644
> --- a/drivers/dsp/bridge/wmd/io_sm.c
> +++ b/drivers/dsp/bridge/wmd/io_sm.c
> @@ -115,7 +115,7 @@ struct IO_MGR {
>        /* private extnd proc info; mmu setup */
>        struct MGR_PROCESSOREXTINFO extProcInfo;
>        struct CMM_OBJECT *hCmmMgr;     /* Shared Mem Mngr            */
May be to fix commentary indentation?
> -       struct work_struct io_workq;     /*workqueue */
> +       struct work_struct io_workq;     /*workqueue */
I didn't get why the space after /* still absent.

> @@ -319,7 +321,7 @@ DSP_STATUS WMD_IO_Destroy(struct IO_MGR *hIOMgr)
>                SYNC_DeleteCS(hIOMgr->hCSObj);  /* Leak Fix. */
>                /* Free this IO manager object: */
>                MEM_FreeObject(hIOMgr);
> -       } else
> +       } else
>                status = DSP_EHANDLE;
Probably } else { ... } would be better. (1)

> @@ -609,7 +608,7 @@ func_cont1:
>                }
>        }
>
> -        /* Copy remaining entries from CDB. All entries are 1 MB and should 
> not
> +       /* Copy remaining entries from CDB. All entries are 1 MB and should 
> not
>         * conflict with SHM entries on MPU or DSP side */
In previous hunks you fixed * ... */. Why not here? (2)

> @@ -1002,15 +995,10 @@ void IO_DPC(IN OUT void *pRefData)
>                        PrintDSPDebugTrace(pIOMgr);
>        }
>  #endif
> -
> -#ifndef DSP_TRACEBUF_DISABLED
> -       PrintDSPDebugTrace(pIOMgr);
> -#endif
>  func_end:
>        return;
No comments about this changes. (Intuitively I understand, but...)

> @@ -1028,29 +1016,28 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
>                }
> -       } else
> +       } else
>                /* Ensure that, if WMD didn't claim it, the IRQ is shared. */
>                DBC_Ensure(hIOMgr->fSharedIRQ);
The same as in (1).

> @@ -1380,10 +1365,10 @@ static void NotifyChnlComplete(struct CHNL_OBJECT 
> *pChnl,
>           !pChnl->pIOCompletions || !pChirp)
>                goto func_end;
>
> -        /*  Note: we signal the channel event only if the queue of IO
> -         *  completions is empty.  If it is not empty, the event is sure to 
> be
> -         *  signalled by the only IO completion list consumer:
> -         *  WMD_CHNL_GetIOC().  */
> +       /*  Note: we signal the channel event only if the queue of IO
> +        *  completions is empty.  If it is not empty, the event is sure to be
> +        *  signalled by the only IO completion list consumer:
> +        *  WMD_CHNL_GetIOC().  */
The same as in (2).

-- 
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 v2 00/20] dspbridge cleanups

2009-11-30 Thread Andy Shevchenko
On Mon, Nov 30, 2009 at 11:54 PM, Omar Ramirez Luna  wrote:

>  arch/arm/plat-omap/include/dspbridge/list.h        |   36 +-
>  drivers/dsp/bridge/services/list.c                 |   33 -
Sorry, I missed patch that contains above changes. What they about?

-- 
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 3/4] staging: tidspbridge: remove gb bitmap implementation

2010-10-22 Thread Andy Shevchenko
On Fri, Oct 22, 2010 at 5:08 PM, Ionut Nicu  wrote:
> Most likely I will have to break patch 4/4 from this series (which I
> also believe is way too big) into multiple patches and re-submit.
>
> I'm expecting some advices from the maintainers/list on how to split
> patch 4 (lst_list removal).
I didn't see it at all in my mailbox. And can't find it on patchwork either...

-- 
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: How to change freq of mmc2_clk to 48Mhz for OMAP35xx

2010-12-08 Thread Andy Shevchenko
On Wed, Dec 8, 2010 at 10:36 PM, Paul Walmsley  wrote:
> Anyway, if you want to try changing it from the kernel side, you'll need
> code like this in the MMC driver or OMAP integration code (off the top of
> my head, untested):

> Please let me know if this doesn't work.
IIRC, there is mmc_set_clock() method, but it isn't exported. Anyway,
I have another issue with some specific code which also requires the
same function to be exported.

-- 
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


[PATCH 6/8] dspbridge: Check status before use return value

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/drv.c |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index bedc34c..44d7f2d 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -825,7 +825,13 @@ DSP_STATUS DRV_ProcDisplayResInfo(u8 *pBuf1, u32 *pSize)
u32 tempStrLen = 0, tempStrLen2 = 0;
DSP_STATUS status = DSP_SOK;
 
-   CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
+   if (DSP_FAILED(CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT))) {
+   /* Should we print something? */
+   *pBuf1 = 0;
+   *pSize = 0;
+   return DSP_EHANDLE;
+   }
+
DRV_GetProcCtxtList(&pCtxt, (struct DRV_OBJECT *)hDrvObject);
GT_0trace(curTrace, GT_ENTER, "*"
 "DRV_ProcDisplayResourceInfo:*\n");
@@ -954,8 +960,12 @@ static DSP_STATUS PrintProcessInformation(void)
u32 tempCount;
u32  procID;
 
+   if (DSP_FAILED(CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT))) {
+   /* Should we print something? */
+   return DSP_EHANDLE;
+   }
+
/* Get the Process context list */
-   CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
DRV_GetProcCtxtList(&pCtxtList, hDrvObject);
GT_0trace(curTrace, GT_4CLASS, "\n### Debug information"
" for DSP bridge ##\n");
-- 
1.5.6.5

--
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


[PATCH 2/8] dspbridge: Drop useless memory allocation

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

strcmp() should do the job without additional memory allocation and
strncpy()/strcmp() calls.

Additionally fix spelling.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/node.c |   15 ---
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/node.c b/drivers/dsp/bridge/rmgr/node.c
index d3f0e34..e213b22 100644
--- a/drivers/dsp/bridge/rmgr/node.c
+++ b/drivers/dsp/bridge/rmgr/node.c
@@ -404,7 +404,6 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJECT *hProcessor,
DSP_STATUS status = DSP_SOK;
struct CMM_OBJECT *hCmmMgr = NULL; /* Shared memory manager hndl */
u32 procId;
-   char *label;
u32 pulValue;
u32 dynextBase;
u32 offSet = 0;
@@ -691,18 +690,16 @@ func_cont2:
}
}
 
-   /* Comapare value read from Node Properties and check if it is same as
+   /* Compare value read from Node Properties and check if it is same as
 * STACKSEGLABEL, if yes read the Address of STACKSEGLABEL, calculate
 * GPP Address, Read the value in that address and override the
 * uStackSeg value in task args */
if (DSP_SUCCEEDED(status) &&
   (char *)pNode->dcdProps.objData.nodeObj.ndbProps.uStackSegName !=
   NULL) {
-   label = MEM_Calloc(sizeof(STACKSEGLABEL)+1, MEM_PAGED);
-   strncpy(label, STACKSEGLABEL, sizeof(STACKSEGLABEL)+1);
-
-   if (strcmp((char *)pNode->dcdProps.objData.nodeObj.
-ndbProps.uStackSegName, label) == 0) {
+   if (strcmp((char *)
+   pNode->dcdProps.objData.nodeObj.ndbProps.uStackSegName,
+   STACKSEGLABEL) == 0) {
status = hNodeMgr->nldrFxns.pfnGetFxnAddr(pNode->
 hNldrNode, "DYNEXT_BEG", &dynextBase);
if (DSP_FAILED(status)) {
@@ -744,10 +741,6 @@ func_cont2:
ulStackSegVal;
 
}
-
-   if (label)
-   MEM_Free(label);
-
}
 
 
-- 
1.5.6.5

--
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


[PATCH 4/8] dspbridge: Check pointer returned by MEM_Calloc()

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

In case of NULL return DSP_EMEMORY status instead of DSP_SOK.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/drv.c |   23 +--
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 691c727..bedc34c 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -1571,17 +1571,18 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, 
s32 bRequest)
/* Releasing resources by deleting the registry key  */
dwBuffSize = sizeof(struct CFG_HOSTRES);
pResources = MEM_Calloc(dwBuffSize, MEM_NONPAGED);
-   if (DSP_FAILED(REG_GetValue(NULL, (char *)driverExt->szString,
-  CURRENTCONFIG, (u8 *)pResources, &dwBuffSize))) {
-   status = CFG_E_RESOURCENOTAVAIL;
-   GT_0trace(curTrace, GT_1CLASS,
-"REG_GetValue Failed \n");
-   } else {
-   GT_0trace(curTrace, GT_1CLASS,
-"REG_GetValue Succeeded \n");
-   }
-
if (pResources != NULL) {
+   if (DSP_FAILED(REG_GetValue(NULL,
+   (char *) driverExt->szString,
+   CURRENTCONFIG, (u8 *) pResources, &dwBuffSize))) {
+   status = CFG_E_RESOURCENOTAVAIL;
+   GT_0trace(curTrace, GT_1CLASS,
+"REG_GetValue Failed \n");
+   } else {
+   GT_0trace(curTrace, GT_1CLASS,
+"REG_GetValue Succeeded \n");
+   }
+
dwBuffSize = sizeof(shm_size);
status = REG_GetValue(NULL, CURRENTCONFIG, SHMSIZE,
(u8 *)&shm_size, &dwBuffSize);
@@ -1646,6 +1647,8 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, 
s32 bRequest)
 (u32)dwBuffSize);
/*  Set all the other entries to NULL */
MEM_Free(pResources);
+   } else {
+   status = DSP_EMEMORY;
}
GT_0trace(curTrace, GT_ENTER, " <- RequestBridgeResources \n");
return status;
-- 
1.5.6.5

--
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


[PATCH 7/8] DSPBRIDGE: Check return value

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

PROC_GetProcessorId() potentially could return different to DSP_SOK status. We
need to check it.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/drv.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 44d7f2d..d21071c 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -990,8 +990,12 @@ static DSP_STATUS PrintProcessInformation(void)
spin_lock(&pCtxtList->proc_list_lock);
list_for_each_entry(proc_obj_ptr, &pCtxtList->processor_list,
proc_object) {
-   PROC_GetProcessorId(proc_obj_ptr, &procID);
-   if (procID == DSP_UNIT) {
+   DSP_STATUS status2 = PROC_GetProcessorId(proc_obj_ptr,
+&procID);
+   if (DSP_FAILED(status2)) {
+   GT_0trace(curTrace, GT_7CLASS, "\n***ERROR:"
+ "Unable to get Processor Id***\n");
+   } else if (procID == DSP_UNIT) {
GT_0trace(curTrace, GT_4CLASS,
"\nProcess connected to"
" DSP Processor\n");
-- 
1.5.6.5

--
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


[PATCH 3/8] DSPBRIDGE: Check input value

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

Check input value before dereferencing it.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/wmd/tiomap3430.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
b/drivers/dsp/bridge/wmd/tiomap3430.c
index db48c49..4cb78c7 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -1266,11 +1266,16 @@ static DSP_STATUS WMD_DEV_Destroy(struct 
WMD_DEV_CONTEXT *hDevContext)
DSP_STATUS status = DSP_SOK;
struct WMD_DEV_CONTEXT *pDevContext = (struct WMD_DEV_CONTEXT *)
hDevContext;
+
+   /* It should never happen */
+   if (!hDevContext)
+   return DSP_EHANDLE;
+
DBG_Trace(DBG_ENTER, "Entering WMD_DEV_Destroy:n hDevContext ::0x%x\n",
  hDevContext);
/* first put the device to stop state */
WMD_BRD_Delete(pDevContext);
-   if (pDevContext && pDevContext->pPtAttrs) {
+   if (pDevContext->pPtAttrs) {
pPtAttrs = pDevContext->pPtAttrs;
if (pPtAttrs->hCSObj)
SYNC_DeleteCS(pPtAttrs->hCSObj);
-- 
1.5.6.5

--
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


[PATCH 5/8] dspbridge: Check pointer before dereferencing it

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/nldr.c |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/nldr.c b/drivers/dsp/bridge/rmgr/nldr.c
index 79f7505..8c162a1 100644
--- a/drivers/dsp/bridge/rmgr/nldr.c
+++ b/drivers/dsp/bridge/rmgr/nldr.c
@@ -1560,6 +1560,13 @@ static DSP_STATUS LoadOvly(struct NLDR_NODEOBJECT 
*hNldrNode,
}
 
DBC_Assert(i < hNldr->nOvlyNodes);
+
+   if (!pONode) {
+   /* Should we print warning here? */
+   status = DSP_ENOTFOUND;
+   goto func_end;
+   }
+
switch (phase) {
case NLDR_CREATE:
pRefCount = &(pONode->createRef);
@@ -1877,6 +1884,13 @@ static void UnloadOvly(struct NLDR_NODEOBJECT 
*hNldrNode, enum NLDR_PHASE phase)
}
 
DBC_Assert(i < hNldr->nOvlyNodes);
+
+   if (!pONode) {
+   /* Should we print warning here? */
+   status = DSP_ENOTFOUND;
+   goto func_end;
+   }
+
switch (phase) {
case NLDR_CREATE:
pRefCount = &(pONode->createRef);
@@ -1917,7 +1931,6 @@ static void UnloadOvly(struct NLDR_NODEOBJECT *hNldrNode, 
enum NLDR_PHASE phase)
}
if (pOtherRef && *pOtherRef == 0)
FreeSects(hNldr, pOtherSects, nOtherAlloc);
-
 }
 
 /*
-- 
1.5.6.5

--
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


[PATCH 1/8] dspbridge: Remove useless check

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

Before this check zlLib already dereferenced on one hand and DBC_Require()
checks for NULL on other hand.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/pmgr/dbll.c |   34 --
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/dbll.c b/drivers/dsp/bridge/pmgr/dbll.c
index 7c3cd40..e655f89 100644
--- a/drivers/dsp/bridge/pmgr/dbll.c
+++ b/drivers/dsp/bridge/pmgr/dbll.c
@@ -909,26 +909,24 @@ void DBLL_unload(struct DBLL_LibraryObj *lib, struct 
DBLL_Attrs *attrs)
goto func_end;
 
zlLib->pTarget->attrs = *attrs;
-   if (zlLib != NULL) {
-   if (zlLib->mHandle) {
-   err = Dynamic_Unload_Module(zlLib->mHandle,
-   &zlLib->symbol.dlSymbol,
-   &zlLib->allocate.dlAlloc, &zlLib->init.dlInit);
-   if (err != 0) {
-   GT_1trace(DBLL_debugMask, GT_5CLASS,
-"Dynamic_Unload_Module "
-"failed: 0x%x\n", err);
-   }
-   }
-   /* remove symbols from symbol table */
-   if (zlLib->symTab != NULL) {
-   GH_delete(zlLib->symTab);
-   zlLib->symTab = NULL;
+   if (zlLib->mHandle) {
+   err = Dynamic_Unload_Module(zlLib->mHandle,
+   &zlLib->symbol.dlSymbol,
+   &zlLib->allocate.dlAlloc, &zlLib->init.dlInit);
+   if (err != 0) {
+   GT_1trace(DBLL_debugMask, GT_5CLASS,
+"Dynamic_Unload_Module "
+"failed: 0x%x\n", err);
}
-   /* delete DOFF desc since it holds *lots* of host OS
-* resources */
-   dofClose(zlLib);
}
+   /* remove symbols from symbol table */
+   if (zlLib->symTab != NULL) {
+   GH_delete(zlLib->symTab);
+   zlLib->symTab = NULL;
+   }
+   /* delete DOFF desc since it holds *lots* of host OS
+* resources */
+   dofClose(zlLib);
 func_end:
DBC_Ensure(zlLib->loadRef >= 0);
 }
-- 
1.5.6.5

--
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


[PATCH 8/8] dspbridge: Check pointer before usage

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko 

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/drv.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index d21071c..491dd39 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -1545,6 +1545,10 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct 
DRV_OBJECT *hDrvObject)
for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension();
pszdevNode != NULL; pszdevNode = (struct DRV_EXT *)
DRV_GetNextDevExtension((u32)pszdevNode)) {
+   if (!pDRVObject->devNodeString) {
+   /* When this could happen? */
+   continue;
+   }
if ((u32)pszdevNode == dwContext) {
/* Found it */
/* Delete from the Driver object list */
-- 
1.5.6.5

--
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: [DSPBRIGDE PATCH 6/6] dsp: bridge: beautify erro path

2009-08-28 Thread Andy Shevchenko
On Fri, Aug 28, 2009 at 11:58 PM, Guzman Lugo,


> @@ -324,7 +324,7 @@ static int __init bridge_init(void)
>        if (result < 0) {
>                GT_1trace(driverTrace, GT_7CLASS, "bridge_init: "
>                                "Can't get Major %d \n", driver_major);
> -               return result;
> +               goto err1;
>        }
>
>        driver_major = MAJOR(dev);
> @@ -332,19 +332,17 @@ static int __init bridge_init(void)
>        bridge_device = kmalloc(sizeof(struct bridge_dev), GFP_KERNEL);
>        if (!bridge_device) {
>                result = -ENOMEM;
> -               unregister_chrdev_region(dev, 1);
> -               return result;
> +               goto err2;
>        }
>        cdev_init(&bridge_device->cdev, &bridge_fops);
>        bridge_device->cdev.owner = THIS_MODULE;
>        bridge_device->cdev.ops = &bridge_fops;
>
>        status = cdev_add(&bridge_device->cdev, dev, 1);
> -
>        if (status) {
>                GT_0trace(driverTrace, GT_7CLASS,
>                                "Failed to add the bridge device \n");
> -               return status;
result = status, isn't is?
or change status to result on previous lines.


> +               goto err3;
>        }
>
>        /* udev support */
> @@ -474,7 +472,17 @@ static int __init bridge_init(void)
>        DBC_Assert(status == 0);
>        DBC_Assert(DSP_SUCCEEDED(initStatus));
>        GT_0trace(driverTrace, GT_ENTER, " <- driver_init\n");
> -       return status;
> +
> +       return 0;
> +
> +err3:
> +       kfree(bridge_device);
> +
> +err2:
> +       unregister_chrdev_region(dev, 1);
> +
> +err1:
> +       return result;
>  }
>
>  /*  This function is invoked during unlinking of the bridge module from the


-- 
With Best Regards,
Andy Shevchenko


Re: [DSPBRIGDE PATCH 6/6] dsp: bridge: beautify erro path

2009-08-29 Thread Andy Shevchenko
On Sat, Aug 29, 2009 at 1:31 AM, Guzman Lugo, Fernando wrote:

>>result = status, isn't is?
>>or change status to result on previous lines.
> Yes, we need to assigned status to result, in order to report the error, 
> however I think we can get rid of result and use status instead, what do you 
> think?

As far as I see this is not the dsp status but just a word to collect
errors. More logical in this piece of your code is to use result word
instead of status.

-- 
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


[PATCH] dspbridge: Check pointer before usage

2009-09-01 Thread Andy Shevchenko
From: Andy Shevchenko 

Theoretically list could be deleted before we go into the for loop.
Additionally we could delete list immediately if it becomes empty.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/drv.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index d21071c..9f726a6 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -1545,18 +1545,23 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct 
DRV_OBJECT *hDrvObject)
for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension();
pszdevNode != NULL; pszdevNode = (struct DRV_EXT *)
DRV_GetNextDevExtension((u32)pszdevNode)) {
+   if (!pDRVObject->devNodeString)
+   /* List already deleted */
+   break;
+
if ((u32)pszdevNode == dwContext) {
/* Found it */
/* Delete from the Driver object list */
LST_RemoveElem(pDRVObject->devNodeString,
- (struct LST_ELEM *)pszdevNode);
+  (struct LST_ELEM *) pszdevNode);
MEM_Free((void *) pszdevNode);
-   break;
}
+
/* Delete the List if it is empty */
if (LST_IsEmpty(pDRVObject->devNodeString)) {
LST_Delete(pDRVObject->devNodeString);
pDRVObject->devNodeString = NULL;
+   break;
}
}
return status;
-- 
1.5.6.5

--
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


[PATCH] dspbridge: Check pointer before usage

2009-09-01 Thread andy . shevchenko
From: Andy Shevchenko 

Check list pointer at every itteration because it could be deleted before we go
into the for loop.

Reworked version of the previous attempts.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/drv.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index d21071c..7e41669 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -1543,8 +1543,9 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct 
DRV_OBJECT *hDrvObject)
 *  The following will over write the status.
 */
for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension();
-   pszdevNode != NULL; pszdevNode = (struct DRV_EXT *)
-   DRV_GetNextDevExtension((u32)pszdevNode)) {
+   pszdevNode != NULL && pDRVObject->devNodeString != NULL;
+   pszdevNode = (struct DRV_EXT *)
+ DRV_GetNextDevExtension((u32) pszdevNode)) {
if ((u32)pszdevNode == dwContext) {
/* Found it */
/* Delete from the Driver object list */
-- 
1.5.6.5

--
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


[PATCH] DSPBRIDGE: Get rid of services/LST_* (step 1)

2009-09-01 Thread Andy Shevchenko
From: Andy Shevchenko 

- Remove LST_Init() and LST_Exit() calls because they are doing nothing except
  tracing, Thus, remove tracing as well.

- Remove DBC_* calls. It's internal kernel business whether to have those
  assertions.

- Switch to list_head structure instead of LST_ELEM. Remove redudant code that
  uses head->self pointer.

- Use native list methods where it's possible in the list.c.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   43 +--
 drivers/dsp/bridge/services/list.c  |  108 +-
 drivers/dsp/bridge/services/mem.c   |2 -
 drivers/dsp/bridge/services/services.c  |9 +--
 4 files changed, 10 insertions(+), 152 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 2e3f995..f9bbd13 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -24,11 +24,9 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
- *  LST_Init
  *  LST_InsertBefore
  *  LST_IsEmpty
  *  LST_Next
@@ -51,14 +49,10 @@
 #define LIST_
 
 #include 
+#include 
 
-#define LST_IsEmpty(l)  (((l)->head.next == &(l)->head))
-
-   struct LST_ELEM {
-   struct LST_ELEM *next;
-   struct LST_ELEM *prev;
-   struct LST_ELEM *self;
-   } ;
+#define LST_ELEMlist_head
+#define LST_IsEmpty(l)  list_empty(&(l)->head)
 
struct LST_LIST {
struct LST_ELEM head;
@@ -111,20 +105,6 @@
extern void LST_Delete(IN struct LST_LIST *pList);
 
 /*
- *   LST_Exit 
- *  Purpose:
- *  Discontinue usage of module; free resources when reference count
- *  reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Resources used by module are freed when cRef reaches zero.
- */
-   extern void LST_Exit(void);
-
-/*
  *   LST_First 
  *  Purpose:
  *  Returns a pointer to the first element of the list, or NULL if the list
@@ -160,7 +140,6 @@
  *  Pointer to element that was at the head of the list (success)
  *  NULL  No elements in list
  *  Requires:
- *  - head.self must be correctly set to &head.
  *  - LST initialized.
  *  - pList != NULL.
  *  Ensures:
@@ -172,19 +151,6 @@
extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
 
 /*
- *   LST_Init 
- *  Purpose:
- *  Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *  LST initialized.
- */
-   extern bool LST_Init(void);
-
-/*
  *   LST_InitElem 
  *  Purpose:
  *  Initializes a list element to default (cleared) values
@@ -262,15 +228,12 @@
  *  Void
  *  Requires:
  *  *pElem and *pList must both exist.
- *  pElem->self = pElem before pElem is passed to this function.
  *  LST initialized.
  *  Ensures:
  *  Notes:
  *  Because the tail is always "just before" the head of the list (the
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list), the list is circular.
- *  Warning: if pElem->self is not set beforehand, LST_GetHead() will
- *  return an erroneous pointer when it is called for this element.
  */
extern void LST_PutTail(IN struct LST_LIST *pList,
IN struct LST_ELEM *pListElem);
diff --git a/drivers/dsp/bridge/services/list.c 
b/drivers/dsp/bridge/services/list.c
index 7fa3e76..b215b68 100644
--- a/drivers/dsp/bridge/services/list.c
+++ b/drivers/dsp/bridge/services/list.c
@@ -23,10 +23,8 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
- *  LST_Init
  *  LST_InitElem
  *  LST_InsertBefore
  *  LST_Next
@@ -51,21 +49,12 @@
 #include 
 #include 
 
-/*  --- Trace & Debug */
-#include 
-#include 
-
 /*  --- OS Adaptation Layer */
 #include 
 
 /*  --- This */
 #include 
 
-/*  --- Globals */
-#if GT_TRACE
-static struct GT_Mask LST_debugMask = { NULL, NULL };  /* GT trace var. */
-#endif
-
 /*
  *   LST_Create 
  *  Purpose:
@@ -75,14 +64,10 @@ struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
 
-   GT_0trace(LST_debugMask, GT_ENTER, "LST_Create: entered\n");
-
pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
MEM_NONPAGED);
if (pList != NULL) {
- 

[PATCH 2/2] DSPBRIDGE: Get rid of services/list.c (step 2)

2009-09-01 Thread Andy Shevchenko
From: Andy Shevchenko 

* Use native list_empty() method instead of LST_IsEmpty() inside list.c. Remove
  extra local variables.
* Move methods from list.c as inline functions in the list.h. Get rid of list.c
  at all.
* Use list_head natively instead of LST_ELEM in the list.h.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   86 ++---
 drivers/dsp/bridge/Kbuild   |2 +-
 drivers/dsp/bridge/services/list.c  |  187 ---
 3 files changed, 70 insertions(+), 205 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/list.c

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index f9bbd13..c9d9e49 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,14 +49,16 @@
 #define LIST_
 
 #include 
+/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
+#include 
 #include 
 
 #define LST_ELEMlist_head
 #define LST_IsEmpty(l)  list_empty(&(l)->head)
 
-   struct LST_LIST {
-   struct LST_ELEM head;
-   } ;
+struct LST_LIST {
+   struct list_head head;
+};
 
 /*
  *   LST_Create 
@@ -80,7 +82,17 @@
  *  "empty" element, because its "next" and "prev" pointers point at
  *  the same location (the element itself).
  */
-   extern struct LST_LIST *LST_Create(void);
+static inline struct LST_LIST *LST_Create(void)
+{
+   struct LST_LIST *pList;
+
+   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
+   MEM_NONPAGED);
+   if (pList != NULL)
+   INIT_LIST_HEAD(&pList->head);
+
+   return pList;
+}
 
 /*
  *   LST_Delete 
@@ -102,7 +114,10 @@
  *  chain of list elements.  Calling this function on a non-empty list
  *  will cause a memory leak.
  */
-   extern void LST_Delete(IN struct LST_LIST *pList);
+static inline void LST_Delete(struct LST_LIST *pList)
+{
+   MEM_Free(pList);
+}
 
 /*
  *   LST_First 
@@ -118,7 +133,12 @@
  *  - pList != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
+static inline struct list_head *LST_First(struct LST_LIST *pList)
+{
+   if (!list_empty(&pList->head))
+   return pList->head.next;
+   return NULL;
+}
 
 /*
  *   LST_GetHead 
@@ -148,7 +168,19 @@
  *  the head of the list, and the head of the list points backward (its
  *  "prev" pointer) to the tail of the list, this list is circular.
  */
-   extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
+static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
+{
+   struct list_head *pElem;
+
+   if (list_empty(&pList->head))
+   return NULL;
+
+   pElem = pList->head.next;
+   pList->head.next = pElem->next;
+   pElem->next->prev = &pList->head;
+
+   return pElem;
+}
 
 /*
  *   LST_InitElem 
@@ -166,7 +198,13 @@
  *  of a list chain -- that would break the chain.
  *
  */
-   extern void LST_InitElem(IN struct LST_ELEM *pListElem);
+static inline void LST_InitElem(struct list_head *pElem)
+{
+   if (pElem) {
+   pElem->next = NULL;
+   pElem->prev = NULL;
+   }
+}
 
 /*
  *   LST_InsertBefore 
@@ -184,9 +222,12 @@
  *  - pElemExisting != NULL.
  *  Ensures:
  */
-   extern void LST_InsertBefore(IN struct LST_LIST *pList,
-IN struct LST_ELEM *pElem,
-IN struct LST_ELEM *pElemExisting);
+static inline void LST_InsertBefore(struct LST_LIST *pList,
+   struct list_head *pElem,
+   struct list_head *pElemExisting)
+{
+   list_add_tail(pElem, pElemExisting);
+}
 
 /*
  *   LST_Next 
@@ -204,8 +245,13 @@
  *  - pCurElem != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_Next(IN struct LST_LIST *pList,
-IN struct LST_ELEM *pCurElem);
+static inline struct list_head *LST_Next(struct LST_LIST *pList,
+struct list_head *pCurElem)
+{
+   if (!list_empty(&pList->head) && (pCurElem->next != &pList->head))
+   return pCurElem->next;
+   return NULL;
+}
 
 /*
  *   LST_PutTail 
@@ -235,8 +281,10 @@
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list), the list is circular.
  */
-   extern void LST_PutTail(IN struct LST_LIST *pList,
-   IN struct LST_ELEM *pListElem);
+static inline void LST_PutTail(str

[PATCH 1/2] DSPBRIDGE: Get rid of services/list.c (step 1)

2009-09-01 Thread Andy Shevchenko
From: Andy Shevchenko 

* Remove LST_Init() and LST_Exit() calls because they are doing nothing except
  tracing, Thus, remove tracing as well.

* Remove DBC_* calls. It's internal kernel business whether to have those
  assertions.

* Switch to list_head structure instead of LST_ELEM. Remove redudant code that
  uses head->self pointer.

* Use native list methods where it's possible in the list.c.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   43 +--
 drivers/dsp/bridge/services/list.c  |  108 +-
 drivers/dsp/bridge/services/mem.c   |2 -
 drivers/dsp/bridge/services/services.c  |9 +--
 4 files changed, 10 insertions(+), 152 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 2e3f995..f9bbd13 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -24,11 +24,9 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
- *  LST_Init
  *  LST_InsertBefore
  *  LST_IsEmpty
  *  LST_Next
@@ -51,14 +49,10 @@
 #define LIST_
 
 #include 
+#include 
 
-#define LST_IsEmpty(l)  (((l)->head.next == &(l)->head))
-
-   struct LST_ELEM {
-   struct LST_ELEM *next;
-   struct LST_ELEM *prev;
-   struct LST_ELEM *self;
-   } ;
+#define LST_ELEMlist_head
+#define LST_IsEmpty(l)  list_empty(&(l)->head)
 
struct LST_LIST {
struct LST_ELEM head;
@@ -111,20 +105,6 @@
extern void LST_Delete(IN struct LST_LIST *pList);
 
 /*
- *   LST_Exit 
- *  Purpose:
- *  Discontinue usage of module; free resources when reference count
- *  reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Resources used by module are freed when cRef reaches zero.
- */
-   extern void LST_Exit(void);
-
-/*
  *   LST_First 
  *  Purpose:
  *  Returns a pointer to the first element of the list, or NULL if the list
@@ -160,7 +140,6 @@
  *  Pointer to element that was at the head of the list (success)
  *  NULL  No elements in list
  *  Requires:
- *  - head.self must be correctly set to &head.
  *  - LST initialized.
  *  - pList != NULL.
  *  Ensures:
@@ -172,19 +151,6 @@
extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
 
 /*
- *   LST_Init 
- *  Purpose:
- *  Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *  LST initialized.
- */
-   extern bool LST_Init(void);
-
-/*
  *   LST_InitElem 
  *  Purpose:
  *  Initializes a list element to default (cleared) values
@@ -262,15 +228,12 @@
  *  Void
  *  Requires:
  *  *pElem and *pList must both exist.
- *  pElem->self = pElem before pElem is passed to this function.
  *  LST initialized.
  *  Ensures:
  *  Notes:
  *  Because the tail is always "just before" the head of the list (the
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list), the list is circular.
- *  Warning: if pElem->self is not set beforehand, LST_GetHead() will
- *  return an erroneous pointer when it is called for this element.
  */
extern void LST_PutTail(IN struct LST_LIST *pList,
IN struct LST_ELEM *pListElem);
diff --git a/drivers/dsp/bridge/services/list.c 
b/drivers/dsp/bridge/services/list.c
index 7fa3e76..b215b68 100644
--- a/drivers/dsp/bridge/services/list.c
+++ b/drivers/dsp/bridge/services/list.c
@@ -23,10 +23,8 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
- *  LST_Init
  *  LST_InitElem
  *  LST_InsertBefore
  *  LST_Next
@@ -51,21 +49,12 @@
 #include 
 #include 
 
-/*  --- Trace & Debug */
-#include 
-#include 
-
 /*  --- OS Adaptation Layer */
 #include 
 
 /*  --- This */
 #include 
 
-/*  --- Globals */
-#if GT_TRACE
-static struct GT_Mask LST_debugMask = { NULL, NULL };  /* GT trace var. */
-#endif
-
 /*
  *   LST_Create 
  *  Purpose:
@@ -75,14 +64,10 @@ struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
 
-   GT_0trace(LST_debugMask, GT_ENTER, "LST_Create: entered\n");
-
pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
MEM_NONPAGED);
if (pList != NULL) {
- 

dspbridge: draft: get rid of services/list.c

2009-09-01 Thread Andy Shevchenko

Hello.

Here are two patches which change driver's own circular linked list
implementation to native one in linux kernel. The initial idea was come from
Hiroshi Doyu.

P.S. Please, ignore mail with 'Message-ID:
<1251793647-14569-1-git-send-email-andy.shevche...@gmail.com>'


-- 
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


[PATCH] dspbridge: use linux memory allocator directly

2009-09-02 Thread Andy Shevchenko
From: Andy Shevchenko 

Instead of MEM_Calloc()/MEM_Free() use kzalloc()/kfree() calls. Thus we get rid
of mem.h dependency.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index c9d9e49..cda1d21 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,8 +49,8 @@
 #define LIST_
 
 #include 
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include 
+#include 
+#include 
 #include 
 
 #define LST_ELEMlist_head
@@ -85,9 +85,9 @@ struct LST_LIST {
 static inline struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
+   gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
 
-   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-   MEM_NONPAGED);
+   pList = (struct LST_LIST *) kzalloc(sizeof(struct LST_LIST), flags);
if (pList != NULL)
INIT_LIST_HEAD(&pList->head);
 
@@ -116,7 +116,8 @@ static inline struct LST_LIST *LST_Create(void)
  */
 static inline void LST_Delete(struct LST_LIST *pList)
 {
-   MEM_Free(pList);
+   if (pList != NULL)
+   kfree(pList);
 }
 
 /*
-- 
1.5.6.5

--
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


[PATCH] dspbridge: use linux memory allocator directly

2009-09-02 Thread Andy Shevchenko
From: Andy Shevchenko 

Instead of MEM_Calloc()/MEM_Free() use kzalloc()/kfree() calls. Thus we get rid
of mem.h dependency.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index c9d9e49..cda1d21 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,8 +49,8 @@
 #define LIST_
 
 #include 
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include 
+#include 
+#include 
 #include 
 
 #define LST_ELEMlist_head
@@ -85,9 +85,9 @@ struct LST_LIST {
 static inline struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
+   gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
 
-   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-   MEM_NONPAGED);
+   pList = (struct LST_LIST *) kzalloc(sizeof(struct LST_LIST), flags);
if (pList != NULL)
INIT_LIST_HEAD(&pList->head);
 
@@ -116,7 +116,7 @@ static inline struct LST_LIST *LST_Create(void)
  */
 static inline void LST_Delete(struct LST_LIST *pList)
 {
-   MEM_Free(pList);
+   kfree(pList);
 }
 
 /*
-- 
1.5.6.5

--
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


[PATCH 2/4] DSPBRIDGE: Get rid of services/list.c (step 2)

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

* Use native list_empty() method instead of LST_IsEmpty() inside list.c. Remove
  extra local variables.
* Move methods from list.c as inline functions in the list.h. Get rid of list.c
  at all.
* Use list_head natively instead of LST_ELEM in the list.h.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   86 ++---
 drivers/dsp/bridge/Kbuild   |2 +-
 drivers/dsp/bridge/services/list.c  |  187 ---
 3 files changed, 70 insertions(+), 205 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/list.c

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index f9bbd13..c9d9e49 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,14 +49,16 @@
 #define LIST_
 
 #include 
+/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
+#include 
 #include 
 
 #define LST_ELEMlist_head
 #define LST_IsEmpty(l)  list_empty(&(l)->head)
 
-   struct LST_LIST {
-   struct LST_ELEM head;
-   } ;
+struct LST_LIST {
+   struct list_head head;
+};
 
 /*
  *   LST_Create 
@@ -80,7 +82,17 @@
  *  "empty" element, because its "next" and "prev" pointers point at
  *  the same location (the element itself).
  */
-   extern struct LST_LIST *LST_Create(void);
+static inline struct LST_LIST *LST_Create(void)
+{
+   struct LST_LIST *pList;
+
+   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
+   MEM_NONPAGED);
+   if (pList != NULL)
+   INIT_LIST_HEAD(&pList->head);
+
+   return pList;
+}
 
 /*
  *   LST_Delete 
@@ -102,7 +114,10 @@
  *  chain of list elements.  Calling this function on a non-empty list
  *  will cause a memory leak.
  */
-   extern void LST_Delete(IN struct LST_LIST *pList);
+static inline void LST_Delete(struct LST_LIST *pList)
+{
+   MEM_Free(pList);
+}
 
 /*
  *   LST_First 
@@ -118,7 +133,12 @@
  *  - pList != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
+static inline struct list_head *LST_First(struct LST_LIST *pList)
+{
+   if (!list_empty(&pList->head))
+   return pList->head.next;
+   return NULL;
+}
 
 /*
  *   LST_GetHead 
@@ -148,7 +168,19 @@
  *  the head of the list, and the head of the list points backward (its
  *  "prev" pointer) to the tail of the list, this list is circular.
  */
-   extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
+static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
+{
+   struct list_head *pElem;
+
+   if (list_empty(&pList->head))
+   return NULL;
+
+   pElem = pList->head.next;
+   pList->head.next = pElem->next;
+   pElem->next->prev = &pList->head;
+
+   return pElem;
+}
 
 /*
  *   LST_InitElem 
@@ -166,7 +198,13 @@
  *  of a list chain -- that would break the chain.
  *
  */
-   extern void LST_InitElem(IN struct LST_ELEM *pListElem);
+static inline void LST_InitElem(struct list_head *pElem)
+{
+   if (pElem) {
+   pElem->next = NULL;
+   pElem->prev = NULL;
+   }
+}
 
 /*
  *   LST_InsertBefore 
@@ -184,9 +222,12 @@
  *  - pElemExisting != NULL.
  *  Ensures:
  */
-   extern void LST_InsertBefore(IN struct LST_LIST *pList,
-IN struct LST_ELEM *pElem,
-IN struct LST_ELEM *pElemExisting);
+static inline void LST_InsertBefore(struct LST_LIST *pList,
+   struct list_head *pElem,
+   struct list_head *pElemExisting)
+{
+   list_add_tail(pElem, pElemExisting);
+}
 
 /*
  *   LST_Next 
@@ -204,8 +245,13 @@
  *  - pCurElem != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_Next(IN struct LST_LIST *pList,
-IN struct LST_ELEM *pCurElem);
+static inline struct list_head *LST_Next(struct LST_LIST *pList,
+struct list_head *pCurElem)
+{
+   if (!list_empty(&pList->head) && (pCurElem->next != &pList->head))
+   return pCurElem->next;
+   return NULL;
+}
 
 /*
  *   LST_PutTail 
@@ -235,8 +281,10 @@
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list), the list is circular.
  */
-   extern void LST_PutTail(IN struct LST_LIST *pList,
-   IN struct LST_ELEM *pListElem);
+static inline void LST_PutTail(str

dspbridge rfc: get rid of services/list.c (try 2)

2009-09-03 Thread Andy Shevchenko

Hello.

Here are two patches which change driver's own circular linked list
implementation to native one in linux kernel. The initial idea was come from
Hiroshi Doyu.

This version includes corrections which I got from Imre and Felipe.
Additionally the fourth patch changes LST_ELEM name to native list_head in
whole dsp bridge driver.

--
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


[PATCH 3/4] dspbridge: use linux memory allocator directly

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

Instead of MEM_Calloc()/MEM_Free() use kzalloc()/kfree() calls. Thus we get rid
of mem.h dependency.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index c9d9e49..9efbe9c 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,8 +49,8 @@
 #define LIST_
 
 #include 
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include 
+#include 
+#include 
 #include 
 
 #define LST_ELEMlist_head
@@ -85,9 +85,9 @@ struct LST_LIST {
 static inline struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
+   gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
 
-   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-   MEM_NONPAGED);
+   pList = kzalloc(sizeof(*pList), flags);
if (pList != NULL)
INIT_LIST_HEAD(&pList->head);
 
@@ -116,7 +116,7 @@ static inline struct LST_LIST *LST_Create(void)
  */
 static inline void LST_Delete(struct LST_LIST *pList)
 {
-   MEM_Free(pList);
+   kfree(pList);
 }
 
 /*
-- 
1.5.6.5

--
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


[PATCH 1/4] DSPBRIDGE: Get rid of services/list.c (step 1)

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

* Remove LST_Init() and LST_Exit() calls because they are doing nothing except
  tracing, Thus, remove tracing as well.

* Remove DBC_* calls. It's internal kernel business whether to have those
  assertions.

* Switch to list_head structure instead of LST_ELEM. Remove redudant code that
  uses head->self pointer.

* Use native list methods where it's possible in the list.c.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   43 +--
 drivers/dsp/bridge/services/list.c  |  108 +-
 drivers/dsp/bridge/services/mem.c   |2 -
 drivers/dsp/bridge/services/services.c  |9 +--
 4 files changed, 10 insertions(+), 152 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 2e3f995..f9bbd13 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -24,11 +24,9 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
- *  LST_Init
  *  LST_InsertBefore
  *  LST_IsEmpty
  *  LST_Next
@@ -51,14 +49,10 @@
 #define LIST_
 
 #include 
+#include 
 
-#define LST_IsEmpty(l)  (((l)->head.next == &(l)->head))
-
-   struct LST_ELEM {
-   struct LST_ELEM *next;
-   struct LST_ELEM *prev;
-   struct LST_ELEM *self;
-   } ;
+#define LST_ELEMlist_head
+#define LST_IsEmpty(l)  list_empty(&(l)->head)
 
struct LST_LIST {
struct LST_ELEM head;
@@ -111,20 +105,6 @@
extern void LST_Delete(IN struct LST_LIST *pList);
 
 /*
- *   LST_Exit 
- *  Purpose:
- *  Discontinue usage of module; free resources when reference count
- *  reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Resources used by module are freed when cRef reaches zero.
- */
-   extern void LST_Exit(void);
-
-/*
  *   LST_First 
  *  Purpose:
  *  Returns a pointer to the first element of the list, or NULL if the list
@@ -160,7 +140,6 @@
  *  Pointer to element that was at the head of the list (success)
  *  NULL  No elements in list
  *  Requires:
- *  - head.self must be correctly set to &head.
  *  - LST initialized.
  *  - pList != NULL.
  *  Ensures:
@@ -172,19 +151,6 @@
extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
 
 /*
- *   LST_Init 
- *  Purpose:
- *  Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *  LST initialized.
- */
-   extern bool LST_Init(void);
-
-/*
  *   LST_InitElem 
  *  Purpose:
  *  Initializes a list element to default (cleared) values
@@ -262,15 +228,12 @@
  *  Void
  *  Requires:
  *  *pElem and *pList must both exist.
- *  pElem->self = pElem before pElem is passed to this function.
  *  LST initialized.
  *  Ensures:
  *  Notes:
  *  Because the tail is always "just before" the head of the list (the
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list), the list is circular.
- *  Warning: if pElem->self is not set beforehand, LST_GetHead() will
- *  return an erroneous pointer when it is called for this element.
  */
extern void LST_PutTail(IN struct LST_LIST *pList,
IN struct LST_ELEM *pListElem);
diff --git a/drivers/dsp/bridge/services/list.c 
b/drivers/dsp/bridge/services/list.c
index 7fa3e76..b215b68 100644
--- a/drivers/dsp/bridge/services/list.c
+++ b/drivers/dsp/bridge/services/list.c
@@ -23,10 +23,8 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
- *  LST_Init
  *  LST_InitElem
  *  LST_InsertBefore
  *  LST_Next
@@ -51,21 +49,12 @@
 #include 
 #include 
 
-/*  --- Trace & Debug */
-#include 
-#include 
-
 /*  --- OS Adaptation Layer */
 #include 
 
 /*  --- This */
 #include 
 
-/*  --- Globals */
-#if GT_TRACE
-static struct GT_Mask LST_debugMask = { NULL, NULL };  /* GT trace var. */
-#endif
-
 /*
  *   LST_Create 
  *  Purpose:
@@ -75,14 +64,10 @@ struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
 
-   GT_0trace(LST_debugMask, GT_ENTER, "LST_Create: entered\n");
-
pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
MEM_NONPAGED);
if (pList != NULL) {
- 

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

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

* 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 
---
 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 
 #include 
 
-#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) {
/* Found it */
   

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 Bityutskiy 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 236    3345

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
Shevchenko wrote:
> On Thu, Sep 3, 2009 at 12:17 PM, Artem Bityutskiy 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


[PATCH] dspbridge: Change LST_ELEM to list_head entirely

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

* 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 
---
 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 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 
 #include 
 
-#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..51b5127 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) {
/* Found it */
   

[PATCH] dspbridge: relocate MEM_ExtPhysPoolRelease() call

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

It's more logical to have calls of symmetric functions at single place.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/mem.h |5 +
 drivers/dsp/bridge/rmgr/drv_interface.c|2 ++
 drivers/dsp/bridge/services/mem.c  |4 ++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/mem.h 
b/arch/arm/plat-omap/include/dspbridge/mem.h
index 4e43f21..b47a6d4 100644
--- a/arch/arm/plat-omap/include/dspbridge/mem.h
+++ b/arch/arm/plat-omap/include/dspbridge/mem.h
@@ -354,4 +354,9 @@
extern void MEM_ExtPhysPoolInit(IN u32 poolPhysBase,
IN u32 poolSize);
 
+/*
+ *   MEM_ExtPhysPoolRelease 
+ */
+   extern void MEM_ExtPhysPoolRelease(void);
+
 #endif /* MEM_ */
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index 08b5cde..e83ba3b 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -503,6 +503,8 @@ static int __devexit omap34xx_bridge_remove(struct 
platform_device *pdev)
clk_handle = NULL;
 
 func_cont:
+   MEM_ExtPhysPoolRelease();
+
SERVICES_Exit();
GT_exit();
 
diff --git a/drivers/dsp/bridge/services/mem.c 
b/drivers/dsp/bridge/services/mem.c
index 22f382b..5836bae 100644
--- a/drivers/dsp/bridge/services/mem.c
+++ b/drivers/dsp/bridge/services/mem.c
@@ -30,6 +30,7 @@
  *  MEM_FreePhysMem
  *  MEM_Init
  *  MEM_ExtPhysPoolInit
+ *  MEM_ExtPhysPoolRelease
  *
  *! Revision History:
  *! =
@@ -199,7 +200,7 @@ void MEM_ExtPhysPoolInit(u32 poolPhysBase, u32 poolSize)
}
 }
 
-static void MEM_ExtPhysPoolRelease(void)
+void MEM_ExtPhysPoolRelease(void)
 {
GT_0trace(MEM_debugMask, GT_1CLASS,
  "Releasing External memory pool \n");
@@ -460,7 +461,6 @@ void MEM_Exit(void)
MEM_Check();
 
 #endif
-   MEM_ExtPhysPoolRelease();
DBC_Ensure(cRefs >= 0);
 }
 
-- 
1.5.6.5

--
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


[PATCH] DSPBRIDGE: remove unsed piece of code

2009-09-03 Thread Andy Shevchenko
From: Andy Shevchenko 

I doubt about usefulness of removed piece of code. But it seems to be not used
because of unchanged value of bJustWokeDSP.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/node.c |   17 -
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/node.c b/drivers/dsp/bridge/rmgr/node.c
index e213b22..a156182 100644
--- a/drivers/dsp/bridge/rmgr/node.c
+++ b/drivers/dsp/bridge/rmgr/node.c
@@ -1278,7 +1278,6 @@ DSP_STATUS NODE_Create(struct NODE_OBJECT *hNode)
enum NODE_TYPE nodeType;
DSP_STATUS status = DSP_SOK;
DSP_STATUS status1 = DSP_SOK;
-   bool bJustWokeDSP = false;
struct DSP_CBDATA cbData;
u32 procId = 255;
struct DSP_PROCESSORSTATE procStatus;
@@ -1429,22 +1428,6 @@ func_cont2:
/* Put back in NODE_ALLOCATED state if error occurred */
NODE_SetState(hNode, NODE_ALLOCATED);
}
-   if (procId == DSP_UNIT) {
-   /* If node create failed, see if should sleep DSP now */
-   if (bJustWokeDSP == true) {
-   /* Check to see if partial create happened on DSP */
-   if (hNode->nodeEnv == (u32)NULL) {
-   /* No environment allocated on DSP, re-sleep
-* DSP now */
-   PROC_Ctrl(hNode->hProcessor, WMDIOCTL_DEEPSLEEP,
-&cbData);
-   } else {
-   /* Increment count, sleep later when node fully
-* deleted */
-   hNodeMgr->uNumCreated++;
-   }
-   }
-   }
 func_cont:
/* Free access to node dispatcher */
(void)SYNC_LeaveCS(hNodeMgr->hSync);
-- 
1.5.6.5

--
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


[PATCH 3/4] dspbridge: use linux memory allocator directly

2009-09-04 Thread Andy Shevchenko
From: Andy Shevchenko 

Instead of MEM_Calloc()/MEM_Free() use kzalloc()/kfree() calls. Thus we get rid
of mem.h dependency.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 414579f..867f5ac 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,8 +49,8 @@
 #define LIST_
 
 #include 
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include 
+#include 
+#include 
 #include 
 
 #define LST_ELEMlist_head
@@ -85,9 +85,9 @@ struct LST_LIST {
 static inline struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
+   gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
 
-   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-   MEM_NONPAGED);
+   pList = kzalloc(sizeof(*pList), flags);
if (pList != NULL)
INIT_LIST_HEAD(&pList->head);
 
@@ -116,8 +116,7 @@ static inline struct LST_LIST *LST_Create(void)
  */
 static inline void LST_Delete(struct LST_LIST *pList)
 {
-   if (pList != NULL)
-   MEM_Free(pList);
+   kfree(pList);
 }
 
 /*
-- 
1.5.6.5

--
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


[PATCH 2/4] DSPBRIDGE: Get rid of services/list.c

2009-09-04 Thread Andy Shevchenko
From: Andy Shevchenko 

* Use native list_empty() method instead of LST_IsEmpty() inside list.c. Remove
  extra local variables.
* Move methods from list.c as inline functions in the list.h. Get rid of list.c
  at all.
* Use list_head natively instead of LST_ELEM in the list.h.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   90 ++---
 drivers/dsp/bridge/Kbuild   |2 +-
 drivers/dsp/bridge/services/list.c  |  200 ---
 3 files changed, 74 insertions(+), 218 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/list.c

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index f9bbd13..414579f 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,14 +49,16 @@
 #define LIST_
 
 #include 
+/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
+#include 
 #include 
 
 #define LST_ELEMlist_head
 #define LST_IsEmpty(l)  list_empty(&(l)->head)
 
-   struct LST_LIST {
-   struct LST_ELEM head;
-   } ;
+struct LST_LIST {
+   struct list_head head;
+};
 
 /*
  *   LST_Create 
@@ -80,7 +82,17 @@
  *  "empty" element, because its "next" and "prev" pointers point at
  *  the same location (the element itself).
  */
-   extern struct LST_LIST *LST_Create(void);
+static inline struct LST_LIST *LST_Create(void)
+{
+   struct LST_LIST *pList;
+
+   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
+   MEM_NONPAGED);
+   if (pList != NULL)
+   INIT_LIST_HEAD(&pList->head);
+
+   return pList;
+}
 
 /*
  *   LST_Delete 
@@ -102,7 +114,11 @@
  *  chain of list elements.  Calling this function on a non-empty list
  *  will cause a memory leak.
  */
-   extern void LST_Delete(IN struct LST_LIST *pList);
+static inline void LST_Delete(struct LST_LIST *pList)
+{
+   if (pList != NULL)
+   MEM_Free(pList);
+}
 
 /*
  *   LST_First 
@@ -118,7 +134,12 @@
  *  - pList != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
+static inline struct list_head *LST_First(struct LST_LIST *pList)
+{
+   if (pList && !list_empty(&pList->head))
+   return pList->head.next;
+   return NULL;
+}
 
 /*
  *   LST_GetHead 
@@ -148,7 +169,19 @@
  *  the head of the list, and the head of the list points backward (its
  *  "prev" pointer) to the tail of the list, this list is circular.
  */
-   extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
+static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
+{
+   struct list_head *pElem;
+
+   if (!pList && list_empty(&pList->head))
+   return NULL;
+
+   pElem = pList->head.next;
+   pList->head.next = pElem->next;
+   pElem->next->prev = &pList->head;
+
+   return pElem;
+}
 
 /*
  *   LST_InitElem 
@@ -166,7 +199,13 @@
  *  of a list chain -- that would break the chain.
  *
  */
-   extern void LST_InitElem(IN struct LST_ELEM *pListElem);
+static inline void LST_InitElem(struct list_head *pElem)
+{
+   if (pElem) {
+   pElem->next = NULL;
+   pElem->prev = NULL;
+   }
+}
 
 /*
  *   LST_InsertBefore 
@@ -184,9 +223,13 @@
  *  - pElemExisting != NULL.
  *  Ensures:
  */
-   extern void LST_InsertBefore(IN struct LST_LIST *pList,
-IN struct LST_ELEM *pElem,
-IN struct LST_ELEM *pElemExisting);
+static inline void LST_InsertBefore(struct LST_LIST *pList,
+   struct list_head *pElem,
+   struct list_head *pElemExisting)
+{
+   if (pList && pElem && pElemExisting)
+   list_add_tail(pElem, pElemExisting);
+}
 
 /*
  *   LST_Next 
@@ -204,8 +247,14 @@
  *  - pCurElem != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_Next(IN struct LST_LIST *pList,
-IN struct LST_ELEM *pCurElem);
+static inline struct list_head *LST_Next(struct LST_LIST *pList,
+struct list_head *pCurElem)
+{
+   if (pList && !list_empty(&pList->head) && pCurElem &&
+  (pCurElem->next != &pList->head))
+   return pCurElem->next;
+   return NULL;
+}
 
 /*
  *   LST_PutTail 
@@ -235,8 +284,11 @@
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list),

dspbridge rfc: get rid of services/list.c (rebased)

2009-09-04 Thread Andy Shevchenko

Hello.

Here are a few patches which change driver's own circular linked list
implementation to native one in linux kernel. The initial idea was come from
Hiroshi Doyu.

This version includes corrections which I got from Imre and Felipe.
Additionally the fourth patch changes LST_ELEM name to native list_head in
whole dsp bridge driver.

All patches are rebased against android-bridge-2.6.29 kernel branch of the
kernel-dspbridge repository.

-- 
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


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

2009-09-04 Thread Andy Shevchenko
From: Andy Shevchenko 

* 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 
---
 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 
 #include 
 
-#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) {
/* Found it */
   

[PATCH 1/4] DSPBRIDGE: Get rid of services/list.c

2009-09-04 Thread Andy Shevchenko
From: Andy Shevchenko 

* Remove LST_Init() and LST_Exit() calls because they are doing nothing except
  tracing, Thus, remove tracing as well.

* Remove DBC_* calls. It's internal kernel business whether to have those
  assertions.

* Switch to list_head structure instead of LST_ELEM. Remove redudant code that
  uses head->self pointer.

* Use native list methods where it's possible in the list.c.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   43 +
 drivers/dsp/bridge/services/list.c  |   89 ++-
 drivers/dsp/bridge/services/mem.c   |2 -
 drivers/dsp/bridge/services/services.c  |9 +--
 4 files changed, 10 insertions(+), 133 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 2e3f995..f9bbd13 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -24,11 +24,9 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
- *  LST_Init
  *  LST_InsertBefore
  *  LST_IsEmpty
  *  LST_Next
@@ -51,14 +49,10 @@
 #define LIST_
 
 #include 
+#include 
 
-#define LST_IsEmpty(l)  (((l)->head.next == &(l)->head))
-
-   struct LST_ELEM {
-   struct LST_ELEM *next;
-   struct LST_ELEM *prev;
-   struct LST_ELEM *self;
-   } ;
+#define LST_ELEMlist_head
+#define LST_IsEmpty(l)  list_empty(&(l)->head)
 
struct LST_LIST {
struct LST_ELEM head;
@@ -111,20 +105,6 @@
extern void LST_Delete(IN struct LST_LIST *pList);
 
 /*
- *   LST_Exit 
- *  Purpose:
- *  Discontinue usage of module; free resources when reference count
- *  reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Resources used by module are freed when cRef reaches zero.
- */
-   extern void LST_Exit(void);
-
-/*
  *   LST_First 
  *  Purpose:
  *  Returns a pointer to the first element of the list, or NULL if the list
@@ -160,7 +140,6 @@
  *  Pointer to element that was at the head of the list (success)
  *  NULL  No elements in list
  *  Requires:
- *  - head.self must be correctly set to &head.
  *  - LST initialized.
  *  - pList != NULL.
  *  Ensures:
@@ -172,19 +151,6 @@
extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
 
 /*
- *   LST_Init 
- *  Purpose:
- *  Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *  LST initialized.
- */
-   extern bool LST_Init(void);
-
-/*
  *   LST_InitElem 
  *  Purpose:
  *  Initializes a list element to default (cleared) values
@@ -262,15 +228,12 @@
  *  Void
  *  Requires:
  *  *pElem and *pList must both exist.
- *  pElem->self = pElem before pElem is passed to this function.
  *  LST initialized.
  *  Ensures:
  *  Notes:
  *  Because the tail is always "just before" the head of the list (the
  *  tail's "next" pointer points at the head of the list, and the head's
  *  "prev" pointer points at the tail of the list), the list is circular.
- *  Warning: if pElem->self is not set beforehand, LST_GetHead() will
- *  return an erroneous pointer when it is called for this element.
  */
extern void LST_PutTail(IN struct LST_LIST *pList,
IN struct LST_ELEM *pListElem);
diff --git a/drivers/dsp/bridge/services/list.c 
b/drivers/dsp/bridge/services/list.c
index 7ac7772..bc82613 100644
--- a/drivers/dsp/bridge/services/list.c
+++ b/drivers/dsp/bridge/services/list.c
@@ -23,10 +23,8 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
- *  LST_Init
  *  LST_InitElem
  *  LST_InsertBefore
  *  LST_Next
@@ -51,21 +49,12 @@
 #include 
 #include 
 
-/*  --- Trace & Debug */
-#include 
-#include 
-
 /*  --- OS Adaptation Layer */
 #include 
 
 /*  --- This */
 #include 
 
-/*  --- Globals */
-#if GT_TRACE
-static struct GT_Mask LST_debugMask = { NULL, NULL };  /* GT trace var. */
-#endif
-
 /*
  *   LST_Create 
  *  Purpose:
@@ -75,14 +64,10 @@ struct LST_LIST *LST_Create(void)
 {
struct LST_LIST *pList;
 
-   GT_0trace(LST_debugMask, GT_ENTER, "LST_Create: entered\n");
-
pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
MEM_NONPAGED);
if (pList != NULL) {
- 

Re: [PATCH 3/4] dspbridge: use linux memory allocator directly

2009-09-04 Thread Andy Shevchenko
On Fri, Sep 4, 2009 at 2:02 PM, Artem Bityutskiy wrote:

>>  static inline struct LST_LIST *LST_Create(void)
> Would be nice to kill this whole function as well.

> I guess whole 'LST_Delete()' could go away as well?

Good point, I thought to get rid of a bit later.
Anyway, I will look into. But probably this mean to revert back to
MEM_* calls when we would like to create or destroy list head...

-- 
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


[PATCH 1/1] DSPBRIDGE: don't use potential invalid pointer

2009-09-07 Thread Andy Shevchenko
From: Andy Shevchenko 

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/proc.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index 832930e..52e2d54 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -323,6 +323,7 @@ PROC_Attach(u32 uProcessor, OPTIONAL CONST struct 
DSP_PROCESSORATTRIN *pAttrIn,
 "PROC_Attach: Could not allocate "
 "storage for notification \n");
MEM_FreeObject(pProcObject);
+   goto func_end;
}
 #ifndef RES_CLEANUP_DISABLE
spin_lock(&pr_ctxt->proc_list_lock);
-- 
1.5.6.5

--
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


dspbridge rfc: get rid of services/list.c (v3)

2009-09-08 Thread Andy Shevchenko

Hello.

Here are a few patches which change driver's own circular linked list
implementation to native one in linux kernel. The initial idea was come from
Hiroshi Doyu.

This version includes corrections which I got from Imre, Artem and Felipe.

All patches are rebased against android-bridge-2.6.29 kernel branch of the
kernel-dspbridge repository.

Please, review them. Thank 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


[PATCHv3 1/3] DSPBRIDGE: Get rid of services/list.c

2009-09-08 Thread Andy Shevchenko
From: Andy Shevchenko 

* Remove LST_Init() and LST_Exit() calls because they are doing nothing except
  tracing, Thus, remove tracing as well.

* Remove DBC_* calls. It's internal kernel business whether to have those
  assertions.

* Move methods from list.c as inline functions to the list.h.

* Switch to list_head structure instead of LST_ELEM:
  - define LST_ELEM as list_head via macro
  - substitute LST_ELEM by list_head
  - remove redudant code that uses head->self pointer

* Remove extra local variables.

* Use native list methods where it's possible inside the list.h.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |  131 +++--
 drivers/dsp/bridge/Kbuild   |2 +-
 drivers/dsp/bridge/services/list.c  |  279 ---
 drivers/dsp/bridge/services/mem.c   |2 -
 drivers/dsp/bridge/services/services.c  |9 +-
 5 files changed, 78 insertions(+), 345 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/list.c

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 2e3f995..414579f 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -24,11 +24,9 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
- *  LST_Init
  *  LST_InsertBefore
  *  LST_IsEmpty
  *  LST_Next
@@ -51,18 +49,16 @@
 #define LIST_
 
 #include 
+/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
+#include 
+#include 
 
-#define LST_IsEmpty(l)  (((l)->head.next == &(l)->head))
+#define LST_ELEMlist_head
+#define LST_IsEmpty(l)  list_empty(&(l)->head)
 
-   struct LST_ELEM {
-   struct LST_ELEM *next;
-   struct LST_ELEM *prev;
-   struct LST_ELEM *self;
-   } ;
-
-   struct LST_LIST {
-   struct LST_ELEM head;
-   } ;
+struct LST_LIST {
+   struct list_head head;
+};
 
 /*
  *   LST_Create 
@@ -86,7 +82,17 @@
  *  "empty" element, because its "next" and "prev" pointers point at
  *  the same location (the element itself).
  */
-   extern struct LST_LIST *LST_Create(void);
+static inline struct LST_LIST *LST_Create(void)
+{
+   struct LST_LIST *pList;
+
+   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
+   MEM_NONPAGED);
+   if (pList != NULL)
+   INIT_LIST_HEAD(&pList->head);
+
+   return pList;
+}
 
 /*
  *   LST_Delete 
@@ -108,21 +114,11 @@
  *  chain of list elements.  Calling this function on a non-empty list
  *  will cause a memory leak.
  */
-   extern void LST_Delete(IN struct LST_LIST *pList);
-
-/*
- *   LST_Exit 
- *  Purpose:
- *  Discontinue usage of module; free resources when reference count
- *  reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Resources used by module are freed when cRef reaches zero.
- */
-   extern void LST_Exit(void);
+static inline void LST_Delete(struct LST_LIST *pList)
+{
+   if (pList != NULL)
+   MEM_Free(pList);
+}
 
 /*
  *   LST_First 
@@ -138,7 +134,12 @@
  *  - pList != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
+static inline struct list_head *LST_First(struct LST_LIST *pList)
+{
+   if (pList && !list_empty(&pList->head))
+   return pList->head.next;
+   return NULL;
+}
 
 /*
  *   LST_GetHead 
@@ -160,7 +161,6 @@
  *  Pointer to element that was at the head of the list (success)
  *  NULL  No elements in list
  *  Requires:
- *  - head.self must be correctly set to &head.
  *  - LST initialized.
  *  - pList != NULL.
  *  Ensures:
@@ -169,20 +169,19 @@
  *  the head of the list, and the head of the list points backward (its
  *  "prev" pointer) to the tail of the list, this list is circular.
  */
-   extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
+static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
+{
+   struct list_head *pElem;
 
-/*
- *   LST_Init 
- *  Purpose:
- *  Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *  LST initialized.
- */
-   extern bool LST_Init(void);
+   if (!pList && list_empty(&pList->head))
+   return NULL;
+
+   pElem = pList->head.next;
+   pList->head.next = pElem->next;
+   pElem->next->prev = &pList->head;
+
+   return pElem;
+}
 
 /*
  *   LST_InitElem =

[PATCHv3 3/3] dspbridge: Don't use LST_Create() and LST_Delete()

2009-09-08 Thread Andy Shevchenko
From: Andy Shevchenko 

Change LST_Create() to the MEM_Calloc() and INIT_LIST_HEAD() pair in optimal 
way.

Use MEM_Free() instead of LST_Delete(). We can use it without checking because
MEM_Free() validates input parameter.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   64 ---
 drivers/dsp/bridge/pmgr/cmm.c   |   27 +++
 drivers/dsp/bridge/pmgr/dev.c   |9 +++-
 drivers/dsp/bridge/rmgr/drv.c   |   18 +---
 drivers/dsp/bridge/rmgr/node.c  |6 ++-
 drivers/dsp/bridge/rmgr/rmm.c   |7 ++-
 drivers/dsp/bridge/services/ntfy.c  |6 ++-
 drivers/dsp/bridge/wmd/chnl_sm.c|5 +-
 drivers/dsp/bridge/wmd/msg_sm.c |   26 ---
 9 files changed, 70 insertions(+), 98 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index f382b20..1110baa 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -22,8 +22,6 @@
  *  of inline list management functions.
  *
  *  Public Functions:
- *  LST_Create
- *  LST_Delete
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
@@ -49,8 +47,6 @@
 #define LIST_
 
 #include 
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include 
 #include 
 
 #define LST_IsEmpty(l)  list_empty(&(l)->head)
@@ -60,66 +56,6 @@ struct LST_LIST {
 };
 
 /*
- *   LST_Create 
- *  Purpose:
- *  Allocates and initializes a circular list.
- *  Details:
- *  Uses portable MEM_Calloc() function to allocate a list containing
- *  a single element and initializes that element to indicate that it
- *  is the "end of the list" (i.e., the list is empty).
- *  An empty list is indicated by the "next" pointer in the element
- *  at the head of the list pointing to the head of the list, itself.
- *  Parameters:
- *  Returns:
- *  Pointer to beginning of created list (success)
- *  NULL --> Allocation failed
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Notes:
- *  The created list contains a single element.  This element is the
- *  "empty" element, because its "next" and "prev" pointers point at
- *  the same location (the element itself).
- */
-static inline struct LST_LIST *LST_Create(void)
-{
-   struct LST_LIST *pList;
-
-   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-   MEM_NONPAGED);
-   if (pList != NULL)
-   INIT_LIST_HEAD(&pList->head);
-
-   return pList;
-}
-
-/*
- *   LST_Delete 
- *  Purpose:
- *  Removes a list by freeing its control structure's memory space.
- *  Details:
- *  Uses portable MEM_Free() function to deallocate the memory
- *  block pointed at by the input parameter.
- *  Parameters:
- *  pList:  Pointer to list control structure of list to be deleted
- *  Returns:
- *  Void
- *  Requires:
- *  - LST initialized.
- *  - pList != NULL.
- *  Ensures:
- *  Notes:
- *  Must ONLY be used for empty lists, because it does not walk the
- *  chain of list elements.  Calling this function on a non-empty list
- *  will cause a memory leak.
- */
-static inline void LST_Delete(struct LST_LIST *pList)
-{
-   if (pList != NULL)
-   MEM_Free(pList);
-}
-
-/*
  *   LST_First 
  *  Purpose:
  *  Returns a pointer to the first element of the list, or NULL if the list
diff --git a/drivers/dsp/bridge/pmgr/cmm.c b/drivers/dsp/bridge/pmgr/cmm.c
index 571aa12..fce46fc 100644
--- a/drivers/dsp/bridge/pmgr/cmm.c
+++ b/drivers/dsp/bridge/pmgr/cmm.c
@@ -359,12 +359,15 @@ DSP_STATUS CMM_Create(OUT struct CMM_OBJECT **phCmmMgr,
 * MEM_AllocObject */
if (DSP_SUCCEEDED(status)) {
/* create node free list */
-   pCmmObject->pNodeFreeListHead = LST_Create();
+   pCmmObject->pNodeFreeListHead = MEM_Calloc(sizeof(struct
+   LST_LIST), MEM_NONPAGED);
if (pCmmObject->pNodeFreeListHead == NULL) {
GT_0trace(CMM_debugMask, GT_7CLASS,
- "CMM_Create: LST_Create() "
- "failed \n");
+ "CMM_Create: Out of memory \n");
status = DSP_EMEMORY;
+   } else {
+   INIT_LIST_HEAD(&pCmmObject->pNodeFreeListHead->
+   head);
}
}
if (DSP_SUCCEEDED(status))
@@ -433,7 +436,7 @@ DSP_STATUS CMM_Destroy(struct CMM_OBJECT 

[PATCHv3 2/3] dspbridge: Change LST_ELEM to list_head entirely

2009-09-08 Thread Andy Shevchenko
From: Andy Shevchenko 

* 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 
---
 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 414579f..f382b20 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -53,7 +53,6 @@
 #include 
 #include 
 
-#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) {
/* Found it */
   

[PATCH] DSPBRIDGE: OSAL: Remove CSL

2009-09-14 Thread Andy Shevchenko
From: Andy Shevchenko 

Current DSP bridge driver still contains redudant pieces of CSL code. Get rid
of it finally.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/csl.h |  135 --
 drivers/dsp/bridge/pmgr/chnl.c |1 -
 drivers/dsp/bridge/pmgr/cod.c  |1 -
 drivers/dsp/bridge/pmgr/dbl.c  |   34 --
 drivers/dsp/bridge/pmgr/dbll.c |3 -
 drivers/dsp/bridge/rmgr/dbdcd.c|1 -
 drivers/dsp/bridge/rmgr/disp.c |1 -
 drivers/dsp/bridge/rmgr/drv.c  |1 -
 drivers/dsp/bridge/rmgr/drv_interface.c|1 -
 drivers/dsp/bridge/rmgr/dspdrv.c   |1 -
 drivers/dsp/bridge/rmgr/nldr.c |1 -
 drivers/dsp/bridge/rmgr/node.c |1 -
 drivers/dsp/bridge/rmgr/proc.c |1 -
 drivers/dsp/bridge/services/cfg.c  |1 -
 drivers/dsp/bridge/services/clk.c  |1 -
 drivers/dsp/bridge/services/csl.c  |  173 
 drivers/dsp/bridge/services/kfile.c|1 -
 drivers/dsp/bridge/services/ntfy.c |1 -
 drivers/dsp/bridge/services/reg.c  |1 -
 drivers/dsp/bridge/services/regsup.c   |1 -
 drivers/dsp/bridge/services/services.c |   10 +--
 drivers/dsp/bridge/services/sync.c |1 -
 drivers/dsp/bridge/wmd/chnl_sm.c   |1 -
 drivers/dsp/bridge/wmd/tiomap3430.c|1 -
 drivers/dsp/bridge/wmd/ue_deh.c|1 -
 25 files changed, 23 insertions(+), 352 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/csl.h
 delete mode 100644 drivers/dsp/bridge/services/csl.c

diff --git a/arch/arm/plat-omap/include/dspbridge/csl.h 
b/arch/arm/plat-omap/include/dspbridge/csl.h
deleted file mode 100644
index b90d6ff..000
--- a/arch/arm/plat-omap/include/dspbridge/csl.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * csl.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2008 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- *   csl.h 
- *  Purpose:
- *  Platform independent C Standard library functions.
- *
- *  Public Functions:
- *  CSL_AnsiToWchar
- *  CSL_ByteSwap
- *  CSL_Exit
- *  CSL_Init
- *  CSL_NumToAscii
- *  CSL_Strtok
- *  CSL_Strtokr
- *  CSL_WcharToAnsi
- *
- *! Revision History:
- *! 
- *! 07-Aug-2002 jeh: Added CSL_Strtokr().
- *! 21-Sep-2001 jeh: Added CSL_Strncmp.
- *! 22-Nov-2000 map: Added CSL_Atoi and CSL_Strtok
- *! 19-Nov-2000 kc:  Added CSL_ByteSwap().
- *! 09-Nov-2000 kc:  Added CSL_Strncat.
- *! 29-Oct-1999 kc:  Added CSL_Wstrlen().
- *! 20-Sep-1999 ag:  Added CSL_Wchar2Ansi().
- *! 19-Jan-1998 cr:  Code review cleanup (mostly documentation fixes).
- *! 29-Dec-1997 cr:  Changed CSL_lowercase to CSL_Uppercase, added
- *!  CSL_AnsiToWchar.
- *! 30-Sep-1997 cr:  Added explicit cdecl descriptors to fxn definitions.
- *! 25-Jun-1997 cr:  Added CSL_strcmp.
- *! 12-Jun-1996 gp:  Created.
- */
-
-#ifndef CSL_
-#define CSL_
-
-#include 
-
-/*
- *   CSL_Exit 
- *  Purpose:
- *  Discontinue usage of the CSL module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  CSL initialized.
- *  Ensures:
- *  Resources acquired in CSL_Init(void) are freed.
- */
-   extern void CSL_Exit(void);
-
-/*
- *   CSL_Init 
- *  Purpose:
- *  Initialize the CSL module's private state.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE if error occured.
- *  Requires:
- *  Ensures:
- *  A requirement for each of the other public CSL functions.
- */
-   extern bool CSL_Init(void);
-
-/*
- *   CSL_NumToAscii 
- *  Purpose:
- *  Convert a 1 or 2 digit number to a 2 digit string.
- *  Parameters:
- *  pstrNumber: Buffer to store converted string.
- *  dwNum:  Number to convert.
- *  Returns:
- *  Requires:
- *  pstrNumber must be able to hold at least three characters.
- *  Ensures:
- *  pstrNumber will be null terminated.
- */
-   extern void CSL_NumToAscii(OUT char *pstrNumber, IN u32 dwNum);
-
-
-/*
- *   CSL_Strtok 
- *  Purpose:
- *  Tokenize a NULL terminated string
- *  Parameters:
- *  ptstrSrc:   pointer to string.
- *  szSeparators:   pointer to a string of seperators
- *  Returns:
- *  char *
- *  Requires:
- *  CSL initialized.
- *  ptstrSrc is a valid string pointer.
- *  szSeparators is a valid string pointe

[PATCHv3.1 2/4] dspbridge: Change LST_ELEM to list_head entirely

2009-09-15 Thread Andy Shevchenko
From: Andy Shevchenko 

* 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 
---
 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |2 +-
 arch/arm/plat-omap/include/dspbridge/list.h |1 -
 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/proc.c  |2 +-
 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 c251761..9baa6ae 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -53,7 +53,6 @@
 #include 
 #include 
 
-#define LST_ELEMlist_head
 #define LST_IsEmpty(l)  list_empty(&(l)->head)
 
 struct LST_LIST {
diff --git a/drivers/dsp/bridge/pmgr/cmm.c b/drivers/dsp/bridge/pmgr/cmm.c
index db9baf3..eecb78e 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) {
/* Found it */
LST_RemoveElem(pAllocator->pInUseListHead,
- (struct LST_ELEM *)pCurNode);
+ (struct list_head *)pCurNode);
/* back to freelist */
AddToFreeList(pAllocator, pCurNode);
status = DSP_SOK;   /* all right! */
@@ -504,7 +502,8 @@ DSP_STATUS CMM_FreeBuf(struct CMM_OBJECT *hCmmMgr, void 
*pBufPA, u32 ulSegId)
}
/* next node. */
pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
-  

[PATCHv3.1 1/4] DSPBRIDGE: Get rid of services/list.c

2009-09-15 Thread Andy Shevchenko
From: Andy Shevchenko 

* Remove LST_Init() and LST_Exit() calls because they are doing nothing except
  tracing, Thus, remove tracing as well.

* Remove DBC_* calls. It's internal kernel business whether to have those
  assertions.

* Move methods from list.c as inline functions to the list.h.

* Switch to list_head structure instead of LST_ELEM:
  - define LST_ELEM as list_head via macro
  - substitute LST_ELEM by list_head
  - remove redudant code that uses head->self pointer

* Remove extra local variables.

* Use native list methods where it's possible inside the list.h.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |  131 +++--
 drivers/dsp/bridge/Kbuild   |2 +-
 drivers/dsp/bridge/services/list.c  |  279 ---
 drivers/dsp/bridge/services/mem.c   |2 -
 drivers/dsp/bridge/services/services.c  |9 +-
 5 files changed, 78 insertions(+), 345 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/list.c

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 2e3f995..c251761 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -24,11 +24,9 @@
  *  Public Functions:
  *  LST_Create
  *  LST_Delete
- *  LST_Exit
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
- *  LST_Init
  *  LST_InsertBefore
  *  LST_IsEmpty
  *  LST_Next
@@ -51,18 +49,16 @@
 #define LIST_
 
 #include 
+/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
+#include 
+#include 
 
-#define LST_IsEmpty(l)  (((l)->head.next == &(l)->head))
+#define LST_ELEMlist_head
+#define LST_IsEmpty(l)  list_empty(&(l)->head)
 
-   struct LST_ELEM {
-   struct LST_ELEM *next;
-   struct LST_ELEM *prev;
-   struct LST_ELEM *self;
-   } ;
-
-   struct LST_LIST {
-   struct LST_ELEM head;
-   } ;
+struct LST_LIST {
+   struct list_head head;
+};
 
 /*
  *   LST_Create 
@@ -86,7 +82,17 @@
  *  "empty" element, because its "next" and "prev" pointers point at
  *  the same location (the element itself).
  */
-   extern struct LST_LIST *LST_Create(void);
+static inline struct LST_LIST *LST_Create(void)
+{
+   struct LST_LIST *pList;
+
+   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
+   MEM_NONPAGED);
+   if (pList != NULL)
+   INIT_LIST_HEAD(&pList->head);
+
+   return pList;
+}
 
 /*
  *   LST_Delete 
@@ -108,21 +114,11 @@
  *  chain of list elements.  Calling this function on a non-empty list
  *  will cause a memory leak.
  */
-   extern void LST_Delete(IN struct LST_LIST *pList);
-
-/*
- *   LST_Exit 
- *  Purpose:
- *  Discontinue usage of module; free resources when reference count
- *  reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Resources used by module are freed when cRef reaches zero.
- */
-   extern void LST_Exit(void);
+static inline void LST_Delete(struct LST_LIST *pList)
+{
+   if (pList != NULL)
+   MEM_Free(pList);
+}
 
 /*
  *   LST_First 
@@ -138,7 +134,12 @@
  *  - pList != NULL.
  *  Ensures:
  */
-   extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
+static inline struct list_head *LST_First(struct LST_LIST *pList)
+{
+   if (pList && !list_empty(&pList->head))
+   return pList->head.next;
+   return NULL;
+}
 
 /*
  *   LST_GetHead 
@@ -160,7 +161,6 @@
  *  Pointer to element that was at the head of the list (success)
  *  NULL  No elements in list
  *  Requires:
- *  - head.self must be correctly set to &head.
  *  - LST initialized.
  *  - pList != NULL.
  *  Ensures:
@@ -169,20 +169,19 @@
  *  the head of the list, and the head of the list points backward (its
  *  "prev" pointer) to the tail of the list, this list is circular.
  */
-   extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
+static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
+{
+   struct list_head *pElem;
 
-/*
- *   LST_Init 
- *  Purpose:
- *  Initializes private state of LST module.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE otherwise.
- *  Requires:
- *  Ensures:
- *  LST initialized.
- */
-   extern bool LST_Init(void);
+   if (!pList || list_empty(&pList->head))
+   return NULL;
+
+   pElem = pList->head.next;
+   pList->head.next = pElem->next;
+   pElem->next->prev = &pList->head;
+
+   return pElem;
+}
 
 /*
  *   LST_InitElem 

[PATCHv3.1 3/4] dspbridge: Don't use LST_Create() and LST_Delete()

2009-09-15 Thread Andy Shevchenko
From: Andy Shevchenko 

Change LST_Create() to the MEM_Calloc() and INIT_LIST_HEAD() pair in optimal 
way.

Use MEM_Free() instead of LST_Delete(). We can use it without checking because
MEM_Free() validates input parameter.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/list.h |   64 ---
 drivers/dsp/bridge/pmgr/cmm.c   |   27 +++
 drivers/dsp/bridge/pmgr/dev.c   |9 +++-
 drivers/dsp/bridge/rmgr/drv.c   |   18 +---
 drivers/dsp/bridge/rmgr/node.c  |6 ++-
 drivers/dsp/bridge/rmgr/rmm.c   |7 ++-
 drivers/dsp/bridge/services/ntfy.c  |6 ++-
 drivers/dsp/bridge/wmd/chnl_sm.c|5 +-
 drivers/dsp/bridge/wmd/msg_sm.c |   26 ---
 9 files changed, 70 insertions(+), 98 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h 
b/arch/arm/plat-omap/include/dspbridge/list.h
index 9baa6ae..86967cc 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -22,8 +22,6 @@
  *  of inline list management functions.
  *
  *  Public Functions:
- *  LST_Create
- *  LST_Delete
  *  LST_First
  *  LST_GetHead
  *  LST_InitElem
@@ -49,8 +47,6 @@
 #define LIST_
 
 #include 
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include 
 #include 
 
 #define LST_IsEmpty(l)  list_empty(&(l)->head)
@@ -60,66 +56,6 @@ struct LST_LIST {
 };
 
 /*
- *   LST_Create 
- *  Purpose:
- *  Allocates and initializes a circular list.
- *  Details:
- *  Uses portable MEM_Calloc() function to allocate a list containing
- *  a single element and initializes that element to indicate that it
- *  is the "end of the list" (i.e., the list is empty).
- *  An empty list is indicated by the "next" pointer in the element
- *  at the head of the list pointing to the head of the list, itself.
- *  Parameters:
- *  Returns:
- *  Pointer to beginning of created list (success)
- *  NULL --> Allocation failed
- *  Requires:
- *  LST initialized.
- *  Ensures:
- *  Notes:
- *  The created list contains a single element.  This element is the
- *  "empty" element, because its "next" and "prev" pointers point at
- *  the same location (the element itself).
- */
-static inline struct LST_LIST *LST_Create(void)
-{
-   struct LST_LIST *pList;
-
-   pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-   MEM_NONPAGED);
-   if (pList != NULL)
-   INIT_LIST_HEAD(&pList->head);
-
-   return pList;
-}
-
-/*
- *   LST_Delete 
- *  Purpose:
- *  Removes a list by freeing its control structure's memory space.
- *  Details:
- *  Uses portable MEM_Free() function to deallocate the memory
- *  block pointed at by the input parameter.
- *  Parameters:
- *  pList:  Pointer to list control structure of list to be deleted
- *  Returns:
- *  Void
- *  Requires:
- *  - LST initialized.
- *  - pList != NULL.
- *  Ensures:
- *  Notes:
- *  Must ONLY be used for empty lists, because it does not walk the
- *  chain of list elements.  Calling this function on a non-empty list
- *  will cause a memory leak.
- */
-static inline void LST_Delete(struct LST_LIST *pList)
-{
-   if (pList != NULL)
-   MEM_Free(pList);
-}
-
-/*
  *   LST_First 
  *  Purpose:
  *  Returns a pointer to the first element of the list, or NULL if the list
diff --git a/drivers/dsp/bridge/pmgr/cmm.c b/drivers/dsp/bridge/pmgr/cmm.c
index eecb78e..dd51a69 100644
--- a/drivers/dsp/bridge/pmgr/cmm.c
+++ b/drivers/dsp/bridge/pmgr/cmm.c
@@ -359,12 +359,15 @@ DSP_STATUS CMM_Create(OUT struct CMM_OBJECT **phCmmMgr,
 * MEM_AllocObject */
if (DSP_SUCCEEDED(status)) {
/* create node free list */
-   pCmmObject->pNodeFreeListHead = LST_Create();
+   pCmmObject->pNodeFreeListHead = MEM_Calloc(sizeof(struct
+   LST_LIST), MEM_NONPAGED);
if (pCmmObject->pNodeFreeListHead == NULL) {
GT_0trace(CMM_debugMask, GT_7CLASS,
- "CMM_Create: LST_Create() "
- "failed \n");
+ "CMM_Create: Out of memory \n");
status = DSP_EMEMORY;
+   } else {
+   INIT_LIST_HEAD(&pCmmObject->pNodeFreeListHead->
+   head);
}
}
if (DSP_SUCCEEDED(status))
@@ -433,7 +436,7 @@ DSP_STATUS CMM_Destroy(struct CMM_OBJECT 

[PATCHv3.1 4/4] DSPBRIDGE: OSAL: Remove extra include directive

2009-09-15 Thread Andy Shevchenko
From: Andy Shevchenko 

Including the list.h in some files looks redundant. So, remove those lines.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/pmgr/chnl.c |1 -
 drivers/dsp/bridge/pmgr/dmm.c  |1 -
 drivers/dsp/bridge/pmgr/msg.c  |1 -
 drivers/dsp/bridge/services/services.c |1 -
 4 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/chnl.c b/drivers/dsp/bridge/pmgr/chnl.c
index 6b5a0d9..4c9bd2b 100644
--- a/drivers/dsp/bridge/pmgr/chnl.c
+++ b/drivers/dsp/bridge/pmgr/chnl.c
@@ -78,7 +78,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/dsp/bridge/pmgr/dmm.c b/drivers/dsp/bridge/pmgr/dmm.c
index f878855..2cbe2e8 100644
--- a/drivers/dsp/bridge/pmgr/dmm.c
+++ b/drivers/dsp/bridge/pmgr/dmm.c
@@ -67,7 +67,6 @@
 #include 
 
 /*  --- OS Adaptation Layer */
-#include 
 #include 
 #include 
 
diff --git a/drivers/dsp/bridge/pmgr/msg.c b/drivers/dsp/bridge/pmgr/msg.c
index d9e4fc6..732a91b 100644
--- a/drivers/dsp/bridge/pmgr/msg.c
+++ b/drivers/dsp/bridge/pmgr/msg.c
@@ -48,7 +48,6 @@
 #include 
 
 /*  --- OS Adaptation Layer */
-#include 
 #include 
 
 /*  --- Mini Driver */
diff --git a/drivers/dsp/bridge/services/services.c 
b/drivers/dsp/bridge/services/services.c
index b68c165..218425c 100644
--- a/drivers/dsp/bridge/services/services.c
+++ b/drivers/dsp/bridge/services/services.c
@@ -48,7 +48,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.5.6.5

--
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


[PATCHv2] DSPBRIDGE: OSAL: Remove CSL

2009-09-16 Thread Andy Shevchenko
From: Andy Shevchenko 

Current DSP bridge driver still contains redudant pieces of CSL code. Get rid
of it finally.

Change atoi(s) to the kernel's simple_strtol(s, NULL, 10).

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/csl.h |  135 --
 drivers/dsp/bridge/Kbuild  |2 +-
 drivers/dsp/bridge/pmgr/chnl.c |1 -
 drivers/dsp/bridge/pmgr/cod.c  |1 -
 drivers/dsp/bridge/pmgr/dbl.c  |   32 +++--
 drivers/dsp/bridge/pmgr/dbll.c |3 -
 drivers/dsp/bridge/rmgr/dbdcd.c|1 -
 drivers/dsp/bridge/rmgr/disp.c |1 -
 drivers/dsp/bridge/rmgr/drv.c  |1 -
 drivers/dsp/bridge/rmgr/drv_interface.c|1 -
 drivers/dsp/bridge/rmgr/dspdrv.c   |1 -
 drivers/dsp/bridge/rmgr/nldr.c |1 -
 drivers/dsp/bridge/rmgr/node.c |1 -
 drivers/dsp/bridge/rmgr/proc.c |1 -
 drivers/dsp/bridge/services/cfg.c  |1 -
 drivers/dsp/bridge/services/clk.c  |1 -
 drivers/dsp/bridge/services/csl.c  |  173 
 drivers/dsp/bridge/services/kfile.c|1 -
 drivers/dsp/bridge/services/ntfy.c |1 -
 drivers/dsp/bridge/services/reg.c  |1 -
 drivers/dsp/bridge/services/regsup.c   |1 -
 drivers/dsp/bridge/services/services.c |   10 +--
 drivers/dsp/bridge/services/sync.c |1 -
 drivers/dsp/bridge/wmd/chnl_sm.c   |1 -
 drivers/dsp/bridge/wmd/tiomap3430.c|1 -
 drivers/dsp/bridge/wmd/ue_deh.c|1 -
 26 files changed, 22 insertions(+), 353 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/csl.h
 delete mode 100644 drivers/dsp/bridge/services/csl.c

diff --git a/arch/arm/plat-omap/include/dspbridge/csl.h 
b/arch/arm/plat-omap/include/dspbridge/csl.h
deleted file mode 100644
index b90d6ff..000
--- a/arch/arm/plat-omap/include/dspbridge/csl.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * csl.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2008 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- *   csl.h 
- *  Purpose:
- *  Platform independent C Standard library functions.
- *
- *  Public Functions:
- *  CSL_AnsiToWchar
- *  CSL_ByteSwap
- *  CSL_Exit
- *  CSL_Init
- *  CSL_NumToAscii
- *  CSL_Strtok
- *  CSL_Strtokr
- *  CSL_WcharToAnsi
- *
- *! Revision History:
- *! 
- *! 07-Aug-2002 jeh: Added CSL_Strtokr().
- *! 21-Sep-2001 jeh: Added CSL_Strncmp.
- *! 22-Nov-2000 map: Added CSL_Atoi and CSL_Strtok
- *! 19-Nov-2000 kc:  Added CSL_ByteSwap().
- *! 09-Nov-2000 kc:  Added CSL_Strncat.
- *! 29-Oct-1999 kc:  Added CSL_Wstrlen().
- *! 20-Sep-1999 ag:  Added CSL_Wchar2Ansi().
- *! 19-Jan-1998 cr:  Code review cleanup (mostly documentation fixes).
- *! 29-Dec-1997 cr:  Changed CSL_lowercase to CSL_Uppercase, added
- *!  CSL_AnsiToWchar.
- *! 30-Sep-1997 cr:  Added explicit cdecl descriptors to fxn definitions.
- *! 25-Jun-1997 cr:  Added CSL_strcmp.
- *! 12-Jun-1996 gp:  Created.
- */
-
-#ifndef CSL_
-#define CSL_
-
-#include 
-
-/*
- *   CSL_Exit 
- *  Purpose:
- *  Discontinue usage of the CSL module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  CSL initialized.
- *  Ensures:
- *  Resources acquired in CSL_Init(void) are freed.
- */
-   extern void CSL_Exit(void);
-
-/*
- *   CSL_Init 
- *  Purpose:
- *  Initialize the CSL module's private state.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE if error occured.
- *  Requires:
- *  Ensures:
- *  A requirement for each of the other public CSL functions.
- */
-   extern bool CSL_Init(void);
-
-/*
- *   CSL_NumToAscii 
- *  Purpose:
- *  Convert a 1 or 2 digit number to a 2 digit string.
- *  Parameters:
- *  pstrNumber: Buffer to store converted string.
- *  dwNum:  Number to convert.
- *  Returns:
- *  Requires:
- *  pstrNumber must be able to hold at least three characters.
- *  Ensures:
- *  pstrNumber will be null terminated.
- */
-   extern void CSL_NumToAscii(OUT char *pstrNumber, IN u32 dwNum);
-
-
-/*
- *   CSL_Strtok 
- *  Purpose:
- *  Tokenize a NULL terminated string
- *  Parameters:
- *  ptstrSrc:   pointer to string.
- *  szSeparators:   pointer to a string of seperators
- *  Returns:
- *  char *
- *  Requires:
- * 

removing CSL (v3)

2009-09-16 Thread Andy Shevchenko

Hello.

This version is slightly improved (I drop out atoi() wrapper).

-- 
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


[PATCH v3] DSPBRIDGE: OSAL: Remove CSL

2009-09-16 Thread Andy Shevchenko
From: Andy Shevchenko 

Current DSP bridge driver still contains redudant pieces of CSL code. Get rid
of it finally.

Change CSL_atoi(s) to the kernel's simple_strtol(s, NULL, 10) in place.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/csl.h |  135 --
 drivers/dsp/bridge/Kbuild  |2 +-
 drivers/dsp/bridge/pmgr/chnl.c |1 -
 drivers/dsp/bridge/pmgr/cod.c  |1 -
 drivers/dsp/bridge/pmgr/dbl.c  |   28 +++--
 drivers/dsp/bridge/pmgr/dbll.c |3 -
 drivers/dsp/bridge/rmgr/dbdcd.c|1 -
 drivers/dsp/bridge/rmgr/disp.c |1 -
 drivers/dsp/bridge/rmgr/drv.c  |1 -
 drivers/dsp/bridge/rmgr/drv_interface.c|1 -
 drivers/dsp/bridge/rmgr/dspdrv.c   |1 -
 drivers/dsp/bridge/rmgr/nldr.c |1 -
 drivers/dsp/bridge/rmgr/node.c |1 -
 drivers/dsp/bridge/rmgr/proc.c |1 -
 drivers/dsp/bridge/services/cfg.c  |1 -
 drivers/dsp/bridge/services/clk.c  |1 -
 drivers/dsp/bridge/services/csl.c  |  173 
 drivers/dsp/bridge/services/kfile.c|1 -
 drivers/dsp/bridge/services/ntfy.c |1 -
 drivers/dsp/bridge/services/reg.c  |1 -
 drivers/dsp/bridge/services/regsup.c   |1 -
 drivers/dsp/bridge/services/services.c |   10 +--
 drivers/dsp/bridge/services/sync.c |1 -
 drivers/dsp/bridge/wmd/chnl_sm.c   |1 -
 drivers/dsp/bridge/wmd/tiomap3430.c|1 -
 drivers/dsp/bridge/wmd/ue_deh.c|1 -
 26 files changed, 18 insertions(+), 353 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/csl.h
 delete mode 100644 drivers/dsp/bridge/services/csl.c

diff --git a/arch/arm/plat-omap/include/dspbridge/csl.h 
b/arch/arm/plat-omap/include/dspbridge/csl.h
deleted file mode 100644
index b90d6ff..000
--- a/arch/arm/plat-omap/include/dspbridge/csl.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * csl.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2008 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- *   csl.h 
- *  Purpose:
- *  Platform independent C Standard library functions.
- *
- *  Public Functions:
- *  CSL_AnsiToWchar
- *  CSL_ByteSwap
- *  CSL_Exit
- *  CSL_Init
- *  CSL_NumToAscii
- *  CSL_Strtok
- *  CSL_Strtokr
- *  CSL_WcharToAnsi
- *
- *! Revision History:
- *! 
- *! 07-Aug-2002 jeh: Added CSL_Strtokr().
- *! 21-Sep-2001 jeh: Added CSL_Strncmp.
- *! 22-Nov-2000 map: Added CSL_Atoi and CSL_Strtok
- *! 19-Nov-2000 kc:  Added CSL_ByteSwap().
- *! 09-Nov-2000 kc:  Added CSL_Strncat.
- *! 29-Oct-1999 kc:  Added CSL_Wstrlen().
- *! 20-Sep-1999 ag:  Added CSL_Wchar2Ansi().
- *! 19-Jan-1998 cr:  Code review cleanup (mostly documentation fixes).
- *! 29-Dec-1997 cr:  Changed CSL_lowercase to CSL_Uppercase, added
- *!  CSL_AnsiToWchar.
- *! 30-Sep-1997 cr:  Added explicit cdecl descriptors to fxn definitions.
- *! 25-Jun-1997 cr:  Added CSL_strcmp.
- *! 12-Jun-1996 gp:  Created.
- */
-
-#ifndef CSL_
-#define CSL_
-
-#include 
-
-/*
- *   CSL_Exit 
- *  Purpose:
- *  Discontinue usage of the CSL module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  CSL initialized.
- *  Ensures:
- *  Resources acquired in CSL_Init(void) are freed.
- */
-   extern void CSL_Exit(void);
-
-/*
- *   CSL_Init 
- *  Purpose:
- *  Initialize the CSL module's private state.
- *  Parameters:
- *  Returns:
- *  TRUE if initialized; FALSE if error occured.
- *  Requires:
- *  Ensures:
- *  A requirement for each of the other public CSL functions.
- */
-   extern bool CSL_Init(void);
-
-/*
- *   CSL_NumToAscii 
- *  Purpose:
- *  Convert a 1 or 2 digit number to a 2 digit string.
- *  Parameters:
- *  pstrNumber: Buffer to store converted string.
- *  dwNum:  Number to convert.
- *  Returns:
- *  Requires:
- *  pstrNumber must be able to hold at least three characters.
- *  Ensures:
- *  pstrNumber will be null terminated.
- */
-   extern void CSL_NumToAscii(OUT char *pstrNumber, IN u32 dwNum);
-
-
-/*
- *   CSL_Strtok 
- *  Purpose:
- *  Tokenize a NULL terminated string
- *  Parameters:
- *  ptstrSrc:   pointer to string.
- *  szSeparators:   pointer to a string of seperators
- *  Returns:
- *  char *
- *  Re

[PATCH] DSPBRIDGE: OSAL: Get rid of KFILE

2009-09-17 Thread Andy Shevchenko
From: Andy Shevchenko 

* Remove KFILE_Init(), KFILE_Exit() and tracing stuff
* Simplify KFILE_Seek()
* Simplify error checker in KFILE_Open after filp_open() call
* Remove pid/tgid related code: it seems totally useless here
* Get rid of KFILE_FileObj, use regular struct file instead

* Remove kfile.c and kfile.h
* Redefine necessary file operations in cod.c in a bit optimal way
* Clean up errbase.h

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/errbase.h |   27 --
 arch/arm/plat-omap/include/dspbridge/kfile.h   |  216 ---
 drivers/dsp/bridge/Kbuild  |2 +-
 drivers/dsp/bridge/pmgr/cod.c  |  108 +++-
 drivers/dsp/bridge/pmgr/dbl.c  |   14 +-
 drivers/dsp/bridge/services/kfile.c|  337 
 drivers/dsp/bridge/services/services.c |   10 +-
 7 files changed, 112 insertions(+), 602 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/kfile.h
 delete mode 100644 drivers/dsp/bridge/services/kfile.c

diff --git a/arch/arm/plat-omap/include/dspbridge/errbase.h 
b/arch/arm/plat-omap/include/dspbridge/errbase.h
index 47b9a0b..271315a 100644
--- a/arch/arm/plat-omap/include/dspbridge/errbase.h
+++ b/arch/arm/plat-omap/include/dspbridge/errbase.h
@@ -464,31 +464,4 @@
 /* Insufficient space to hold data in registry value. */
 #define REG_E_MOREDATA  (REG_EBASE + 0x03)
 
-/* FAILURE Codes : KFILE */
-#define KFILE_EBASE (DSP_COMP_EBASE + 0x900)
-
-/* Invalid file handle. */
-#define E_KFILE_INVALIDHANDLE   (KFILE_EBASE + 0x01)
-
-/* Bad file name. */
-#define E_KFILE_BADFILENAME (KFILE_EBASE + 0x02)
-
-/* Invalid file mode. */
-#define E_KFILE_INVALIDMODE (KFILE_EBASE + 0x03)
-
-/* No resources available. */
-#define E_KFILE_NORESOURCES (KFILE_EBASE + 0x04)
-
-/* Invalid file buffer. */
-#define E_KFILE_INVALIDBUFFER   (KFILE_EBASE + 0x05)
-
-/* Bad origin argument. */
-#define E_KFILE_BADORIGINFLAG   (KFILE_EBASE + 0x06)
-
-/* Invalid file offset value. */
-#define E_KFILE_INVALIDOFFSET   (KFILE_EBASE + 0x07)
-
-/* General KFILE error condition */
-#define E_KFILE_ERROR   (KFILE_EBASE + 0x08)
-
 #endif /* ERRBASE_ */
diff --git a/arch/arm/plat-omap/include/dspbridge/kfile.h 
b/arch/arm/plat-omap/include/dspbridge/kfile.h
deleted file mode 100644
index 23c89b0..000
--- a/arch/arm/plat-omap/include/dspbridge/kfile.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * kfile.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-
-/*
- *   kfile.h 
- *  Purpose:
- *  Provide file I/O management capabilities.
- *
- *  Public Functions:
- *  KFILE_Close
- *  KFILE_Exit
- *  KFILE_Init
- *  KFILE_Open
- *  KFILE_Read
- *  KFILE_Seek
- *  KFILE_Tell
- *  KFILE_Write
- *
- *  Notes:
- *  The KFILE module is not like most of the other DSP/BIOS Bridge modules
- *  in that it doesn't return WSX_STATUS type values.  Rather, it's
- *  prototypes are meant to match the stdio file prototypes
- *  (ie, fopen, fclose, etc.).
- *
- *! Revision History
- *! 
- *! 29-Oct-1999 kc:  Clean up for code review.
- *! 07-Jan-1998 cr:  Clean up for code review.
- *! 15-Aug-1997 cr:  Added E_KFILE_ERROR for general error condition.
- *! 04-Aug-1997 cr:  Added explicit CDECL descriptions.
- *! 11-Nov-1996 cr:  Implemented changes based on code review.
- *! 05-Nov-1996 cr:  Cleaned up for code review.
- *! 29-May-1996 gp:  Added requirement that size != 0 in _Write() and _Read().
- *! 28-May-1996 mg:  Changed return values for Read/Write.
- *! 14-Dec-1995 cr:  Created.
- */
-
-#ifndef KFILE_
-#define KFILE_
-
-/*
- *  Constants for KFILE_Seek.  Note that these MUST be the same definitions as
- *  those defined for fseek.
- */
-#define KFILE_SEEK_SET  0x00   /* seek from beginning of file */
-#define KFILE_SEEK_CUR  0x01   /* seek from current position */
-#define KFILE_SEEK_END  0x02   /* seek from end of file */
-
-   struct KFILE_FileObj;
-
-/*
- *   KFILE_Close 
- *  Purpose:
- *  This function closes a file's stream.
- *  Parameters:
- *  hFile:  Handle of the file stream returned by KFILE_Open.
- *  Returns:
- *  E_KFILE_INVALIDHANDLE:  bad handle.
- *  0:  success.
- *  E_KFILE_ERROR:  unable to close specif

[PATCH] dspbridge: clean up errbase.h

2009-09-17 Thread Andy Shevchenko
From: Andy Shevchenko 

It seems BRD_* error codes from this certain file is redundant.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/errbase.h |   15 ---
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/errbase.h 
b/arch/arm/plat-omap/include/dspbridge/errbase.h
index f04c005..47b9a0b 100644
--- a/arch/arm/plat-omap/include/dspbridge/errbase.h
+++ b/arch/arm/plat-omap/include/dspbridge/errbase.h
@@ -324,21 +324,6 @@
 /* Insufficient buffer size */
 #define CFG_E_INSUFFICIENTBUFSIZE   (CFG_EBASE + 0x05)
 
-/* FAILURE Codes : BRD */
-#define BRD_EBASE   (DSP_COMP_EBASE + 0x300)
-
-/* Board client does not have sufficient access rights for this operation. */
-#define BRD_E_ACCESSDENIED  (BRD_EBASE + 0x00)
-
-/* Unable to find trace buffer symbols in the DSP executable COFF file. */
-#define BRD_E_NOTRACEBUFFER (BRD_EBASE + 0x01)
-
-/* Attempted to auto-start board, but no default DSP executable configured. */
-#define BRD_E_NOEXEC(BRD_EBASE + 0x02)
-
-/* The operation failed because it was started from a wrong state */
-#define BRD_E_WRONGSTATE(BRD_EBASE + 0x03)
-
 /* FAILURE Codes : COD */
 #define COD_EBASE   (DSP_COMP_EBASE + 0x400)
 
-- 
1.5.6.5

--
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: Any one is still using omap-kernel on N810???

2009-09-18 Thread Andy Shevchenko
On Fri, Sep 18, 2009 at 12:42 PM, Stefano Panella
 wrote:
> I have got a N810 board and I am trying to install ubuntu on it.
As far as I know the N810 is a Nokia's device which runs Maemo 4.x OS.
Maemo is an fork of linux OS for that special device.
I think almost all opensourced components are committed to the
linux-omap tree, but official kernels are provided from certain
repository.

> Is there any how-to or update instruction I can follow?
Perhaps more useful to ask in maemo.org.

-- 
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: [RFC] DSPBRIDGE: Kill CAMelCaSiNg

2009-09-21 Thread Andy Shevchenko
On Mon, Sep 21, 2009 at 3:05 PM, Felipe Contreras
 wrote:
> Yes, I think we should do that, and make some sort of release,
> possibly squashing all the changes... my current branch counts 218
> commits.
I think it should be somehow announced before. Because, f.e., my
patches is so big to rewrite them
(and most of them are accepted already, although I can't see commits
in public repository)

> I did a few more cleanups (yeah, I'm too picky) and here's the result.
Actually even this could be simplified :-)

> #**
> #* @brief - changes camel casing to ones with smaller case
> #*
> camel_to_norm() {
>        echo $1 | tr '\_' '+' | sed 's/\([A-Z]\)/_\l\1/g' | sed
> 's/^_\([a-z]\)/\1/g' | \
I suppose there is could be used code like: sed -e '; '
instead of two or more sed calls.

>        tr 'A-Z' 'a-z' | sed "s/\([a-z][a-z]\+\)/-\1-/g" | tr -d '_'| \
tr -d '_' is the 's/_//g' expression for sed

>        tr '-' '_' | sed -e "s/_$//g" | sed -e "s/^_//g" | tr '+' '_' | \
>        sed -e "s/__*/_/g" | sed -e "s/_\([0-9][0-9]*\)/\1/g" | \
>        sed -e "s/^[a-z]\_\([a-z][a-z]\+\)/\1/g"
The similar. It could be optimized to a few sed calls (perhaps even to
one call with all expressions in a sequence).

> # grab the output for only the ones we want..
> grep "$DIR_FILE" tags | grep -v "^\!" | sed -e
> "s/\/\^.*\"/REPLACE_1/g" > $TMPFILE
sed could match and skip lines like grep -v 'smth.': sed -e '/^!/d; ...'

>                                dos2unix -n $file $TMPFILE1
>                                sed -e "s/\<$token\>/$new/g" $TMPFILE1 > $file
dos2unix actually one expression for sed, AFAIK.
And new sed versions (starting from 3.8?) have -i which means 'in place'.

P.S. And personally I prefer to use perl :-)

-- 
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


[PATCH 0/2] dspbridge: OSAL: Simplify REG API

2009-09-21 Thread Andy Shevchenko
From: Andy Shevchenko 

There are two patches which simplify registry API.

Andy Shevchenko (2):
  DSPBRIDGE: OSAL: Simplify REG API
  DSPBRIDGE: OSAL: Remove unused registry variables

 arch/arm/plat-omap/include/dspbridge/dbreg.h |3 -
 arch/arm/plat-omap/include/dspbridge/reg.h   |  102 +++--
 drivers/dsp/bridge/rmgr/dbdcd.c  |   22 ++---
 drivers/dsp/bridge/rmgr/drv.c|   22 ++
 drivers/dsp/bridge/rmgr/drv_interface.c  |   35 ++---
 drivers/dsp/bridge/services/cfg.c|   50 -
 drivers/dsp/bridge/services/reg.c|   26 ++-
 drivers/dsp/bridge/services/regsup.c |3 +-
 drivers/dsp/bridge/services/regsup.h |4 +-
 drivers/dsp/bridge/wmd/tiomap3430.c  |4 +-
 10 files changed, 68 insertions(+), 203 deletions(-)

--
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


[PATCH 2/2] DSPBRIDGE: OSAL: Remove unused registry variables

2009-09-21 Thread Andy Shevchenko
From: Andy Shevchenko 

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/dbreg.h |3 ---
 drivers/dsp/bridge/rmgr/drv_interface.c  |   12 
 drivers/dsp/bridge/services/cfg.c|5 -
 3 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dbreg.h 
b/arch/arm/plat-omap/include/dspbridge/dbreg.h
index d311b88..59b6496 100644
--- a/arch/arm/plat-omap/include/dspbridge/dbreg.h
+++ b/arch/arm/plat-omap/include/dspbridge/dbreg.h
@@ -88,7 +88,6 @@
 #define WMDFILENAME  "MiniDriver"  /* WMD entry name */
 #define CHIPTYPE "ChipType"/* Chip type */
 #define CHIPNUM  "NumChips"/* Number of chips */
-#define NUMPROCS "NumOfProcessors" /* Number of processors */
 #define DEFEXEC  "DefaultExecutable"   /* Default executable */
 #define AUTOSTART"AutoStart"   /* Statically load flag */
 #define IVAAUTOSTART "IvaAutoStart"/* Statically load flag */
@@ -107,7 +106,5 @@
 #define TCWORDSWAP   "TCWordSwap"  /* Traffic Contoller Word Swap */
 #define DSPRESOURCES "DspTMSResources" /* C55 DSP resurces on OMAP */
 #define IVA1RESOURCES"ARM7IvaResources"/* ARM7 IVA resurces on OMAP */
-#define PHYSMEMPOOLBASE  "PhysicalMemBase"   /* Physical mem passed to driver 
*/
-#define PHYSMEMPOOLSIZE  "PhysicalMemSize"   /* Physical mem passed to driver 
*/
 
 #endif /* DBREG_ */
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index 6a540a9..2653c1f 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -129,7 +129,6 @@ static s32 driver_major = DRIVER_MAJOR;
 static s32 driver_minor = DRIVER_MINOR;
 static char *base_img;
 char *iva_img;
-static char *num_procs = "C55=1";
 static s32 shm_size = 0x50;/* 5 MB */
 static u32 phys_mempool_base;
 static u32 phys_mempool_size;
@@ -356,7 +355,6 @@ static int __devinit omap34xx_bridge_probe(struct 
platform_device *pdev)
REG_SetValue(AUTOSTART, (u8 *)&temp, sizeof(temp));
REG_SetValue(DEFEXEC, (u8 *) "\0", (u32)2);
}
-   REG_SetValue(NUMPROCS, (u8 *) num_procs, strlen(num_procs) + 1);
 
if (shm_size >= 0x1) {  /* 64 KB */
initStatus = REG_SetValue(SHMSIZE, (u8 *)&shm_size,
@@ -375,19 +373,9 @@ static int __devinit omap34xx_bridge_probe(struct 
platform_device *pdev)
phys_mempool_size = pdata->phys_mempool_size;
}
 
-   if (phys_mempool_base > 0x0) {
-   initStatus = REG_SetValue(PHYSMEMPOOLBASE,
-(u8 *)&phys_mempool_base,
-sizeof(phys_mempool_base));
-   }
GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_base = 0x%x \n",
 phys_mempool_base);
 
-   if (phys_mempool_size > 0x0) {
-   initStatus = REG_SetValue(PHYSMEMPOOLSIZE,
-(u8 *)&phys_mempool_size,
-sizeof(phys_mempool_size));
-   }
GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_size = 0x%x\n",
 phys_mempool_base);
if ((phys_mempool_base > 0x0) && (phys_mempool_size > 0x0))
diff --git a/drivers/dsp/bridge/services/cfg.c 
b/drivers/dsp/bridge/services/cfg.c
index cb4ffea..e3cdda3 100644
--- a/drivers/dsp/bridge/services/cfg.c
+++ b/drivers/dsp/bridge/services/cfg.c
@@ -413,11 +413,6 @@ DSP_STATUS CFG_SetDevObject(struct CFG_DEVNODE *hDevNode, 
u32 dwValue)
  "Registering the DSP Device \n");
status = REG_SetValue("DEVICE_DSP", (u8 *)&dwValue,
  dwBuffSize);
-   if (DSP_SUCCEEDED(status)) {
-   dwBuffSize = sizeof(hDevNode);
-   status = REG_SetValue("DEVNODESTRING_DSP",
-   (u8 *)&hDevNode, dwBuffSize);
-   }
} else {
GT_0trace(CFG_debugMask, GT_6CLASS,
  "Failed to Register Device \n");
-- 
1.5.6.5

--
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


[PATCH 1/2] DSPBRIDGE: OSAL: Simplify REG API

2009-09-21 Thread Andy Shevchenko
From: Andy Shevchenko 

Simplify REG API by removing useless input parameters.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/reg.h |  102 
 drivers/dsp/bridge/rmgr/dbdcd.c|   22 +++
 drivers/dsp/bridge/rmgr/drv.c  |   22 ++
 drivers/dsp/bridge/rmgr/drv_interface.c|   33 -
 drivers/dsp/bridge/services/cfg.c  |   49 +-
 drivers/dsp/bridge/services/reg.c  |   26 ++-
 drivers/dsp/bridge/services/regsup.c   |3 +-
 drivers/dsp/bridge/services/regsup.h   |4 +-
 drivers/dsp/bridge/wmd/tiomap3430.c|4 +-
 9 files changed, 75 insertions(+), 190 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/reg.h 
b/arch/arm/plat-omap/include/dspbridge/reg.h
index 5b34952..64a8fe8 100644
--- a/arch/arm/plat-omap/include/dspbridge/reg.h
+++ b/arch/arm/plat-omap/include/dspbridge/reg.h
@@ -22,7 +22,6 @@
  *
  *  Public Functions:
  *  REG_DeleteValue
- *  REG_EnumKey
  *  REG_EnumValue
  *  REG_Exit
  *  REG_GetValue
@@ -53,23 +52,6 @@
 
 #include 
 
-/*  - Defines, Data Structures, Typedefs for Linux */
-#ifndef UNDER_CE
-
-#ifndef REG_SZ
-#define REG_SZ  1
-#endif
-
-#ifndef REG_BINARY
-#define REG_BINARY  3
-#endif
-
-#ifndef REG_DWORD
-#define REG_DWORD   4
-#endif
-
-#endif /* UNDER_CE */
-
 #define REG_MAXREGPATHLENGTH255
 
 /*
@@ -78,57 +60,18 @@
  *  Deletes a registry entry. NOTE: A registry entry is not the same as
  *  a registry key.
  *  Parameters:
- *  phKey:  Currently reserved; must be NULL.
- *  pstrSubkey: Path to key to open.
  *  pstrValue:  Name of entry to delete.
  *  Returns:
  *  DSP_SOK:Success.
  *  DSP_EFAIL:  General failure.
  *  Requires:
  *  - REG initialized.
- *  - pstrSubkey & pstrValue are non-NULL values.
- *  - phKey is NULL.
- *  - length of pstrSubkey < REG_MAXREGPATHLENGTH.
+ *  - pstrValue is non-NULL value.
  *  - length of pstrValue < REG_MAXREGPATHLENGTH.
  *  Ensures:
  *  Details:
  */
-   extern DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey,
- IN CONST char *pstrSubkey,
- IN CONST char *pstrValue);
-
-/*
- *   REG_EnumKey 
- *  Purpose:
- *  Enumerates subkeys of the specified path to the  registry key
- *  Retrieves the  name of the subkey(given the index) and
- *  appends with the orignal path to form the full path.
- *  Parameters:
- *  phKey:  Currently reserved; must be NULL.
- *  pstrKey The name of the registry key to be enumerated.
- *  dwIndex Specifies the index of the subkey to retrieve.
- *  pstrSubkey: Pointer to buffer that receives full path name of the
- *  specified key + the sub-key
- *  pdwValueSize:   Specifies bytes of memory pstrSubkey points to on 
input,
- *  on output, specifies actual memory bytes written into.
- *  If there is no sub key,pdwValueSize returns NULL.
- *  Returns:
- *  DSP_SOK:Success.
- *  DSP_EFAIL:  General failure.
- *  Requires:
- *  - REG initialized.
- *  - pstrKey is non-NULL value.
- *  - pdwValueSize is a valid pointer.
- *  - phKey is NULL.
- *  - length of pstrKey < REG_MAXREGPATHLENGTH.
- *  Ensures:
- *  - strlen(pstrSubkey) is > strlen(pstrKey) &&
- *  - strlen(pstrSubkey) is < REG_MAXREGPATHLENGTH
- */
-   extern DSP_STATUS REG_EnumKey(OPTIONAL IN HANDLE *phKey,
- IN u32 dwIndex, IN CONST char *pstrKey,
- IN OUT char *pstrSubkey,
- IN OUT u32 *pdwValueSize);
+extern DSP_STATUS REG_DeleteValue(IN CONST char *pstrValue);
 
 /*
  *   REG_EnumValue 
@@ -136,7 +79,6 @@
  *  Enumerates values of a specified key. Retrieves each value name and
  *  the data associated with the value.
  *  Parameters:
- *  phKey:  Currently reserved; must be NULL.
  *  dwIndex:Specifies the index of the value to retrieve.
  *  pstrKey:The name of the registry key to be enumerated.
  *  pstrValue:  Pointer to buffer that receives the name of the value.
@@ -152,19 +94,16 @@
  *  DSP_EFAIL:  General failure.
  *  Requires:
  *  REG initialized.
- *  phKey is NULL.
  *  pstrKey is a non-NULL value.
  *  pstrValue, pstrData, pdwValueSize and pdwDataSize are valid pointers.
  *  Length of pstrKey is less than REG_MAXREGPATHLENGTH.
  *  Ensures:
  */
-   extern DSP_STATUS REG_EnumValue(IN HANDLE *phKey,
-   IN u32 dwIndex,
-   IN CONST char *pstrKey,
-  

[PATCH 0/2] dspbridge: OSAL: Simplify REG API

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

There are two patches which simplify registry API.

Andy Shevchenko (2):
  DSPBRIDGE: OSAL: Simplify REG API
  DSPBRIDGE: OSAL: Remove unused registry variables

 arch/arm/plat-omap/include/dspbridge/dbreg.h |3 -
 arch/arm/plat-omap/include/dspbridge/reg.h   |  102 +++--
 drivers/dsp/bridge/rmgr/dbdcd.c  |   22 ++---
 drivers/dsp/bridge/rmgr/drv.c|   22 ++
 drivers/dsp/bridge/rmgr/drv_interface.c  |   35 ++---
 drivers/dsp/bridge/services/cfg.c|   50 -
 drivers/dsp/bridge/services/reg.c|   26 ++-
 drivers/dsp/bridge/services/regsup.c |3 +-
 drivers/dsp/bridge/services/regsup.h |4 +-
 drivers/dsp/bridge/wmd/tiomap3430.c  |4 +-
 10 files changed, 68 insertions(+), 203 deletions(-)

--
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


[PATCHv2 3/5] DSPBRIDGE: OSAL: Clean up dbreg.h and move it

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

* Clean up dbreg.h - there are plenty of unused definitions
* Move necessary constants to the dbdefs.h
* Remove dbreg.h inclusion from other files

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/dbdefs.h |   26 ++
 arch/arm/plat-omap/include/dspbridge/dbreg.h  |  110 -
 drivers/dsp/bridge/pmgr/dev.c |1 -
 drivers/dsp/bridge/rmgr/drv.c |3 -
 drivers/dsp/bridge/rmgr/drv_interface.c   |2 -
 drivers/dsp/bridge/rmgr/dspdrv.c  |3 -
 drivers/dsp/bridge/rmgr/mgr.c |1 -
 drivers/dsp/bridge/rmgr/node.c|1 -
 drivers/dsp/bridge/rmgr/proc.c|1 -
 drivers/dsp/bridge/rmgr/strm.c|1 -
 drivers/dsp/bridge/services/cfg.c |3 -
 drivers/dsp/bridge/services/reg.c |3 -
 drivers/dsp/bridge/services/regsup.c  |1 -
 drivers/dsp/bridge/wmd/io_sm.c|1 -
 drivers/dsp/bridge/wmd/tiomap3430.c   |1 -
 15 files changed, 26 insertions(+), 132 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbreg.h

diff --git a/arch/arm/plat-omap/include/dspbridge/dbdefs.h 
b/arch/arm/plat-omap/include/dspbridge/dbdefs.h
index 1a47839..7445b73 100644
--- a/arch/arm/plat-omap/include/dspbridge/dbdefs.h
+++ b/arch/arm/plat-omap/include/dspbridge/dbdefs.h
@@ -589,4 +589,30 @@ bit 6 - MMU element size = 64bit (valid only for non mixed 
page entries)
 #define GEM_CACHE_LINE_SIZE 128
 #define GEM_L1P_PREFETCH_SIZE   128
 
+
+/*
+ * Definitions from dbreg.h
+ */
+
+#define DSPPROCTYPE_C646410
+#define IVAPROCTYPE_ARM7   470
+
+#define REG_MGR_OBJECT 1
+#define REG_DRV_OBJECT 2
+
+/* registry */
+#define DRVOBJECT  "DrvObject"
+#define MGROBJECT  "MgrObject"
+
+/* Max registry path length. Also the max registry value length. */
+#define MAXREGPATHLENGTH   255
+
+/* MiniDriver related definitions */
+#define DEFEXEC"DefaultExecutable" /* Default executable */
+#define AUTOSTART  "AutoStart" /* Statically load flag */
+#define CURRENTCONFIG  "CurrentConfig" /* Current resources */
+#define SHMSIZE"SHMSize"   /* Size of SHM reservd 
on MPU */
+#define TCWORDSWAP "TCWordSwap"/* Traffic Contoller Word Swap 
*/
+#define DSPRESOURCES   "DspTMSResources"   /* C55 DSP resurces on OMAP */
+
 #endif /* DBDEFS_ */
diff --git a/arch/arm/plat-omap/include/dspbridge/dbreg.h 
b/arch/arm/plat-omap/include/dspbridge/dbreg.h
deleted file mode 100644
index 59b6496..000
--- a/arch/arm/plat-omap/include/dspbridge/dbreg.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * dbreg.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-
-/*
- *   dbreg.h 
- *  Purpose:
- *  Registry keys for use in Linux.  This is the clearinghouse for
- *  registry definitions, hopefully eliminating overlapping between
- *  modules.
- *
- *! Revision History:
- *! 
- *! 10-Apr-2003 vp:  Added macro for subkey TCWORDSWAP.
- *! 21-Mar-2003 sb:  Added macro for subkey SHMSize
- *! 27-Aug-2001 jeh  Added WSXREG_LOADERFILENAME.
- *! 13-Feb-2001 kc:  DSP/BIOS Bridge name updates.
- *! 29-Nov-2000 rr:  Added WSXREG_DSPTYPE_55 as 6.
- *! 06-Sep-2000 jeh: Added WSXREG_CHNLOFFSET, WSXREG_NUMCHNLS,
- *!  WSXREG_CHNLBUFSIZE.
- *! 26-Aug-2000 rr:  MEMBASE expanded to 9 entries.
- *! 26-Jul-2000 rr:  Added WSXREG_DCDNAME for the DCD Dll name. It will
- *!  live under WSXREG_WINSPOXCONFIG.
- *! 17-Jul-2000 rr:  REG_MGR_OBJECT and REG_DRV_OBJECT defined. They
- *!  are stored in the Registrty under WSXREG_WINSPOXCONFIG
- *!  when they are created in DSP_Init. WSXREG_DEVOBJECT
- *!  and WSXREG_MGROBJECT defined.
- *! 11-Dec-1999 ag:  Renamed Isa to IsaBus due to conflict with ceddk.h.
- *! 12-Nov-1999 rr:  New Registry Defnitions.
- *! 15-Oct-1999 rr:  New entry for DevObject created. WSXREG_DEVOBJECT
- *!  under WSXREG_DDSPDRIVERPATH
- *! 10-Nov-1997 cr:  Added WSXREG_INFPATH, WSXREG_WINDEVICEPATH,
- *!  WSXREG_WINCURVERSION
- *! 21-Oct-1997 cr:  Added WSXREG_BUSTYPE.
- *! 08-Sep-1997 cr:  Added WSXREG_SERVICES, WSXREG_SERVICENAME and

[PATCHv2 0/5] dspbridge: OSAL: Simplify so called 'registry'

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

There are several patches which simplify registry API and code.

Andy Shevchenko (5):
  DSPBRIDGE: OSAL: Simplify REG API
  DSPBRIDGE: OSAL: Remove unused registry variables
  DSPBRIDGE: OSAL: Clean up dbreg.h and move it
  DSPBRIDGE: OSAL: Implement registry as linked list
  DSPBRIDGE: OSAL: Remove printS()

 arch/arm/plat-omap/include/dspbridge/dbdefs.h |   26 +++
 arch/arm/plat-omap/include/dspbridge/dbreg.h  |  113 
 arch/arm/plat-omap/include/dspbridge/reg.h|  102 ++-
 drivers/dsp/bridge/pmgr/dev.c |1 -
 drivers/dsp/bridge/rmgr/dbdcd.c   |   22 +--
 drivers/dsp/bridge/rmgr/drv.c |   25 +--
 drivers/dsp/bridge/rmgr/drv_interface.c   |   37 +---
 drivers/dsp/bridge/rmgr/dspdrv.c  |3 -
 drivers/dsp/bridge/rmgr/mgr.c |1 -
 drivers/dsp/bridge/rmgr/node.c|1 -
 drivers/dsp/bridge/rmgr/proc.c|1 -
 drivers/dsp/bridge/rmgr/strm.c|1 -
 drivers/dsp/bridge/services/cfg.c |   53 ++
 drivers/dsp/bridge/services/reg.c |   29 +--
 drivers/dsp/bridge/services/regsup.c  |  243 +++-
 drivers/dsp/bridge/services/regsup.h  |7 +-
 drivers/dsp/bridge/wmd/io_sm.c|1 -
 drivers/dsp/bridge/wmd/tiomap3430.c   |5 +-
 18 files changed, 164 insertions(+), 507 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbreg.h

--
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


[PATCHv2 4/5] DSPBRIDGE: OSAL: Implement registry as linked list

2009-09-23 Thread Andy Shevchenko
From: Andy Shevchenko 

Change implementation of registry to a linked list.

In future this will became to some static structures and probably list for
DCD_REGKEY array.

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/services/regsup.c |  216 +++---
 drivers/dsp/bridge/services/regsup.h |3 -
 2 files changed, 70 insertions(+), 149 deletions(-)

diff --git a/drivers/dsp/bridge/services/regsup.c 
b/drivers/dsp/bridge/services/regsup.c
index e40d989..71651a8 100644
--- a/drivers/dsp/bridge/services/regsup.c
+++ b/drivers/dsp/bridge/services/regsup.c
@@ -42,27 +42,21 @@
 
 /*  --- OS Adaptation Layer */
 #include 
+#include 
 
 /*  --- This */
 #include 
 
-struct RegValueStruct {
-   char name[BRIDGE_MAX_NAME_SIZE];   /*  Name of a given value entry  */
+struct RegValue {
+   struct list_head link;  /* Make it linked to a list */
+   char name[MAXREGPATHLENGTH];/*  Name of a given value entry  */
u32 dataSize;   /*  Size of the data  */
void *pData;/*  Pointer to the actual data  */
int counter;/* Number of register attempts for this key */
 };
 
-struct RegKeyStruct {
-   /*The current number of value entries this key has*/
-   u32 numValueEntries;
-   /* Array of value entries */
-   struct RegValueStruct values[BRIDGE_MAX_NUM_REG_ENTRIES];
-};
-
-
 /*  Pointer to the registry support key  */
-static struct RegKeyStruct *pRegKey;
+static struct LST_LIST regKey, *pRegKey = ®Key;
 
 #if GT_TRACE
 extern struct GT_Mask REG_debugMask;   /* GT trace var. */
@@ -95,14 +89,7 @@ static inline void printS(void *pBuf)
  */
 bool regsupInit(void)
 {
-   if (pRegKey != NULL)
-   return true;
-
-   /*  Need to allocate and setup our registry.  */
-   pRegKey = MEM_Calloc(sizeof(struct RegKeyStruct), MEM_NONPAGED);
-   if (pRegKey == NULL)
-   return false;
-
+   INIT_LIST_HEAD(&pRegKey->head);
return true;
 }
 
@@ -113,41 +100,12 @@ bool regsupInit(void)
  */
 void regsupExit(void)
 {
-   u32 i;
-
-   /*  Make sure data has actually been allocated.  */
-   if (pRegKey == NULL) {
-   /*  Nothing initialized.return!  */
-   return;
-   }
-
-   GT_1trace(REG_debugMask, GT_2CLASS, "pRegKey->numValueEntries %d\n",
- pRegKey->numValueEntries);
-
/*  Now go through each entry and free all resources.  */
-   for (i = 0; ((i < BRIDGE_MAX_NUM_REG_ENTRIES) &&
-   (i < pRegKey->numValueEntries)); i++) {
-   if (pRegKey->values[i].name[0] != '\0') {
-   /*  We have a valid entry.free it up!  */
-   if (pRegKey->values[i].pData != NULL) {
-   GT_3trace(REG_debugMask, GT_2CLASS,
- "E %d\t %s DATA %x ", i,
- pRegKey->values[i].name,
- *(u32 *)pRegKey->values[i].pData);
-   printS((u8 *)(pRegKey->values[i].pData));
-   MEM_Free(pRegKey->values[i].pData);
-   }
-   pRegKey->values[i].pData = NULL;
-   pRegKey->values[i].dataSize = 0;
-   pRegKey->values[i].name[0] = '\0';
-   }
+   while (!LST_IsEmpty(pRegKey)) {
+   struct RegValue *rv = (struct RegValue *)LST_GetHead(pRegKey);
+   MEM_Free(rv->pData);
+   MEM_Free(rv);
}
-
-   /*  Now that all of the resources are freed up, free the main one!  */
-   MEM_Free(pRegKey);
-
-   /*  Don't forget to NULL out the global entry!  */
-   pRegKey = NULL;
 }
 
 /*
@@ -158,25 +116,25 @@ void regsupExit(void)
 DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 *dataSize)
 {
DSP_STATUS retVal = DSP_EFAIL;
-   u32 i;
+   struct RegValue *rv = (struct RegValue *)LST_First(pRegKey);
 
/*  Need to search through the entries looking for the right one.  */
-   for (i = 0; i < pRegKey->numValueEntries; i++) {
+   while (rv) {
/*  See if the name matches.  */
-   if (strncmp(pRegKey->values[i].name, valName,
-   BRIDGE_MAX_NAME_SIZE) == 0) {
-
+   if (strncmp(rv->name, valName, MAXREGPATHLENGTH) == 0) {
/*  We have a match!  Copy out the data.  */
-   memcpy(pBuf, pRegKey->values[i].pData,
-  pRegKey->values[i].dataSize);
+   memcpy(pBuf, rv->pData, rv->dataSize);
 
/*  Get the size for the caller.  */
-   *dataSize = pRegKey->

Re: [PATCH 06/11] staging: ti dspbridge: add generic utilities

2010-06-23 Thread Andy Shevchenko
On Wed, Jun 23, 2010 at 4:02 PM, Ohad Ben-Cohen  wrote:
> Add TI's DSP Bridge generic utilities driver sources
> Signed-off-by: Andy Shevchenko 


> +++ b/drivers/staging/tidspbridge/gen/uuidutil.c

Following part could be significantly simplified

> +/*
> + *   htoi 
> + *  Purpose:
> + *      Converts a hex value to a decimal integer.
> + */

> +/*
> + *   uuid_uuid_from_string 
> + *  Purpose:
> + *      Converts a string to a struct dsp_uuid.
> + */


There is a code (because I am already in s-o-b list I just put here
the excerpts, however, I could prepare patch in standard form, if you
want to)

static s32 uuid_hex_to_bin(char *buf, s32 len)
{
s32 i;
s32 result = 0;

for (i = 0; i < len; i++) {
value = hex_to_bin(*buf++);
result *= 16;
if (value > 0)
result += value;
}

return result;
}

void uuid_uuid_from_string(IN char *pszUuid, OUT struct dsp_uuid *uuid_obj)
{
s32 j;

uuid_obj->ul_data1 = uuid_hex_to_bin(pszUuid, 8);
pszUuid += 8;

/* Step over underscore */
pszUuid++;

uuid_obj->us_data2 = (u16) uuid_hex_to_bin(pszUuid, 4);
pszUuid += 4;

/* Step over underscore */
pszUuid++;

uuid_obj->us_data3 = (u16) uuid_hex_to_bin(pszUuid, 4);
pszUuid += 4;

/* Step over underscore */
pszUuid++;

uuid_obj->uc_data4 = (u8) uuid_hex_to_bin(pszUuid, 2);
pszUuid += 2;

uuid_obj->uc_data5 = (u8) uuid_hex_to_bin(pszUuid, 2);
pszUuid += 2;

/* Step over underscore */
pszUuid++;

for (j = 0; j < 6; j++) {
uuid_obj->uc_data6[j] = (u8) uuid_hex_to_bin(pszUuid, 2);
    pszUuid += 2;
}
}



-- 
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


[PATCH] staging: tidspbridge: gen: simplify and clean up

2010-07-06 Thread Andy Shevchenko
There is recently added hex_to_bin() kernel's method which we could use
instead of custom long function.

Signed-off-by: Andy Shevchenko 
Cc: Ohad Ben-Cohen 
Cc: Greg Kroah-Hartman 
Cc: linux-omap@vger.kernel.org
---
 drivers/staging/tidspbridge/gen/uuidutil.c |  167 +---
 1 files changed, 28 insertions(+), 139 deletions(-)

diff --git a/drivers/staging/tidspbridge/gen/uuidutil.c 
b/drivers/staging/tidspbridge/gen/uuidutil.c
index ce9319d..eb09bc3 100644
--- a/drivers/staging/tidspbridge/gen/uuidutil.c
+++ b/drivers/staging/tidspbridge/gen/uuidutil.c
@@ -54,61 +54,19 @@ void uuid_uuid_to_string(IN struct dsp_uuid *uuid_obj, OUT 
char *pszUuid,
DBC_ENSURE(i != -1);
 }
 
-/*
- *   htoi 
- *  Purpose:
- *  Converts a hex value to a decimal integer.
- */
-
-static int htoi(char c)
+static s32 uuid_hex_to_bin(char *buf, s32 len)
 {
-   switch (c) {
-   case '0':
-   return 0;
-   case '1':
-   return 1;
-   case '2':
-   return 2;
-   case '3':
-   return 3;
-   case '4':
-   return 4;
-   case '5':
-   return 5;
-   case '6':
-   return 6;
-   case '7':
-   return 7;
-   case '8':
-   return 8;
-   case '9':
-   return 9;
-   case 'A':
-   return 10;
-   case 'B':
-   return 11;
-   case 'C':
-   return 12;
-   case 'D':
-   return 13;
-   case 'E':
-   return 14;
-   case 'F':
-   return 15;
-   case 'a':
-   return 10;
-   case 'b':
-   return 11;
-   case 'c':
-   return 12;
-   case 'd':
-   return 13;
-   case 'e':
-   return 14;
-   case 'f':
-   return 15;
+   s32 i;
+   s32 result = 0;
+
+   for (i = 0; i < len; i++) {
+   value = hex_to_bin(*buf++);
+   result *= 16;
+   if (value > 0)
+   result += value;
}
-   return 0;
+
+   return result;
 }
 
 /*
@@ -118,106 +76,37 @@ static int htoi(char c)
  */
 void uuid_uuid_from_string(IN char *pszUuid, OUT struct dsp_uuid *uuid_obj)
 {
-   char c;
-   s32 i, j;
-   s32 result;
-   char *temp = pszUuid;
+   s32 j;
 
-   result = 0;
-   for (i = 0; i < 8; i++) {
-   /* Get first character in string */
-   c = *temp;
-
-   /* Increase the results by new value */
-   result *= 16;
-   result += htoi(c);
-
-   /* Go to next character in string */
-   temp++;
-   }
-   uuid_obj->ul_data1 = result;
+   uuid_obj->ul_data1 = uuid_hex_to_bin(pszUuid, 8);
+   pszUuid += 8;
 
/* Step over underscore */
-   temp++;
+   pszUuid++;
 
-   result = 0;
-   for (i = 0; i < 4; i++) {
-   /* Get first character in string */
-   c = *temp;
-
-   /* Increase the results by new value */
-   result *= 16;
-   result += htoi(c);
-
-   /* Go to next character in string */
-   temp++;
-   }
-   uuid_obj->us_data2 = (u16) result;
+   uuid_obj->us_data2 = (u16) uuid_hex_to_bin(pszUuid, 4);
+   pszUuid += 4;
 
/* Step over underscore */
-   temp++;
-
-   result = 0;
-   for (i = 0; i < 4; i++) {
-   /* Get first character in string */
-   c = *temp;
+   pszUuid++;
 
-   /* Increase the results by new value */
-   result *= 16;
-   result += htoi(c);
-
-   /* Go to next character in string */
-   temp++;
-   }
-   uuid_obj->us_data3 = (u16) result;
+   uuid_obj->us_data3 = (u16) uuid_hex_to_bin(pszUuid, 4);
+   pszUuid += 4;
 
/* Step over underscore */
-   temp++;
-
-   result = 0;
-   for (i = 0; i < 2; i++) {
-   /* Get first character in string */
-   c = *temp;
+   pszUuid++;
 
-   /* Increase the results by new value */
-   result *= 16;
-   result += htoi(c);
+   uuid_obj->uc_data4 = (u8) uuid_hex_to_bin(pszUuid, 2);
+   pszUuid += 2;
 
-   /* Go to next character in string */
-   temp++;
-   }
-   uuid_obj->uc_data4 = (u8) result;
-
-   result = 0;
-   for (i = 0; i < 2; i++) {
-   /* Get first character in string */
-   c = *temp;
-
-   /* Increase the results by new value */
-

Re: [PATCH] staging: ti dspbridge: fix compilation error

2010-07-09 Thread Andy Shevchenko
On Sat, Jul 10, 2010 at 1:48 AM, Rene Sapiens  wrote:
> This patch fix a compilation error in uuid_hex_to_bin
> due to the patch "simplify and clean up"
>
> Signed-off-by: Rene Sapiens 
Oh, previous version of patch was sent. Thanks for fix.

ACK.

> ---
>  drivers/staging/tidspbridge/gen/uuidutil.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 drivers/staging/tidspbridge/gen/uuidutil.c
>
> diff --git a/drivers/staging/tidspbridge/gen/uuidutil.c 
> b/drivers/staging/tidspbridge/gen/uuidutil.c
> index eb09bc3..070761b
> --- a/drivers/staging/tidspbridge/gen/uuidutil.c
> +++ b/drivers/staging/tidspbridge/gen/uuidutil.c
> @@ -58,6 +58,7 @@ static s32 uuid_hex_to_bin(char *buf, s32 len)
>  {
>        s32 i;
>        s32 result = 0;
> +       int value;
>
>        for (i = 0; i < len; i++) {
>                value = hex_to_bin(*buf++);
> --
> 1.6.3.3
>
>



-- 
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 5/5] staging:ti dspbridge: replace simple_strtoul by strict_strtoul

2010-07-28 Thread Andy Shevchenko
On Wed, Jul 28, 2010 at 6:09 PM, Greg KH  wrote:
> On Wed, Jul 28, 2010 at 09:40:52AM -0500, Ernesto Ramos wrote:
>> Replace simple_strtoul by strict_strtoul in atoi function.
>
> Why not use the built-in kernel function instead of having your own atoi
> function?
The commit message left opened questions about
http://dev.omapzoom.org/?p=tidspbridge/kernel-dspbridge.git;a=commit;h=b8af1123b47741086ef5a307ad1ec8fec6fc7f0d

-- 
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 5/5] staging:ti dspbridge: replace simple_strtoul by strict_strtoul

2010-07-28 Thread Andy Shevchenko
On Wed, Jul 28, 2010 at 5:40 PM, Ernesto Ramos  wrote:
> Replace simple_strtoul by strict_strtoul in atoi function.
In general the question what is the purpose here to do the change?

> @@ -1023,7 +1025,9 @@ static s32 atoi(char *psz_buf)
>                base = 16;
>        }
>
> -       return simple_strtoul(pch, NULL, base);
> +       ret_val = strict_strtoul(pch, base, &res);
> +
> +       return ret_val ? : res;
May be better to use explicit values in condition?

-- 
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] DSPBRIDGE: Various compile warning fixes

2010-01-21 Thread Andy Shevchenko
On Thu, Jan 21, 2010 at 3:40 PM, Ameya Palande  wrote:
> --- a/drivers/dsp/bridge/wmd/io_sm.c
> +++ b/drivers/dsp/bridge/wmd/io_sm.c
> @@ -1210,7 +1210,7 @@ static void InputChnl(struct IO_MGR *pIOMgr, struct 
> CHNL_OBJECT *pChnl,
>                            pChnlMgr->uWordSize;
>        chnlId = IO_GetValue(pIOMgr->hWmdContext, struct SHM, sm, inputId);
>        dwArg = IO_GetLong(pIOMgr->hWmdContext, struct SHM, sm, arg);
> -       if (!(chnlId >= 0) || !(chnlId < CHNL_MAXCHANNELS)) {
> +       if (chnlId >= CHNL_MAXCHANNELS) {
Could chnlld be less than zero? Anyway better to test:
(chnlId >= CHNL_MAXCHANNELS || chnlld < 0)

-- 
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


[PATCH] dspbridge: minor clean up in memdefs.h

2010-01-27 Thread andy . shevchenko
From: Andy Shevchenko 

Remove useless macroses. They were doing nothing, so it's clear to just get rid
of them.

Signed-off-by: Andy Shevchenko 
---
 arch/arm/plat-omap/include/dspbridge/memdefs.h |3 ---
 drivers/dsp/bridge/wmd/tiomap_io.c |5 ++---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/memdefs.h 
b/arch/arm/plat-omap/include/dspbridge/memdefs.h
index e70225e..2e44f5c 100644
--- a/arch/arm/plat-omap/include/dspbridge/memdefs.h
+++ b/arch/arm/plat-omap/include/dspbridge/memdefs.h
@@ -34,7 +34,4 @@
 #define MEM_GETVIRTUALSEGID 0x2000
 #define MEM_MASKVIRTUALSEGID(MEM_SETVIRTUALSEGID | MEM_GETVIRTUALSEGID)
 
-#define TO_VIRTUAL_UNCACHED(x) x
-#define INTREG_TO_VIRTUAL_UNCACHED(x) x
-
 #endif /* MEMDEFS_ */
diff --git a/drivers/dsp/bridge/wmd/tiomap_io.c 
b/drivers/dsp/bridge/wmd/tiomap_io.c
index f60b8db..4e85efd 100644
--- a/drivers/dsp/bridge/wmd/tiomap_io.c
+++ b/drivers/dsp/bridge/wmd/tiomap_io.c
@@ -366,9 +366,8 @@ DSP_STATUS WriteExtDspData(struct WMD_DEV_CONTEXT 
*pDevContext,
 dwExtProgVirtMem);
 
pDevContext->dwDspExtBaseAddr =
-   (u32)MEM_LinearAddress((void *)
-   TO_VIRTUAL_UNCACHED(dwExtProgVirtMem), ulExtEnd
-   - ulExtBase);
+   (u32)MEM_LinearAddress((void *)dwExtProgVirtMem,
+   ulExtEnd - ulExtBase);
dwBaseAddr += pDevContext->dwDspExtBaseAddr;
/* This dwDspExtBaseAddr will get cleared only when
 * the board is stopped.  */
-- 
1.5.6.5

--
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


[PATCH] dspbridge: Simplify Atoi() method

2010-02-03 Thread Andy Shevchenko
From: Andy Shevchenko 

Try to use simple_strtol() kernel native method instead.

However, there are opened questions:
 - why type of Atoi() is s32 if the sign is used only to detect base?
 - should we really to check hex integers like DEAD0123h?
 - how many spaces could lead token?

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/dbdcd.c |   42 +-
 1 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/dbdcd.c b/drivers/dsp/bridge/rmgr/dbdcd.c
index caa57f1..fe2ed57 100644
--- a/drivers/dsp/bridge/rmgr/dbdcd.c
+++ b/drivers/dsp/bridge/rmgr/dbdcd.c
@@ -1002,50 +1002,20 @@ DSP_STATUS DCD_UnregisterObject(IN struct DSP_UUID 
*pUuid,
  */
 static s32 Atoi(char *pszBuf)
 {
-   s32 result = 0;
char *pch = pszBuf;
-   char c;
-   char first;
-   s32 base = 10;
-   s32 len;
+   s32 base = 0;
 
while (isspace(*pch))
pch++;
 
-   first = *pch;
-   if (first == '-' || first == '+') {
+   if (*pch == '-' || *pch == '+') {
+   base = 10;
pch++;
-   } else {
-   /* Determine if base 10 or base 16 */
-   len = strlen(pch);
-   if (len  > 1) {
-   c = pch[1];
-   if ((*pch == '0' && (c == 'x' || c == 'X'))) {
-   base = 16;
-   pch += 2;
-   }
-   c = pch[len - 1];
-   if (c == 'h' || c == 'H')
-   base = 16;
-
-   }
-   }
-
-   while (isdigit(c = *pch) || ((base == 16) && isxdigit(c))) {
-   result *= base;
-   if ('A' <= c && c <= 'F') {
-   c = c - 'A' + 10;
-   } else {
-   if ('a' <= c && c <= 'f')
-   c = c - 'a' + 10;
-   else
-   c -= '0';
-   }
-   result += c;
-   ++pch;
+   } else if (*pch && (pch[strlen(pch) - 1] | 0x20 == 'h')) {
+   base = 16;
}
 
-   return result;
+   return simple_strtoul(pch, NULL, base);
 }
 
 /*
-- 
1.5.6.5

--
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: [Patchv2 0/8] DSPBRIDGE: typedef cleanup

2010-02-06 Thread Andy Shevchenko
On Sat, Feb 6, 2010 at 3:21 AM, Hebbar, Shivananda  wrote:
> Resending the patches after updating review comments and also
> Fixing some compilation breaks.

Sorry for late question, however, I fully agree with HANDLE -> void *,
but why u32 is not normal type for those changes? What do I miss?

-- 
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] dspbridge: Simplify Atoi() method

2010-02-09 Thread Andy Shevchenko
On Wed, Feb 10, 2010 at 4:02 AM, Omar Ramirez Luna  wrote:
>> Try to use simple_strtol() kernel native method instead.
> strtol or strtoul?
I don't know for sure, see below.

>> However, there are opened questions:
>>  - why type of Atoi() is s32 if the sign is used only to detect base?
This is the question about l vs ul.

>> +       } else if (*pch&&  (pch[strlen(pch) - 1] | 0x20 == 'h')) {
>
> perhaps tolower(x)
Yep, I saw only internal macro in lib/vsprintf.c, but totally forgot
about ctype.h.

-- 
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


[PATCH] dspbridge: Simplify Atoi() method (v2)

2010-02-10 Thread Andy Shevchenko
From: Andy Shevchenko 

Try to use simple_strtoul() kernel native method instead.

However, there are opened questions:
 - why type of Atoi() is s32 if the sign is used only to detect base?
 - should we really to check hex integers like DEAD0123h?
 - how many spaces could lead token?

Signed-off-by: Andy Shevchenko 
---
 drivers/dsp/bridge/rmgr/dbdcd.c |   42 +-
 1 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/dbdcd.c b/drivers/dsp/bridge/rmgr/dbdcd.c
index 9efb7dc..a460d1a 100644
--- a/drivers/dsp/bridge/rmgr/dbdcd.c
+++ b/drivers/dsp/bridge/rmgr/dbdcd.c
@@ -1001,50 +1001,20 @@ DSP_STATUS DCD_UnregisterObject(IN struct DSP_UUID 
*pUuid,
  */
 static s32 Atoi(char *pszBuf)
 {
-   s32 result = 0;
char *pch = pszBuf;
-   char c;
-   char first;
-   s32 base = 10;
-   s32 len;
+   s32 base = 0;
 
while (isspace(*pch))
pch++;
 
-   first = *pch;
-   if (first == '-' || first == '+') {
+   if (*pch == '-' || *pch == '+') {
+   base = 10;
pch++;
-   } else {
-   /* Determine if base 10 or base 16 */
-   len = strlen(pch);
-   if (len  > 1) {
-   c = pch[1];
-   if ((*pch == '0' && (c == 'x' || c == 'X'))) {
-   base = 16;
-   pch += 2;
-   }
-   c = pch[len - 1];
-   if (c == 'h' || c == 'H')
-   base = 16;
-
-   }
-   }
-
-   while (isdigit(c = *pch) || ((base == 16) && isxdigit(c))) {
-   result *= base;
-   if ('A' <= c && c <= 'F') {
-   c = c - 'A' + 10;
-   } else {
-   if ('a' <= c && c <= 'f')
-   c = c - 'a' + 10;
-   else
-   c -= '0';
-   }
-   result += c;
-   ++pch;
+   } else if (*pch && tolower(pch[strlen(pch) - 1]) == 'h') {
+   base = 16;
}
 
-   return result;
+   return simple_strtoul(pch, NULL, base);
 }
 
 /*
-- 
1.5.6.5

--
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[0/2]:DSPBRIDGE: Excessive u32 Cleanup

2010-02-18 Thread Andy Shevchenko
On Thu, Feb 18, 2010 at 10:10 PM, Hebbar, Shivananda  wrote:
>> What is the motivation of this change?
> Sometime back ,there was comment on excessive u32ypes used in bridge.
> http://marc.info/?l=linux-omap&m=123998339213416&w=2
I respect Artem for his work, but his personal hate of u* types not a
reason to bring some useless patches.

Look:
[a...@localhost linux-2.6]$ git grep -n -w u32 | wc
  76327  388062 5253203

I guess you don't need further exlanations here.

-- 
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] Media controller: Define media_entity_init() and media_entity_cleanup() conditionally

2011-08-17 Thread Andy Shevchenko
On Wed, 2011-08-17 at 16:04 +0530, Deepthy Ravi wrote: 
> From: Vaibhav Hiremath 
> 
> Defines the two functions only when CONFIG_MEDIA_CONTROLLER
> is enabled.
Is it not a driver's option to be dependent on MEDIA_CONTROLLER?


-- 
Andy Shevchenko 
Intel Finland Oy
--
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: [PATCHv2] ISP:BUILD:FIX: Move media_entity_init() and

2011-08-24 Thread Andy Shevchenko
> > > >> Fix the build break caused when CONFIG_MEDIA_CONTROLLER
> > > >> option is disabled and if any sensor driver has to be used
> > > >> between MC and non MC framework compatible devices.
> > > >>
> > > >> For example,if tvp514x video decoder driver migrated to
> > > >> MC framework is being built without CONFIG_MEDIA_CONTROLLER
> > > >> option enabled, the following error messages will result.
> > > >> drivers/built-in.o: In function `tvp514x_remove':
> > > >> drivers/media/video/tvp514x.c:1285: undefined reference to
> > > >> `media_entity_cleanup'
> > > >> drivers/built-in.o: In function `tvp514x_probe':
> > > >> drivers/media/video/tvp514x.c:1237: undefined reference to
> > > >> `media_entity_init'
> > > >
> > > > If the tvp514x is migrated to the MC framework, its Kconfig option
> > should
> > > > depend on MEDIA_CONTROLLER.
> > >
> > > The same TVP514x driver is being used for both MC and non MC compatible
> > > devices, for example OMAP3 and AM35x. So if it is made dependent on
> > MEDIA
> > > CONTROLLER, we cannot enable the driver for MC independent devices.
> > 
> > Then you should use conditional compilation in the tvp514x driver itself.
> > Or
> [Hiremath, Vaibhav] No. I am not in favor of conditional compilation in 
> driver code. 
> 
> > better, port the AM35x driver to the MC API.
> > 
> [Hiremath, Vaibhav] 
> Why should we use MC if I have very simple device (like AM35x) which only 
> supports single path? I can very well use simple V4L2 sub-dev based approach 
> (master - slave), isn't it?
Why should you break the API in unappropriated way?

The patch is NACK, obviously.

-- 
Andy Shevchenko 
Intel Finland Oy
--
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 V2 04/16] mmc: omap_hsmmc: reduce a bit the error handlers in probe()

2011-05-06 Thread Andy Shevchenko
On Fri, May 6, 2011 at 2:34 PM, Varadarajan, Charulatha  wrote:
> On Fri, May 6, 2011 at 14:44, Adrian Hunter  wrote:
>> From: Andy Shevchenko 
>>
>
> Add patch description here.
You mean something like following:
"The code contains similarities in the error path of probe function.
Let's combine them at one place."
?

>
>> Signed-off-by: Andy Shevchenko 
>> Signed-off-by: Adrian Hunter 
>> ---
>>  drivers/mmc/host/omap_hsmmc.c |   17 ++---
>>  1 files changed, 6 insertions(+), 11 deletions(-)
>>
>
> <>
> --
> 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
>



-- 
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


[PATCHv2.1] mmc: omap_hsmmc: reduce a bit the error handlers in probe()

2011-05-10 Thread Andy Shevchenko
The code contains the similarities in the error path of probe function. Let's
combine them at one place.

Signed-off-by: Andy Shevchenko 
Signed-off-by: Adrian Hunter 
---
 drivers/mmc/host/omap_hsmmc.c |   17 ++---
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index aeaf0cf..b9200ef 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2118,18 +2118,11 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
/* we start off in DISABLED state */
host->dpm_state = DISABLED;
 
-   if (clk_enable(host->iclk) != 0) {
-   clk_put(host->iclk);
-   clk_put(host->fclk);
-   goto err1;
-   }
+   if (clk_enable(host->iclk) != 0)
+   goto err2;
 
-   if (mmc_host_enable(host->mmc) != 0) {
-   clk_disable(host->iclk);
-   clk_put(host->iclk);
-   clk_put(host->fclk);
-   goto err1;
-   }
+   if (mmc_host_enable(host->mmc) != 0)
+   goto err3;
 
if (cpu_is_omap2430()) {
host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
@@ -2274,7 +2267,9 @@ err_irq_cd_init:
free_irq(host->irq, host);
 err_irq:
mmc_host_disable(host->mmc);
+err3:
clk_disable(host->iclk);
+err2:
clk_put(host->fclk);
clk_put(host->iclk);
if (host->got_dbclk) {
-- 
1.6.3.3

--
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


[PATCHv2.1] mmc: omap_hsmmc: split duplicate code to calc_divisor() function

2011-05-10 Thread Andy Shevchenko
There are two places where the same calculations are done. Let's split them to
separate function.

In addition the new function is simplified by usage DIV_ROUND_UP kernel macro.

Signed-off-by: Andy Shevchenko 
Signed-off-by: Adrian Hunter 
---
 drivers/mmc/host/omap_hsmmc.c |   46 +
 1 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b9200ef..8787ba8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -584,6 +585,20 @@ static void omap_hsmmc_disable_irq(struct omap_hsmmc_host 
*host)
OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
 }
 
+/* Calculate divisor for the given clock frequency */
+static u16 calc_divisor(struct mmc_ios *ios)
+{
+   u16 dsor = 0;
+
+   if (ios->clock) {
+   dsor = DIV_ROUND_UP(OMAP_MMC_MASTER_CLOCK, ios->clock);
+   if (dsor > 250)
+   dsor = 250;
+   }
+
+   return dsor;
+}
+
 #ifdef CONFIG_PM
 
 /*
@@ -596,7 +611,6 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
struct omap_mmc_platform_data *pdata = host->pdata;
int context_loss = 0;
u32 hctl, capa, con;
-   u16 dsor = 0;
unsigned long timeout;
 
if (pdata->get_context_loss_count) {
@@ -675,21 +689,10 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
break;
}
 
-   if (ios->clock) {
-   dsor = OMAP_MMC_MASTER_CLOCK / ios->clock;
-   if (dsor < 1)
-   dsor = 1;
-
-   if (OMAP_MMC_MASTER_CLOCK / dsor > ios->clock)
-   dsor++;
-
-   if (dsor > 250)
-   dsor = 250;
-   }
-
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) & ~CEN);
-   OMAP_HSMMC_WRITE(host->base, SYSCTL, (dsor << 6) | (DTO << 16));
+   OMAP_HSMMC_WRITE(host->base, SYSCTL,
+   (calc_divisor(ios) << 6) | (DTO << 16));
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | ICE);
 
@@ -1527,7 +1530,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, 
struct mmc_request *req)
 static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
struct omap_hsmmc_host *host = mmc_priv(mmc);
-   u16 dsor = 0;
unsigned long regval;
unsigned long timeout;
u32 con;
@@ -1591,21 +1593,11 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
}
}
 
-   if (ios->clock) {
-   dsor = OMAP_MMC_MASTER_CLOCK / ios->clock;
-   if (dsor < 1)
-   dsor = 1;
-
-   if (OMAP_MMC_MASTER_CLOCK / dsor > ios->clock)
-   dsor++;
-
-   if (dsor > 250)
-   dsor = 250;
-   }
omap_hsmmc_stop_clock(host);
+
regval = OMAP_HSMMC_READ(host->base, SYSCTL);
regval = regval & ~(CLKD_MASK);
-   regval = regval | (dsor << 6) | (DTO << 16);
+   regval = regval | (calc_divisor(ios) << 6) | (DTO << 16);
OMAP_HSMMC_WRITE(host->base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | ICE);
-- 
1.6.3.3

--
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 RFC 22/26] ARM: omap: move dma channel allocation into plat-omap code

2014-01-02 Thread Andy Shevchenko
On Thu, 2014-01-02 at 15:12 +, Russell King wrote:
> This really needs to be there, because otherwise the plat-omap code can
> kfree() this data structure, and then re-use the pointer later.

One comment bellow.

> 
> Signed-off-by: Russell King 
> ---
>  arch/arm/mach-omap1/dma.c |   11 ---
>  arch/arm/mach-omap2/dma.c |7 ---
>  arch/arm/plat-omap/dma.c  |   11 ---
>  include/linux/omap-dma.h  |1 -
>  4 files changed, 8 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
> index 4aae75d40bdd..3e93d0a323a4 100644
> --- a/arch/arm/mach-omap1/dma.c
> +++ b/arch/arm/mach-omap1/dma.c
> @@ -325,17 +325,6 @@ static int __init omap1_system_dma_init(void)
>   d->dev_caps |= CLEAR_CSR_ON_READ;
>   d->dev_caps |= IS_WORD_16;
>  
> -
> - d->chan = kzalloc(sizeof(struct omap_dma_lch) *
> - (d->lch_count), GFP_KERNEL);
> - if (!d->chan) {
> - dev_err(&pdev->dev,
> - "%s: Memory allocation failed for d->chan!\n",
> - __func__);
> - ret = -ENOMEM;
> - goto exit_release_d;
> - }
> -
>   if (cpu_is_omap15xx())
>   d->chan_count = 9;
>   else if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
> diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
> index 244ff5012aed..9f210d637354 100644
> --- a/arch/arm/mach-omap2/dma.c
> +++ b/arch/arm/mach-omap2/dma.c
> @@ -251,13 +251,6 @@ static int __init omap2_system_dma_init_dev(struct 
> omap_hwmod *oh, void *unused)
>   }
>  
>   d = oh->dev_attr;
> - d->chan = kzalloc(sizeof(struct omap_dma_lch) *
> - (d->lch_count), GFP_KERNEL);
> -
> - if (!d->chan) {
> - dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
> - return -ENOMEM;
> - }
>  
>   if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
>   d->dev_caps |= HS_CHANNELS_RESERVED;
> diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
> index d4d9a5e62152..377c3d7dc4ce 100644
> --- a/arch/arm/plat-omap/dma.c
> +++ b/arch/arm/plat-omap/dma.c
> @@ -2030,9 +2030,16 @@ static int omap_system_dma_probe(struct 
> platform_device *pdev)
>  
>   dma_lch_count   = d->lch_count;
>   dma_chan_count  = dma_lch_count;
> - dma_chan= d->chan;
>   enable_1510_mode= d->dev_caps & ENABLE_1510_MODE;
>  
> + dma_chan = devm_kzalloc(&pdev->dev, sizeof(struct omap_dma_lch) *
> + dma_lch_count, GFP_KERNEL);

devm_kcalloc ?

> + if (!dma_chan) {
> + dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
> + return -ENOMEM;
> + }
> +
> +
>   if (dma_omap2plus()) {
>   dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
>   dma_lch_count, GFP_KERNEL);
> @@ -2117,7 +2124,6 @@ static int omap_system_dma_probe(struct platform_device 
> *pdev)
>   }
>  
>  exit_dma_lch_fail:
> - kfree(dma_chan);
>   return ret;
>  }
>  
> @@ -2137,7 +2143,6 @@ static int omap_system_dma_remove(struct 
> platform_device *pdev)
>   free_irq(dma_irq, (void *)(irq_rel + 1));
>   }
>   }
> - kfree(dma_chan);
>   return 0;
>  }
>  
> diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
> index 41328725721a..7813636a193d 100644
> --- a/include/linux/omap-dma.h
> +++ b/include/linux/omap-dma.h
> @@ -268,7 +268,6 @@ struct omap_dma_dev_attr {
>   u32 dev_caps;
>   u16 lch_count;
>   u16 chan_count;
> - struct omap_dma_lch *chan;
>  };
>  
>  enum {

-- 
Andy Shevchenko 
Intel Finland Oy

--
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 RFC 20/26] ARM: omap: clean up DMA register accesses

2014-01-02 Thread Andy Shevchenko
 [CDAC]  = 0xb8,
> + [CCR]   = { 0x0080, 0x60, OMAP_DMA_REG_32BIT },
> + [CLNK_CTRL] = { 0x0084, 0x60, OMAP_DMA_REG_32BIT },
> + [CICR]  = { 0x0088, 0x60, OMAP_DMA_REG_32BIT },
> + [CSR]   = { 0x008c, 0x60, OMAP_DMA_REG_32BIT },
> + [CSDP]  = { 0x0090, 0x60, OMAP_DMA_REG_32BIT },
> + [CEN]   = { 0x0094, 0x60, OMAP_DMA_REG_32BIT },
> + [CFN]   = { 0x0098, 0x60, OMAP_DMA_REG_32BIT },
> + [CSEI]  = { 0x00a4, 0x60, OMAP_DMA_REG_32BIT },
> + [CSFI]  = { 0x00a8, 0x60, OMAP_DMA_REG_32BIT },
> + [CDEI]  = { 0x00ac, 0x60, OMAP_DMA_REG_32BIT },
> + [CDFI]  = { 0x00b0, 0x60, OMAP_DMA_REG_32BIT },
> + [CSAC]  = { 0x00b4, 0x60, OMAP_DMA_REG_32BIT },
> + [CDAC]  = { 0x00b8, 0x60, OMAP_DMA_REG_32BIT },
>  
>   /* Channel specific register offsets */
> - [CSSA]  = 0x9c,
> - [CDSA]  = 0xa0,
> - [CCEN]  = 0xbc,
> - [CCFN]  = 0xc0,
> - [COLOR] = 0xc4,
> + [CSSA]  = { 0x009c, 0x60, OMAP_DMA_REG_32BIT },
> + [CDSA]  = { 0x00a0, 0x60, OMAP_DMA_REG_32BIT },
> + [CCEN]  = { 0x00bc, 0x60, OMAP_DMA_REG_32BIT },
> + [CCFN]  = { 0x00c0, 0x60, OMAP_DMA_REG_32BIT },
> + [COLOR] = { 0x00c4, 0x60, OMAP_DMA_REG_32BIT },
>  
>   /* OMAP4 specific registers */
> - [CDP]   = 0xd0,
> - [CNDP]  = 0xd4,
> - [CCDN]  = 0xd8,
> + [CDP]   = { 0x00d0, 0x60, OMAP_DMA_REG_32BIT },
> + [CNDP]  = { 0x00d4, 0x60, OMAP_DMA_REG_32BIT },
> + [CCDN]  = { 0x00d8, 0x60, OMAP_DMA_REG_32BIT },
>  };
>  
>  static void __iomem *dma_base;
>  static inline void dma_write(u32 val, int reg, int lch)
>  {
> - u8  stride;
> - u32 offset;
> + void __iomem *addr = dma_base;
> +
> + addr += reg_map[reg].offset;
> + addr += reg_map[reg].stride * lch;
>  
> - stride = (reg >= CSDP) ? OMAP2_DMA_STRIDE : 0;
> - offset = reg_map[reg] + (stride * lch);
> - __raw_writel(val, dma_base + offset);
> + __raw_writel(val, addr);
>  }
>  
>  static inline u32 dma_read(int reg, int lch)
>  {
> - u8 stride;
> - u32 offset, val;
> + void __iomem *addr = dma_base;
> +
> + addr += reg_map[reg].offset;
> + addr += reg_map[reg].stride * lch;
>  
> - stride = (reg >= CSDP) ? OMAP2_DMA_STRIDE : 0;
> - offset = reg_map[reg] + (stride * lch);
> - val = __raw_readl(dma_base + offset);
> - return val;
> + return __raw_readl(addr);
>  }
>  
>  static void omap2_clear_dma(int lch)
> diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
> index 0bb7de77d478..41328725721a 100644
> --- a/include/linux/omap-dma.h
> +++ b/include/linux/omap-dma.h
> @@ -271,6 +271,19 @@ struct omap_dma_dev_attr {
>   struct omap_dma_lch *chan;
>  };
>  
> +enum {
> + OMAP_DMA_REG_NONE,
> + OMAP_DMA_REG_16BIT,
> + OMAP_DMA_REG_2X16BIT,
> + OMAP_DMA_REG_32BIT,
> +};
> +
> +struct omap_dma_reg {
> + u16 offset;
> + u8  stride;
> + u8  type;
> +};
> +
>  /* System DMA platform data structure */
>  struct omap_system_dma_plat_info {
>   struct omap_dma_dev_attr *dma_attr;

-- 
Andy Shevchenko 
Intel Finland Oy

--
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: [RFC PATCH 0/5] add gpio_chip_ops to hold GPIO operations

2014-04-10 Thread Andy Shevchenko
On Thu, 2014-04-10 at 11:34 +0200, Javier Martinez Canillas wrote:
> On 04/10/2014 09:36 AM, Alexandre Courbot wrote:
> > 
> > "Since having the operations" maybe?
> > 
> 
> Yes, since I'm not a native english speaker I sometimes miss some obvious
> grammatical errors. I'll fix those when posting the final version with all the
> drivers converted.

JFYI: there is nice project called codespell [1].

[1] git://github.com/lucasdemarchi/codespell.git

-- 
Andy Shevchenko 
Intel Finland Oy

--
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 v2] usb: omap2430: fix memleak in err case

2013-05-28 Thread Andy Shevchenko
No go.

Check the 4b7e450fb5cefb5865c77999a675330206ab3b8a
And update you tree, please.

--
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 v5 03/14] ARM: edma: add AM33XX support to the private EDMA API

2013-01-28 Thread Andy Shevchenko
 &pdev->dev);
> @@ -1476,8 +1760,12 @@ static int edma_probe(struct platform_device *pdev)
> goto fail;
> }
>
> -   sprintf(irq_name, "edma%d_err", j);
> -   err_irq[j] = platform_get_irq_byname(pdev, irq_name);
> +   if (node)
> +   err_irq[j] = irq_of_parse_and_map(node, 2);
> +   else {
> +   sprintf(irq_name, "edma%d_err", j);
> +   err_irq[j] = platform_get_irq_byname(pdev, irq_name);
> +   }
> edma_cc[j]->irq_res_end = err_irq[j];
> status = request_irq(err_irq[j], dma_ccerr_handler, 0,
> "edma_error", &pdev->dev);
> @@ -1538,9 +1826,17 @@ fail1:
> return status;
>  }
>
> +static const struct of_device_id edma_of_ids[] = {
> +   { .compatible = "ti,edma3", },
> +   {}
> +};
>
>  static struct platform_driver edma_driver = {
> -   .driver.name= "edma",
> +   .driver = {
> +   .name   = "edma",
> +   .of_match_table = edma_of_ids,
> +   },
> +   .probe = edma_probe,
>  };
>
>  static int __init edma_init(void)
> diff --git a/include/linux/platform_data/edma.h 
> b/include/linux/platform_data/edma.h
> index 2344ea2..ffc1fb2 100644
> --- a/include/linux/platform_data/edma.h
> +++ b/include/linux/platform_data/edma.h
> @@ -177,6 +177,7 @@ struct edma_soc_info {
>
> const s8(*queue_tc_mapping)[2];
> const s8(*queue_priority_mapping)[2];
> +   const s16   (*xbar_chans)[2];
>  };
>
>  #endif
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
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 v5 07/14] dmaengine: add dma_request_slave_channel_compat()

2013-01-28 Thread Andy Shevchenko
On Tue, Jan 15, 2013 at 10:32 PM, Matt Porter  wrote:
> Adds a dma_request_slave_channel_compat() wrapper which accepts
> both the arguments from dma_request_channel() and
> dma_request_slave_channel(). Based on whether the driver is
> instantiated via DT, the appropriate channel request call will be
> made.
>
> This allows for a much cleaner migration of drivers to the
> dmaengine DT API as platforms continue to be mixed between those
> that boot using DT and those that do not.

Does it mean the introduced function is kinda temporary?

>
> Suggested-by: Tony Lindgren 
> Signed-off-by: Matt Porter 
> Acked-by: Tony Lindgren 
> ---
>  include/linux/dmaengine.h |   10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 9fd0c5b..64f9f69 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -1047,6 +1047,16 @@ void dma_run_dependencies(struct 
> dma_async_tx_descriptor *tx);
>  struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
>  struct dma_chan *net_dma_find_channel(void);
>  #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
> +static inline struct dma_chan
> +*dma_request_slave_channel_compat(dma_cap_mask_t mask, dma_filter_fn fn,
> + void *fn_param, struct device *dev,
> + char *name)
> +{
> +   if (dev->of_node)
> +   return dma_request_slave_channel(dev, name);
> +   else
> +   return dma_request_channel(mask, fn, fn_param);
> +}
>
>  /* --- Helper iov-locking functions --- */
>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
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 v5 03/14] ARM: edma: add AM33XX support to the private EDMA API

2013-01-29 Thread Andy Shevchenko
On Wed, Jan 30, 2013 at 8:41 AM, Matt Porter  wrote:
> On Mon, Jan 28, 2013 at 09:27:24PM +0200, Andy Shevchenko wrote:
>> On Tue, Jan 15, 2013 at 10:32 PM, Matt Porter  wrote:
>> > Adds support for parsing the TI EDMA DT data into the required
>> > EDMA private API platform data. Enables runtime PM support to
>> > initialize the EDMA hwmod. Adds AM33XX EMDA crossbar event mux
>> > support.
>> >
>> > Signed-off-by: Matt Porter 
>> > ---
>> >  arch/arm/common/edma.c |  314 
>> > ++--
>> >  include/linux/platform_data/edma.h |1 +
>> >  2 files changed, 306 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
>> > index 2dce245..beeb1d2 100644
>> > --- a/arch/arm/common/edma.c
>> > +++ b/arch/arm/common/edma.c
>> > @@ -24,6 +24,13 @@
>> >  #include 
>> >  #include 
>> >  #include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> >
>> >  #include 
>> >
>> > @@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel);
>> >   */
>> >  int edma_alloc_slot(unsigned ctlr, int slot)
>> >  {
>> > +   if (!edma_cc[ctlr])
>> > +   return -EINVAL;
>> > +
>> > if (slot >= 0)
>> > slot = EDMA_CHAN_SLOT(slot);
>> >
>> > @@ -1366,31 +1376,291 @@ void edma_clear_event(unsigned channel)
>> >  EXPORT_SYMBOL(edma_clear_event);
>> >
>> >  
>> > /*---*/
>> > +static int edma_of_read_u32_to_s8_array(const struct device_node *np,
>> > +const char *propname, s8 
>> > *out_values,
>> > +size_t sz)
>>
>> I'm sorry I didn't get why you couldn't use of_property_read_u8_array() ?
>> The similar comment to u16 and so on.
>
> There's some manipulation of the legacy Davinci platform data
> structures going on here. The driving reason was to not change any of
> the davinci platforms pdata which uses s8/s16 tables of mapping values
> with signed values as terminators. These versions below add the
> convert to the signed value and terminate the array as needed by the
> existing driver. This will all go away when the driver is rewritten and
> merged into drivers/dma/edma.c. At that point I want to throwaway all
> these legacy data structures. First, there's some more drivers to
> convert to dmaengine api.
>

I mean instead of custom functions you could use existing ones.
And sign here will be implicitly applied.

So, what I propose is to do something like this

static int edma_of_read_u32_to_s8_array(const struct device_node *np,
const char *propname, s8 *out_values,
size_t sz)
{

int ret;
ret = of_property_read_u8_array(np, propname, out_values, sz);
if (ret)
 return ret;

   /* Terminate it */
   *out_values++ = -1;
   *out_values++ = -1;
}

> -Matt
>>
>> > +{
>> > +   struct property *prop = of_find_property(np, propname, NULL);
>> > +   const __be32 *val;
>> > +
>> > +   if (!prop)
>> > +   return -EINVAL;
>> > +   if (!prop->value)
>> > +   return -ENODATA;
>> > +   if ((sz * sizeof(u32)) > prop->length)
>> > +   return -EOVERFLOW;
>> > +
>> > +   val = prop->value;
>> > +
>> > +   while (sz--)
>> > +   *out_values++ = (s8)(be32_to_cpup(val++) & 0xff);
>> > +
>> > +   /* Terminate it */
>> > +   *out_values++ = -1;
>> > +   *out_values++ = -1;
>> > +
>> > +   return 0;
>> > +}
>> > +
>> > +static int edma_of_read_u32_to_s16_array(const struct device_node *np,
>> > +const char *propname, s16 
>> > *out_values,
>> > +size_t sz)
>> > +{
>> > +   struct property *prop = of_find_property(np, propname, NULL);
>> > +   const __be32 *val;
>> > +
>> > +   if (!prop)
>> > +   return -EINVAL;
>> > +   if (!prop->value)
>> > +   return -ENODATA;
>> 

Re: [PATCH v9 3/9] ARM: edma: add AM33XX support to the private EDMA API

2013-03-06 Thread Andy Shevchenko
On Wed, Mar 6, 2013 at 6:15 PM, Matt Porter  wrote:
> Adds support for parsing the TI EDMA DT data into the
> required EDMA private API platform data. Enables runtime
> PM support to initialize the EDMA hwmod. Adds AM33XX EDMA
> crossbar event mux support. Enables build on OMAP.

> --- a/arch/arm/common/edma.c
> +++ b/arch/arm/common/edma.c

> +static int edma_xbar_event_map(struct device *dev,
> +  struct device_node *node,
> +  struct edma_soc_info *pdata, int len)
> +{
> +   int ret = 0;
> +   int i;
> +   struct resource res;
> +   void *xbar;
> +   const s16 (*xbar_chans)[2];
> +   u32 shift, offset, mux;
> +
> +   xbar_chans = devm_kzalloc(dev,
> + len/sizeof(s16) + 2*sizeof(s16),
> + GFP_KERNEL);
> +   if (!xbar_chans)
> +   return -ENOMEM;
> +
> +   ret = of_address_to_resource(node, 1, &res);
> +   if (ret)
> +   return -EIO;
> +
> +   xbar = devm_ioremap(dev, res.start, resource_size(&res));
> +   if (!xbar)
> +   return -ENOMEM;
> +
> +   ret = edma_of_read_u32_to_s16_array(node,
> +   "ti,edma-xbar-event-map",
> +   (s16 *)xbar_chans,
> +   len/sizeof(u32));
> +   if (ret)
> +   return -EIO;
> +
> +   for (i = 0; xbar_chans[i][0] != -1; i++) {
> +   shift = (xbar_chans[i][1] % 4) * 8;

Looks like shift = (xbar_chans[i][1] & 0x03) << 3;

> +   offset = xbar_chans[i][1] >> 2;
> +   offset <<= 2;

Is it offset = xbar_chans[i][1] & 0xfffc; ?

> +   mux = readl((void *)((u32)xbar + offset));
> +   mux &= ~(0xff << shift);
> +   mux |= xbar_chans[i][0] << shift;
> +   writel(mux, (void *)((u32)xbar + offset));
> +   }


-- 
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 00/10] initial clkdev cleanups

2015-03-03 Thread Andy Shevchenko
On Mon, 2015-03-02 at 13:50 -0800, Stephen Boyd wrote:
> On 03/02/15 09:05, Russell King - ARM Linux wrote:
> > Here's some initial clkdev cleanups.  These are targetted for the next
> > merge window, and while the initial patches can be merged independently,
> > I'd prefer to keep the series together as further work on solving the
> > problems which unique struct clk's has introduced is needed.


> > I'm also killing a chunk of seemingly unused code in the omap3isp driver.
> >
> > Lastly, I'm introducing a clkdev_create() helper, which combines the
> > clkdev_alloc() + clkdev_add() pattern which keeps cropping up.
> >
> 
> We already have a solution to that problem with clk_register_clkdev().
> Andy has done some work to make clk_register_clkdev() return a struct
> clk_lookup pointer[1]. Maybe we can do that instead of introducing a new
> clkdev_create() function. There is some benefit to having a new function
> though so that we can avoid a flag day, although it looks like the flag
> day is small in this case so it might not actually matter.

> [1] https://www.marc.info/?l=linux-kernel&m=142469226512289

Agree with Stephen, why should we have the second function doing the
same? Just name changing?

I think you may just incorporate that patch into your series.

-- 
Andy Shevchenko 
Intel Finland Oy

--
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-11-18 Thread Andy Shevchenko
On Wed, Nov 18, 2015 at 5:07 PM, Arnd Bergmann  wrote:
> On Wednesday 18 November 2015 16:41:35 Peter Ujfalusi wrote:
>> On 11/18/2015 04:29 PM, Arnd Bergmann wrote:
>> > On Wednesday 18 November 2015 16:21:26 Peter Ujfalusi wrote:
>> >> 2. non slave channel requests, where only the functionality matters, like
>> >> memcpy, interleaved, memset, etc.
>> >> We could have a simple:
>> >> dma_request_channel(mask);
>> >>
>> >> But looking at the drivers using dmaengine legacy dma_request_channel() 
>> >> API:
>> >> Some sets DMA_INTERRUPT or DMA_PRIVATE or DMA_SG along with DMA_SLAVE:
>> >> drivers/misc/carma/carma-fpga.c 
>> >> DMA_INTERRUPT|DMA_SLAVE|DMA_SG
>> >> drivers/misc/carma/carma-fpga-program.c 
>> >> DMA_MEMCPY|DMA_SLAVE|DMA_SG
>> >> drivers/media/platform/soc_camera/mx3_camera.c  DMA_SLAVE|DMA_PRIVATE
>> >> sound/soc/intel/common/sst-firmware.c   DMA_SLAVE|DMA_MEMCPY
>> >>
>> >> as examples.
>> >> Not sure how valid are these...
>
> I just had a look myself. carma has been removed fortunately in linux-next,
> so we don't have to worry about that any more.
>
> I assume that the sst-firmware.c case is a mistake, it should just use a
> plain DMA_SLAVE and not DMA_MEMCPY.

Other way around.

-- 
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-11-18 Thread Andy Shevchenko
On Wed, Nov 18, 2015 at 4:21 PM, Peter Ujfalusi  wrote:
> Hi Vinod,
>
> bringing this old thread back to life as I just started to work on this.

What I remember we need to convert drivers to use new API meanwhile it
is good to keep old one to avoid patch storm which does nothing useful
(IIRC Russel's opinion).

On the other hand there are a lot of drivers that are used on the set
of platforms starting from legacy and abandoned ones (like AVR32) to
relatively new and newest.

And I'm not a fan of those thousands of API calls either.

-- 
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-11-18 Thread Andy Shevchenko
On Wed, Nov 18, 2015 at 5:51 PM, Arnd Bergmann  wrote:
> On Wednesday 18 November 2015 17:43:04 Andy Shevchenko wrote:
>> >
>> > I assume that the sst-firmware.c case is a mistake, it should just use a
>> > plain DMA_SLAVE and not DMA_MEMCPY.
>>
>> Other way around.
>>
>
> Ok, I see. In that case I guess it also shouldn't call
> dmaengine_slave_config(), right? I don't think that's valid
> on a MEMCPY channel.

Hmm… That's right, though I suspect still one thing why it's done this
way. Let's ask Vinod and Liam about that.

-- 
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-11-20 Thread Andy Shevchenko
On Fri, Nov 20, 2015 at 12:58 PM, Arnd Bergmann  wrote:
> On Friday 20 November 2015 12:25:06 Peter Ujfalusi wrote:
>> On 11/19/2015 01:25 PM, Arnd Bergmann wrote:

> Another idea would be to remove the filter function from struct dma_chan_map
> and pass the map through platform data

Why not unified device properties?

-- 
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-11-20 Thread Andy Shevchenko
On Fri, Nov 20, 2015 at 2:30 PM, Peter Ujfalusi  wrote:
> On 11/20/2015 02:24 PM, Andy Shevchenko wrote:
>> On Fri, Nov 20, 2015 at 12:58 PM, Arnd Bergmann  wrote:
>>> On Friday 20 November 2015 12:25:06 Peter Ujfalusi wrote:
>>>> On 11/19/2015 01:25 PM, Arnd Bergmann wrote:
>>
>>> Another idea would be to remove the filter function from struct dma_chan_map
>>> and pass the map through platform data
>>
>> Why not unified device properties?
>
> Is this some Windows/ACPI feature?

Nope.

Check drivers/base/property.c

> Quick search gives mostly MSDN and
> Windows10 related links.
>
> We only need dma_chan_map for platforms which has not been converted to DT and
> still using legacy boot. Or platforms which can still boot in legacy mode. In
> DT/ACPI mode we do not need this map at all.


-- 
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: [RFC v02 00/15] dmaengine: New 'universal' API for requesting channel

2015-11-30 Thread Andy Shevchenko
ma_filter_map to get the channel with the dma_get_channel() internal
> function.
>
> Regards,
> Peter
> ---
> Peter Ujfalusi (15):
>   dmaengine: core: Allow NULL mask pointer in
> __dma_device_satisfies_mask()
>   dmaengine: core: Move and merge the code paths using private_candidate
>   dmaengine: core: Introduce new, universal API to request a channel
>   dmaengine: edma: Add support for DMA filter mapping to slave devices
>   ARM: davinci: devices-da8xx: Add dma_filter_map to edma
>   ARM: davinci: dm355: Add dma_filter_map to edma
>   ARM: davinci: dm365: Add dma_filter_map to edma
>   ARM: davinci: dm644x: Add dma_filter_map to edma
>   ARM: davinci: dm646x: Add dma_filter_map to edma
>   mmc: davinci_mmc: Use dma_request_chan() to requesting DMA channel
>   spi: davinci: Use dma_request_chan() to requesting DMA channel
>   ARM: davinci: devices-da8xx: Remove DMA resources for MMC and SPI
>   ARM: davinci: devices: Remove DMA resources for MMC
>   ARM: davinci: dm355: Remove DMA resources for SPI
>   ARM: davinci: dm365: Remove DMA resources for SPI
>
>  arch/arm/mach-davinci/devices-da8xx.c |  95 ++--
>  arch/arm/mach-davinci/devices.c   |  19 
>  arch/arm/mach-davinci/dm355.c |  28 ++++--
>  arch/arm/mach-davinci/dm365.c |  30 +--
>  arch/arm/mach-davinci/dm644x.c|  12 +++
>  arch/arm/mach-davinci/dm646x.c|  11 +++
>  drivers/dma/dmaengine.c   | 160 
> +-
>  drivers/dma/edma.c|  24 +
>  drivers/mmc/host/davinci_mmc.c|  52 +++
>  drivers/spi/spi-davinci.c |  76 +---
>  include/linux/dmaengine.h |  31 +++
>  include/linux/platform_data/edma.h|   5 ++
>  12 files changed, 330 insertions(+), 213 deletions(-)
>
> --
> 2.6.3
>



-- 
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: [RFC v02 01/15] dmaengine: core: Allow NULL mask pointer in __dma_device_satisfies_mask()

2015-11-30 Thread Andy Shevchenko
On Mon, Nov 30, 2015 at 3:45 PM, Peter Ujfalusi  wrote:
> Treat as true condition the case when the mask is NULL.

What do you think about setting some default (all "on") mask when mask
is not supplied?

I don't know for sure but there might be cases when you don't want
literally *any* channel to satisfy.

>
> Signed-off-by: Peter Ujfalusi 
> ---
>  drivers/dma/dmaengine.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index daf54a39bcc7..52c3eee48e2e 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -184,6 +184,9 @@ __dma_device_satisfies_mask(struct dma_device *device,
>  {
> dma_cap_mask_t has;
>
> +   if (!want)
> +   return true;
> +
> bitmap_and(has.bits, want->bits, device->cap_mask.bits,
> DMA_TX_TYPE_END);
> return bitmap_equal(want->bits, has.bits, DMA_TX_TYPE_END);
> --
> 2.6.3
>



-- 
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


  1   2   >