--- orig/linux-2.6.0/drivers/scsi/aha152x.c 2004-01-10 18:25:53.000000000 +0100 +++ linux-2.6.0/drivers/scsi/aha152x.c 2004-01-10 18:28:30.000000000 +0100 @@ -860,9 +860,6 @@ { int i; - if (check_region(io_port, IO_RANGE)) - return 0; - SETPORT(io_port + O_DMACNTRL1, 0); /* reset stack pointer */ for (i = 0; i < 16; i++) SETPORT(io_port + O_STACK, i); @@ -878,9 +875,6 @@ { int i; - if (check_region(io_port, IO_RANGE)) - return 0; - SETPORT(io_port + O_TC_DMACNTRL1, 0); /* reset stack pointer */ for (i = 0; i < 16; i++) SETPORT(io_port + O_STACK, i); @@ -903,13 +897,20 @@ if (i == ARRAY_SIZE(ports)) return 0; #endif + if (!request_region(setup->io_port, IO_RANGE, "aha152x")) + return 0; if(aha152x_porttest(setup->io_port)) { - setup->tc1550=0; + setup->tc1550=0; } else if(tc1550_porttest(setup->io_port)) { - setup->tc1550=1; - } else - return 0; + setup->tc1550=1; + } else { + release_region(setup->io_port, IO_RANGE); + return 0; + } + + release_region(setup->io_port, IO_RANGE); + if ((setup->irq < IRQ_MIN) || (setup->irq > IRQ_MAX)) return 0; @@ -965,7 +966,7 @@ { struct Scsi_Host *shpnt; - shpnt = scsi_register(&aha152x_driver_template, sizeof(struct aha152x_hostdata)); + shpnt = scsi_host_alloc(&aha152x_driver_template, sizeof(struct aha152x_hostdata)); if (!shpnt) { printk(KERN_ERR "aha152x: scsi_register failed\n"); return NULL; @@ -1080,6 +1081,9 @@ printk(KERN_ERR "aha152x%d: failed to reassign interrupt.\n", shpnt->host_no); goto out_unregister_host; } + + scsi_add_host(shpnt, 0); + scsi_scan_host(shpnt); return shpnt; /* the pcmcia stub needs the return value; */ out_unregister_host: @@ -1087,11 +1091,11 @@ out_release_region: release_region(shpnt->io_port, IO_RANGE); out_unregister: - scsi_unregister(shpnt); + scsi_host_put(shpnt); return NULL; } -static int aha152x_detect(Scsi_Host_Template * tpnt) +static int __init aha152x_init(void) { int i, j, ok; #if defined(AUTOCONF) @@ -1360,7 +1364,6 @@ return registered_count>0; } - static int aha152x_release(struct Scsi_Host *shpnt) { if (shpnt->irq) @@ -1374,11 +1377,25 @@ pnp_device_detach(HOSTDATA(shpnt)->pnpdev); #endif - scsi_unregister(shpnt); + scsi_host_put(shpnt); return 0; } +static void __exit aha152x_exit(void) +{ + int i; + + for(i=0; i