mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-11 15:49:56 +00:00
[SCSI] Switch fdomain to the pci_get API
Doesn't make the hardware hot pluggable but does ensure the driver won't crash when another device is hot-unplugged at the wrong moment. Soon I propose to deprecate pci_find_device() and some of its friends. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
ed632da84c
commit
47bcd3546d
@ -387,6 +387,7 @@ static void __iomem * bios_mem;
|
|||||||
static int bios_major;
|
static int bios_major;
|
||||||
static int bios_minor;
|
static int bios_minor;
|
||||||
static int PCI_bus;
|
static int PCI_bus;
|
||||||
|
static struct pci_dev *PCI_dev;
|
||||||
static int Quantum; /* Quantum board variant */
|
static int Quantum; /* Quantum board variant */
|
||||||
static int interrupt_level;
|
static int interrupt_level;
|
||||||
static volatile int in_command;
|
static volatile int in_command;
|
||||||
@ -812,9 +813,10 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
|
|||||||
PCI_DEVICE_ID_FD_36C70 );
|
PCI_DEVICE_ID_FD_36C70 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((pdev = pci_find_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL)
|
if ((pdev = pci_get_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if (pci_enable_device(pdev)) return 0;
|
if (pci_enable_device(pdev))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
#if DEBUG_DETECT
|
#if DEBUG_DETECT
|
||||||
printk( "scsi: <fdomain> TMC-3260 detect:"
|
printk( "scsi: <fdomain> TMC-3260 detect:"
|
||||||
@ -831,7 +833,7 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
|
|||||||
pci_irq = pdev->irq;
|
pci_irq = pdev->irq;
|
||||||
|
|
||||||
if (!request_region( pci_base, 0x10, "fdomain" ))
|
if (!request_region( pci_base, 0x10, "fdomain" ))
|
||||||
return 0;
|
goto fail;
|
||||||
|
|
||||||
/* Now we have the I/O base address and interrupt from the PCI
|
/* Now we have the I/O base address and interrupt from the PCI
|
||||||
configuration registers. */
|
configuration registers. */
|
||||||
@ -848,17 +850,22 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_
|
|||||||
if (!fdomain_is_valid_port(pci_base)) {
|
if (!fdomain_is_valid_port(pci_base)) {
|
||||||
printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" );
|
printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" );
|
||||||
release_region(pci_base, 0x10);
|
release_region(pci_base, 0x10);
|
||||||
return 0;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in a few global variables. Ugh. */
|
/* Fill in a few global variables. Ugh. */
|
||||||
bios_major = bios_minor = -1;
|
bios_major = bios_minor = -1;
|
||||||
PCI_bus = 1;
|
PCI_bus = 1;
|
||||||
|
PCI_dev = pdev;
|
||||||
Quantum = 0;
|
Quantum = 0;
|
||||||
bios_base = 0;
|
bios_base = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
fail:
|
||||||
|
pci_dev_put(pdev);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
|
struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
|
||||||
@ -909,8 +916,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
|
|||||||
if (setup_called) {
|
if (setup_called) {
|
||||||
printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n");
|
printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n");
|
||||||
}
|
}
|
||||||
release_region(port_base, 0x10);
|
goto fail;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this_id) {
|
if (this_id) {
|
||||||
@ -942,8 +948,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
|
|||||||
/* Log IRQ with kernel */
|
/* Log IRQ with kernel */
|
||||||
if (!interrupt_level) {
|
if (!interrupt_level) {
|
||||||
printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" );
|
printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" );
|
||||||
release_region(port_base, 0x10);
|
goto fail;
|
||||||
return NULL;
|
|
||||||
} else {
|
} else {
|
||||||
/* Register the IRQ with the kernel */
|
/* Register the IRQ with the kernel */
|
||||||
|
|
||||||
@ -964,11 +969,14 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
|
|||||||
printk(KERN_ERR " Send mail to faith@acm.org\n" );
|
printk(KERN_ERR " Send mail to faith@acm.org\n" );
|
||||||
}
|
}
|
||||||
printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" );
|
printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" );
|
||||||
release_region(port_base, 0x10);
|
goto fail;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return shpnt;
|
return shpnt;
|
||||||
|
fail:
|
||||||
|
pci_dev_put(pdev);
|
||||||
|
release_region(port_base, 0x10);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
|
static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
|
||||||
@ -1714,6 +1722,8 @@ static int fdomain_16x0_release(struct Scsi_Host *shpnt)
|
|||||||
free_irq(shpnt->irq, shpnt);
|
free_irq(shpnt->irq, shpnt);
|
||||||
if (shpnt->io_port && shpnt->n_io_port)
|
if (shpnt->io_port && shpnt->n_io_port)
|
||||||
release_region(shpnt->io_port, shpnt->n_io_port);
|
release_region(shpnt->io_port, shpnt->n_io_port);
|
||||||
|
if (PCI_bus)
|
||||||
|
pci_dev_put(PCI_dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user