ahc_linux_detect(Scsi_Host_Template *template)
{
struct ahc_softc *ahc;
- int found;
+ int found = 0;
+ int eisa_err, pci_err;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/*
*/
ahc_list_lockinit();
-#ifdef CONFIG_PCI
- ahc_linux_pci_init();
-#endif
+ pci_err = ahc_linux_pci_init();
+ eisa_err = ahc_linux_eisa_init();
+
+ if(pci_err && eisa_err)
+ goto out;
-#ifdef CONFIG_EISA
- ahc_linux_eisa_init();
-#endif
/*
* Register with the SCSI layer all
* controllers we've found.
*/
- found = 0;
TAILQ_FOREACH(ahc, &ahc_tailq, links) {
if (ahc_linux_register_host(ahc, template) == 0)
found++;
}
+out:
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
spin_lock_irq(&io_request_lock);
#endif
aic7xxx_detect_complete++;
+
return (found);
}
/* Still equal. Sort by BIOS address, ioport, or bus/slot/func. */
switch (rvalue) {
+#ifdef CONFIG_PCI
case AHC_PCI:
{
char primary_channel;
value = 1;
break;
}
+#endif
case AHC_EISA:
if ((rahc->flags & AHC_BIOS_ENABLED) != 0) {
value = rahc->platform_data->bios_address
sprintf(current->comm, "ahc_dv_%d", ahc->unit);
#else
daemonize("ahc_dv_%d", ahc->unit);
+ current->flags |= PF_FREEZE;
#endif
unlock_kernel();
}
static void
-ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev)
+__ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev)
{
struct ahc_linux_target *targ;
- del_timer_sync(&dev->timer);
targ = dev->target;
targ->devices[dev->lun] = NULL;
free(dev, M_DEVBUF);
ahc_linux_free_target(ahc, targ);
}
+static void
+ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev)
+{
+ del_timer_sync(&dev->timer);
+ __ahc_linux_free_device(ahc, dev);
+}
+
void
ahc_send_async(struct ahc_softc *ahc, char channel,
u_int target, u_int lun, ac_code code, void *arg)
ahc_linux_run_device_queue(ahc, dev);
if (TAILQ_EMPTY(&dev->busyq)
&& dev->active == 0)
- ahc_linux_free_device(ahc, dev);
+ __ahc_linux_free_device(ahc, dev);
ahc_unlock(ahc, &s);
}
}
}
+static void ahc_linux_exit(void);
+
static int __init
ahc_linux_init(void)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- return (ahc_linux_detect(&aic7xxx_driver_template) ? 0 : -ENODEV);
+ int rc = ahc_linux_detect(&aic7xxx_driver_template);
+ if (rc)
+ return rc;
+ ahc_linux_exit();
+ return -ENODEV;
#else
scsi_register_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
if (aic7xxx_driver_template.present == 0) {
#endif
}
-static void __exit
+static void
ahc_linux_exit(void)
{
struct ahc_softc *ahc;
*/
scsi_unregister_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
#endif
-#ifdef CONFIG_PCI
ahc_linux_pci_exit();
-#endif
-#ifdef CONFIG_EISA
ahc_linux_eisa_exit();
-#endif
}
module_init(ahc_linux_init);