X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fgdth.c;h=6d67f5c0eb8e4133621898d7f5f07f18920592a5;hb=99109301d103fbf0de43fc5a580a406c12a501e0;hp=3ac080ee6e2f2785230259e595d39d806ebeed26;hpb=a52cefc80fc92981592c688d1c8067442afe4cec;p=linux-2.6 diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 3ac080ee6e..6d67f5c0eb 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -141,7 +141,7 @@ static void gdth_delay(int milliseconds); static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs); static irqreturn_t gdth_interrupt(int irq, void *dev_id); -static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq, +static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int gdth_from_wait, int* pIndex); static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index, Scsi_Cmnd *scp); @@ -165,7 +165,6 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp); static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive); static void gdth_enable_int(gdth_ha_str *ha); -static unchar gdth_get_status(gdth_ha_str *ha, int irq); static int gdth_test_busy(gdth_ha_str *ha); static int gdth_get_cmd_index(gdth_ha_str *ha); static void gdth_release_event(gdth_ha_str *ha); @@ -643,12 +642,15 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, *cnt, vendor, device)); pdev = NULL; - while ((pdev = pci_find_device(vendor, device, pdev)) + while ((pdev = pci_get_device(vendor, device, pdev)) != NULL) { if (pci_enable_device(pdev)) continue; - if (*cnt >= MAXHA) + if (*cnt >= MAXHA) { + pci_dev_put(pdev); return; + } + /* GDT PCI controller found, resources are already in pdev */ pcistr[*cnt].pdev = pdev; pcistr[*cnt].irq = pdev->irq; @@ -1334,14 +1336,12 @@ static void __init gdth_enable_int(gdth_ha_str *ha) } /* return IStatus if interrupt was from this card else 0 */ -static unchar gdth_get_status(gdth_ha_str *ha, int irq) +static unchar gdth_get_status(gdth_ha_str *ha) { unchar IStatus = 0; - TRACE(("gdth_get_status() irq %d ctr_count %d\n", irq, gdth_ctr_count)); + TRACE(("gdth_get_status() irq %d ctr_count %d\n", ha->irq, gdth_ctr_count)); - if (ha->irq != (unchar)irq) /* check IRQ */ - return false; if (ha->type == GDT_EISA) IStatus = inb((ushort)ha->bmic + EDOORREG); else if (ha->type == GDT_ISA) @@ -1523,7 +1523,7 @@ static int gdth_wait(gdth_ha_str *ha, int index, ulong32 time) return 1; /* no wait required */ do { - __gdth_interrupt(ha, (int)ha->irq, true, &wait_index); + __gdth_interrupt(ha, true, &wait_index); if (wait_index == index) { answer_found = TRUE; break; @@ -2374,18 +2374,18 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, if (cpsum+cpnow > cpcount) cpnow = cpcount - cpsum; cpsum += cpnow; - if (!sl->page) { + if (!sg_page(sl)) { printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n", ha->hanum); return; } local_irq_save(flags); - address = kmap_atomic(sl->page, KM_BIO_SRC_IRQ) + sl->offset; + address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset; if (to_buffer) memcpy(buffer, address, cpnow); else memcpy(address, buffer, cpnow); - flush_dcache_page(sl->page); + flush_dcache_page(sg_page(sl)); kunmap_atomic(address, KM_BIO_SRC_IRQ); local_irq_restore(flags); if (cpsum == cpcount) @@ -3036,7 +3036,7 @@ static void gdth_clear_events(void) /* SCSI interface functions */ -static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq, +static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int gdth_from_wait, int* pIndex) { gdt6m_dpram_str __iomem *dp6m_ptr = NULL; @@ -3054,7 +3054,7 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq, int act_int_coal = 0; #endif - TRACE(("gdth_interrupt() IRQ %d\n",irq)); + TRACE(("gdth_interrupt() IRQ %d\n", ha->irq)); /* if polling and not from gdth_wait() -> return */ if (gdth_polling) { @@ -3067,7 +3067,8 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq, spin_lock_irqsave(&ha->smp_lock, flags); /* search controller */ - if (0 == (IStatus = gdth_get_status(ha, irq))) { + IStatus = gdth_get_status(ha); + if (IStatus == 0) { /* spurious interrupt */ if (!gdth_polling) spin_unlock_irqrestore(&ha->smp_lock, flags); @@ -3294,9 +3295,9 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, int irq, static irqreturn_t gdth_interrupt(int irq, void *dev_id) { - gdth_ha_str *ha = (gdth_ha_str *)dev_id; + gdth_ha_str *ha = dev_id; - return __gdth_interrupt(ha, irq, false, NULL); + return __gdth_interrupt(ha, false, NULL); } static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index, @@ -4734,7 +4735,7 @@ static struct scsi_host_template gdth_template = { }; #ifdef CONFIG_ISA -static int gdth_isa_probe_one(ulong32 isa_bios) +static int __init gdth_isa_probe_one(ulong32 isa_bios) { struct Scsi_Host *shp; gdth_ha_str *ha; @@ -4838,6 +4839,9 @@ static int gdth_isa_probe_one(ulong32 isa_bios) if (error) goto out_free_coal_stat; list_add_tail(&ha->list, &gdth_instances); + + scsi_scan_host(shp); + return 0; out_free_coal_stat: @@ -4862,7 +4866,7 @@ static int gdth_isa_probe_one(ulong32 isa_bios) #endif /* CONFIG_ISA */ #ifdef CONFIG_EISA -static int gdth_eisa_probe_one(ushort eisa_slot) +static int __init gdth_eisa_probe_one(ushort eisa_slot) { struct Scsi_Host *shp; gdth_ha_str *ha; @@ -4965,6 +4969,9 @@ static int gdth_eisa_probe_one(ushort eisa_slot) if (error) goto out_free_coal_stat; list_add_tail(&ha->list, &gdth_instances); + + scsi_scan_host(shp); + return 0; out_free_ccb_phys: @@ -4991,7 +4998,7 @@ static int gdth_eisa_probe_one(ushort eisa_slot) #endif /* CONFIG_EISA */ #ifdef CONFIG_PCI -static int gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr) +static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr) { struct Scsi_Host *shp; gdth_ha_str *ha; @@ -5102,6 +5109,9 @@ static int gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr) if (error) goto out_free_coal_stat; list_add_tail(&ha->list, &gdth_instances); + + scsi_scan_host(shp); + return 0; out_free_coal_stat: