diff options
Diffstat (limited to 'drivers/scsi/fdomain.c')
-rw-r--r-- | drivers/scsi/fdomain.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 41b05fc45380..5d4ea6f77953 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c | |||
@@ -278,9 +278,9 @@ | |||
278 | #include <linux/pci.h> | 278 | #include <linux/pci.h> |
279 | #include <linux/stat.h> | 279 | #include <linux/stat.h> |
280 | #include <linux/delay.h> | 280 | #include <linux/delay.h> |
281 | #include <linux/io.h> | ||
281 | #include <scsi/scsicam.h> | 282 | #include <scsi/scsicam.h> |
282 | 283 | ||
283 | #include <asm/io.h> | ||
284 | #include <asm/system.h> | 284 | #include <asm/system.h> |
285 | 285 | ||
286 | #include <scsi/scsi.h> | 286 | #include <scsi/scsi.h> |
@@ -387,6 +387,7 @@ static void __iomem * bios_mem; | |||
387 | static int bios_major; | 387 | static int bios_major; |
388 | static int bios_minor; | 388 | static int bios_minor; |
389 | static int PCI_bus; | 389 | static int PCI_bus; |
390 | static struct pci_dev *PCI_dev; | ||
390 | static int Quantum; /* Quantum board variant */ | 391 | static int Quantum; /* Quantum board variant */ |
391 | static int interrupt_level; | 392 | static int interrupt_level; |
392 | static volatile int in_command; | 393 | static volatile int in_command; |
@@ -812,9 +813,10 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_ | |||
812 | PCI_DEVICE_ID_FD_36C70 ); | 813 | PCI_DEVICE_ID_FD_36C70 ); |
813 | #endif | 814 | #endif |
814 | 815 | ||
815 | if ((pdev = pci_find_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL) | 816 | if ((pdev = pci_get_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL) |
816 | return 0; | 817 | return 0; |
817 | if (pci_enable_device(pdev)) return 0; | 818 | if (pci_enable_device(pdev)) |
819 | goto fail; | ||
818 | 820 | ||
819 | #if DEBUG_DETECT | 821 | #if DEBUG_DETECT |
820 | printk( "scsi: <fdomain> TMC-3260 detect:" | 822 | printk( "scsi: <fdomain> TMC-3260 detect:" |
@@ -831,7 +833,7 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_ | |||
831 | pci_irq = pdev->irq; | 833 | pci_irq = pdev->irq; |
832 | 834 | ||
833 | if (!request_region( pci_base, 0x10, "fdomain" )) | 835 | if (!request_region( pci_base, 0x10, "fdomain" )) |
834 | return 0; | 836 | goto fail; |
835 | 837 | ||
836 | /* Now we have the I/O base address and interrupt from the PCI | 838 | /* Now we have the I/O base address and interrupt from the PCI |
837 | configuration registers. */ | 839 | configuration registers. */ |
@@ -848,17 +850,22 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_ | |||
848 | if (!fdomain_is_valid_port(pci_base)) { | 850 | if (!fdomain_is_valid_port(pci_base)) { |
849 | printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" ); | 851 | printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" ); |
850 | release_region(pci_base, 0x10); | 852 | release_region(pci_base, 0x10); |
851 | return 0; | 853 | goto fail; |
852 | } | 854 | } |
853 | 855 | ||
854 | /* Fill in a few global variables. Ugh. */ | 856 | /* Fill in a few global variables. Ugh. */ |
855 | bios_major = bios_minor = -1; | 857 | bios_major = bios_minor = -1; |
856 | PCI_bus = 1; | 858 | PCI_bus = 1; |
859 | PCI_dev = pdev; | ||
857 | Quantum = 0; | 860 | Quantum = 0; |
858 | bios_base = 0; | 861 | bios_base = 0; |
859 | 862 | ||
860 | return 1; | 863 | return 1; |
864 | fail: | ||
865 | pci_dev_put(pdev); | ||
866 | return 0; | ||
861 | } | 867 | } |
868 | |||
862 | #endif | 869 | #endif |
863 | 870 | ||
864 | struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | 871 | 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 ) | |||
909 | if (setup_called) { | 916 | if (setup_called) { |
910 | printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n"); | 917 | printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n"); |
911 | } | 918 | } |
912 | release_region(port_base, 0x10); | 919 | goto fail; |
913 | return NULL; | ||
914 | } | 920 | } |
915 | 921 | ||
916 | if (this_id) { | 922 | if (this_id) { |
@@ -942,8 +948,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | |||
942 | /* Log IRQ with kernel */ | 948 | /* Log IRQ with kernel */ |
943 | if (!interrupt_level) { | 949 | if (!interrupt_level) { |
944 | printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" ); | 950 | printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" ); |
945 | release_region(port_base, 0x10); | 951 | goto fail; |
946 | return NULL; | ||
947 | } else { | 952 | } else { |
948 | /* Register the IRQ with the kernel */ | 953 | /* Register the IRQ with the kernel */ |
949 | 954 | ||
@@ -964,11 +969,14 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | |||
964 | printk(KERN_ERR " Send mail to faith@acm.org\n" ); | 969 | printk(KERN_ERR " Send mail to faith@acm.org\n" ); |
965 | } | 970 | } |
966 | printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" ); | 971 | printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" ); |
967 | release_region(port_base, 0x10); | 972 | goto fail; |
968 | return NULL; | ||
969 | } | 973 | } |
970 | } | 974 | } |
971 | return shpnt; | 975 | return shpnt; |
976 | fail: | ||
977 | pci_dev_put(pdev); | ||
978 | release_region(port_base, 0x10); | ||
979 | return NULL; | ||
972 | } | 980 | } |
973 | 981 | ||
974 | static int fdomain_16x0_detect(struct scsi_host_template *tpnt) | 982 | static int fdomain_16x0_detect(struct scsi_host_template *tpnt) |
@@ -1714,6 +1722,8 @@ static int fdomain_16x0_release(struct Scsi_Host *shpnt) | |||
1714 | free_irq(shpnt->irq, shpnt); | 1722 | free_irq(shpnt->irq, shpnt); |
1715 | if (shpnt->io_port && shpnt->n_io_port) | 1723 | if (shpnt->io_port && shpnt->n_io_port) |
1716 | release_region(shpnt->io_port, shpnt->n_io_port); | 1724 | release_region(shpnt->io_port, shpnt->n_io_port); |
1725 | if (PCI_bus) | ||
1726 | pci_dev_put(PCI_dev); | ||
1717 | return 0; | 1727 | return 0; |
1718 | } | 1728 | } |
1719 | 1729 | ||
@@ -1736,6 +1746,15 @@ struct scsi_host_template fdomain_driver_template = { | |||
1736 | }; | 1746 | }; |
1737 | 1747 | ||
1738 | #ifndef PCMCIA | 1748 | #ifndef PCMCIA |
1749 | |||
1750 | static struct pci_device_id fdomain_pci_tbl[] __devinitdata = { | ||
1751 | { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, | ||
1752 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | ||
1753 | { } | ||
1754 | }; | ||
1755 | MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl); | ||
1756 | |||
1739 | #define driver_template fdomain_driver_template | 1757 | #define driver_template fdomain_driver_template |
1740 | #include "scsi_module.c" | 1758 | #include "scsi_module.c" |
1759 | |||
1741 | #endif | 1760 | #endif |