Commit cc935710 authored by Michael Buesch's avatar Michael Buesch Committed by John W. Linville

[PATCH] bcm43xx: use pci_iomap() for convenience.

This reduces codesize.
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f298a2ec
......@@ -645,7 +645,6 @@ struct bcm43xx_private {
unsigned int irq;
void __iomem *mmio_addr;
unsigned int mmio_len;
/* Do not use the lock directly. Use the bcm43xx_lock* helper
* functions, to be MMIO-safe. */
......
......@@ -92,7 +92,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
fappend("subsystem_vendor: 0x%04x subsystem_device: 0x%04x\n",
pci_dev->subsystem_vendor, pci_dev->subsystem_device);
fappend("IRQ: %d\n", bcm->irq);
fappend("mmio_addr: 0x%p mmio_len: %u\n", bcm->mmio_addr, bcm->mmio_len);
fappend("mmio_addr: 0x%p\n", bcm->mmio_addr);
fappend("chip_id: 0x%04x chip_rev: 0x%02x\n", bcm->chip_id, bcm->chip_rev);
if ((bcm->core_80211[0].rev >= 3) && (bcm43xx_read32(bcm, 0x0158) & (1 << 16)))
fappend("Radio disabled by hardware!\n");
......
......@@ -3288,8 +3288,7 @@ static void bcm43xx_detach_board(struct bcm43xx_private *bcm)
bcm43xx_chipset_detach(bcm);
/* Do _not_ access the chip, after it is detached. */
iounmap(bcm->mmio_addr);
pci_iounmap(pci_dev, bcm->mmio_addr);
pci_release_regions(pci_dev);
pci_disable_device(pci_dev);
......@@ -3379,40 +3378,26 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
struct net_device *net_dev = bcm->net_dev;
int err;
int i;
unsigned long mmio_start, mmio_flags, mmio_len;
u32 coremask;
err = pci_enable_device(pci_dev);
if (err) {
printk(KERN_ERR PFX "unable to wake up pci device (%i)\n", err);
printk(KERN_ERR PFX "pci_enable_device() failed\n");
goto out;
}
mmio_start = pci_resource_start(pci_dev, 0);
mmio_flags = pci_resource_flags(pci_dev, 0);
mmio_len = pci_resource_len(pci_dev, 0);
if (!(mmio_flags & IORESOURCE_MEM)) {
printk(KERN_ERR PFX
"%s, region #0 not an MMIO resource, aborting\n",
pci_name(pci_dev));
err = -ENODEV;
goto err_pci_disable;
}
err = pci_request_regions(pci_dev, KBUILD_MODNAME);
if (err) {
printk(KERN_ERR PFX
"could not access PCI resources (%i)\n", err);
printk(KERN_ERR PFX "pci_request_regions() failed\n");
goto err_pci_disable;
}
/* enable PCI bus-mastering */
pci_set_master(pci_dev);
bcm->mmio_addr = ioremap(mmio_start, mmio_len);
bcm->mmio_addr = pci_iomap(pci_dev, 0, ~0UL);
if (!bcm->mmio_addr) {
printk(KERN_ERR PFX "%s: cannot remap MMIO, aborting\n",
pci_name(pci_dev));
printk(KERN_ERR PFX "pci_iomap() failed\n");
err = -EIO;
goto err_pci_release;
}
bcm->mmio_len = mmio_len;
net_dev->base_addr = (unsigned long)bcm->mmio_addr;
bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
......@@ -3505,7 +3490,7 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
err_chipset_detach:
bcm43xx_chipset_detach(bcm);
err_iounmap:
iounmap(bcm->mmio_addr);
pci_iounmap(pci_dev, bcm->mmio_addr);
err_pci_release:
pci_release_regions(pci_dev);
err_pci_disable:
......
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