Skip to content

Commit 702131e

Browse files
rmileckiKalle Valo
authored andcommitted
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>
1 parent 708c964 commit 702131e

6 files changed

Lines changed: 45 additions & 37 deletions

File tree

‎drivers/bcma/driver_pci.c‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
282282
}
283283
EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
284284

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-
318285
static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
319286
{
320287
u32 w;

‎drivers/bcma/host_pci.c‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus *bus)
351351
bcma_core_pci_down(&bus->drv_pci[0]);
352352
}
353353
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);

‎drivers/net/wireless/b43/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
48664866
switch (dev->dev->bus_type) {
48674867
#ifdef CONFIG_B43_BCMA
48684868
case B43_BUS_BCMA:
4869-
bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
4869+
bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
48704870
dev->dev->bdev, true);
48714871
bcma_host_pci_up(dev->dev->bdev->bus);
48724872
break;

‎drivers/net/wireless/brcm80211/brcmsmac/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw)
49594959
* Configure pci/pcmcia here instead of in brcms_c_attach()
49604960
* to allow mfg hotswap: down, hotswap (chip power cycle), up.
49614961
*/
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,
49634963
true);
49644964

49654965
/*

‎include/linux/bcma/bcma.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,22 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
437437
#ifdef CONFIG_BCMA_HOST_PCI
438438
extern void bcma_host_pci_up(struct bcma_bus *bus);
439439
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);
440442
#else
441443
static inline void bcma_host_pci_up(struct bcma_bus *bus)
442444
{
443445
}
444446
static inline void bcma_host_pci_down(struct bcma_bus *bus)
445447
{
446448
}
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;
455+
}
447456
#endif
448457

449458
extern bool bcma_core_is_enabled(struct bcma_device *core);

‎include/linux/bcma/bcma_driver_pci.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ struct bcma_drv_pci {
238238
#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
239239
#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
240240

241-
extern int bcma_core_pci_irq_ctl(struct bcma_bus *bus,
242-
struct bcma_device *core, bool enable);
243241
extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
244242

245243
extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);

0 commit comments

Comments
 (0)