diff options
author | Michael Buesch <mb@bu3sch.de> | 2006-04-09 20:08:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-04-24 16:15:53 -0400 |
commit | cc9357104b19b2b0377713c33d87d78518912c3d (patch) | |
tree | e53b117c4d01ef0f4d567d6f7e0891f24fc89fb3 /drivers/net/wireless/bcm43xx | |
parent | f298a2ec62e51cc81b85a120d8fa5b9f8f5a94b1 (diff) |
[PATCH] bcm43xx: use pci_iomap() for convenience.
This reduces codesize.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 27 |
3 files changed, 7 insertions, 23 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index 2e83083935e..e66fdb1f3cf 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h | |||
@@ -645,7 +645,6 @@ struct bcm43xx_private { | |||
645 | unsigned int irq; | 645 | unsigned int irq; |
646 | 646 | ||
647 | void __iomem *mmio_addr; | 647 | void __iomem *mmio_addr; |
648 | unsigned int mmio_len; | ||
649 | 648 | ||
650 | /* Do not use the lock directly. Use the bcm43xx_lock* helper | 649 | /* Do not use the lock directly. Use the bcm43xx_lock* helper |
651 | * functions, to be MMIO-safe. */ | 650 | * functions, to be MMIO-safe. */ |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c index 35a4fcb6d92..7497fb16076 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | |||
@@ -92,7 +92,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, | |||
92 | fappend("subsystem_vendor: 0x%04x subsystem_device: 0x%04x\n", | 92 | fappend("subsystem_vendor: 0x%04x subsystem_device: 0x%04x\n", |
93 | pci_dev->subsystem_vendor, pci_dev->subsystem_device); | 93 | pci_dev->subsystem_vendor, pci_dev->subsystem_device); |
94 | fappend("IRQ: %d\n", bcm->irq); | 94 | fappend("IRQ: %d\n", bcm->irq); |
95 | fappend("mmio_addr: 0x%p mmio_len: %u\n", bcm->mmio_addr, bcm->mmio_len); | 95 | fappend("mmio_addr: 0x%p\n", bcm->mmio_addr); |
96 | fappend("chip_id: 0x%04x chip_rev: 0x%02x\n", bcm->chip_id, bcm->chip_rev); | 96 | fappend("chip_id: 0x%04x chip_rev: 0x%02x\n", bcm->chip_id, bcm->chip_rev); |
97 | if ((bcm->core_80211[0].rev >= 3) && (bcm43xx_read32(bcm, 0x0158) & (1 << 16))) | 97 | if ((bcm->core_80211[0].rev >= 3) && (bcm43xx_read32(bcm, 0x0158) & (1 << 16))) |
98 | fappend("Radio disabled by hardware!\n"); | 98 | fappend("Radio disabled by hardware!\n"); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 9a06e61df0a..19852866072 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -3288,8 +3288,7 @@ static void bcm43xx_detach_board(struct bcm43xx_private *bcm) | |||
3288 | 3288 | ||
3289 | bcm43xx_chipset_detach(bcm); | 3289 | bcm43xx_chipset_detach(bcm); |
3290 | /* Do _not_ access the chip, after it is detached. */ | 3290 | /* Do _not_ access the chip, after it is detached. */ |
3291 | iounmap(bcm->mmio_addr); | 3291 | pci_iounmap(pci_dev, bcm->mmio_addr); |
3292 | |||
3293 | pci_release_regions(pci_dev); | 3292 | pci_release_regions(pci_dev); |
3294 | pci_disable_device(pci_dev); | 3293 | pci_disable_device(pci_dev); |
3295 | 3294 | ||
@@ -3379,40 +3378,26 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) | |||
3379 | struct net_device *net_dev = bcm->net_dev; | 3378 | struct net_device *net_dev = bcm->net_dev; |
3380 | int err; | 3379 | int err; |
3381 | int i; | 3380 | int i; |
3382 | unsigned long mmio_start, mmio_flags, mmio_len; | ||
3383 | u32 coremask; | 3381 | u32 coremask; |
3384 | 3382 | ||
3385 | err = pci_enable_device(pci_dev); | 3383 | err = pci_enable_device(pci_dev); |
3386 | if (err) { | 3384 | if (err) { |
3387 | printk(KERN_ERR PFX "unable to wake up pci device (%i)\n", err); | 3385 | printk(KERN_ERR PFX "pci_enable_device() failed\n"); |
3388 | goto out; | 3386 | goto out; |
3389 | } | 3387 | } |
3390 | mmio_start = pci_resource_start(pci_dev, 0); | ||
3391 | mmio_flags = pci_resource_flags(pci_dev, 0); | ||
3392 | mmio_len = pci_resource_len(pci_dev, 0); | ||
3393 | if (!(mmio_flags & IORESOURCE_MEM)) { | ||
3394 | printk(KERN_ERR PFX | ||
3395 | "%s, region #0 not an MMIO resource, aborting\n", | ||
3396 | pci_name(pci_dev)); | ||
3397 | err = -ENODEV; | ||
3398 | goto err_pci_disable; | ||
3399 | } | ||
3400 | err = pci_request_regions(pci_dev, KBUILD_MODNAME); | 3388 | err = pci_request_regions(pci_dev, KBUILD_MODNAME); |
3401 | if (err) { | 3389 | if (err) { |
3402 | printk(KERN_ERR PFX | 3390 | printk(KERN_ERR PFX "pci_request_regions() failed\n"); |
3403 | "could not access PCI resources (%i)\n", err); | ||
3404 | goto err_pci_disable; | 3391 | goto err_pci_disable; |
3405 | } | 3392 | } |
3406 | /* enable PCI bus-mastering */ | 3393 | /* enable PCI bus-mastering */ |
3407 | pci_set_master(pci_dev); | 3394 | pci_set_master(pci_dev); |
3408 | bcm->mmio_addr = ioremap(mmio_start, mmio_len); | 3395 | bcm->mmio_addr = pci_iomap(pci_dev, 0, ~0UL); |
3409 | if (!bcm->mmio_addr) { | 3396 | if (!bcm->mmio_addr) { |
3410 | printk(KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", | 3397 | printk(KERN_ERR PFX "pci_iomap() failed\n"); |
3411 | pci_name(pci_dev)); | ||
3412 | err = -EIO; | 3398 | err = -EIO; |
3413 | goto err_pci_release; | 3399 | goto err_pci_release; |
3414 | } | 3400 | } |
3415 | bcm->mmio_len = mmio_len; | ||
3416 | net_dev->base_addr = (unsigned long)bcm->mmio_addr; | 3401 | net_dev->base_addr = (unsigned long)bcm->mmio_addr; |
3417 | 3402 | ||
3418 | bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID, | 3403 | bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID, |
@@ -3505,7 +3490,7 @@ err_80211_unwind: | |||
3505 | err_chipset_detach: | 3490 | err_chipset_detach: |
3506 | bcm43xx_chipset_detach(bcm); | 3491 | bcm43xx_chipset_detach(bcm); |
3507 | err_iounmap: | 3492 | err_iounmap: |
3508 | iounmap(bcm->mmio_addr); | 3493 | pci_iounmap(pci_dev, bcm->mmio_addr); |
3509 | err_pci_release: | 3494 | err_pci_release: |
3510 | pci_release_regions(pci_dev); | 3495 | pci_release_regions(pci_dev); |
3511 | err_pci_disable: | 3496 | err_pci_disable: |