RE: [PATCH 04/13] DSPBRIDGE: fix macros that break when inside an if/else

2009-07-19 Thread Ramirez Luna, Omar
>From: Ameya Palande [mailto:ameya.pala...@nokia.com]
>Subject: [PATCH 04/13] DSPBRIDGE: fix macros that break when inside an if/else
>
>From: Doyu Hiroshi (Nokia-D/Helsinki) 
>
>Based on the following discussion:
>  http://marc.info/?l=linux-omap&m=124697893724881&w=2
>
>Signed-off-by: Hiroshi DOYU 
>---
> drivers/dsp/bridge/pmgr/wcd.c |   60 ++--
> 1 files changed, 39 insertions(+), 21 deletions(-)
>

Fixed compiler error with debug enabled: "WCD_debugMask undeclared..."

Pushed to d.o-z

- omar
--
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 04/13] DSPBRIDGE: fix macros that break when inside an if/else

2009-07-15 Thread Guzman Lugo, Fernando

The patch looks good for me.

> -Original Message-
> From: Ameya Palande [mailto:ameya.pala...@nokia.com]
> Sent: Wednesday, July 15, 2009 9:56 AM
> To: linux-omap@vger.kernel.org
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Menon, Nishanth;
> hiroshi.d...@nokia.com
> Subject: [PATCH 04/13] DSPBRIDGE: fix macros that break when inside an
> if/else
> 
> From: Doyu Hiroshi (Nokia-D/Helsinki) 
> 
> Based on the following discussion:
>   http://marc.info/?l=linux-omap&m=124697893724881&w=2
> 
> Signed-off-by: Hiroshi DOYU 
> ---
>  drivers/dsp/bridge/pmgr/wcd.c |   60 ++--
> 
>  1 files changed, 39 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
> index 441130c..8708c78 100644
> --- a/drivers/dsp/bridge/pmgr/wcd.c
> +++ b/drivers/dsp/bridge/pmgr/wcd.c
> @@ -145,27 +145,45 @@
>  #define MAX_STREAMS 16
>  #define MAX_BUFS 64
> 
> -/* Following two macros should ideally have do{}while(0) */
> -
> -#define cp_fm_usr(dest, src, status, elements)\
> -if (DSP_SUCCEEDED(status)) {\
> - if (unlikely(src == NULL) ||\
> - unlikely(copy_from_user(dest, src, elements *
> sizeof(*(dest) { \
> - GT_1trace(WCD_debugMask, GT_7CLASS, \
> - "copy_from_user failed, src=0x%x\n", src);  \
> - status = DSP_EPOINTER ; \
> - } \
> -}
> -
> -#define cp_to_usr(dest, src, status, elements)\
> -if (DSP_SUCCEEDED(status)) {\
> - if (unlikely(dest == NULL) ||   \
> - unlikely(copy_to_user(dest, src, elements * sizeof(*(src)
> { \
> - GT_1trace(WCD_debugMask, GT_7CLASS, \
> - "copy_to_user failed, dest=0x%x\n", dest); \
> - status = DSP_EPOINTER ;\
> - } \
> -}
> +static inline void __cp_fm_usr(void *to, const void __user *from,
> +DSP_STATUS *err, unsigned long bytes)
> +{
> + if (DSP_FAILED(*err))
> + return;
> +
> + if (unlikely(!from)) {
> + *err = DSP_EPOINTER;
> + return;
> + }
> +
> + if (unlikely(copy_from_user(to, from, bytes))) {
> + GT_2trace(WCD_debugMask, GT_7CLASS,
> +   "%s failed, from=0x%08x\n", __func__, from);
> + *err = DSP_EPOINTER;
> + }
> +}
> +#define cp_fm_usr(to, from, err, n)  \
> + __cp_fm_usr(to, from, &(err), (n) * sizeof(*(to)))
> +
> +static inline void __cp_to_usr(void __user *to, const void *from,
> +DSP_STATUS *err, unsigned long bytes)
> +{
> + if (DSP_FAILED(*err))
> + return;
> +
> + if (unlikely(!to)) {
> + *err = DSP_EPOINTER;
> + return;
> + }
> +
> + if (unlikely(copy_to_user(to, from, bytes))) {
> + GT_2trace(WCD_debugMask, GT_7CLASS,
> +   "%s failed, to=0x%08x\n", __func__, to);
> + *err = DSP_EPOINTER;
> + }
> +}
> +#define cp_to_usr(to, from, err, n)  \
> + __cp_to_usr(to, from, &(err), (n) * sizeof(*(from)))
> 
>  /* Device IOCtl function pointer */
>  struct WCD_Cmd {
> --
> 1.6.2.4
> 
Acked-by Fernando Guzman Lugo 

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