bcma: move PCI IRQ control function to host specific code
authorRafał Miłecki <zajec5@gmail.com>
Thu, 5 Mar 2015 17:25:10 +0000 (18:25 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 13 Mar 2015 14:25:50 +0000 (16:25 +0200)
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>
drivers/bcma/driver_pci.c
drivers/bcma/host_pci.c
drivers/net/wireless/b43/main.c
drivers/net/wireless/brcm80211/brcmsmac/main.c
include/linux/bcma/bcma.h
include/linux/bcma/bcma_driver_pci.h

index cfd35bc1c5a35752a1ac30f751cce6dcd544a864..f499a469e66d08d7dfcb50e123c82fc920f32ea9 100644 (file)
@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
 }
 EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
 
-int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
-                         bool enable)
-{
-       struct pci_dev *pdev;
-       u32 coremask, tmp;
-       int err = 0;
-
-       if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
-               /* This bcma device is not on a PCI host-bus. So the IRQs are
-                * not routed through the PCI core.
-                * So we must not enable routing through the PCI core. */
-               goto out;
-       }
-
-       pdev = bus->host_pci;
-
-       err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
-       if (err)
-               goto out;
-
-       coremask = BIT(core->core_index) << 8;
-       if (enable)
-               tmp |= coremask;
-       else
-               tmp &= ~coremask;
-
-       err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
-
-out:
-       return err;
-}
-EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
-
 static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
 {
        u32 w;
index a62a2f9091f529d8a9c7ccfdb607446accc6f676..0856189c065fd57826df7edab2dba3217d5e283c 100644 (file)
@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus *bus)
                bcma_core_pci_down(&bus->drv_pci[0]);
 }
 EXPORT_SYMBOL_GPL(bcma_host_pci_down);
+
+/* See also si_pci_setup */
+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
+                         bool enable)
+{
+       struct pci_dev *pdev;
+       u32 coremask, tmp;
+       int err = 0;
+
+       if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
+               /* This bcma device is not on a PCI host-bus. So the IRQs are
+                * not routed through the PCI core.
+                * So we must not enable routing through the PCI core. */
+               goto out;
+       }
+
+       pdev = bus->host_pci;
+
+       err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
+       if (err)
+               goto out;
+
+       coremask = BIT(core->core_index) << 8;
+       if (enable)
+               tmp |= coremask;
+       else
+               tmp &= ~coremask;
+
+       err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
+
+out:
+       return err;
+}
+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
index ac99798570e8d8dfdfcf3260312c48376f74903e..998490a7b1670f0ec688c86d0004305af9b71fac 100644 (file)
@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
        switch (dev->dev->bus_type) {
 #ifdef CONFIG_B43_BCMA
        case B43_BUS_BCMA:
-               bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
+               bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
                                      dev->dev->bdev, true);
                bcma_host_pci_up(dev->dev->bdev->bus);
                break;
index c84af1dfc88fdde21df4c384a82e849ba827464a..369527e2768956ee30563d8d330341c802f7bc6d 100644 (file)
@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw)
         * Configure pci/pcmcia here instead of in brcms_c_attach()
         * to allow mfg hotswap:  down, hotswap (chip power cycle), up.
         */
-       bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
+       bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
                              true);
 
        /*
index 44057b45ed326d4274a4cdd008465e40e1db8667..e34f906647d39dce39985d1cfe836f42b689c556 100644 (file)
@@ -437,6 +437,8 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
 #ifdef CONFIG_BCMA_HOST_PCI
 extern void bcma_host_pci_up(struct bcma_bus *bus);
 extern void bcma_host_pci_down(struct bcma_bus *bus);
+extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
+                                struct bcma_device *core, bool enable);
 #else
 static inline void bcma_host_pci_up(struct bcma_bus *bus)
 {
@@ -444,6 +446,13 @@ static inline void bcma_host_pci_up(struct bcma_bus *bus)
 static inline void bcma_host_pci_down(struct bcma_bus *bus)
 {
 }
+static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
+                                       struct bcma_device *core, bool enable)
+{
+       if (bus->hosttype == BCMA_HOSTTYPE_PCI)
+               return -ENOTSUPP;
+       return 0;
+}
 #endif
 
 extern bool bcma_core_is_enabled(struct bcma_device *core);
index 8e90004fdfd7b215074d7a4a97280d6405765db4..3a468687c170cdbb92e758aea8b423879501ab98 100644 (file)
@@ -238,8 +238,6 @@ struct bcma_drv_pci {
 #define pcicore_write16(pc, offset, val)       bcma_write16((pc)->core, offset, val)
 #define pcicore_write32(pc, offset, val)       bcma_write32((pc)->core, offset, val)
 
-extern int bcma_core_pci_irq_ctl(struct bcma_bus *bus,
-                                struct bcma_device *core, bool enable);
 extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
 
 extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);