Skip to contentSkip to conversation

Fix compile warning in drivers/pnp/resource.c with !CONFIG_PCI

PATCH In review Mika Kukkonen 2 participants 2 messages Mar 21, 2005 – Mar 22, 2005 Pnp support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix compile warning in drivers/pnp/resource.c with !CONFIG_PCI

With !CONFIG_PCI I get following warning:

CC drivers/pnp/resource.o
drivers/pnp/resource.c:24: warning: `pnp_skip_pci_scan' defined but not used

Two ways to fix this, first one would be to simply #ifdef the variable. But the variable
in question is not (according to cscope) actually used outside this one other place (and reason why it became a warning now is that Adrian made it static), and so the code inside CONFIG_PCI is actually relying on the fact that the variable is implicitly initialized to 0. So the patch just deletes the variable.

--MiKu

resource.c 2005-03-21 19:41:54 +02:00 renamed from drivers/pnp/resource.c 2005-03-14 01:29:58 +02:00 +0 -1
@@ -21,7 +21,6 @@
 #include <linux/pnp.h>
 #include "base.h"
 
-static int pnp_skip_pci_scan;                          /* skip PCI

resource scanning */
static int pnp_reserve_irq[16] = { [0 ... 15] = -1 }; /* reserve
(don't use) some IRQ */
static int pnp_reserve_dma[8] = { [0 ... 7] = -1 }; /* reserve
(don't use) some DMA */
static int pnp_reserve_io[16] = { [0 ... 15] = -1 }; /* reserve
(don't use) some I/O region */
@@ -385,7 +384,7 @@

 #ifdef CONFIG_PCI
        /* check if the resource is being used by a pci device */

- if (!pnp_skip_pci_scan) {
+ {
struct pci_dev * pci = NULL;
while ((pci = pci_find_device(PCI_ANY_ID, PCI_ANY_ID,

pci)) != NULL) {
                        if (pci->irq == *irq)
#1 lore raw
Quoted 7 lines · Mika Kukkonen

With !CONFIG_PCI I get following warning:

CC drivers/pnp/resource.o
drivers/pnp/resource.c:24: warning: `pnp_skip_pci_scan' defined but not used

Quoted 7 lines

Two ways to fix this, first one would be to simply #ifdef the variable. But the variable
in question is not (according to cscope) actually used outside this one other place (and reason why it became a warning now is that Adrian made it static), and so the code inside CONFIG_PCI is actually relying on the fact that the variable is implicitly initialized to 0. So the patch just deletes the variable.

Well Adam might actually have meant to set pnp_skip_pci_scan with a __setup thingy.

Your patch was wildly wordwrapped.

We have a cute macro for that pci_dev walk.

I queued this up:

drivers/pnp/resource.c renamed from drivers/pnp/resource.c~fix-compile-warning-in-drivers-pnp-resourcec-with-config_pci +3 -4
@@ -21,7 +21,6 @@
 #include <linux/pnp.h>
 #include "base.h"
 
-static int pnp_skip_pci_scan;				/* skip PCI resource scanning */
 static int pnp_reserve_irq[16] = { [0 ... 15] = -1 };	/* reserve (don't use) some IRQ */
 static int pnp_reserve_dma[8] = { [0 ... 7] = -1 };	/* reserve (don't use) some DMA */
 static int pnp_reserve_io[16] = { [0 ... 15] = -1 };	/* reserve (don't use) some I/O region */
@@ -385,9 +384,9 @@ int pnp_check_irq(struct pnp_dev * dev, 
 
 #ifdef CONFIG_PCI
 	/* check if the resource is being used by a pci device */
-	if (!pnp_skip_pci_scan) {
-		struct pci_dev * pci = NULL;
-		while ((pci = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci)) != NULL) {
+	{
+		struct pci_dev *pci = NULL;
+		for_each_pci_dev(pci) {
 			if (pci->irq == *irq)
 				return 0;
 		}

_