LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: my first janitorial
       [not found] <9c9aa5d00703310639q68fa5d19k4d8e3bfb56b1fa6@mail.gmail.com>
@ 2007-04-01  5:24 ` Pedram M
  2007-04-01  6:16   ` [KJ] " Jaco Kroon
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pedram M @ 2007-04-01  5:24 UTC (permalink / raw)
  To: kernel-janitors; +Cc: linux-kernel

How about this one? Am I doing it right now?
If not, please try to explain more to me what I am
doing wrong.

@@ -4760,7 +4760,7 @@
 	for (i = 0; i < NR_CARDS; i++) {
 		/* look for a Cyclades card by vendor and device id */
 		while ((device_id = cy_pci_dev_id[dev_index]) != 0) {
-			if ((pdev = pci_find_device(PCI_VENDOR_ID_CYCLADES,
+			if ((pdev = pci_get_device(PCI_VENDOR_ID_CYCLADES,
 						   device_id, pdev)) == NULL) {
 				dev_index++;	/* try next device id */
 			} else {

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

* Re: [KJ] my first janitorial
  2007-04-01  5:24 ` my first janitorial Pedram M
@ 2007-04-01  6:16   ` Jaco Kroon
  2007-04-01  6:17   ` Willy Tarreau
  2007-04-01 16:00   ` Alan Cox
  2 siblings, 0 replies; 6+ messages in thread
From: Jaco Kroon @ 2007-04-01  6:16 UTC (permalink / raw)
  To: Pedram M; +Cc: kernel-janitors, linux-kernel

Pedram M wrote:
> How about this one? Am I doing it right now?
> If not, please try to explain more to me what I am
> doing wrong.

You need a changelog entry (or explanation of what you're doing). You 
need a signed-off-by line and your patch needs to apply to the root of 
the kernel tree with -p1, something like:

-------------
Replace deprecated pci_find_device call with pci_get_device.

Signed-Off-By: Pedram M <pmessri@gmail.com>

--- linux-2.6.20.3.orig/path/to/file.c     2006-06-24 09:41:08.000000000 
+0200
+++ linux-2.6.20.3/path/to/file.c       2006-07-15 21:01:57.000000000 +0200
@@ -4760,7 +4760,7 @@
  	for (i = 0; i < NR_CARDS; i++) {
  		/* look for a Cyclades card by vendor and device id */
  		while ((device_id = cy_pci_dev_id[dev_index]) != 0) {
-			if ((pdev = pci_find_device(PCI_VENDOR_ID_CYCLADES,
+			if ((pdev = pci_get_device(PCI_VENDOR_ID_CYCLADES,
  						   device_id, pdev)) == NULL) {
  				dev_index++;	/* try next device id */
  			} else {
-------------

And your subject needs to please include the string "[PATCH]", something 
like:  [PATCH] path/to/file.c: pci_find_device cleanup

However, as pointed out, the code itself is incorrect, for every 
pci_get_device there also needs to be a call to pci_put_device in order 
to maintain reference counts.

Your client does not seem to be clobbering the patch itself and 
maintains tabs and line wrapping (unlike my client).

Jaco

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

* Re: my first janitorial
  2007-04-01  5:24 ` my first janitorial Pedram M
  2007-04-01  6:16   ` [KJ] " Jaco Kroon
@ 2007-04-01  6:17   ` Willy Tarreau
  2007-04-01 19:04     ` Jan Engelhardt
  2007-04-01 16:00   ` Alan Cox
  2 siblings, 1 reply; 6+ messages in thread
From: Willy Tarreau @ 2007-04-01  6:17 UTC (permalink / raw)
  To: Pedram M; +Cc: kernel-janitors, linux-kernel

Hi,

On Sat, Mar 31, 2007 at 10:24:12PM -0700, Pedram M wrote:
> How about this one? Am I doing it right now?
> If not, please try to explain more to me what I am
> doing wrong.

You have made several mistakes :
  - you must select an appropriate subject for your mail. Nobody cares
    that it is your first mail, what they care about is the problem you
    are trying to fix and what it applies to. Preferably start your
    subject with [PATCH] so that people can quickly notice it without
    having to open it first.

  - you did not send a description of your patch. It is important to
    have a full description, it can be from 1 line to 1 page depending
    on the complexity of the issue. It is important to explain why you
    think you are right so that people can argue if they don't agree.
    Please also try to be as factual as possible, because your message
    will become the commit message. It means that sentences such as
    "I think that ..." are not the best we can write.

  - you must sign your patch. For this, add a "Signed-Off-By:" footer.
    Take a look at other patches for this.

   - your patch was cut and cannot apply to anything. A proper patch starts
     with line beginning with "---" line, followed by a line with "+++",
     both indicating the file your patch is supposed to apply to. Make your
     patch with one level directory for the kernel so that it can apply with
     "patch -p1". For instance:

        $ diff -u linux-2.6.20/Makefile linux-2.6.20-mine/Makefile

     Another solution is to use '.' as the directory, in order to add one
     directory level for "patch -p1" to be happy :

        $ diff -u ./Makefile.orig ./Makefile

Hoping this helps,
Willy


> @@ -4760,7 +4760,7 @@
> 	for (i = 0; i < NR_CARDS; i++) {
> 		/* look for a Cyclades card by vendor and device id */
> 		while ((device_id = cy_pci_dev_id[dev_index]) != 0) {
> -			if ((pdev = pci_find_device(PCI_VENDOR_ID_CYCLADES,
> +			if ((pdev = pci_get_device(PCI_VENDOR_ID_CYCLADES,
> 						   device_id, pdev)) == 
> 						   NULL) {
> 				dev_index++;	/* try next device id */
> 			} else {
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/

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

* Re: my first janitorial
  2007-04-01  5:24 ` my first janitorial Pedram M
  2007-04-01  6:16   ` [KJ] " Jaco Kroon
  2007-04-01  6:17   ` Willy Tarreau
@ 2007-04-01 16:00   ` Alan Cox
  2007-04-01 18:28     ` Jiri Slaby
  2 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2007-04-01 16:00 UTC (permalink / raw)
  To: Pedram M; +Cc: kernel-janitors, linux-kernel

On Sat, 31 Mar 2007 22:24:12 -0700
"Pedram M" <pmessri@gmail.com> wrote:

> How about this one? Am I doing it right now?
> If not, please try to explain more to me what I am
> doing wrong.

You need to hold a reference to the PCI device for the entire duration it
is used. I think you actually also need something like this to get the whole
thing using pci references and pci_get_* properly

Alan

--- drivers/char/cyclades.c~	2007-04-01 15:52:16.000000000 +0100
+++ drivers/char/cyclades.c	2007-04-01 15:52:16.000000000 +0100
@@ -4803,7 +4782,7 @@
                 cy_card[j].bus_index = 1;
                 cy_card[j].first_line = cy_next_channel;
                 cy_card[j].num_chips = cy_pci_nchan/4;
-		cy_card[j].pdev = pdev;
+		cy_card[j].pdev = pci_dev_get(pdev);
 	
                 /* enable interrupts in the PCI interface */
 		plx_ver = cy_readb(cy_pci_addr2 + CyPLX_VER) & 0x0f;
@@ -4901,7 +4880,7 @@
 			Ze_addr0[ZeIndex] = cy_pci_addr0;
 			Ze_addr2[ZeIndex] = cy_pci_addr2;
 			Ze_irq[ZeIndex] = cy_pci_irq;
-			Ze_pdev[ZeIndex] = pdev;
+			Ze_pdev[ZeIndex] = pci_dev_get(pdev);
 			ZeIndex++;
 		    }
 		    i--;
@@ -4986,7 +4965,7 @@
                 cy_card[j].bus_index = 1;
                 cy_card[j].first_line = cy_next_channel;
                 cy_card[j].num_chips = -1;
-		cy_card[j].pdev = pdev;
+		cy_card[j].pdev = pci_dev_get(pdev);
 
                 /* print message */
 #ifdef CONFIG_CYZ_INTR
@@ -5007,6 +4986,10 @@
                 cy_next_channel += cy_pci_nchan;
 	    }
         }
+        
+        if (pdev)
+		pci_dev_put(pdev);
+        
 
         for (; ZeIndex != 0 && i < NR_CARDS; i++) {
 	    cy_pci_phys0 = Ze_phys0[0];
@@ -5485,11 +5468,12 @@
 	    )
 		free_irq(cy_card[i].irq, &cy_card[i]);
 #ifdef CONFIG_PCI
-		if (cy_card[i].pdev)
+		if (cy_card[i].pdev) {
 			pci_release_regions(cy_card[i].pdev);
+			pci_dev_put(pdev);
+		}
 #endif
         }
     }
 } /* cy_cleanup_module */
 
 module_init(cy_init);

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

* Re: my first janitorial
  2007-04-01 16:00   ` Alan Cox
@ 2007-04-01 18:28     ` Jiri Slaby
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2007-04-01 18:28 UTC (permalink / raw)
  To: Alan Cox; +Cc: Pedram M, kernel-janitors, linux-kernel

Alan Cox napsal(a):
> On Sat, 31 Mar 2007 22:24:12 -0700
> "Pedram M" <pmessri@gmail.com> wrote:
> 
>> How about this one? Am I doing it right now?
>> If not, please try to explain more to me what I am
>> doing wrong.
> 
> You need to hold a reference to the PCI device for the entire duration it
> is used. I think you actually also need something like this to get the whole
> thing using pci references and pci_get_* properly
> 
> Alan
> 
> --- drivers/char/cyclades.c~	2007-04-01 15:52:16.000000000 +0100
> +++ drivers/char/cyclades.c	2007-04-01 15:52:16.000000000 +0100
> @@ -4803,7 +4782,7 @@
>                  cy_card[j].bus_index = 1;
>                  cy_card[j].first_line = cy_next_channel;
>                  cy_card[j].num_chips = cy_pci_nchan/4;
> -		cy_card[j].pdev = pdev;
> +		cy_card[j].pdev = pci_dev_get(pdev);

No, please let this code be, I have a bunch of patches to have pci_probing
for this driver, the remaining part for first set of patches is testing.

thanks,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
 B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E

Hnus <hnus@fi.muni.cz> is an alias for /dev/null

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

* Re: my first janitorial
  2007-04-01  6:17   ` Willy Tarreau
@ 2007-04-01 19:04     ` Jan Engelhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2007-04-01 19:04 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: Pedram M, kernel-janitors, linux-kernel


On Apr 1 2007 08:17, Willy Tarreau wrote:
>
>   - your patch was cut and cannot apply to anything. A proper patch starts
>     with line beginning with "---" line, followed by a line with "+++",
>     both indicating the file your patch is supposed to apply to. Make your
>     patch with one level directory for the kernel so that it can apply with
>     "patch -p1". For instance:
>
>        $ diff -u linux-2.6.20/Makefile linux-2.6.20-mine/Makefile
>
>     Another solution is to use '.' as the directory, in order to add one
>     directory level for "patch -p1" to be happy :
>
>        $ diff -u ./Makefile.orig ./Makefile

Suggesting quilt.



Jan
-- 

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

end of thread, other threads:[~2007-04-01 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9c9aa5d00703310639q68fa5d19k4d8e3bfb56b1fa6@mail.gmail.com>
2007-04-01  5:24 ` my first janitorial Pedram M
2007-04-01  6:16   ` [KJ] " Jaco Kroon
2007-04-01  6:17   ` Willy Tarreau
2007-04-01 19:04     ` Jan Engelhardt
2007-04-01 16:00   ` Alan Cox
2007-04-01 18:28     ` Jiri Slaby

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).