2010-11-02 15:31:24

by Audun Hoem

[permalink] [raw]
Subject: [PATCH] staging: frontier: alphatrack: fixed coding style issues

Cleaned up a macro definition and another simple style warning.

Signed-off-by: Audun Hoem <[email protected]>
---
drivers/staging/frontier/alphatrack.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c
index ef7fbf8..6e3bd73 100644
--- a/drivers/staging/frontier/alphatrack.c
+++ b/drivers/staging/frontier/alphatrack.c
@@ -88,8 +88,11 @@ MODULE_SUPPORTED_DEVICE("Frontier Designs Alphatrack Control Surface");
static int debug = ALPHATRACK_DEBUG;

/* Use our own dbg macro */
-#define dbg_info(dev, format, arg...) do \
- { if (debug) dev_info(dev , format , ## arg); } while (0)
+#define dbg_info(dev, format, arg...) \
+do { \
+ if (debug) \
+ dev_info(dev , format , ## arg); \
+} while (0)

#define alphatrack_ocmd_info(dev, cmd, format, arg...)

@@ -769,7 +772,7 @@ static int usb_alphatrack_probe(struct usb_interface *intf,
}

dev->write_buffer =
- kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);
+ kmalloc(sizeof(struct alphatrack_ocmd) *true_size, GFP_KERNEL);

if (!dev->write_buffer) {
dev_err(&intf->dev, "Couldn't allocate write_buffer\n");
--
1.7.0.4


2010-11-02 15:37:48

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] staging: frontier: alphatrack: fixed coding style issues

On Tue, 2010-11-02 at 16:31 +0100, Audun Hoem wrote:
> Cleaned up a macro definition and another simple style warning.
> Signed-off-by: Audun Hoem <[email protected]>
> ---
> drivers/staging/frontier/alphatrack.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c
> index ef7fbf8..6e3bd73 100644
> --- a/drivers/staging/frontier/alphatrack.c
> +++ b/drivers/staging/frontier/alphatrack.c
> @@ -88,8 +88,11 @@ MODULE_SUPPORTED_DEVICE("Frontier Designs Alphatrack Control Surface");
> static int debug = ALPHATRACK_DEBUG;
>
> /* Use our own dbg macro */
> -#define dbg_info(dev, format, arg...) do \
> - { if (debug) dev_info(dev , format , ## arg); } while (0)
> +#define dbg_info(dev, format, arg...) \
> +do { \
> + if (debug) \
> + dev_info(dev , format , ## arg); \

There is no need for the spaces before commas.

gcc 2.xx required a space before a comma with a trailing ##arg,
but that compiler version is no longer supported.

This should be:
dev_info(dev, format, ##arg);

though I think using dev_dbg and getting rid of the dbg_info
macro is better.

> +} while (0)
>
> #define alphatrack_ocmd_info(dev, cmd, format, arg...)
>
> @@ -769,7 +772,7 @@ static int usb_alphatrack_probe(struct usb_interface *intf,
> }
>
> dev->write_buffer =
> - kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);
> + kmalloc(sizeof(struct alphatrack_ocmd) *true_size, GFP_KERNEL);

Not an improvement.

If checkpatch warns about this, it's a checkpatch defect.

2010-11-02 16:06:17

by Audun Hoem

[permalink] [raw]
Subject: Re: [PATCH] staging: frontier: alphatrack: fixed coding style issues

On 11/2/10, Joe Perches <[email protected]> wrote:
> On Tue, 2010-11-02 at 16:31 +0100, Audun Hoem wrote:
>> Cleaned up a macro definition and another simple style warning.
>> Signed-off-by: Audun Hoem <[email protected]>
>> ---
>> drivers/staging/frontier/alphatrack.c | 9 ++++++---
>> 1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/frontier/alphatrack.c
>> b/drivers/staging/frontier/alphatrack.c
>> index ef7fbf8..6e3bd73 100644
>> --- a/drivers/staging/frontier/alphatrack.c
>> +++ b/drivers/staging/frontier/alphatrack.c
>> @@ -88,8 +88,11 @@ MODULE_SUPPORTED_DEVICE("Frontier Designs Alphatrack
>> Control Surface");
>> static int debug = ALPHATRACK_DEBUG;
>>
>> /* Use our own dbg macro */
>> -#define dbg_info(dev, format, arg...) do \
>> - { if (debug) dev_info(dev , format , ## arg); } while (0)
>> +#define dbg_info(dev, format, arg...) \
>> +do { \
>> + if (debug) \
>> + dev_info(dev , format , ## arg); \
>
> There is no need for the spaces before commas.
>
> gcc 2.xx required a space before a comma with a trailing ##arg,
> but that compiler version is no longer supported.
>
> This should be:
> dev_info(dev, format, ##arg);
>
> though I think using dev_dbg and getting rid of the dbg_info
> macro is better.
>

I was planning to remove the patch in a later patch, which I at the
time thought was necessary, but in light of this checkpatch fault, I
guess I could have just pushed it in this one.
>> +} while (0)
>>
>> #define alphatrack_ocmd_info(dev, cmd, format, arg...)
>>
>> @@ -769,7 +772,7 @@ static int usb_alphatrack_probe(struct usb_interface
>> *intf,
>> }
>>
>> dev->write_buffer =
>> - kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);
>> + kmalloc(sizeof(struct alphatrack_ocmd) *true_size, GFP_KERNEL);
>
> Not an improvement.
>
> If checkpatch warns about this, it's a checkpatch defect.
Interesting. Apparently it mistook the multiplication operator for the
unary * operator. May take a look at that perl script later.

2010-11-02 16:10:38

by Audun Hoem

[permalink] [raw]
Subject: Re: [PATCH] staging: frontier: alphatrack: fixed coding style issues

> I was planning to remove the patch in a later patch, which I at the
> time thought was necessary, but in light of this checkpatch fault, I
> guess I could have just pushed it in this one.
Sorry, meant to say "remove the macro," of course.