* [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
@ 2010-07-04 10:09 Joe Eloff
2010-07-06 17:12 ` Aldo Cedillo
0 siblings, 1 reply; 4+ messages in thread
From: Joe Eloff @ 2010-07-04 10:09 UTC (permalink / raw)
To: gregkh, mchehab, olimpiu.pascariu, julia, tj; +Cc: devel, linux-kernel
>From b7f34cd4bf14c07f64a95f70410f34e2c843fd3b Mon Sep 17 00:00:00 2001
From: Joe Eloff <kagen101@gmail.com>
Date: Sun, 4 Jul 2010 11:37:03 +0200
Subject: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
This is a patch to the cx25821.c file that fixes up a brace warning found by the checkpatch.pl tool
Signed-off-by: Joe Eloff <kagen101@gmail.com>
---
drivers/staging/cx25821/cx25821-audio-upstream.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c
index eb39d13..e7346ec 100644
--- a/drivers/staging/cx25821/cx25821-audio-upstream.c
+++ b/drivers/staging/cx25821/cx25821-audio-upstream.c
@@ -762,9 +762,9 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
str_length + 1);
/* Default if filename is empty string */
- if (strcmp(dev->input_audiofilename, "") == 0) {
+ if (strcmp(dev->input_audiofilename, "") == 0)
dev->_audiofilename = "/root/audioGOOD.wav";
- }
+
} else {
str_length = strlen(_defaultAudioName);
dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
2010-07-04 10:09 [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c Joe Eloff
@ 2010-07-06 17:12 ` Aldo Cedillo
2010-07-06 17:24 ` Joe Eloff
0 siblings, 1 reply; 4+ messages in thread
From: Aldo Cedillo @ 2010-07-06 17:12 UTC (permalink / raw)
To: kagen101
Cc: gregkh, mchehab, olimpiu.pascariu, julia, tj, devel, linux-kernel
> Subject: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
> This is a patch to the cx25821.c file that fixes up a brace warning found by the checkpatch.pl tool
> Signed-off-by: Joe Eloff <kagen101@gmail.com>
>
> ---
> drivers/staging/cx25821/cx25821-audio-upstream.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c
> index eb39d13..e7346ec 100644
> --- a/drivers/staging/cx25821/cx25821-audio-upstream.c
> +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c
> @@ -762,9 +762,9 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
> str_length + 1);
I haven't tried checkpatch.pl over that file, but in the CodingStyle
document you can read this:
Do not unnecessarily use braces where a single statement will do.
if (condition)
action();
This does not apply if one branch of a conditional statement is a single
statement. Use braces in both branches.
if (condition) {
do_this();
do_that();
} else {
otherwise();
}
Which one is the correct style? I ask these because I have seen this
in other parts of the kernel. So maybe I can help to homogenize this.
> /* Default if filename is empty string */
> - if (strcmp(dev->input_audiofilename, "") == 0) {
> + if (strcmp(dev->input_audiofilename, "") == 0)
> dev->_audiofilename = "/root/audioGOOD.wav";
> - }
I believe only this one has to go.
> +
> } else {
So the first brace closes the brace of the if line.
> str_length = strlen(_defaultAudioName);
> dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);
Thanks,
Aldo Brett
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
2010-07-06 17:12 ` Aldo Cedillo
@ 2010-07-06 17:24 ` Joe Eloff
2010-07-06 17:37 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 4+ messages in thread
From: Joe Eloff @ 2010-07-06 17:24 UTC (permalink / raw)
To: Aldo Cedillo
Cc: gregkh, mchehab, olimpiu.pascariu, julia, tj, devel, linux-kernel
On Tue, 2010-07-06 at 12:12 -0500, Aldo Cedillo wrote:
> > Subject: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
> > This is a patch to the cx25821.c file that fixes up a brace warning found by the checkpatch.pl tool
> > Signed-off-by: Joe Eloff <kagen101@gmail.com>
> >
> > ---
> > drivers/staging/cx25821/cx25821-audio-upstream.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c
> > index eb39d13..e7346ec 100644
> > --- a/drivers/staging/cx25821/cx25821-audio-upstream.c
> > +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c
> > @@ -762,9 +762,9 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
> > str_length + 1);
>
>
> I haven't tried checkpatch.pl over that file, but in the CodingStyle
> document you can read this:
>
> Do not unnecessarily use braces where a single statement will do.
>
> if (condition)
> action();
>
> This does not apply if one branch of a conditional statement is a single
> statement. Use braces in both branches.
>
> if (condition) {
> do_this();
> do_that();
> } else {
> otherwise();
> }
>
> Which one is the correct style? I ask these because I have seen this
> in other parts of the kernel. So maybe I can help to homogenize this.
>
> > /* Default if filename is empty string */
> > - if (strcmp(dev->input_audiofilename, "") == 0) {
> > + if (strcmp(dev->input_audiofilename, "") == 0)
> > dev->_audiofilename = "/root/audioGOOD.wav";
> > - }
> I believe only this one has to go.
> > +
> > } else {
> So the first brace closes the brace of the if line.
> > str_length = strlen(_defaultAudioName);
> > dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);
>
> Thanks,
> Aldo Brett
Thats good to know thanks for pointing that out, I have picked up a few
discrepancies with interpretation and checkpatch.pl.
Am noting it and trying to patch checkpatch.pl as I continue :).
I think checkpatch.pl points this out as the opposite to interpretation
thou otherwise I would not have patched it I guess.
Current TODO on checkpatch:
1. type i = 0 ; /* space before ; is not picked up by checkpatch.
2. What you mentioned is interpreted different by checkpatch.pl
Regards,
Joe
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
2010-07-06 17:24 ` Joe Eloff
@ 2010-07-06 17:37 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-06 17:37 UTC (permalink / raw)
To: kagen101
Cc: Aldo Cedillo, gregkh, olimpiu.pascariu, julia, tj, devel,
linux-kernel
Em 06-07-2010 14:24, Joe Eloff escreveu:
> On Tue, 2010-07-06 at 12:12 -0500, Aldo Cedillo wrote:
>>> Subject: [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c
>>> This is a patch to the cx25821.c file that fixes up a brace warning found by the checkpatch.pl tool
>>> Signed-off-by: Joe Eloff <kagen101@gmail.com>
>>>
>>> ---
>>> drivers/staging/cx25821/cx25821-audio-upstream.c | 4 ++--
>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c
>>> index eb39d13..e7346ec 100644
>>> --- a/drivers/staging/cx25821/cx25821-audio-upstream.c
>>> +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c
>>> @@ -762,9 +762,9 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
>>> str_length + 1);
>>
>>
>> I haven't tried checkpatch.pl over that file, but in the CodingStyle
>> document you can read this:
>>
>> Do not unnecessarily use braces where a single statement will do.
>>
>> if (condition)
>> action();
>>
>> This does not apply if one branch of a conditional statement is a single
>> statement. Use braces in both branches.
>>
>> if (condition) {
>> do_this();
>> do_that();
>> } else {
>> otherwise();
>> }
>>
>> Which one is the correct style? I ask these because I have seen this
>> in other parts of the kernel. So maybe I can help to homogenize this.
>>
>>> /* Default if filename is empty string */
>>> - if (strcmp(dev->input_audiofilename, "") == 0) {
>>> + if (strcmp(dev->input_audiofilename, "") == 0)
>>> dev->_audiofilename = "/root/audioGOOD.wav";
>>> - }
>> I believe only this one has to go.
>>> +
>>> } else {
>> So the first brace closes the brace of the if line.
>>> str_length = strlen(_defaultAudioName);
>>> dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL);
>>
>> Thanks,
>> Aldo Brett
>
> Thats good to know thanks for pointing that out, I have picked up a few
> discrepancies with interpretation and checkpatch.pl.
> Am noting it and trying to patch checkpatch.pl as I continue :).
>
> I think checkpatch.pl points this out as the opposite to interpretation
> thou otherwise I would not have patched it I guess.
>
> Current TODO on checkpatch:
>
> 1. type i = 0 ; /* space before ; is not picked up by checkpatch.
> 2. What you mentioned is interpreted different by checkpatch.pl
If you intend to submit more patches to cx25821, please generate it against my tree, as
the driver suffered a major cleanup recently.
http://git.linuxtv.org/v4l-dvb.git
branch devel/for_v2.6.36
Cheers,
Mauro.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-06 18:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-04 10:09 [PATCH] Staging: cx25821: fix brace coding style issue in cx25821-audio-upstream.c Joe Eloff
2010-07-06 17:12 ` Aldo Cedillo
2010-07-06 17:24 ` Joe Eloff
2010-07-06 17:37 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox