Commit 8a0acc94 authored by Tim Waugh's avatar Tim Waugh Committed by Linus Torvalds

[PATCH] 2.5.6-pre1: parport PCI card hooks

This patch adds some necessary PCI card hooks.  Patch originally from
VScom IIRC.

2001-11-14  Tim Waugh  <twaugh@redhat.com> [sent 2001-11-27]

	* drivers/parport/parport_pc.c,
	drivers/parport/parport_serial.c: PCI card hooks.
	* drivers/parport/ChangeLog: Updated.
parent d5d28282
2001-11-14 Tim Waugh <twaugh@redhat.com>
* parport_pc.c (parport_pc_pci_probe): Hooks for PCI cards before
and after probing for ports.
* parport_serial.c (parport_register): Likewise.
2002-01-20 Tim Waugh <twaugh@redhat.com>
* parport_pc.c (parport_pc_compat_write_block_pio,
......
......@@ -2719,6 +2719,15 @@ static struct parport_pc_pci {
int hi; /* -1 if not there, >6 for offset-method (max
BAR is 6) */
} addr[4];
/* If set, this is called immediately after pci_enable_device.
* If it returns non-zero, no probing will take place and the
* ports will not be used. */
int (*preinit_hook) (struct pci_dev *pdev, int autoirq, int autodma);
/* If set, this is called after probing for ports. If 'failed'
* is non-zero we couldn't use any of the ports. */
void (*postinit_hook) (struct pci_dev *pdev, int failed);
} cards[] __devinitdata = {
/* siig_1s1p_10x_550 */ { 1, { { 3, 4 }, } },
/* siig_1s1p_10x_650 */ { 1, { { 3, 4 }, } },
......@@ -2895,6 +2904,10 @@ static int __devinit parport_pc_pci_probe (struct pci_dev *dev,
if ((err = pci_enable_device (dev)) != 0)
return err;
if (cards[i].preinit_hook &&
cards[i].preinit_hook (dev, PARPORT_IRQ_NONE, PARPORT_DMA_NONE))
return -ENODEV;
for (n = 0; n < cards[i].numports; n++) {
int lo = cards[i].addr[n].lo;
int hi = cards[i].addr[n].hi;
......@@ -2917,6 +2930,9 @@ static int __devinit parport_pc_pci_probe (struct pci_dev *dev,
count++;
}
if (cards[i].postinit_hook)
cards[i].postinit_hook (dev, count == 0);
return count == 0 ? -ENODEV : 0;
}
......
......@@ -53,6 +53,15 @@ static struct parport_pc_pci {
int hi; /* -1 if not there, >6 for offset-method (max
BAR is 6) */
} addr[4];
/* If set, this is called immediately after pci_enable_device.
* If it returns non-zero, no probing will take place and the
* ports will not be used. */
int (*preinit_hook) (struct pci_dev *pdev, int autoirq, int autodma);
/* If set, this is called after probing for ports. If 'failed'
* is non-zero we couldn't use any of the ports. */
void (*postinit_hook) (struct pci_dev *pdev, int failed);
} cards[] __devinitdata = {
/* titan_110l */ { 1, { { 3, -1 }, } },
/* titan_210l */ { 1, { { 3, -1 }, } },
......@@ -239,6 +248,10 @@ static int __devinit parport_register (struct pci_dev *dev,
int i = id->driver_data, n;
int success = 0;
if (cards[i].preinit_hook &&
cards[i].preinit_hook (dev, PARPORT_IRQ_NONE, PARPORT_DMA_NONE))
return -ENODEV;
for (n = 0; n < cards[i].numports; n++) {
struct parport *port;
int lo = cards[i].addr[n].lo;
......@@ -265,6 +278,9 @@ static int __devinit parport_register (struct pci_dev *dev,
}
}
if (cards[i].postinit_hook)
cards[i].postinit_hook (dev, !success);
return success ? 0 : 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment