diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-07-30 10:10:23 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:39:49 -0400 |
commit | 13ac2d9c791469d4af51aa65653ab0fbd0916fcc (patch) | |
tree | 0fef27a439aa815bd3b3af010aa5c469873a5e2d | |
parent | 895d6b4ca88ecc69b9301675eb220c6a926d8bb1 (diff) |
[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>
-rw-r--r-- | drivers/scsi/advansys.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 310b92678035..986c52a7b95e 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -854,8 +854,6 @@ typedef unsigned char uchar; | |||
854 | #define ERR (-1) | 854 | #define ERR (-1) |
855 | #define UW_ERR (uint)(0xFFFF) | 855 | #define UW_ERR (uint)(0xFFFF) |
856 | #define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0) | 856 | #define isodd_word(val) ((((uint)val) & (uint)0x0001) != 0) |
857 | #define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) | ||
858 | #define ASC_PCI_MKID(bus, dev, func) ((((dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) | ||
859 | 857 | ||
860 | #define ASC_DVCLIB_CALL_DONE (1) | 858 | #define ASC_DVCLIB_CALL_DONE (1) |
861 | #define ASC_DVCLIB_CALL_FAILED (0) | 859 | #define ASC_DVCLIB_CALL_FAILED (0) |
@@ -1378,7 +1376,6 @@ typedef struct asc_dvc_cfg { | |||
1378 | uchar max_tag_qng[ASC_MAX_TID + 1]; | 1376 | uchar max_tag_qng[ASC_MAX_TID + 1]; |
1379 | uchar *overrun_buf; | 1377 | uchar *overrun_buf; |
1380 | uchar sdtr_period_offset[ASC_MAX_TID + 1]; | 1378 | uchar sdtr_period_offset[ASC_MAX_TID + 1]; |
1381 | ushort pci_slot_info; | ||
1382 | uchar adapter_info[6]; | 1379 | uchar adapter_info[6]; |
1383 | } ASC_DVC_CFG; | 1380 | } ASC_DVC_CFG; |
1384 | 1381 | ||
@@ -2814,9 +2811,6 @@ typedef struct adv_dvc_cfg { | |||
2814 | ushort control_flag; /* Microcode Control Flag */ | 2811 | ushort control_flag; /* Microcode Control Flag */ |
2815 | ushort mcode_date; /* Microcode date */ | 2812 | ushort mcode_date; /* Microcode date */ |
2816 | ushort mcode_version; /* Microcode version */ | 2813 | ushort mcode_version; /* Microcode version */ |
2817 | ushort pci_slot_info; /* high byte device/function number */ | ||
2818 | /* bits 7-3 device num., bits 2-0 function num. */ | ||
2819 | /* low byte bus num. */ | ||
2820 | ushort serial1; /* EEPROM serial number word 1 */ | 2814 | ushort serial1; /* EEPROM serial number word 1 */ |
2821 | ushort serial2; /* EEPROM serial number word 2 */ | 2815 | ushort serial2; /* EEPROM serial number word 2 */ |
2822 | ushort serial3; /* EEPROM serial number word 3 */ | 2816 | ushort serial3; /* EEPROM serial number word 3 */ |
@@ -3632,6 +3626,10 @@ typedef struct asc_board { | |||
3632 | ushort bios_codelen; /* BIOS Code Segment Length. */ | 3626 | ushort bios_codelen; /* BIOS Code Segment Length. */ |
3633 | } asc_board_t; | 3627 | } asc_board_t; |
3634 | 3628 | ||
3629 | #define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \ | ||
3630 | dvc_var.adv_dvc_var) | ||
3631 | #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) | ||
3632 | |||
3635 | /* Number of boards detected in system. */ | 3633 | /* Number of boards detected in system. */ |
3636 | static int asc_board_count; | 3634 | static int asc_board_count; |
3637 | 3635 | ||
@@ -7764,8 +7762,7 @@ static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h) | |||
7764 | printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n", | 7762 | printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n", |
7765 | h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version); | 7763 | h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version); |
7766 | 7764 | ||
7767 | printk(" control_flag 0x%x, pci_slot_info 0x%x\n", | 7765 | printk(" control_flag 0x%x\n", h->control_flag); |
7768 | h->control_flag, h->pci_slot_info); | ||
7769 | } | 7766 | } |
7770 | 7767 | ||
7771 | /* | 7768 | /* |
@@ -15201,6 +15198,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) | |||
15201 | * ready to be 'ored' into SCSI_CFG1. | 15198 | * ready to be 'ored' into SCSI_CFG1. |
15202 | */ | 15199 | */ |
15203 | if ((asc_dvc->cfg->termination & TERM_SE) == 0) { | 15200 | if ((asc_dvc->cfg->termination & TERM_SE) == 0) { |
15201 | struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); | ||
15204 | /* SE automatic termination control is enabled. */ | 15202 | /* SE automatic termination control is enabled. */ |
15205 | switch (scsi_cfg1 & C_DET_SE) { | 15203 | switch (scsi_cfg1 & C_DET_SE) { |
15206 | /* TERM_SE_HI: on, TERM_SE_LO: on */ | 15204 | /* TERM_SE_HI: on, TERM_SE_LO: on */ |
@@ -15211,7 +15209,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) | |||
15211 | break; | 15209 | break; |
15212 | 15210 | ||
15213 | case 0x0: | 15211 | case 0x0: |
15214 | if (ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) == 0) { | 15212 | if (PCI_FUNC(pdev->devfn) == 0) { |
15215 | /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */ | 15213 | /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */ |
15216 | } else { | 15214 | } else { |
15217 | /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */ | 15215 | /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */ |
@@ -15817,15 +15815,14 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) | |||
15817 | */ | 15815 | */ |
15818 | if (AdvGet38C1600EEPConfig(iop_base, &eep_config) != | 15816 | if (AdvGet38C1600EEPConfig(iop_base, &eep_config) != |
15819 | eep_config.check_sum) { | 15817 | eep_config.check_sum) { |
15818 | struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); | ||
15820 | warn_code |= ASC_WARN_EEPROM_CHKSUM; | 15819 | warn_code |= ASC_WARN_EEPROM_CHKSUM; |
15821 | 15820 | ||
15822 | /* | 15821 | /* |
15823 | * Set EEPROM default values. | 15822 | * Set EEPROM default values. |
15824 | */ | 15823 | */ |
15825 | for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++) { | 15824 | for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++) { |
15826 | if (i == 1 | 15825 | if (i == 1 && PCI_FUNC(pdev->devfn) != 0) { |
15827 | && ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) != | ||
15828 | 0) { | ||
15829 | /* | 15826 | /* |
15830 | * Set Function 1 EEPROM Word 0 MSB | 15827 | * Set Function 1 EEPROM Word 0 MSB |
15831 | * | 15828 | * |
@@ -17146,10 +17143,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
17146 | #ifdef CONFIG_PCI | 17143 | #ifdef CONFIG_PCI |
17147 | case ASC_IS_PCI: | 17144 | case ASC_IS_PCI: |
17148 | shost->irq = asc_dvc_varp->irq_no = pdev->irq; | 17145 | shost->irq = asc_dvc_varp->irq_no = pdev->irq; |
17149 | asc_dvc_varp->cfg->pci_slot_info = | ||
17150 | ASC_PCI_MKID(pdev->bus->number, | ||
17151 | PCI_SLOT(pdev->devfn), | ||
17152 | PCI_FUNC(pdev->devfn)); | ||
17153 | shost->unchecked_isa_dma = FALSE; | 17146 | shost->unchecked_isa_dma = FALSE; |
17154 | share_irq = IRQF_SHARED; | 17147 | share_irq = IRQF_SHARED; |
17155 | break; | 17148 | break; |
@@ -17169,10 +17162,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
17169 | */ | 17162 | */ |
17170 | #ifdef CONFIG_PCI | 17163 | #ifdef CONFIG_PCI |
17171 | shost->irq = adv_dvc_varp->irq_no = pdev->irq; | 17164 | shost->irq = adv_dvc_varp->irq_no = pdev->irq; |
17172 | adv_dvc_varp->cfg->pci_slot_info = | ||
17173 | ASC_PCI_MKID(pdev->bus->number, | ||
17174 | PCI_SLOT(pdev->devfn), | ||
17175 | PCI_FUNC(pdev->devfn)); | ||
17176 | shost->unchecked_isa_dma = FALSE; | 17165 | shost->unchecked_isa_dma = FALSE; |
17177 | share_irq = IRQF_SHARED; | 17166 | share_irq = IRQF_SHARED; |
17178 | #endif /* CONFIG_PCI */ | 17167 | #endif /* CONFIG_PCI */ |