public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: octeon-usb: fixed a macro coding style issue
@ 2014-04-25 13:40 Nicolas Del Piano
  2014-04-25 13:42 ` Levente Kurusa
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Del Piano @ 2014-04-25 13:40 UTC (permalink / raw)
  To: gregkh
  Cc: aaro.koskinen, devendra.aaru, raluca.oncioiu91, david.daney,
	devel, linux-kernel, Nicolas Del Piano

Fixed a coding style error, macros with comples values should be enclosed in parenthesis.

Signed-off-by: Nicolas Del Piano <ndel314@gmail.com>
---
 drivers/staging/octeon-usb/octeon-hcd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 8b8ce72..475ecc4 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -246,7 +246,7 @@ enum cvmx_usb_pipe_flags {
 };

 /* Normal prefetch that use the pref instruction. */
-#define CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0))
+#define (CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0)))

 /* Maximum number of times to retry failed transactions */
 #define MAX_RETRIES		3
--
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Staging: octeon-usb: fixed a macro coding style issue
  2014-04-25 13:40 [PATCH] Staging: octeon-usb: fixed a macro coding style issue Nicolas Del Piano
@ 2014-04-25 13:42 ` Levente Kurusa
  0 siblings, 0 replies; 5+ messages in thread
From: Levente Kurusa @ 2014-04-25 13:42 UTC (permalink / raw)
  To: Nicolas Del Piano, gregkh
  Cc: aaro.koskinen, devendra.aaru, raluca.oncioiu91, david.daney,
	devel, linux-kernel

Hi,

On 04/25/2014 03:40 PM, Nicolas Del Piano wrote:
> Fixed a coding style error, macros with comples values should be enclosed in parenthesis.
> 
> Signed-off-by: Nicolas Del Piano <ndel314@gmail.com>
> ---
>  drivers/staging/octeon-usb/octeon-hcd.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> index 8b8ce72..475ecc4 100644
> --- a/drivers/staging/octeon-usb/octeon-hcd.c
> +++ b/drivers/staging/octeon-usb/octeon-hcd.c
> @@ -246,7 +246,7 @@ enum cvmx_usb_pipe_flags {
>  };
> 
>  /* Normal prefetch that use the pref instruction. */
> -#define CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0))
> +#define (CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0)))

Not that way around! :-)

The parantheses should be around the code block not the
name block.

-- 
Regards,
Levente Kurusa
PGP: 4EF5D641

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Staging: octeon-usb: fixed a macro coding style issue
@ 2014-04-25 13:48 Nicolas Del Piano
  2014-04-25 14:21 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Del Piano @ 2014-04-25 13:48 UTC (permalink / raw)
  To: gregkh
  Cc: aaro.koskinen, devendra.aaru, raluca.oncioiu91, david.daney,
	devel, linux-kernel, Nicolas Del Piano

Fixed a coding style error, macros with complex values should be enclosed in parentheses.

Signed-off-by: Nicolas Del Piano <ndel314@gmail.com>
---
 drivers/staging/octeon-usb/octeon-hcd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 8b8ce72..ef3a8ce 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -246,7 +246,7 @@ enum cvmx_usb_pipe_flags {
 };

 /* Normal prefetch that use the pref instruction. */
-#define CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0))
+#define CVMX_PREFETCH(address, offset) (asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0)))

 /* Maximum number of times to retry failed transactions */
 #define MAX_RETRIES		3
--
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Staging: octeon-usb: fixed a macro coding style issue
  2014-04-25 13:48 Nicolas Del Piano
@ 2014-04-25 14:21 ` Greg KH
  2014-04-25 15:58   ` David Daney
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-04-25 14:21 UTC (permalink / raw)
  To: Nicolas Del Piano
  Cc: devel, david.daney, raluca.oncioiu91, linux-kernel, aaro.koskinen

On Fri, Apr 25, 2014 at 10:48:22AM -0300, Nicolas Del Piano wrote:
> Fixed a coding style error, macros with complex values should be enclosed in parentheses.
> 
> Signed-off-by: Nicolas Del Piano <ndel314@gmail.com>
> ---
>  drivers/staging/octeon-usb/octeon-hcd.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> index 8b8ce72..ef3a8ce 100644
> --- a/drivers/staging/octeon-usb/octeon-hcd.c
> +++ b/drivers/staging/octeon-usb/octeon-hcd.c
> @@ -246,7 +246,7 @@ enum cvmx_usb_pipe_flags {
>  };
> 
>  /* Normal prefetch that use the pref instruction. */
> -#define CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0))
> +#define CVMX_PREFETCH(address, offset) (asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0)))
> 
>  /* Maximum number of times to retry failed transactions */
>  #define MAX_RETRIES		3

Will that actually compile?

Why the heck are we using asm in a define in the first place?  Shouldn't
this be an inline function or something?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Staging: octeon-usb: fixed a macro coding style issue
  2014-04-25 14:21 ` Greg KH
@ 2014-04-25 15:58   ` David Daney
  0 siblings, 0 replies; 5+ messages in thread
From: David Daney @ 2014-04-25 15:58 UTC (permalink / raw)
  To: Greg KH, Nicolas Del Piano
  Cc: devel, david.daney, raluca.oncioiu91, linux-kernel, aaro.koskinen

On 04/25/2014 07:21 AM, Greg KH wrote:
> On Fri, Apr 25, 2014 at 10:48:22AM -0300, Nicolas Del Piano wrote:
>> Fixed a coding style error, macros with complex values should be enclosed in parentheses.
>>
>> Signed-off-by: Nicolas Del Piano <ndel314@gmail.com>
>> ---
>>   drivers/staging/octeon-usb/octeon-hcd.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
>> index 8b8ce72..ef3a8ce 100644
>> --- a/drivers/staging/octeon-usb/octeon-hcd.c
>> +++ b/drivers/staging/octeon-usb/octeon-hcd.c
>> @@ -246,7 +246,7 @@ enum cvmx_usb_pipe_flags {
>>   };
>>
>>   /* Normal prefetch that use the pref instruction. */
>> -#define CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0))
>> +#define CVMX_PREFETCH(address, offset) (asm volatile ("pref %[type], %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" (0)))
>>
>>   /* Maximum number of times to retry failed transactions */
>>   #define MAX_RETRIES		3
>
> Will that actually compile?

No it does not.  Really when changing things like this, you should first 
understand what it is doing.  In the case of this patch, I don't think 
that understanding was present.

It appears that in the case of this patch, Documentation/SubmitChecklist 
was not consulted.  In particular item #2(all sections) was omitted.

Q: Why did I have to waste 15 minutes of my day on this?  Is the patch 
subimtter's time so valuable that standard patch submittal procedures 
cannot be followed?

>
> Why the heck are we using asm in a define in the first place?  Shouldn't
> this be an inline function or something?

You are correct.  It turns out that <linux/prefetch.h> already has such 
a definition.

>
> thanks,
>
> greg k-h
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-25 15:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 13:40 [PATCH] Staging: octeon-usb: fixed a macro coding style issue Nicolas Del Piano
2014-04-25 13:42 ` Levente Kurusa
  -- strict thread matches above, loose matches on Subject: below --
2014-04-25 13:48 Nicolas Del Piano
2014-04-25 14:21 ` Greg KH
2014-04-25 15:58   ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox