Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcma: move PCI IRQ control function to host specific code

This function isn't really related to any bus core. It touches PCI
device config registers only, so move it to the (PCI) host file.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Rafał Miłecki and committed by
Kalle Valo
702131e2 708c964c

+45 -37
-33
drivers/bcma/driver_pci.c
··· 282 282 } 283 283 EXPORT_SYMBOL_GPL(bcma_core_pci_power_save); 284 284 285 - int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, 286 - bool enable) 287 - { 288 - struct pci_dev *pdev; 289 - u32 coremask, tmp; 290 - int err = 0; 291 - 292 - if (bus->hosttype != BCMA_HOSTTYPE_PCI) { 293 - /* This bcma device is not on a PCI host-bus. So the IRQs are 294 - * not routed through the PCI core. 295 - * So we must not enable routing through the PCI core. */ 296 - goto out; 297 - } 298 - 299 - pdev = bus->host_pci; 300 - 301 - err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); 302 - if (err) 303 - goto out; 304 - 305 - coremask = BIT(core->core_index) << 8; 306 - if (enable) 307 - tmp |= coremask; 308 - else 309 - tmp &= ~coremask; 310 - 311 - err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); 312 - 313 - out: 314 - return err; 315 - } 316 - EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); 317 - 318 285 static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) 319 286 { 320 287 u32 w;
+34
drivers/bcma/host_pci.c
··· 351 351 bcma_core_pci_down(&bus->drv_pci[0]); 352 352 } 353 353 EXPORT_SYMBOL_GPL(bcma_host_pci_down); 354 + 355 + /* See also si_pci_setup */ 356 + int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, 357 + bool enable) 358 + { 359 + struct pci_dev *pdev; 360 + u32 coremask, tmp; 361 + int err = 0; 362 + 363 + if (bus->hosttype != BCMA_HOSTTYPE_PCI) { 364 + /* This bcma device is not on a PCI host-bus. So the IRQs are 365 + * not routed through the PCI core. 366 + * So we must not enable routing through the PCI core. */ 367 + goto out; 368 + } 369 + 370 + pdev = bus->host_pci; 371 + 372 + err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); 373 + if (err) 374 + goto out; 375 + 376 + coremask = BIT(core->core_index) << 8; 377 + if (enable) 378 + tmp |= coremask; 379 + else 380 + tmp &= ~coremask; 381 + 382 + err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); 383 + 384 + out: 385 + return err; 386 + } 387 + EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
+1 -1
drivers/net/wireless/b43/main.c
··· 4866 4866 switch (dev->dev->bus_type) { 4867 4867 #ifdef CONFIG_B43_BCMA 4868 4868 case B43_BUS_BCMA: 4869 - bcma_core_pci_irq_ctl(dev->dev->bdev->bus, 4869 + bcma_host_pci_irq_ctl(dev->dev->bdev->bus, 4870 4870 dev->dev->bdev, true); 4871 4871 bcma_host_pci_up(dev->dev->bdev->bus); 4872 4872 break;
+1 -1
drivers/net/wireless/brcm80211/brcmsmac/main.c
··· 4959 4959 * Configure pci/pcmcia here instead of in brcms_c_attach() 4960 4960 * to allow mfg hotswap: down, hotswap (chip power cycle), up. 4961 4961 */ 4962 - bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, 4962 + bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, 4963 4963 true); 4964 4964 4965 4965 /*
+9
include/linux/bcma/bcma.h
··· 437 437 #ifdef CONFIG_BCMA_HOST_PCI 438 438 extern void bcma_host_pci_up(struct bcma_bus *bus); 439 439 extern void bcma_host_pci_down(struct bcma_bus *bus); 440 + extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus, 441 + struct bcma_device *core, bool enable); 440 442 #else 441 443 static inline void bcma_host_pci_up(struct bcma_bus *bus) 442 444 { 443 445 } 444 446 static inline void bcma_host_pci_down(struct bcma_bus *bus) 445 447 { 448 + } 449 + static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus, 450 + struct bcma_device *core, bool enable) 451 + { 452 + if (bus->hosttype == BCMA_HOSTTYPE_PCI) 453 + return -ENOTSUPP; 454 + return 0; 446 455 } 447 456 #endif 448 457
-2
include/linux/bcma/bcma_driver_pci.h
··· 238 238 #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 239 239 #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 240 240 241 - extern int bcma_core_pci_irq_ctl(struct bcma_bus *bus, 242 - struct bcma_device *core, bool enable); 243 241 extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 244 242 245 243 extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);