[SCSI] advansys: Remove pci_slot_info

The driver kept a copy of the PCI config address; refer to the pci_dev
associated with the card instead.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
Matthew Wilcox 2007-07-30 08:10:23 -06:00 committed by James Bottomley
parent 895d6b4ca8
commit 13ac2d9c79

View file

@ -854,8 +854,6 @@ typedef unsigned char uchar;
#define ERR (-1) #define ERR (-1)
#define UW_ERR (uint)(0xFFFF) #define UW_ERR (uint)(0xFFFF)
#define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0) #define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0)
#define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7)
#define ASC_PCI_MKID(bus, dev, func) ((((dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF))
#define ASC_DVCLIB_CALL_DONE (1) #define ASC_DVCLIB_CALL_DONE (1)
#define ASC_DVCLIB_CALL_FAILED (0) #define ASC_DVCLIB_CALL_FAILED (0)
@ -1378,7 +1376,6 @@ typedef struct asc_dvc_cfg {
uchar max_tag_qng[ASC_MAX_TID + 1]; uchar max_tag_qng[ASC_MAX_TID + 1];
uchar *overrun_buf; uchar *overrun_buf;
uchar sdtr_period_offset[ASC_MAX_TID + 1]; uchar sdtr_period_offset[ASC_MAX_TID + 1];
ushort pci_slot_info;
uchar adapter_info[6]; uchar adapter_info[6];
} ASC_DVC_CFG; } ASC_DVC_CFG;
@ -2814,9 +2811,6 @@ typedef struct adv_dvc_cfg {
ushort control_flag; /* Microcode Control Flag */ ushort control_flag; /* Microcode Control Flag */
ushort mcode_date; /* Microcode date */ ushort mcode_date; /* Microcode date */
ushort mcode_version; /* Microcode version */ ushort mcode_version; /* Microcode version */
ushort pci_slot_info; /* high byte device/function number */
/* bits 7-3 device num., bits 2-0 function num. */
/* low byte bus num. */
ushort serial1; /* EEPROM serial number word 1 */ ushort serial1; /* EEPROM serial number word 1 */
ushort serial2; /* EEPROM serial number word 2 */ ushort serial2; /* EEPROM serial number word 2 */
ushort serial3; /* EEPROM serial number word 3 */ ushort serial3; /* EEPROM serial number word 3 */
@ -3632,6 +3626,10 @@ typedef struct asc_board {
ushort bios_codelen; /* BIOS Code Segment Length. */ ushort bios_codelen; /* BIOS Code Segment Length. */
} asc_board_t; } asc_board_t;
#define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \
dvc_var.adv_dvc_var)
#define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev)
/* Number of boards detected in system. */ /* Number of boards detected in system. */
static int asc_board_count; static int asc_board_count;
@ -7764,8 +7762,7 @@ static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h)
printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n", printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n",
h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version); h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version);
printk(" control_flag 0x%x, pci_slot_info 0x%x\n", printk(" control_flag 0x%x\n", h->control_flag);
h->control_flag, h->pci_slot_info);
} }
/* /*
@ -15201,6 +15198,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
* ready to be 'ored' into SCSI_CFG1. * ready to be 'ored' into SCSI_CFG1.
*/ */
if ((asc_dvc->cfg->termination & TERM_SE) == 0) { if ((asc_dvc->cfg->termination & TERM_SE) == 0) {
struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc);
/* SE automatic termination control is enabled. */ /* SE automatic termination control is enabled. */
switch (scsi_cfg1 & C_DET_SE) { switch (scsi_cfg1 & C_DET_SE) {
/* TERM_SE_HI: on, TERM_SE_LO: on */ /* TERM_SE_HI: on, TERM_SE_LO: on */
@ -15211,7 +15209,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
break; break;
case 0x0: case 0x0:
if (ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) == 0) { if (PCI_FUNC(pdev->devfn) == 0) {
/* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */ /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */
} else { } else {
/* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */ /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */
@ -15817,15 +15815,14 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
*/ */
if (AdvGet38C1600EEPConfig(iop_base, &eep_config) != if (AdvGet38C1600EEPConfig(iop_base, &eep_config) !=
eep_config.check_sum) { eep_config.check_sum) {
struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc);
warn_code |= ASC_WARN_EEPROM_CHKSUM; warn_code |= ASC_WARN_EEPROM_CHKSUM;
/* /*
* Set EEPROM default values. * Set EEPROM default values.
*/ */
for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++) { for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++) {
if (i == 1 if (i == 1 && PCI_FUNC(pdev->devfn) != 0) {
&& ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) !=
0) {
/* /*
* Set Function 1 EEPROM Word 0 MSB * Set Function 1 EEPROM Word 0 MSB
* *
@ -17146,10 +17143,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
case ASC_IS_PCI: case ASC_IS_PCI:
shost->irq = asc_dvc_varp->irq_no = pdev->irq; shost->irq = asc_dvc_varp->irq_no = pdev->irq;
asc_dvc_varp->cfg->pci_slot_info =
ASC_PCI_MKID(pdev->bus->number,
PCI_SLOT(pdev->devfn),
PCI_FUNC(pdev->devfn));
shost->unchecked_isa_dma = FALSE; shost->unchecked_isa_dma = FALSE;
share_irq = IRQF_SHARED; share_irq = IRQF_SHARED;
break; break;
@ -17169,10 +17162,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
*/ */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
shost->irq = adv_dvc_varp->irq_no = pdev->irq; shost->irq = adv_dvc_varp->irq_no = pdev->irq;
adv_dvc_varp->cfg->pci_slot_info =
ASC_PCI_MKID(pdev->bus->number,
PCI_SLOT(pdev->devfn),
PCI_FUNC(pdev->devfn));
shost->unchecked_isa_dma = FALSE; shost->unchecked_isa_dma = FALSE;
share_irq = IRQF_SHARED; share_irq = IRQF_SHARED;
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */