git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Write and Submit Your First Kernel Patch
@ 2009-10-23 18:46 Kevyn-Alexandre Paré
       [not found] ` <87zl7hudn4.fsf@erwin.mina86.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Kevyn-Alexandre Paré @ 2009-10-23 18:46 UTC (permalink / raw)
  To: linux-newbie, kernel-janitors, git

Hi,

Just before I send my patch I got this error with:
./scripts/checkpatch.pl --terse --file
0001-Staging-comedi-driver-fix-coding-style.patch

0001-Staging-comedi-driver-fix-coding-style.patch:27: ERROR: trailing whitespace
0001-Staging-comedi-driver-fix-coding-style.patch:35: ERROR: trailing whitespace
0001-Staging-comedi-driver-fix-coding-style.patch:43: ERROR: trailing whitespace
0001-Staging-comedi-driver-fix-coding-style.patch:53: ERROR: trailing whitespace

I have done a step by step explanation of what I have done:
http://kapare.blogspot.com/2009/09/write-and-submit-your-first-kernel.html

It seem to me that the whitespace are added after I do this command:
git format-patch -s -n master..mybranch

Can someone help me with that because google did help me to found the answer?

Thx

kap

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

* Re: Write and Submit Your First Kernel Patch
       [not found]   ` <dc1d0f40910231219l600d3579i57c7580fe798d445@mail.gmail.com>
@ 2009-10-23 19:41     ` Michal Nazarewicz
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Nazarewicz @ 2009-10-23 19:41 UTC (permalink / raw)
  To: Kevyn-Alexandre Paré; +Cc: linux-newbie, kernel-janitors, git

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

>> Kevyn-Alexandre Paré <kevyn.alexandre.pare@gmail.com> writes:
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:27: ERROR: trailing whitespace
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:35: ERROR: trailing whitespace
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:43: ERROR: trailing whitespace
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:53: ERROR: trailing whitespace
>>>
>>> I have done a step by step explanation of what I have done:
>>> http://kapare.blogspot.com/2009/09/write-and-submit-your-first-kernel.html>>
>>> It seem to me that the whitespace are added after I do this command:
>>> git format-patch -s -n master..mybranch

> On Fri, Oct 23, 2009 at 3:13 PM, Michal Nazarewicz <mina86@tlen.pl> wrote:
>> Do "git rebase --whitespace=fix master" and git will try to fix whitespaces.

Kevyn-Alexandre Paré <kevyn.alexandre.pare@gmail.com> writes:
> thx Michal,
>
> But the problem remain:

If I'm not mistaken "git rebase --whitespace=fix master" should do the
trick.  I'm out of good ideas if it does not.  Best I can advice is to
fix the patch by hand -- just edit it in some decent editor and remove
trailing whitespaces from those lines.

-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Write and Submit Your First Kernel Patch
  2009-10-23 18:46 Write and Submit Your First Kernel Patch Kevyn-Alexandre Paré
       [not found] ` <87zl7hudn4.fsf@erwin.mina86.com>
@ 2009-10-23 19:52 ` Junio C Hamano
  2009-10-23 20:30   ` Kevyn-Alexandre Paré
  2009-10-23 20:33 ` Daniel Barkalow
  2 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-10-23 19:52 UTC (permalink / raw)
  To: Kevyn-Alexandre Paré; +Cc: linux-newbie, kernel-janitors, git

Kevyn-Alexandre Paré  <kevyn.alexandre.pare@gmail.com> writes:

> Just before I send my patch I got this error with:
> ./scripts/checkpatch.pl --terse --file
> 0001-Staging-comedi-driver-fix-coding-style.patch
>
> 0001-Staging-comedi-driver-fix-coding-style.patch:27: ERROR: trailing whitespace
> 0001-Staging-comedi-driver-fix-coding-style.patch:35: ERROR: trailing whitespace
> 0001-Staging-comedi-driver-fix-coding-style.patch:43: ERROR: trailing whitespace
> 0001-Staging-comedi-driver-fix-coding-style.patch:53: ERROR: trailing whitespace
>
> I have done a step by step explanation of what I have done:
> http://kapare.blogspot.com/2009/09/write-and-submit-your-first-kernel.html
>
> It seem to me that the whitespace are added after I do this command:
> git format-patch -s -n master..mybranch

"The whitespace are added after..." sounds to me that what you committed
were checkpatch compliant, and format-patch somehow broke it.  If that is
the case we need to fix format-patch.

Please check if "git show $commit" output for the commit that corresponds
to the "[Staging] comedi driver: fix coding style" patch has trailing
whitespaces.  That is what you committed.

If there already is whitespace breakage in what you committed, then we do
not have to blame format-patch and look for bugs in it to fix.

Otherwise, please send 0001-*.patch (output from format-patch) and output
from that "git show $commit" as separate attachments, so that we can debug
and fix format-patch.

Thanks.

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

* Re: Write and Submit Your First Kernel Patch
  2009-10-23 19:52 ` Junio C Hamano
@ 2009-10-23 20:30   ` Kevyn-Alexandre Paré
  2009-10-23 20:34     ` Kevyn-Alexandre Paré
  0 siblings, 1 reply; 8+ messages in thread
From: Kevyn-Alexandre Paré @ 2009-10-23 20:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: linux-newbie, kernel-janitors, git

[-- Attachment #1: Type: text/plain, Size: 3149 bytes --]

Thx junio for that analyse!

So what I understand from what you have said is that the problem is
not in format-patch since that I see white space from git show $commit
?!:

history: I was trying to remove coding style problem in
drivers/staging/comedi/drivers/pcl726.c

./scripts/checkpatch.pl --terse --file
drivers/staging/comedi/drivers/pcl726.c        #### NO warning after
removing problems
### git commit -a
                      # was done after that
### git format-patch -s -n master..pcl726

kapare@vostro:~/linux-kernel-patch/linux-2.6$ git show $commit >
TEST.git.show.commit      #### see whitespace in vim
kapare@vostro:~/linux-kernel-patch/linux-2.6$ ./scripts/checkpatch.pl
--terse --file TEST.git.show.commit
TEST:19: ERROR: trailing whitespace
TEST:27: ERROR: trailing whitespace
TEST:35: ERROR: trailing whitespace
TEST:45: ERROR: trailing whitespace
TEST:55: ERROR: trailing whitespace
TEST:60: ERROR: trailing whitespace
TEST:67: ERROR: trailing whitespace
TEST:69: ERROR: trailing whitespace
TEST:80: ERROR: trailing whitespace
TEST:106: ERROR: trailing whitespace
TEST:113: ERROR: trailing whitespace

So what am I doing wrong? Any clues? see attachment you ask

thx

kap

On Fri, Oct 23, 2009 at 3:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Kevyn-Alexandre Paré  <kevyn.alexandre.pare@gmail.com> writes:
>
>> Just before I send my patch I got this error with:
>> ./scripts/checkpatch.pl --terse --file
>> 0001-Staging-comedi-driver-fix-coding-style.patch
>>
>> 0001-Staging-comedi-driver-fix-coding-style.patch:27: ERROR: trailing whitespace
>> 0001-Staging-comedi-driver-fix-coding-style.patch:35: ERROR: trailing whitespace
>> 0001-Staging-comedi-driver-fix-coding-style.patch:43: ERROR: trailing whitespace
>> 0001-Staging-comedi-driver-fix-coding-style.patch:53: ERROR: trailing whitespace
>>
>> I have done a step by step explanation of what I have done:
>> http://kapare.blogspot.com/2009/09/write-and-submit-your-first-kernel.html
>>
>> It seem to me that the whitespace are added after I do this command:
>> git format-patch -s -n master..mybranch
>
> "The whitespace are added after..." sounds to me that what you committed
> were checkpatch compliant, and format-patch somehow broke it.  If that is
> the case we need to fix format-patch.
>
> Please check if "git show $commit" output for the commit that corresponds
> to the "[Staging] comedi driver: fix coding style" patch has trailing
> whitespaces.  That is what you committed.
>
> If there already is whitespace breakage in what you committed, then we do
> not have to blame format-patch and look for bugs in it to fix.
>
> Otherwise, please send 0001-*.patch (output from format-patch) and output
> from that "git show $commit" as separate attachments, so that we can debug
> and fix format-patch.
>
> Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>

[-- Attachment #2: 0001-Staging-comedi-driver-fix-coding-style.patch --]
[-- Type: text/x-patch, Size: 4017 bytes --]

From 2313270068581ff425140c1f361b26edd096658f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Kevyn-Alexandre=20Par=C3=A9?= <kevyn.alexandre.pare@gmail.com>
Date: Fri, 23 Oct 2009 00:59:40 -0400
Subject: [PATCH 1/1] Staging: comedi driver: fix coding style
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Kevyn-Alexandre Paré <kevyn.alexandre.pare@gmail.com>
---
 drivers/staging/comedi/drivers/pcl726.c |   41 +++++++++++++++----------------
 1 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c
index ccadd09..6208bca 100644
--- a/drivers/staging/comedi/drivers/pcl726.c
+++ b/drivers/staging/comedi/drivers/pcl726.c
@@ -39,27 +39,27 @@ Interrupts are not supported.
     Options for PCL-726:
      [0] - IO Base
      [2]...[7] - D/A output range for channel 1-6:
-               0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
-	       4: 4-20mA, 5: unknown (external reference)
+		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
+		4: 4-20mA, 5: unknown (external reference)
 
     Options for PCL-727:
      [0] - IO Base
      [2]...[13] - D/A output range for channel 1-12:
-               0: 0-5V, 1: 0-10V, 2: +/-5V,
-	       3: 4-20mA
+		0: 0-5V, 1: 0-10V, 2: +/-5V,
+		3: 4-20mA
 
     Options for PCL-728 and ACL-6128:
      [0] - IO Base
      [2], [3] - D/A output range for channel 1 and 2:
-               0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
-	       4: 4-20mA, 5: 0-20mA
+		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
+		4: 4-20mA, 5: 0-20mA
 
     Options for ACL-6126:
      [0] - IO Base
      [1] - IRQ (0=disable, 3, 5, 6, 7, 9, 10, 11, 12, 15) (currently ignored)
      [2]...[7] - D/A output range for channel 1-6:
-               0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
-	       4: 4-20mA
+		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
+		4: 4-20mA
 */
 
 /*
@@ -127,7 +127,8 @@ struct pcl726_board {
 	int di_lo;
 	int do_hi;
 	int do_lo;
-	const struct comedi_lrange *const *range_type_list;	/*  list of supported ranges */
+	const struct comedi_lrange *const *range_type_list;
+	/*  list of supported ranges */
 };
 
 static const struct pcl726_board boardtypes[] = {
@@ -204,9 +205,8 @@ static int pcl726_ao_insn_read(struct comedi_device *dev,
 	int chan = CR_CHAN(insn->chanspec);
 	int n;
 
-	for (n = 0; n < insn->n; n++) {
+	for (n = 0; n < insn->n; n++)
 		data[n] = devpriv->ao_readback[chan];
-	}
 	return n;
 }
 
@@ -256,10 +256,10 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 	iobase = it->options[0];
 	iorange = this_board->io_range;
-	printk("comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor,
+	printk(KERN_WARNING, "comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor,
 	       this_board->name, iobase);
 	if (!request_region(iobase, iorange, "pcl726")) {
-		printk("I/O port conflict\n");
+		printk(KERN_WARNING, "I/O port conflict\n");
 		return -EIO;
 	}
 
@@ -283,16 +283,16 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		devpriv->first_chan = 2;
 		if (irq) {	/* we want to use IRQ */
 			if (((1 << irq) & boardtypes[board].IRQbits) == 0) {
-				printk
-				    (", IRQ %d is out of allowed range, DISABLING IT",
-				     irq);
+				printk(KERN_WARNING,
+					", IRQ %d is out of allowed range,"
+					" DISABLING IT", irq);
 				irq = 0;	/* Bad IRQ */
 			} else {
 				if (request_irq(irq, interrupt_pcl818, 0,
 						"pcl726", dev)) {
-					printk
-					    (", unable to allocate IRQ %d, DISABLING IT",
-					     irq);
+					printk(KERN_WARNING,
+						", unable to allocate IRQ %d,"
+						" DISABLING IT", irq);
 					irq = 0;	/* Can't use IRQ */
 				} else {
 					printk(", irq=%d", irq);
@@ -372,9 +372,8 @@ static int pcl726_detach(struct comedi_device *dev)
 /* printk("comedi%d: pcl726: remove\n",dev->minor); */
 
 #ifdef ACL6126_IRQ
-	if (dev->irq) {
+	if (dev->irq)
 		free_irq(dev->irq, dev);
-	}
 #endif
 
 	if (dev->iobase)
-- 
1.6.0.4


[-- Attachment #3: TEST.git.show.commit --]
[-- Type: application/octet-stream, Size: 3652 bytes --]

commit 2313270068581ff425140c1f361b26edd096658f
Author: Kevyn-Alexandre Paré <kevyn.alexandre.pare@gmail.com>
Date:   Fri Oct 23 00:59:40 2009 -0400

    Staging: comedi driver: fix coding style

diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c
index ccadd09..6208bca 100644
--- a/drivers/staging/comedi/drivers/pcl726.c
+++ b/drivers/staging/comedi/drivers/pcl726.c
@@ -39,27 +39,27 @@ Interrupts are not supported.
     Options for PCL-726:
      [0] - IO Base
      [2]...[7] - D/A output range for channel 1-6:
-               0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
-	       4: 4-20mA, 5: unknown (external reference)
+		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
+		4: 4-20mA, 5: unknown (external reference)
 
     Options for PCL-727:
      [0] - IO Base
      [2]...[13] - D/A output range for channel 1-12:
-               0: 0-5V, 1: 0-10V, 2: +/-5V,
-	       3: 4-20mA
+		0: 0-5V, 1: 0-10V, 2: +/-5V,
+		3: 4-20mA
 
     Options for PCL-728 and ACL-6128:
      [0] - IO Base
      [2], [3] - D/A output range for channel 1 and 2:
-               0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
-	       4: 4-20mA, 5: 0-20mA
+		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
+		4: 4-20mA, 5: 0-20mA
 
     Options for ACL-6126:
      [0] - IO Base
      [1] - IRQ (0=disable, 3, 5, 6, 7, 9, 10, 11, 12, 15) (currently ignored)
      [2]...[7] - D/A output range for channel 1-6:
-               0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
-	       4: 4-20mA
+		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
+		4: 4-20mA
 */
 
 /*
@@ -127,7 +127,8 @@ struct pcl726_board {
 	int di_lo;
 	int do_hi;
 	int do_lo;
-	const struct comedi_lrange *const *range_type_list;	/*  list of supported ranges */
+	const struct comedi_lrange *const *range_type_list;
+	/*  list of supported ranges */
 };
 
 static const struct pcl726_board boardtypes[] = {
@@ -204,9 +205,8 @@ static int pcl726_ao_insn_read(struct comedi_device *dev,
 	int chan = CR_CHAN(insn->chanspec);
 	int n;
 
-	for (n = 0; n < insn->n; n++) {
+	for (n = 0; n < insn->n; n++)
 		data[n] = devpriv->ao_readback[chan];
-	}
 	return n;
 }
 
@@ -256,10 +256,10 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 	iobase = it->options[0];
 	iorange = this_board->io_range;
-	printk("comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor,
+	printk(KERN_WARNING, "comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor,
 	       this_board->name, iobase);
 	if (!request_region(iobase, iorange, "pcl726")) {
-		printk("I/O port conflict\n");
+		printk(KERN_WARNING, "I/O port conflict\n");
 		return -EIO;
 	}
 
@@ -283,16 +283,16 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		devpriv->first_chan = 2;
 		if (irq) {	/* we want to use IRQ */
 			if (((1 << irq) & boardtypes[board].IRQbits) == 0) {
-				printk
-				    (", IRQ %d is out of allowed range, DISABLING IT",
-				     irq);
+				printk(KERN_WARNING,
+					", IRQ %d is out of allowed range,"
+					" DISABLING IT", irq);
 				irq = 0;	/* Bad IRQ */
 			} else {
 				if (request_irq(irq, interrupt_pcl818, 0,
 						"pcl726", dev)) {
-					printk
-					    (", unable to allocate IRQ %d, DISABLING IT",
-					     irq);
+					printk(KERN_WARNING,
+						", unable to allocate IRQ %d,"
+						" DISABLING IT", irq);
 					irq = 0;	/* Can't use IRQ */
 				} else {
 					printk(", irq=%d", irq);
@@ -372,9 +372,8 @@ static int pcl726_detach(struct comedi_device *dev)
 /* printk("comedi%d: pcl726: remove\n",dev->minor); */
 
 #ifdef ACL6126_IRQ
-	if (dev->irq) {
+	if (dev->irq)
 		free_irq(dev->irq, dev);
-	}
 #endif
 
 	if (dev->iobase)

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

* Re: Write and Submit Your First Kernel Patch
  2009-10-23 18:46 Write and Submit Your First Kernel Patch Kevyn-Alexandre Paré
       [not found] ` <87zl7hudn4.fsf@erwin.mina86.com>
  2009-10-23 19:52 ` Junio C Hamano
@ 2009-10-23 20:33 ` Daniel Barkalow
  2009-10-23 20:58   ` Junio C Hamano
  2 siblings, 1 reply; 8+ messages in thread
From: Daniel Barkalow @ 2009-10-23 20:33 UTC (permalink / raw)
  To: Kevyn-Alexandre Paré; +Cc: linux-newbie, kernel-janitors, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1118 bytes --]

On Fri, 23 Oct 2009, Kevyn-Alexandre Paré wrote:

> Hi,
> 
> Just before I send my patch I got this error with:
> ./scripts/checkpatch.pl --terse --file
> 0001-Staging-comedi-driver-fix-coding-style.patch

You're using checkpatch --file on a patch. I hope you don't intend your 
patch to be added to the kernel source as a file, but rather applied to 
the kernel source, changing other files. (I bet "gcc 0001-Staging*.patch" 
will get interesting errors, too...) The patch format adds a single 
character at the beginning of each line to say whether it's a addition, a 
deletion, or a context line, and the context lines are identified by a 
space character. This means that a blank context line consists of just 
this space character, which is therefore a trailing space. We get the same 
type of complaints when we have expected diff output in our test scripts.

I'm kind of surprised that checkpatch doesn't completely blow up when it's 
expecting a source file and getting a patch (and maybe tell you what 
you've done). But that's the source of your errors, anyway.

	-Daniel
*This .sig left intentionally blank*

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

* Re: Write and Submit Your First Kernel Patch
  2009-10-23 20:30   ` Kevyn-Alexandre Paré
@ 2009-10-23 20:34     ` Kevyn-Alexandre Paré
  0 siblings, 0 replies; 8+ messages in thread
From: Kevyn-Alexandre Paré @ 2009-10-23 20:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: linux-newbie, kernel-janitors, git

[-- Attachment #1: Type: text/plain, Size: 3379 bytes --]

I forgot my .c file

On Fri, Oct 23, 2009 at 4:30 PM, Kevyn-Alexandre Paré
<kevyn.alexandre.pare@gmail.com> wrote:
> Thx junio for that analyse!
>
> So what I understand from what you have said is that the problem is
> not in format-patch since that I see white space from git show $commit
> ?!:
>
> history: I was trying to remove coding style problem in
> drivers/staging/comedi/drivers/pcl726.c
>
> ./scripts/checkpatch.pl --terse --file
> drivers/staging/comedi/drivers/pcl726.c        #### NO warning after
> removing problems
> ### git commit -a
>                      # was done after that
> ### git format-patch -s -n master..pcl726
>
> kapare@vostro:~/linux-kernel-patch/linux-2.6$ git show $commit >
> TEST.git.show.commit      #### see whitespace in vim
> kapare@vostro:~/linux-kernel-patch/linux-2.6$ ./scripts/checkpatch.pl
> --terse --file TEST.git.show.commit
> TEST:19: ERROR: trailing whitespace
> TEST:27: ERROR: trailing whitespace
> TEST:35: ERROR: trailing whitespace
> TEST:45: ERROR: trailing whitespace
> TEST:55: ERROR: trailing whitespace
> TEST:60: ERROR: trailing whitespace
> TEST:67: ERROR: trailing whitespace
> TEST:69: ERROR: trailing whitespace
> TEST:80: ERROR: trailing whitespace
> TEST:106: ERROR: trailing whitespace
> TEST:113: ERROR: trailing whitespace
>
> So what am I doing wrong? Any clues? see attachment you ask
>
> thx
>
> kap
>
> On Fri, Oct 23, 2009 at 3:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Kevyn-Alexandre Paré  <kevyn.alexandre.pare@gmail.com> writes:
>>
>>> Just before I send my patch I got this error with:
>>> ./scripts/checkpatch.pl --terse --file
>>> 0001-Staging-comedi-driver-fix-coding-style.patch
>>>
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:27: ERROR: trailing whitespace
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:35: ERROR: trailing whitespace
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:43: ERROR: trailing whitespace
>>> 0001-Staging-comedi-driver-fix-coding-style.patch:53: ERROR: trailing whitespace
>>>
>>> I have done a step by step explanation of what I have done:
>>> http://kapare.blogspot.com/2009/09/write-and-submit-your-first-kernel.html
>>>
>>> It seem to me that the whitespace are added after I do this command:
>>> git format-patch -s -n master..mybranch
>>
>> "The whitespace are added after..." sounds to me that what you committed
>> were checkpatch compliant, and format-patch somehow broke it.  If that is
>> the case we need to fix format-patch.
>>
>> Please check if "git show $commit" output for the commit that corresponds
>> to the "[Staging] comedi driver: fix coding style" patch has trailing
>> whitespaces.  That is what you committed.
>>
>> If there already is whitespace breakage in what you committed, then we do
>> not have to blame format-patch and look for bugs in it to fix.
>>
>> Otherwise, please send 0001-*.patch (output from format-patch) and output
>> from that "git show $commit" as separate attachments, so that we can debug
>> and fix format-patch.
>>
>> Thanks.
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.linux-learn.org/faqs
>>
>

[-- Attachment #2: pcl726.c --]
[-- Type: text/x-csrc, Size: 9864 bytes --]

/*
    comedi/drivers/pcl726.c

    hardware driver for Advantech cards:
     card:   PCL-726, PCL-727, PCL-728
     driver: pcl726,  pcl727,  pcl728
    and for ADLink cards:
     card:   ACL-6126, ACL-6128
     driver: acl6126,  acl6128

    COMEDI - Linux Control and Measurement Device Interface
    Copyright (C) 1998 David A. Schleef <ds@schleef.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/
/*
Driver: pcl726
Description: Advantech PCL-726 & compatibles
Author: ds
Status: untested
Devices: [Advantech] PCL-726 (pcl726), PCL-727 (pcl727), PCL-728 (pcl728),
  [ADLink] ACL-6126 (acl6126), ACL-6128 (acl6128)

Interrupts are not supported.

    Options for PCL-726:
     [0] - IO Base
     [2]...[7] - D/A output range for channel 1-6:
		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
		4: 4-20mA, 5: unknown (external reference)

    Options for PCL-727:
     [0] - IO Base
     [2]...[13] - D/A output range for channel 1-12:
		0: 0-5V, 1: 0-10V, 2: +/-5V,
		3: 4-20mA

    Options for PCL-728 and ACL-6128:
     [0] - IO Base
     [2], [3] - D/A output range for channel 1 and 2:
		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
		4: 4-20mA, 5: 0-20mA

    Options for ACL-6126:
     [0] - IO Base
     [1] - IRQ (0=disable, 3, 5, 6, 7, 9, 10, 11, 12, 15) (currently ignored)
     [2]...[7] - D/A output range for channel 1-6:
		0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V,
		4: 4-20mA
*/

/*
    Thanks to Circuit Specialists for having programming info (!) on
    their web page.  (http://www.cir.com/)
*/

#include "../comedidev.h"

#include <linux/ioport.h>

#undef ACL6126_IRQ		/* no interrupt support (yet) */

#define PCL726_SIZE 16
#define PCL727_SIZE 32
#define PCL728_SIZE 8

#define PCL726_DAC0_HI 0
#define PCL726_DAC0_LO 1

#define PCL726_DO_HI 12
#define PCL726_DO_LO 13
#define PCL726_DI_HI 14
#define PCL726_DI_LO 15

#define PCL727_DO_HI 24
#define PCL727_DO_LO 25
#define PCL727_DI_HI  0
#define PCL727_DI_LO  1

static const struct comedi_lrange range_4_20mA = { 1, {RANGE_mA(4, 20)} };
static const struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} };

static const struct comedi_lrange *const rangelist_726[] = {
	&range_unipolar5, &range_unipolar10,
	&range_bipolar5, &range_bipolar10,
	&range_4_20mA, &range_unknown
};

static const struct comedi_lrange *const rangelist_727[] = {
	&range_unipolar5, &range_unipolar10,
	&range_bipolar5,
	&range_4_20mA
};

static const struct comedi_lrange *const rangelist_728[] = {
	&range_unipolar5, &range_unipolar10,
	&range_bipolar5, &range_bipolar10,
	&range_4_20mA, &range_0_20mA
};

static int pcl726_attach(struct comedi_device *dev,
			 struct comedi_devconfig *it);
static int pcl726_detach(struct comedi_device *dev);

struct pcl726_board {

	const char *name;	/*  driver name */
	int n_aochan;		/*  num of D/A chans */
	int num_of_ranges;	/*  num of ranges */
	unsigned int IRQbits;	/*  allowed interrupts */
	unsigned int io_range;	/*  len of IO space */
	char have_dio;		/*  1=card have DI/DO ports */
	int di_hi;		/*  ports for DI/DO operations */
	int di_lo;
	int do_hi;
	int do_lo;
	const struct comedi_lrange *const *range_type_list;
	/*  list of supported ranges */
};

static const struct pcl726_board boardtypes[] = {
	{"pcl726", 6, 6, 0x0000, PCL726_SIZE, 1,
	 PCL726_DI_HI, PCL726_DI_LO, PCL726_DO_HI, PCL726_DO_LO,
	 &rangelist_726[0],},
	{"pcl727", 12, 4, 0x0000, PCL727_SIZE, 1,
	 PCL727_DI_HI, PCL727_DI_LO, PCL727_DO_HI, PCL727_DO_LO,
	 &rangelist_727[0],},
	{"pcl728", 2, 6, 0x0000, PCL728_SIZE, 0,
	 0, 0, 0, 0,
	 &rangelist_728[0],},
	{"acl6126", 6, 5, 0x96e8, PCL726_SIZE, 1,
	 PCL726_DI_HI, PCL726_DI_LO, PCL726_DO_HI, PCL726_DO_LO,
	 &rangelist_726[0],},
	{"acl6128", 2, 6, 0x0000, PCL728_SIZE, 0,
	 0, 0, 0, 0,
	 &rangelist_728[0],},
};

#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pcl726_board))
#define this_board ((const struct pcl726_board *)dev->board_ptr)

static struct comedi_driver driver_pcl726 = {
	.driver_name = "pcl726",
	.module = THIS_MODULE,
	.attach = pcl726_attach,
	.detach = pcl726_detach,
	.board_name = &boardtypes[0].name,
	.num_names = n_boardtypes,
	.offset = sizeof(struct pcl726_board),
};

COMEDI_INITCLEANUP(driver_pcl726);

struct pcl726_private {

	int bipolar[12];
	const struct comedi_lrange *rangelist[12];
	unsigned int ao_readback[12];
};

#define devpriv ((struct pcl726_private *)dev->private)

static int pcl726_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
			  struct comedi_insn *insn, unsigned int *data)
{
	int hi, lo;
	int n;
	int chan = CR_CHAN(insn->chanspec);

	for (n = 0; n < insn->n; n++) {
		lo = data[n] & 0xff;
		hi = (data[n] >> 8) & 0xf;
		if (devpriv->bipolar[chan])
			hi ^= 0x8;
		/*
		 * the programming info did not say which order
		 * to write bytes.  switch the order of the next
		 * two lines if you get glitches.
		 */
		outb(hi, dev->iobase + PCL726_DAC0_HI + 2 * chan);
		outb(lo, dev->iobase + PCL726_DAC0_LO + 2 * chan);
		devpriv->ao_readback[chan] = data[n];
	}

	return n;
}

static int pcl726_ao_insn_read(struct comedi_device *dev,
			       struct comedi_subdevice *s,
			       struct comedi_insn *insn, unsigned int *data)
{
	int chan = CR_CHAN(insn->chanspec);
	int n;

	for (n = 0; n < insn->n; n++)
		data[n] = devpriv->ao_readback[chan];
	return n;
}

static int pcl726_di_insn_bits(struct comedi_device *dev,
			       struct comedi_subdevice *s,
			       struct comedi_insn *insn, unsigned int *data)
{
	if (insn->n != 2)
		return -EINVAL;

	data[1] = inb(dev->iobase + this_board->di_lo) |
	    (inb(dev->iobase + this_board->di_hi) << 8);

	return 2;
}

static int pcl726_do_insn_bits(struct comedi_device *dev,
			       struct comedi_subdevice *s,
			       struct comedi_insn *insn, unsigned int *data)
{
	if (insn->n != 2)
		return -EINVAL;

	if (data[0]) {
		s->state &= ~data[0];
		s->state |= data[0] & data[1];
	}
	if (data[1] & 0x00ff)
		outb(s->state & 0xff, dev->iobase + this_board->do_lo);
	if (data[1] & 0xff00)
		outb((s->state >> 8), dev->iobase + this_board->do_hi);

	data[1] = s->state;

	return 2;
}

static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
	struct comedi_subdevice *s;
	unsigned long iobase;
	unsigned int iorange;
	int ret, i;
#ifdef ACL6126_IRQ
	unsigned int irq;
#endif

	iobase = it->options[0];
	iorange = this_board->io_range;
	printk(KERN_WARNING, "comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor,
	       this_board->name, iobase);
	if (!request_region(iobase, iorange, "pcl726")) {
		printk(KERN_WARNING, "I/O port conflict\n");
		return -EIO;
	}

	dev->iobase = iobase;

	dev->board_name = this_board->name;

	ret = alloc_private(dev, sizeof(struct pcl726_private));
	if (ret < 0)
		return -ENOMEM;

	for (i = 0; i < 12; i++) {
		devpriv->bipolar[i] = 0;
		devpriv->rangelist[i] = &range_unknown;
	}

#ifdef ACL6126_IRQ
	irq = 0;
	if (boardtypes[board].IRQbits != 0) {	/* board support IRQ */
		irq = it->options[1];
		devpriv->first_chan = 2;
		if (irq) {	/* we want to use IRQ */
			if (((1 << irq) & boardtypes[board].IRQbits) == 0) {
				printk(KERN_WARNING,
					", IRQ %d is out of allowed range,"
					" DISABLING IT", irq);
				irq = 0;	/* Bad IRQ */
			} else {
				if (request_irq(irq, interrupt_pcl818, 0,
						"pcl726", dev)) {
					printk(KERN_WARNING,
						", unable to allocate IRQ %d,"
						" DISABLING IT", irq);
					irq = 0;	/* Can't use IRQ */
				} else {
					printk(", irq=%d", irq);
				}
			}
		}
	}

	dev->irq = irq;
#endif

	printk("\n");

	ret = alloc_subdevices(dev, 3);
	if (ret < 0)
		return ret;

	s = dev->subdevices + 0;
	/* ao */
	s->type = COMEDI_SUBD_AO;
	s->subdev_flags = SDF_WRITABLE | SDF_GROUND;
	s->n_chan = this_board->n_aochan;
	s->maxdata = 0xfff;
	s->len_chanlist = 1;
	s->insn_write = pcl726_ao_insn;
	s->insn_read = pcl726_ao_insn_read;
	s->range_table_list = devpriv->rangelist;
	for (i = 0; i < this_board->n_aochan; i++) {
		int j;

		j = it->options[2 + 1];
		if ((j < 0) || (j >= this_board->num_of_ranges)) {
			printk
			    ("Invalid range for channel %d! Must be 0<=%d<%d\n",
			     i, j, this_board->num_of_ranges - 1);
			j = 0;
		}
		devpriv->rangelist[i] = this_board->range_type_list[j];
		if (devpriv->rangelist[i]->range[0].min ==
		    -devpriv->rangelist[i]->range[0].max)
			devpriv->bipolar[i] = 1;	/* bipolar range */
	}

	s = dev->subdevices + 1;
	/* di */
	if (!this_board->have_dio) {
		s->type = COMEDI_SUBD_UNUSED;
	} else {
		s->type = COMEDI_SUBD_DI;
		s->subdev_flags = SDF_READABLE | SDF_GROUND;
		s->n_chan = 16;
		s->maxdata = 1;
		s->len_chanlist = 1;
		s->insn_bits = pcl726_di_insn_bits;
		s->range_table = &range_digital;
	}

	s = dev->subdevices + 2;
	/* do */
	if (!this_board->have_dio) {
		s->type = COMEDI_SUBD_UNUSED;
	} else {
		s->type = COMEDI_SUBD_DO;
		s->subdev_flags = SDF_WRITABLE | SDF_GROUND;
		s->n_chan = 16;
		s->maxdata = 1;
		s->len_chanlist = 1;
		s->insn_bits = pcl726_do_insn_bits;
		s->range_table = &range_digital;
	}

	return 0;
}

static int pcl726_detach(struct comedi_device *dev)
{
/* printk("comedi%d: pcl726: remove\n",dev->minor); */

#ifdef ACL6126_IRQ
	if (dev->irq)
		free_irq(dev->irq, dev);
#endif

	if (dev->iobase)
		release_region(dev->iobase, this_board->io_range);

	return 0;
}

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

* Re: Write and Submit Your First Kernel Patch
  2009-10-23 20:33 ` Daniel Barkalow
@ 2009-10-23 20:58   ` Junio C Hamano
  2009-10-23 21:26     ` Kevyn-Alexandre Paré
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-10-23 20:58 UTC (permalink / raw)
  To: Daniel Barkalow
  Cc: Kevyn-Alexandre Paré, linux-newbie, kernel-janitors, git

Daniel Barkalow <barkalow@iabervon.org> writes:

> On Fri, 23 Oct 2009, Kevyn-Alexandre Paré wrote:
>
>> Just before I send my patch I got this error with:
>> ./scripts/checkpatch.pl --terse --file
>> 0001-Staging-comedi-driver-fix-coding-style.patch
>
> You're using checkpatch --file on a patch. I hope you don't intend your 
> patch to be added to the kernel source as a file, but rather applied to 
> the kernel source, changing other files. (I bet "gcc 0001-Staging*.patch" 
> will get interesting errors, too...) The patch format adds a single 
> character at the beginning of each line to say whether it's a addition, a 
> deletion, or a context line, and the context lines are identified by a 
> space character. This means that a blank context line consists of just 
> this space character, which is therefore a trailing space. We get the same 
> type of complaints when we have expected diff output in our test scripts.
>
> I'm kind of surprised that checkpatch doesn't completely blow up when it's 
> expecting a source file and getting a patch (and maybe tell you what 
> you've done). But that's the source of your errors, anyway.

Ah, your analysis is correct.  This is a usage error of checkpatch script
and there is nothing for us to worry about.

Thanks; I also failed to spot --file option when I responded.
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

* Re: Write and Submit Your First Kernel Patch
  2009-10-23 20:58   ` Junio C Hamano
@ 2009-10-23 21:26     ` Kevyn-Alexandre Paré
  0 siblings, 0 replies; 8+ messages in thread
From: Kevyn-Alexandre Paré @ 2009-10-23 21:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Daniel Barkalow, linux-newbie, kernel-janitors, git

My mistake but I learn a lot from you guys!

I should simply have done:
./scripts/checkpatch.pl --terse --patch
0001-Staging-comedi-driver-fix-coding-style.patch

or

./scripts/checkpatch.pl --terse --patch
0001-Staging-comedi-driver-fix-coding-style.patch
# Since --patch is the default!

No warning to the output, I will change my blog

thx again

kap

On Fri, Oct 23, 2009 at 4:58 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Daniel Barkalow <barkalow@iabervon.org> writes:
>
>> On Fri, 23 Oct 2009, Kevyn-Alexandre Paré wrote:
>>
>>> Just before I send my patch I got this error with:
>>> ./scripts/checkpatch.pl --terse --file
>>> 0001-Staging-comedi-driver-fix-coding-style.patch
>>
>> You're using checkpatch --file on a patch. I hope you don't intend your
>> patch to be added to the kernel source as a file, but rather applied to
>> the kernel source, changing other files. (I bet "gcc 0001-Staging*.patch"
>> will get interesting errors, too...) The patch format adds a single
>> character at the beginning of each line to say whether it's a addition, a
>> deletion, or a context line, and the context lines are identified by a
>> space character. This means that a blank context line consists of just
>> this space character, which is therefore a trailing space. We get the same
>> type of complaints when we have expected diff output in our test scripts.
>>
>> I'm kind of surprised that checkpatch doesn't completely blow up when it's
>> expecting a source file and getting a patch (and maybe tell you what
>> you've done). But that's the source of your errors, anyway.
>
> Ah, your analysis is correct.  This is a usage error of checkpatch script
> and there is nothing for us to worry about.
>
> Thanks; I also failed to spot --file option when I responded.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

end of thread, other threads:[~2009-10-23 21:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-23 18:46 Write and Submit Your First Kernel Patch Kevyn-Alexandre Paré
     [not found] ` <87zl7hudn4.fsf@erwin.mina86.com>
     [not found]   ` <dc1d0f40910231219l600d3579i57c7580fe798d445@mail.gmail.com>
2009-10-23 19:41     ` Michal Nazarewicz
2009-10-23 19:52 ` Junio C Hamano
2009-10-23 20:30   ` Kevyn-Alexandre Paré
2009-10-23 20:34     ` Kevyn-Alexandre Paré
2009-10-23 20:33 ` Daniel Barkalow
2009-10-23 20:58   ` Junio C Hamano
2009-10-23 21:26     ` Kevyn-Alexandre Paré

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).