aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-19 23:28:09 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 18:04:27 -0500
commit0948391641918b95d8d96c15089eb5ac156850b3 (patch)
tree8120c8b1eb2307ae13bddb62de1f4682c6c1cbc3 /drivers
parentb718989da7cf1f77ed5665dba0d2c73bd9dfe2d7 (diff)
PCI: Remove users of pci_enable_device_bars()
This patch converts users of pci_enable_device_bars() to the new pci_enable_device_{io,mem} interface. The new API fits nicely, except maybe for the QLA case where a bit of code re-organization might be a good idea but I prefer sticking to the simple patch as I don't have hardware to test on. I'll also need some feedback on the cs5520 change. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_cs5520.c2
-rw-r--r--drivers/i2c/busses/scx200_acb.c2
-rw-r--r--drivers/ide/pci/cs5520.c10
-rw-r--r--drivers/ide/setup-pci.c6
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c21
7 files changed, 33 insertions, 12 deletions
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index d4590f546c49..7ed279b0a12e 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -229,7 +229,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
229 return -ENOMEM; 229 return -ENOMEM;
230 230
231 /* Perform set up for DMA */ 231 /* Perform set up for DMA */
232 if (pci_enable_device_bars(pdev, 1<<2)) { 232 if (pci_enable_device_io(pdev)) {
233 printk(KERN_ERR DRV_NAME ": unable to configure BAR2.\n"); 233 printk(KERN_ERR DRV_NAME ": unable to configure BAR2.\n");
234 return -ENODEV; 234 return -ENODEV;
235 } 235 }
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index e6c4a2b762ec..f5e7a70da831 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -492,7 +492,7 @@ static __init int scx200_create_pci(const char *text, struct pci_dev *pdev,
492 iface->pdev = pdev; 492 iface->pdev = pdev;
493 iface->bar = bar; 493 iface->bar = bar;
494 494
495 rc = pci_enable_device_bars(iface->pdev, 1 << iface->bar); 495 rc = pci_enable_device_io(iface->pdev);
496 if (rc) 496 if (rc)
497 goto errout_free; 497 goto errout_free;
498 498
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 6ec00b8d7ec1..10adc49f80ca 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -156,8 +156,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
156 ide_setup_pci_noise(dev, d); 156 ide_setup_pci_noise(dev, d);
157 157
158 /* We must not grab the entire device, it has 'ISA' space in its 158 /* We must not grab the entire device, it has 'ISA' space in its
159 BARS too and we will freak out other bits of the kernel */ 159 * BARS too and we will freak out other bits of the kernel
160 if (pci_enable_device_bars(dev, 1<<2)) { 160 *
161 * pci_enable_device_bars() is going away. I replaced it with
162 * IO only enable for now but I'll need confirmation this is
163 * allright for that device. If not, it will need some kind of
164 * quirk. --BenH.
165 */
166 if (pci_enable_device_io(dev)) {
161 printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); 167 printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name);
162 return -ENODEV; 168 return -ENODEV;
163 } 169 }
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 676c66e72881..cf79470a932d 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -240,7 +240,9 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
240 * @d: IDE port info 240 * @d: IDE port info
241 * 241 *
242 * Enable the IDE PCI device. We attempt to enable the device in full 242 * Enable the IDE PCI device. We attempt to enable the device in full
243 * but if that fails then we only need BAR4 so we will enable that. 243 * but if that fails then we only need IO space. The PCI code should
244 * have setup the proper resources for us already for controllers in
245 * legacy mode.
244 * 246 *
245 * Returns zero on success or an error code 247 * Returns zero on success or an error code
246 */ 248 */
@@ -250,7 +252,7 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d)
250 int ret; 252 int ret;
251 253
252 if (pci_enable_device(dev)) { 254 if (pci_enable_device(dev)) {
253 ret = pci_enable_device_bars(dev, 1 << 4); 255 ret = pci_enable_device_io(dev);
254 if (ret < 0) { 256 if (ret < 0) {
255 printk(KERN_WARNING "%s: (ide_setup_pci_device:) " 257 printk(KERN_WARNING "%s: (ide_setup_pci_device:) "
256 "Could not enable device.\n", d->name); 258 "Could not enable device.\n", d->name);
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 3205f7488d1c..29b4cf9e059b 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2296,10 +2296,9 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
2296 struct Scsi_Host *shost = pci_get_drvdata(pdev); 2296 struct Scsi_Host *shost = pci_get_drvdata(pdev);
2297 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 2297 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
2298 struct lpfc_sli *psli = &phba->sli; 2298 struct lpfc_sli *psli = &phba->sli;
2299 int bars = pci_select_bars(pdev, IORESOURCE_MEM);
2300 2299
2301 dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n"); 2300 dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n");
2302 if (pci_enable_device_bars(pdev, bars)) { 2301 if (pci_enable_device_mem(pdev)) {
2303 printk(KERN_ERR "lpfc: Cannot re-enable " 2302 printk(KERN_ERR "lpfc: Cannot re-enable "
2304 "PCI device after reset.\n"); 2303 "PCI device after reset.\n");
2305 return PCI_ERS_RESULT_DISCONNECT; 2304 return PCI_ERS_RESULT_DISCONNECT;
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6f129da37589..b72c7f170854 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2268,6 +2268,7 @@ typedef struct scsi_qla_host {
2268 spinlock_t hardware_lock ____cacheline_aligned; 2268 spinlock_t hardware_lock ____cacheline_aligned;
2269 2269
2270 int bars; 2270 int bars;
2271 int mem_only;
2271 device_reg_t __iomem *iobase; /* Base I/O address */ 2272 device_reg_t __iomem *iobase; /* Base I/O address */
2272 resource_size_t pio_address; 2273 resource_size_t pio_address;
2273#define MIN_IOBASE_LEN 0x100 2274#define MIN_IOBASE_LEN 0x100
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3954ed2d7b51..8f69caf83272 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1564,7 +1564,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1564 char pci_info[30]; 1564 char pci_info[30];
1565 char fw_str[30]; 1565 char fw_str[30];
1566 struct scsi_host_template *sht; 1566 struct scsi_host_template *sht;
1567 int bars; 1567 int bars, mem_only = 0;
1568 1568
1569 bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); 1569 bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
1570 sht = &qla2x00_driver_template; 1570 sht = &qla2x00_driver_template;
@@ -1575,10 +1575,16 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1575 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) { 1575 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) {
1576 bars = pci_select_bars(pdev, IORESOURCE_MEM); 1576 bars = pci_select_bars(pdev, IORESOURCE_MEM);
1577 sht = &qla24xx_driver_template; 1577 sht = &qla24xx_driver_template;
1578 mem_only = 1;
1578 } 1579 }
1579 1580
1580 if (pci_enable_device_bars(pdev, bars)) 1581 if (mem_only) {
1581 goto probe_out; 1582 if (pci_enable_device_mem(pdev))
1583 goto probe_out;
1584 } else {
1585 if (pci_enable_device(pdev))
1586 goto probe_out;
1587 }
1582 1588
1583 if (pci_find_aer_capability(pdev)) 1589 if (pci_find_aer_capability(pdev))
1584 if (pci_enable_pcie_error_reporting(pdev)) 1590 if (pci_enable_pcie_error_reporting(pdev))
@@ -1601,6 +1607,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1601 sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no); 1607 sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no);
1602 ha->parent = NULL; 1608 ha->parent = NULL;
1603 ha->bars = bars; 1609 ha->bars = bars;
1610 ha->mem_only = mem_only;
1604 1611
1605 /* Set ISP-type information. */ 1612 /* Set ISP-type information. */
1606 qla2x00_set_isp_flags(ha); 1613 qla2x00_set_isp_flags(ha);
@@ -2875,8 +2882,14 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
2875{ 2882{
2876 pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; 2883 pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT;
2877 scsi_qla_host_t *ha = pci_get_drvdata(pdev); 2884 scsi_qla_host_t *ha = pci_get_drvdata(pdev);
2885 int rc;
2886
2887 if (ha->mem_only)
2888 rc = pci_enable_device_mem(pdev);
2889 else
2890 rc = pci_enable_device(pdev);
2878 2891
2879 if (pci_enable_device_bars(pdev, ha->bars)) { 2892 if (rc) {
2880 qla_printk(KERN_WARNING, ha, 2893 qla_printk(KERN_WARNING, ha,
2881 "Can't re-enable PCI device after reset.\n"); 2894 "Can't re-enable PCI device after reset.\n");
2882 2895