mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Adrian Bunk <bunk@fs.tum.de>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: 2.6.8-rc3-mm1: ip2mainc-add-missing-pci_enable_device breaks compilation
Date: Thu, 5 Aug 2004 09:45:40 -0600	[thread overview]
Message-ID: <200408050945.40470.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <20040805123809.GF2746@fs.tum.de>

On Thursday 05 August 2004 6:38 am, Adrian Bunk wrote:
> This causes the following compile error:
> drivers/char/ip2main.c:445: request for member `pci_dev' in something not a structure or union

Thanks for finding this.  Andrew, if you replace that patch with the
following, it should fix it.  The error occurs when CONFIG_COMPUTONE=m,
so I've now built it as both built-in and a module.


I don't have this hardware, so this has been compiled but not tested.

Add pci_enable_device()/pci_disable_device().  In the past, drivers
often worked without this, but it is now required in order to route
PCI interrupts correctly.  In addition, this driver incorrectly used
the IRQ value from PCI config space rather than the one in the struct
pci_dev.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

===== drivers/char/ip2main.c 1.44 vs edited =====
--- 1.44/drivers/char/ip2main.c	2004-04-14 11:08:00 -06:00
+++ edited/drivers/char/ip2main.c	2004-08-05 09:37:22 -06:00
@@ -440,6 +440,12 @@
 	// free memory
 	for (i = 0; i < IP2_MAX_BOARDS; i++) {
 		void *pB;
+#ifdef CONFIG_PCI
+		if (ip2config.type[i] == PCI && ip2config.pci_dev[i]) {
+			pci_disable_device(ip2config.pci_dev[i]);
+			ip2config.pci_dev[i] = NULL;
+		}
+#endif
 		if ((pB = i2BoardPtrTable[i]) != 0 ) {
 			kfree ( pB );
 			i2BoardPtrTable[i] = NULL;
@@ -594,9 +600,14 @@
 							  PCI_DEVICE_ID_COMPUTONE_IP2EX, pci_dev_i);
 				if (pci_dev_i != NULL) {
 					unsigned int addr;
-					unsigned char pci_irq;
 
+					if (pci_enable_device(pci_dev_i)) {
+						printk( KERN_ERR "IP2: can't enable PCI device at %s\n",
+							pci_name(pci_dev_i));
+						break;
+					}
 					ip2config.type[i] = PCI;
+					ip2config.pci_dev[i] = pci_dev_i;
 					status =
 					pci_read_config_dword(pci_dev_i, PCI_BASE_ADDRESS_1, &addr);
 					if ( addr & 1 ) {
@@ -604,8 +615,6 @@
 					} else {
 						printk( KERN_ERR "IP2: PCI I/O address error\n");
 					}
-					status =
-					pci_read_config_byte(pci_dev_i, PCI_INTERRUPT_LINE, &pci_irq);
 
 //		If the PCI BIOS assigned it, lets try and use it.  If we
 //		can't acquire it or it screws up, deal with it then.
@@ -614,7 +623,7 @@
 //						printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
 //						pci_irq = 0;
 //					}
-					ip2config.irq[i] = pci_irq;
+					ip2config.irq[i] = pci_dev_i->irq;
 				} else {	// ann error
 					ip2config.addr[i] = 0;
 					if (status == PCIBIOS_DEVICE_NOT_FOUND) {
===== drivers/char/ip2/ip2types.h 1.1 vs edited =====
--- 1.1/drivers/char/ip2/ip2types.h	2002-02-05 10:40:06 -07:00
+++ edited/drivers/char/ip2/ip2types.h	2004-08-04 12:20:02 -06:00
@@ -49,6 +49,9 @@
 	short irq[IP2_MAX_BOARDS]; 
 	unsigned short addr[IP2_MAX_BOARDS];
 	int type[IP2_MAX_BOARDS];
+#ifdef CONFIG_PCI
+	struct pci_dev *pci_dev[IP2_MAX_BOARDS];
+#endif
 } ip2config_t;
 
 #endif

  reply	other threads:[~2004-08-05 15:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 10:19 2.6.8-rc3-mm1 Andrew Morton
2004-08-05 11:18 ` 2.6.8-rc3-mm1: SCHEDSTATS compile error Adrian Bunk
2004-08-05 15:25   ` Martin J. Bligh
2004-08-05 16:49     ` Adrian Bunk
2004-08-05 18:17       ` Rick Lindsley
2004-08-05 18:20         ` Adrian Bunk
2004-08-05 19:15           ` Rick Lindsley
2004-08-05 19:54             ` Luiz Fernando N. Capitulino
2004-08-05 20:20             ` Adrian Bunk
2004-08-09 19:46         ` Bill Davidsen
2004-08-09 19:51           ` Rick Lindsley
2004-08-05 11:20 ` 2.6.8-rc3-mm1 Sean Neakums
2004-08-05 11:49 ` 2.6.8-rc3-mm1: ALSA: vortex_asXtalkGainsAllChan multiple definitions Adrian Bunk
2004-08-05 12:38 ` 2.6.8-rc3-mm1: ip2mainc-add-missing-pci_enable_device breaks compilation Adrian Bunk
2004-08-05 15:45   ` Bjorn Helgaas [this message]
2004-08-05 12:50 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 13:03 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 21:38   ` 2.6.8-rc3-mm1 Andrew Morton
2004-08-06 15:25     ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 13:24 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 13:36 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 16:13 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 16:42 ` 2.6.8-rc3-mm1 Christoph Hellwig
2004-08-05 20:24   ` 2.6.8-rc3-mm1 Alan Cox
2004-08-05 16:52 ` 2.6.8-rc3-mm1 (compile stats) John Cherry
2004-08-06  3:34 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-06  4:24   ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-06  4:39     ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-06  5:17       ` 2.6.8-rc3-mm1 Andrew Morton
     [not found] ` <20040806075219.GW17188@holomorphy.com>
2004-08-06  8:11   ` alpha signal race fixes William Lee Irwin III
2004-08-06 12:48 ` 2.6.8-rc3-mm1 Mark Watts
2004-08-06 19:58 ` 2.6.8-rc3-mm1: sk98lin/skge.c compile error with PROC_FS=n Adrian Bunk
2004-08-06 19:58 ` 2.6.8-rc3-mm1: PROC_FS=n link errors Adrian Bunk
2004-08-06 20:24   ` William Lee Irwin III
2004-08-06 20:33     ` William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408050945.40470.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@osdl.org \
    --cc=bunk@fs.tum.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®