RE: [PATCH 1/4] DSPBRIDGE: Fix macros that break when inside an if/else

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the patch, it only has indentation problems, this is the checkpatch output:

WARNING: suspect code indent for conditional statements (8, 12)
#34: FILE: drivers/dsp/bridge/pmgr/wcd.c:152:
+       if (DSP_SUCCEEDED(status)) {                    \
+           if (unlikely((src) == NULL) ||              \

WARNING: line over 80 characters
#36: FILE: drivers/dsp/bridge/pmgr/wcd.c:154:
+               unlikely(copy_from_user(dest, src, (elements) * sizeof(*(dest))))) { \

WARNING: suspect code indent for conditional statements (8, 12)
#46: FILE: drivers/dsp/bridge/pmgr/wcd.c:164:
+       if (DSP_SUCCEEDED(status)) {                    \
+           if (unlikely((dest) == NULL) ||                             \

WARNING: line over 80 characters
#48: FILE: drivers/dsp/bridge/pmgr/wcd.c:166:
+               unlikely(copy_to_user(dest, src, (elements) * sizeof(*(src))))) { \

total: 0 errors, 4 warnings, 48 lines checked

Could you please fix that warning please?

Regards,
Fernando.


> -----Original Message-----
> From: Ameya Palande [mailto:ameya.palande@xxxxxxxxx]
> Sent: Tuesday, July 07, 2009 10:02 AM
> To: linux-omap@xxxxxxxxxxxxxxx
> Cc: Guzman Lugo, Fernando; Kanigeri, Hari; ext-phil.2.carmody@xxxxxxxxx
> Subject: [PATCH 1/4] DSPBRIDGE: Fix macros that break when inside an
> if/else
> 
> From: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
> 
> cp_{to,fm}_usr break if between an if and an else (with no {}).
> 
> http://www.faqs.org/faqs/C-faq/abridged/
> 10.4: What's the best way to write a multi-statement macro?
> A:    #define Func() do {stmt1; stmt2; ... } while(0) /* (no trailing ;)
> */
> 
> Signed-off-by: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
> ---
>  drivers/dsp/bridge/pmgr/wcd.c |   42 ++++++++++++++++++++++--------------
> ----
>  1 files changed, 23 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
> index 86812c6..aaf3019 100644
> --- a/drivers/dsp/bridge/pmgr/wcd.c
> +++ b/drivers/dsp/bridge/pmgr/wcd.c
> @@ -147,25 +147,29 @@
> 
>  /* 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 ;\
> -	} \
> -    }
> +#define cp_fm_usr(dest, src, status, elements)	\
> +    do {						\
> +	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 ;				\
> +	    }						\
> +	}						\
> +    } while (0)
> +
> +#define cp_to_usr(dest, src, status, elements) \
> +    do {						\
> +	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 ;		\
> +	    }						\
> +	}						\
> +    } while (0)
> 
>  /* Device IOCtl function pointer */
>  struct WCD_Cmd {
> --
> 1.6.2.4
> 

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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux