Commit 9d0e96eb authored by Matthew Wilcox's avatar Matthew Wilcox Committed by James Bottomley

[SCSI] advansys: Get rid of board index number

It's always a mistake to have your own index of boards; just use the
scsi host number.
Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f092d229
...@@ -66,8 +66,7 @@ ...@@ -66,8 +66,7 @@
* 5. check DMA mapping functions for failure * 5. check DMA mapping functions for failure
* 6. Use scsi_transport_spi * 6. Use scsi_transport_spi
* 7. advansys_info is not safe against multiple simultaneous callers * 7. advansys_info is not safe against multiple simultaneous callers
* 8. Kill boardp->id * 8. Add module_param to override ISA/VLB ioport array
* 9. Add module_param to override ISA/VLB ioport array
*/ */
#warning this driver is still not properly converted to the DMA API #warning this driver is still not properly converted to the DMA API
...@@ -2416,7 +2415,6 @@ typedef struct adv_req { ...@@ -2416,7 +2415,6 @@ typedef struct adv_req {
*/ */
struct asc_board { struct asc_board {
struct device *dev; struct device *dev;
int id; /* Board Id */
uint flags; /* Board flags */ uint flags; /* Board flags */
unsigned int irq; unsigned int irq;
union { union {
...@@ -2467,9 +2465,6 @@ struct asc_board { ...@@ -2467,9 +2465,6 @@ struct asc_board {
dvc_var.adv_dvc_var) dvc_var.adv_dvc_var)
#define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev)
/* Number of boards detected in system. */
static int asc_board_count;
/* Overrun buffer used by all narrow boards. */ /* Overrun buffer used by all narrow boards. */
static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 };
...@@ -2848,9 +2843,8 @@ static const char *advansys_info(struct Scsi_Host *shost) ...@@ -2848,9 +2843,8 @@ static const char *advansys_info(struct Scsi_Host *shost)
} }
} else { } else {
busname = "?"; busname = "?";
ASC_PRINT2("advansys_info: board %d: unknown " shost_printk(KERN_ERR, shost, "unknown bus "
"bus type %d\n", boardp->id, "type %d\n", asc_dvc_varp->bus_type);
asc_dvc_varp->bus_type);
} }
sprintf(info, sprintf(info,
"AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X", "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X",
...@@ -4382,7 +4376,6 @@ static void AscSetBank(PortAddr iop_base, uchar bank) ...@@ -4382,7 +4376,6 @@ static void AscSetBank(PortAddr iop_base, uchar bank)
val &= ~CC_BANK_ONE; val &= ~CC_BANK_ONE;
} }
AscSetChipControl(iop_base, val); AscSetChipControl(iop_base, val);
return;
} }
static void AscSetChipIH(PortAddr iop_base, ushort ins_code) static void AscSetChipIH(PortAddr iop_base, ushort ins_code)
...@@ -4390,7 +4383,6 @@ static void AscSetChipIH(PortAddr iop_base, ushort ins_code) ...@@ -4390,7 +4383,6 @@ static void AscSetChipIH(PortAddr iop_base, ushort ins_code)
AscSetBank(iop_base, 1); AscSetBank(iop_base, 1);
AscWriteChipIH(iop_base, ins_code); AscWriteChipIH(iop_base, ins_code);
AscSetBank(iop_base, 0); AscSetBank(iop_base, 0);
return;
} }
static int AscStartChip(PortAddr iop_base) static int AscStartChip(PortAddr iop_base)
...@@ -4475,7 +4467,6 @@ static void AscEnableInterrupt(PortAddr iop_base) ...@@ -4475,7 +4467,6 @@ static void AscEnableInterrupt(PortAddr iop_base)
cfg = AscGetChipCfgLsw(iop_base); cfg = AscGetChipCfgLsw(iop_base);
AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON); AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON);
return;
} }
static void AscDisableInterrupt(PortAddr iop_base) static void AscDisableInterrupt(PortAddr iop_base)
...@@ -4484,7 +4475,6 @@ static void AscDisableInterrupt(PortAddr iop_base) ...@@ -4484,7 +4475,6 @@ static void AscDisableInterrupt(PortAddr iop_base)
cfg = AscGetChipCfgLsw(iop_base); cfg = AscGetChipCfgLsw(iop_base);
AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON)); AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON));
return;
} }
static uchar AscReadLramByte(PortAddr iop_base, ushort addr) static uchar AscReadLramByte(PortAddr iop_base, ushort addr)
...@@ -4542,7 +4532,6 @@ static void AscWriteLramWord(PortAddr iop_base, ushort addr, ushort word_val) ...@@ -4542,7 +4532,6 @@ static void AscWriteLramWord(PortAddr iop_base, ushort addr, ushort word_val)
{ {
AscSetChipLramAddr(iop_base, addr); AscSetChipLramAddr(iop_base, addr);
AscSetChipLramData(iop_base, word_val); AscSetChipLramData(iop_base, word_val);
return;
} }
static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val) static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val)
...@@ -4560,7 +4549,6 @@ static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val) ...@@ -4560,7 +4549,6 @@ static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val)
word_data |= ((ushort)byte_val & 0x00FF); word_data |= ((ushort)byte_val & 0x00FF);
} }
AscWriteLramWord(iop_base, addr, word_data); AscWriteLramWord(iop_base, addr, word_data);
return;
} }
/* /*
...@@ -4588,7 +4576,6 @@ AscMemWordCopyPtrToLram(PortAddr iop_base, ...@@ -4588,7 +4576,6 @@ AscMemWordCopyPtrToLram(PortAddr iop_base,
outpw(iop_base + IOP_RAM_DATA, outpw(iop_base + IOP_RAM_DATA,
((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
} }
return;
} }
/* /*
...@@ -4608,7 +4595,6 @@ AscMemDWordCopyPtrToLram(PortAddr iop_base, ...@@ -4608,7 +4595,6 @@ AscMemDWordCopyPtrToLram(PortAddr iop_base,
outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); /* LSW */ outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); /* LSW */
outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]); /* MSW */ outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]); /* MSW */
} }
return;
} }
/* /*
...@@ -4630,7 +4616,6 @@ AscMemWordCopyPtrFromLram(PortAddr iop_base, ...@@ -4630,7 +4616,6 @@ AscMemWordCopyPtrFromLram(PortAddr iop_base,
d_buffer[i] = word & 0xff; d_buffer[i] = word & 0xff;
d_buffer[i + 1] = (word >> 8) & 0xff; d_buffer[i + 1] = (word >> 8) & 0xff;
} }
return;
} }
static ASC_DCNT AscMemSumLramWord(PortAddr iop_base, ushort s_addr, int words) static ASC_DCNT AscMemSumLramWord(PortAddr iop_base, ushort s_addr, int words)
...@@ -8397,8 +8382,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) ...@@ -8397,8 +8382,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
boardp->adv_reqp = reqp; boardp->adv_reqp = reqp;
ASC_DBG(1, "done\n"); ASC_DBG(1, "done\n");
return;
} }
/* /*
...@@ -8569,7 +8552,6 @@ static void AscAckInterrupt(PortAddr iop_base) ...@@ -8569,7 +8552,6 @@ static void AscAckInterrupt(PortAddr iop_base)
} }
} }
AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag); AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag);
return;
} }
static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time) static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time)
...@@ -9325,8 +9307,6 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) ...@@ -9325,8 +9307,6 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
} }
asc_scsi_done(scp); asc_scsi_done(scp);
return;
} }
static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) static int AscIsrQDone(ASC_DVC_VAR *asc_dvc)
...@@ -10055,8 +10035,8 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, ...@@ -10055,8 +10035,8 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
scp->sc_data_direction); scp->sc_data_direction);
if (use_sg > scp->device->host->sg_tablesize) { if (use_sg > scp->device->host->sg_tablesize) {
ASC_PRINT3("asc_build_req: board %d: use_sg %d > " scmd_printk(KERN_ERR, scp, "use_sg %d > "
"sg_tablesize %d\n", boardp->id, use_sg, "sg_tablesize %d\n", use_sg,
scp->device->host->sg_tablesize); scp->device->host->sg_tablesize);
dma_unmap_sg(boardp->dev, slp, scp->use_sg, dma_unmap_sg(boardp->dev, slp, scp->use_sg,
scp->sc_data_direction); scp->sc_data_direction);
...@@ -10332,8 +10312,8 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, ...@@ -10332,8 +10312,8 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
scp->sc_data_direction); scp->sc_data_direction);
if (use_sg > ADV_MAX_SG_LIST) { if (use_sg > ADV_MAX_SG_LIST) {
ASC_PRINT3("adv_build_req: board %d: use_sg %d > " scmd_printk(KERN_ERR, scp, "use_sg %d > "
"ADV_MAX_SG_LIST %d\n", boardp->id, use_sg, "ADV_MAX_SG_LIST %d\n", use_sg,
scp->device->host->sg_tablesize); scp->device->host->sg_tablesize);
dma_unmap_sg(boardp->dev, slp, scp->use_sg, dma_unmap_sg(boardp->dev, slp, scp->use_sg,
scp->sc_data_direction); scp->sc_data_direction);
...@@ -11174,14 +11154,14 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) ...@@ -11174,14 +11154,14 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
ASC_STATS(scp->device->host, exe_busy); ASC_STATS(scp->device->host, exe_busy);
break; break;
case ASC_ERROR: case ASC_ERROR:
ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() " scmd_printk(KERN_ERR, scp, "ExeScsiQueue() ASC_ERROR, "
"ASC_ERROR, err_code 0x%x\n", boardp->id, err_code); "err_code 0x%x\n", err_code);
ASC_STATS(scp->device->host, exe_error); ASC_STATS(scp->device->host, exe_error);
scp->result = HOST_BYTE(DID_ERROR); scp->result = HOST_BYTE(DID_ERROR);
break; break;
default: default:
ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() " scmd_printk(KERN_ERR, scp, "ExeScsiQueue() unknown, "
"unknown, err_code 0x%x\n", boardp->id, err_code); "err_code 0x%x\n", err_code);
ASC_STATS(scp->device->host, exe_unknown); ASC_STATS(scp->device->host, exe_unknown);
scp->result = HOST_BYTE(DID_ERROR); scp->result = HOST_BYTE(DID_ERROR);
break; break;
...@@ -11314,7 +11294,6 @@ static void __devinit AscEnableIsaDma(uchar dma_channel) ...@@ -11314,7 +11294,6 @@ static void __devinit AscEnableIsaDma(uchar dma_channel)
outp(0x00D6, (ushort)(0xC0 | (dma_channel - 4))); outp(0x00D6, (ushort)(0xC0 | (dma_channel - 4)));
outp(0x00D4, (ushort)(dma_channel - 4)); outp(0x00D4, (ushort)(dma_channel - 4));
} }
return;
} }
#endif /* CONFIG_ISA */ #endif /* CONFIG_ISA */
...@@ -11613,7 +11592,6 @@ static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc) ...@@ -11613,7 +11592,6 @@ static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc)
static void __devinit AscWaitEEPWrite(void) static void __devinit AscWaitEEPWrite(void)
{ {
mdelay(20); mdelay(20);
return;
} }
static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg)
...@@ -11936,9 +11914,10 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc) ...@@ -11936,9 +11914,10 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
return (warn_code); return (warn_code);
} }
static int __devinit AscInitGetConfig(struct asc_board *boardp) static int __devinit AscInitGetConfig(struct Scsi_Host *shost)
{ {
ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; struct asc_board *board = shost_priv(shost);
ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var;
unsigned short warn_code = 0; unsigned short warn_code = 0;
asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG;
...@@ -11959,43 +11938,40 @@ static int __devinit AscInitGetConfig(struct asc_board *boardp) ...@@ -11959,43 +11938,40 @@ static int __devinit AscInitGetConfig(struct asc_board *boardp)
case 0: /* No error */ case 0: /* No error */
break; break;
case ASC_WARN_IO_PORT_ROTATE: case ASC_WARN_IO_PORT_ROTATE:
ASC_PRINT1("AscInitGetConfig: board %d: I/O port address " shost_printk(KERN_WARNING, shost, "I/O port address "
"modified\n", boardp->id); "modified\n");
break; break;
case ASC_WARN_AUTO_CONFIG: case ASC_WARN_AUTO_CONFIG:
ASC_PRINT1("AscInitGetConfig: board %d: I/O port increment " shost_printk(KERN_WARNING, shost, "I/O port increment switch "
"switch enabled\n", boardp->id); "enabled\n");
break; break;
case ASC_WARN_EEPROM_CHKSUM: case ASC_WARN_EEPROM_CHKSUM:
ASC_PRINT1("AscInitGetConfig: board %d: EEPROM checksum " shost_printk(KERN_WARNING, shost, "EEPROM checksum error\n");
"error\n", boardp->id);
break; break;
case ASC_WARN_IRQ_MODIFIED: case ASC_WARN_IRQ_MODIFIED:
ASC_PRINT1("AscInitGetConfig: board %d: IRQ modified\n", shost_printk(KERN_WARNING, shost, "IRQ modified\n");
boardp->id);
break; break;
case ASC_WARN_CMD_QNG_CONFLICT: case ASC_WARN_CMD_QNG_CONFLICT:
ASC_PRINT1("AscInitGetConfig: board %d: tag queuing enabled " shost_printk(KERN_WARNING, shost, "tag queuing enabled w/o "
"w/o disconnects\n", boardp->id); "disconnects\n");
break; break;
default: default:
ASC_PRINT2("AscInitGetConfig: board %d: unknown warning: " shost_printk(KERN_WARNING, shost, "unknown warning: 0x%x\n",
"0x%x\n", boardp->id, warn_code); warn_code);
break; break;
} }
if (asc_dvc->err_code != 0) { if (asc_dvc->err_code != 0)
ASC_PRINT3("AscInitGetConfig: board %d error: init_state 0x%x, " shost_printk(KERN_ERR, shost, "error 0x%x at init_state "
"err_code 0x%x\n", boardp->id, asc_dvc->init_state, "0x%x\n", asc_dvc->err_code, asc_dvc->init_state);
asc_dvc->err_code);
}
return asc_dvc->err_code; return asc_dvc->err_code;
} }
static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct asc_board *boardp) static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct Scsi_Host *shost)
{ {
ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; struct asc_board *board = shost_priv(shost);
ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var;
PortAddr iop_base = asc_dvc->iop_base; PortAddr iop_base = asc_dvc->iop_base;
unsigned short cfg_msw; unsigned short cfg_msw;
unsigned short warn_code = 0; unsigned short warn_code = 0;
...@@ -12060,37 +12036,32 @@ static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct asc_board *bo ...@@ -12060,37 +12036,32 @@ static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct asc_board *bo
case 0: /* No error. */ case 0: /* No error. */
break; break;
case ASC_WARN_IO_PORT_ROTATE: case ASC_WARN_IO_PORT_ROTATE:
ASC_PRINT1("AscInitSetConfig: board %d: I/O port address " shost_printk(KERN_WARNING, shost, "I/O port address "
"modified\n", boardp->id); "modified\n");
break; break;
case ASC_WARN_AUTO_CONFIG: case ASC_WARN_AUTO_CONFIG:
ASC_PRINT1("AscInitSetConfig: board %d: I/O port increment " shost_printk(KERN_WARNING, shost, "I/O port increment switch "
"switch enabled\n", boardp->id); "enabled\n");
break; break;
case ASC_WARN_EEPROM_CHKSUM: case ASC_WARN_EEPROM_CHKSUM:
ASC_PRINT1("AscInitSetConfig: board %d: EEPROM checksum " shost_printk(KERN_WARNING, shost, "EEPROM checksum error\n");
"error\n", boardp->id);
break; break;
case ASC_WARN_IRQ_MODIFIED: case ASC_WARN_IRQ_MODIFIED:
ASC_PRINT1("AscInitSetConfig: board %d: IRQ modified\n", shost_printk(KERN_WARNING, shost, "IRQ modified\n");
boardp->id);
break; break;
case ASC_WARN_CMD_QNG_CONFLICT: case ASC_WARN_CMD_QNG_CONFLICT:
ASC_PRINT1("AscInitSetConfig: board %d: tag queuing w/o " shost_printk(KERN_WARNING, shost, "tag queuing w/o "
"disconnects\n", "disconnects\n");
boardp->id);
break; break;
default: default:
ASC_PRINT2("AscInitSetConfig: board %d: unknown warning: " shost_printk(KERN_WARNING, shost, "unknown warning: 0x%x\n",
"0x%x\n", boardp->id, warn_code); warn_code);
break; break;
} }
if (asc_dvc->err_code != 0) { if (asc_dvc->err_code != 0)
ASC_PRINT3("AscInitSetConfig: board %d error: init_state 0x%x, " shost_printk(KERN_ERR, shost, "error 0x%x at init_state "
"err_code 0x%x\n", boardp->id, asc_dvc->init_state, "0x%x\n", asc_dvc->err_code, asc_dvc->init_state);
asc_dvc->err_code);
}
return asc_dvc->err_code; return asc_dvc->err_code;
} }
...@@ -13390,9 +13361,10 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) ...@@ -13390,9 +13361,10 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
* then 0 is returned. * then 0 is returned.
*/ */
static int __devinit static int __devinit
AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp) AdvInitGetConfig(struct pci_dev *pdev, struct Scsi_Host *shost)
{ {
ADV_DVC_VAR *asc_dvc = &boardp->dvc_var.adv_dvc_var; struct asc_board *board = shost_priv(shost);
ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var;
unsigned short warn_code = 0; unsigned short warn_code = 0;
AdvPortAddr iop_base = asc_dvc->iop_base; AdvPortAddr iop_base = asc_dvc->iop_base;
u16 cmd; u16 cmd;
...@@ -13458,15 +13430,12 @@ AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp) ...@@ -13458,15 +13430,12 @@ AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp)
warn_code |= status; warn_code |= status;
} }
if (warn_code != 0) { if (warn_code != 0)
ASC_PRINT2("AdvInitGetConfig: board %d: warning: 0x%x\n", shost_printk(KERN_WARNING, shost, "warning: 0x%x\n", warn_code);
boardp->id, warn_code);
}
if (asc_dvc->err_code) { if (asc_dvc->err_code)
ASC_PRINT2("AdvInitGetConfig: board %d error: err_code 0x%x\n", shost_printk(KERN_ERR, shost, "error code 0x%x\n",
boardp->id, asc_dvc->err_code); asc_dvc->err_code);
}
return asc_dvc->err_code; return asc_dvc->err_code;
} }
...@@ -13499,9 +13468,10 @@ static struct scsi_host_template advansys_template = { ...@@ -13499,9 +13468,10 @@ static struct scsi_host_template advansys_template = {
.use_clustering = ENABLE_CLUSTERING, .use_clustering = ENABLE_CLUSTERING,
}; };
static int __devinit static int __devinit advansys_wide_init_chip(struct Scsi_Host *shost)
advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
{ {
struct asc_board *board = shost_priv(shost);
struct adv_dvc_var *adv_dvc = &board->dvc_var.adv_dvc_var;
int req_cnt = 0; int req_cnt = 0;
adv_req_t *reqp = NULL; adv_req_t *reqp = NULL;
int sg_cnt = 0; int sg_cnt = 0;
...@@ -13512,10 +13482,10 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) ...@@ -13512,10 +13482,10 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
* Allocate buffer carrier structures. The total size * Allocate buffer carrier structures. The total size
* is about 4 KB, so allocate all at once. * is about 4 KB, so allocate all at once.
*/ */
boardp->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL); board->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL);
ASC_DBG(1, "carrp 0x%p\n", boardp->carrp); ASC_DBG(1, "carrp 0x%p\n", board->carrp);
if (!boardp->carrp) if (!board->carrp)
goto kmalloc_failed; goto kmalloc_failed;
/* /*
...@@ -13523,7 +13493,7 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) ...@@ -13523,7 +13493,7 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
* board. The total size is about 16 KB, so allocate all at once. * board. The total size is about 16 KB, so allocate all at once.
* If the allocation fails decrement and try again. * If the allocation fails decrement and try again.
*/ */
for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) { for (req_cnt = adv_dvc->max_host_qng; req_cnt > 0; req_cnt--) {
reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL); reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL);
ASC_DBG(1, "reqp 0x%p, req_cnt %d, bytes %lu\n", reqp, req_cnt, ASC_DBG(1, "reqp 0x%p, req_cnt %d, bytes %lu\n", reqp, req_cnt,
...@@ -13536,31 +13506,31 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) ...@@ -13536,31 +13506,31 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
if (!reqp) if (!reqp)
goto kmalloc_failed; goto kmalloc_failed;
boardp->orig_reqp = reqp; board->orig_reqp = reqp;
/* /*
* Allocate up to ADV_TOT_SG_BLOCK request structures for * Allocate up to ADV_TOT_SG_BLOCK request structures for
* the Wide board. Each structure is about 136 bytes. * the Wide board. Each structure is about 136 bytes.
*/ */
boardp->adv_sgblkp = NULL; board->adv_sgblkp = NULL;
for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) { for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) {
sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL); sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL);
if (!sgp) if (!sgp)
break; break;
sgp->next_sgblkp = boardp->adv_sgblkp; sgp->next_sgblkp = board->adv_sgblkp;
boardp->adv_sgblkp = sgp; board->adv_sgblkp = sgp;
} }
ASC_DBG(1, "sg_cnt %d * %u = %u bytes\n", sg_cnt, sizeof(adv_sgblk_t), ASC_DBG(1, "sg_cnt %d * %u = %u bytes\n", sg_cnt, sizeof(adv_sgblk_t),
(unsigned)(sizeof(adv_sgblk_t) * sg_cnt)); (unsigned)(sizeof(adv_sgblk_t) * sg_cnt));
if (!boardp->adv_sgblkp) if (!board->adv_sgblkp)
goto kmalloc_failed; goto kmalloc_failed;
adv_dvc_varp->carrier_buf = boardp->carrp; adv_dvc->carrier_buf = board->carrp;
/* /*
* Point 'adv_reqp' to the request structures and * Point 'adv_reqp' to the request structures and
...@@ -13571,30 +13541,29 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) ...@@ -13571,30 +13541,29 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
for (; req_cnt > 0; req_cnt--) { for (; req_cnt > 0; req_cnt--) {
reqp[req_cnt - 1].next_reqp = &reqp[req_cnt]; reqp[req_cnt - 1].next_reqp = &reqp[req_cnt];
} }
boardp->adv_reqp = &reqp[0]; board->adv_reqp = &reqp[0];
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { if (adv_dvc->chip_type == ADV_CHIP_ASC3550) {
ASC_DBG(2, "AdvInitAsc3550Driver()\n"); ASC_DBG(2, "AdvInitAsc3550Driver()\n");
warn_code = AdvInitAsc3550Driver(adv_dvc_varp); warn_code = AdvInitAsc3550Driver(adv_dvc);
} else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { } else if (adv_dvc->chip_type == ADV_CHIP_ASC38C0800) {
ASC_DBG(2, "AdvInitAsc38C0800Driver()\n"); ASC_DBG(2, "AdvInitAsc38C0800Driver()\n");
warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp); warn_code = AdvInitAsc38C0800Driver(adv_dvc);
} else { } else {
ASC_DBG(2, "AdvInitAsc38C1600Driver()\n"); ASC_DBG(2, "AdvInitAsc38C1600Driver()\n");
warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp); warn_code = AdvInitAsc38C1600Driver(adv_dvc);
} }
err_code = adv_dvc_varp->err_code; err_code = adv_dvc->err_code;
if (warn_code || err_code) { if (warn_code || err_code) {
ASC_PRINT3("advansys_wide_init_chip: board %d error: warn 0x%x," shost_printk(KERN_WARNING, shost, "error: warn 0x%x, error "
" error 0x%x\n", boardp->id, warn_code, err_code); "0x%x\n", warn_code, err_code);
} }
goto exit; goto exit;
kmalloc_failed: kmalloc_failed:
ASC_PRINT1("advansys_wide_init_chip: board %d error: kmalloc() " shost_printk(KERN_ERR, shost, "error: kmalloc() failed\n");
"failed\n", boardp->id);
err_code = ADV_ERROR; err_code = ADV_ERROR;
exit: exit:
return err_code; return err_code;
...@@ -13622,7 +13591,6 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13622,7 +13591,6 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
ADV_DVC_VAR *adv_dvc_varp = NULL; ADV_DVC_VAR *adv_dvc_varp = NULL;
int share_irq, warn_code, ret; int share_irq, warn_code, ret;
boardp->id = asc_board_count++;
pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL; pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL;
if (ASC_NARROW_BOARD(boardp)) { if (ASC_NARROW_BOARD(boardp)) {
...@@ -13653,9 +13621,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13653,9 +13621,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1), boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1),
boardp->asc_n_io_port); boardp->asc_n_io_port);
if (!boardp->ioremap_addr) { if (!boardp->ioremap_addr) {
ASC_PRINT3 shost_printk(KERN_ERR, shost, "ioremap(%x, %d) "
("advansys_board_found: board %d: ioremap(%x, %d) returned NULL\n", "returned NULL\n",
boardp->id, pci_resource_start(pdev, 1), pci_resource_start(pdev, 1),
boardp->asc_n_io_port); boardp->asc_n_io_port);
ret = -ENODEV; ret = -ENODEV;
goto err_shost; goto err_shost;
...@@ -13682,8 +13650,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13682,8 +13650,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
*/ */
boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL); boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL);
if (!boardp->prtbuf) { if (!boardp->prtbuf) {
ASC_PRINT2("advansys_board_found: board %d: kmalloc(%d) " shost_printk(KERN_ERR, shost, "kmalloc(%d) returned NULL\n",
"returned NULL\n", boardp->id, ASC_PRTBUF_SIZE); ASC_PRTBUF_SIZE);
ret = -ENOMEM; ret = -ENOMEM;
goto err_unmap; goto err_unmap;
} }
...@@ -13716,9 +13684,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13716,9 +13684,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
break; break;
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
default: default:
ASC_PRINT2 shost_printk(KERN_ERR, shost, "unknown adapter type: "
("advansys_board_found: board %d: unknown adapter type: %d\n", "%d\n", asc_dvc_varp->bus_type);
boardp->id, asc_dvc_varp->bus_type);
shost->unchecked_isa_dma = TRUE; shost->unchecked_isa_dma = TRUE;
share_irq = 0; share_irq = 0;
break; break;
...@@ -13731,7 +13698,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13731,7 +13698,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
* referenced only use the bit-wise AND operator "&". * referenced only use the bit-wise AND operator "&".
*/ */
ASC_DBG(2, "AscInitGetConfig()\n"); ASC_DBG(2, "AscInitGetConfig()\n");
ret = AscInitGetConfig(boardp) ? -ENODEV : 0; ret = AscInitGetConfig(shost) ? -ENODEV : 0;
} else { } else {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* /*
...@@ -13742,7 +13709,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13742,7 +13709,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
share_irq = IRQF_SHARED; share_irq = IRQF_SHARED;
ASC_DBG(2, "AdvInitGetConfig()\n"); ASC_DBG(2, "AdvInitGetConfig()\n");
ret = AdvInitGetConfig(pdev, boardp) ? -ENODEV : 0; ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0;
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
} }
...@@ -13790,7 +13757,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13790,7 +13757,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
* Modify board configuration. * Modify board configuration.
*/ */
ASC_DBG(2, "AscInitSetConfig()\n"); ASC_DBG(2, "AscInitSetConfig()\n");
ret = AscInitSetConfig(pdev, boardp) ? -ENODEV : 0; ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0;
if (ret) if (ret)
goto err_free_proc; goto err_free_proc;
} else { } else {
...@@ -14024,9 +13991,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -14024,9 +13991,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel; shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel;
ret = request_dma(shost->dma_channel, DRV_NAME); ret = request_dma(shost->dma_channel, DRV_NAME);
if (ret) { if (ret) {
ASC_PRINT3 shost_printk(KERN_ERR, shost, "request_dma() "
("advansys_board_found: board %d: request_dma() %d failed %d\n", "%d failed %d\n",
boardp->id, shost->dma_channel, ret); shost->dma_channel, ret);
goto err_free_proc; goto err_free_proc;
} }
AscEnableIsaDma(shost->dma_channel); AscEnableIsaDma(shost->dma_channel);
...@@ -14042,17 +14009,14 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -14042,17 +14009,14 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
if (ret) { if (ret) {
if (ret == -EBUSY) { if (ret == -EBUSY) {
ASC_PRINT2 shost_printk(KERN_ERR, shost, "request_irq(): IRQ 0x%x "
("advansys_board_found: board %d: request_irq(): IRQ 0x%x already in use.\n", "already in use\n", boardp->irq);
boardp->id, boardp->irq);
} else if (ret == -EINVAL) { } else if (ret == -EINVAL) {
ASC_PRINT2 shost_printk(KERN_ERR, shost, "request_irq(): IRQ 0x%x "
("advansys_board_found: board %d: request_irq(): IRQ 0x%x not valid.\n", "not valid\n", boardp->irq);
boardp->id, boardp->irq);
} else { } else {
ASC_PRINT3 shost_printk(KERN_ERR, shost, "request_irq(): IRQ 0x%x "
("advansys_board_found: board %d: request_irq(): IRQ 0x%x failed with %d\n", "failed with %d\n", boardp->irq, ret);
boardp->id, boardp->irq, ret);
} }
goto err_free_dma; goto err_free_dma;
} }
...@@ -14065,15 +14029,15 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -14065,15 +14029,15 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
warn_code = AscInitAsc1000Driver(asc_dvc_varp); warn_code = AscInitAsc1000Driver(asc_dvc_varp);
if (warn_code || asc_dvc_varp->err_code) { if (warn_code || asc_dvc_varp->err_code) {
ASC_PRINT4("advansys_board_found: board %d error: " shost_printk(KERN_ERR, shost, "error: init_state 0x%x, "
"init_state 0x%x, warn 0x%x, error 0x%x\n", "warn 0x%x, error 0x%x\n",
boardp->id, asc_dvc_varp->init_state, asc_dvc_varp->init_state, warn_code,
warn_code, asc_dvc_varp->err_code); asc_dvc_varp->err_code);
if (asc_dvc_varp->err_code) if (asc_dvc_varp->err_code)
ret = -ENODEV; ret = -ENODEV;
} }
} else { } else {
if (advansys_wide_init_chip(boardp, adv_dvc_varp)) if (advansys_wide_init_chip(shost))
ret = -ENODEV; ret = -ENODEV;
} }
......
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