Commit 96a3b847 authored by James Bottomley's avatar James Bottomley

Fix errors in [PATCH] aic7xxx: fix oops whe hardware is not present

This patch was causing a boot panic.  Now fixed.
parent 5053dc60
...@@ -159,10 +159,10 @@ ahc_linux_eisa_init(void) ...@@ -159,10 +159,10 @@ ahc_linux_eisa_init(void)
void void
ahc_linux_eisa_exit(void) ahc_linux_eisa_exit(void)
{ {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) if(aic7xxx_probe_eisa_vl != 0 && aic7770_driver.id_table != NULL) {
eisa_driver_unregister(&aic7770_driver); eisa_driver_unregister(&aic7770_driver);
free(aic7770_driver.id_table, M_DEVBUF); free(aic7770_driver.id_table, M_DEVBUF);
#endif }
} }
static int static int
......
...@@ -843,7 +843,8 @@ static int ...@@ -843,7 +843,8 @@ static int
ahc_linux_detect(Scsi_Host_Template *template) ahc_linux_detect(Scsi_Host_Template *template)
{ {
struct ahc_softc *ahc; struct ahc_softc *ahc;
int found; int found = 0;
int eisa_err, pci_err;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/* /*
...@@ -891,21 +892,12 @@ ahc_linux_detect(Scsi_Host_Template *template) ...@@ -891,21 +892,12 @@ ahc_linux_detect(Scsi_Host_Template *template)
*/ */
ahc_list_lockinit(); ahc_list_lockinit();
#ifdef CONFIG_PCI pci_err = ahc_linux_pci_init();
found = ahc_linux_pci_init(); eisa_err = ahc_linux_eisa_init();
if (found)
goto out;
#endif
#ifdef CONFIG_EISA if(pci_err && eisa_err)
found = ahc_linux_eisa_init();
if (found) {
#ifdef CONFIG_PCI
ahc_linux_pci_exit();
#endif
goto out; goto out;
}
#endif
/* /*
* Register with the SCSI layer all * Register with the SCSI layer all
...@@ -916,12 +908,13 @@ ahc_linux_detect(Scsi_Host_Template *template) ...@@ -916,12 +908,13 @@ ahc_linux_detect(Scsi_Host_Template *template)
if (ahc_linux_register_host(ahc, template) == 0) if (ahc_linux_register_host(ahc, template) == 0)
found++; found++;
} }
out:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
spin_lock_irq(&io_request_lock); spin_lock_irq(&io_request_lock);
#endif #endif
aic7xxx_detect_complete++; aic7xxx_detect_complete++;
out:
return (found); return (found);
} }
...@@ -5078,7 +5071,7 @@ ahc_platform_dump_card_state(struct ahc_softc *ahc) ...@@ -5078,7 +5071,7 @@ ahc_platform_dump_card_state(struct ahc_softc *ahc)
} }
} }
static void __exit ahc_linux_exit(void); static void ahc_linux_exit(void);
static int __init static int __init
ahc_linux_init(void) ahc_linux_init(void)
...@@ -5101,7 +5094,7 @@ ahc_linux_init(void) ...@@ -5101,7 +5094,7 @@ ahc_linux_init(void)
#endif #endif
} }
static void __exit static void
ahc_linux_exit(void) ahc_linux_exit(void)
{ {
struct ahc_softc *ahc; struct ahc_softc *ahc;
...@@ -5128,12 +5121,8 @@ ahc_linux_exit(void) ...@@ -5128,12 +5121,8 @@ ahc_linux_exit(void)
*/ */
scsi_unregister_module(MODULE_SCSI_HA, &aic7xxx_driver_template); scsi_unregister_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
#endif #endif
#ifdef CONFIG_PCI
ahc_linux_pci_exit(); ahc_linux_pci_exit();
#endif
#ifdef CONFIG_EISA
ahc_linux_eisa_exit(); ahc_linux_eisa_exit();
#endif
} }
module_init(ahc_linux_init); module_init(ahc_linux_init);
......
...@@ -845,6 +845,12 @@ void ahc_linux_eisa_exit(void); ...@@ -845,6 +845,12 @@ void ahc_linux_eisa_exit(void);
int aic7770_map_registers(struct ahc_softc *ahc, int aic7770_map_registers(struct ahc_softc *ahc,
u_int port); u_int port);
int aic7770_map_int(struct ahc_softc *ahc, u_int irq); int aic7770_map_int(struct ahc_softc *ahc, u_int irq);
#else
static inline int ahc_linux_eisa_init(void) {
return -ENODEV;
}
static inline void ahc_linux_eisa_exit(void) {
}
#endif #endif
/******************************* PCI Routines *********************************/ /******************************* PCI Routines *********************************/
...@@ -932,6 +938,12 @@ ahc_get_pci_bus(ahc_dev_softc_t pci) ...@@ -932,6 +938,12 @@ ahc_get_pci_bus(ahc_dev_softc_t pci)
{ {
return (pci->bus->number); return (pci->bus->number);
} }
#else
static inline int ahc_linux_pci_init(void) {
return -ENODEV;
}
static inline void ahc_linux_pci_exit(void) {
}
#endif #endif
static __inline void ahc_flush_device_writes(struct ahc_softc *); static __inline void ahc_flush_device_writes(struct ahc_softc *);
......
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