brcm47xx: various fixes and code cleanups for irq code
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 235-bcma-dont-expose-mips-irq.patch
1 --- a/include/linux/bcma/bcma_driver_mips.h
2 +++ b/include/linux/bcma/bcma_driver_mips.h
3 @@ -48,6 +48,6 @@ static inline void bcma_core_mips_early_
4  
5  extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
6  
7 -extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
8 +extern unsigned int bcma_core_irq(struct bcma_device *core);
9  
10  #endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
11 --- a/drivers/bcma/driver_chipcommon.c
12 +++ b/drivers/bcma/driver_chipcommon.c
13 @@ -258,7 +258,7 @@ void bcma_chipco_serial_init(struct bcma
14                 return;
15         }
16  
17 -       irq = bcma_core_mips_irq(cc->core);
18 +       irq = bcma_core_irq(cc->core);
19  
20         /* Determine the registers of the UARTs */
21         cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART);
22 --- a/drivers/bcma/driver_mips.c
23 +++ b/drivers/bcma/driver_mips.c
24 @@ -86,7 +86,7 @@ static u32 bcma_core_mips_irqflag(struct
25   * If disabled, 5 is returned.
26   * If not supported, 6 is returned.
27   */
28 -unsigned int bcma_core_mips_irq(struct bcma_device *dev)
29 +static unsigned int bcma_core_mips_irq(struct bcma_device *dev)
30  {
31         struct bcma_device *mdev = dev->bus->drv_mips.core;
32         u32 irqflag;
33 @@ -103,7 +103,13 @@ unsigned int bcma_core_mips_irq(struct b
34  
35         return 5;
36  }
37 -EXPORT_SYMBOL(bcma_core_mips_irq);
38 +
39 +unsigned int bcma_core_irq(struct bcma_device *dev)
40 +{
41 +       unsigned int mips_irq = bcma_core_mips_irq(dev);
42 +       return mips_irq <= 4 ? mips_irq + 2 : 0;
43 +}
44 +EXPORT_SYMBOL(bcma_core_irq);
45  
46  static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
47  {
48 --- a/drivers/bcma/driver_pci_host.c
49 +++ b/drivers/bcma/driver_pci_host.c
50 @@ -577,7 +577,7 @@ int bcma_core_pci_plat_dev_init(struct p
51         pr_info("PCI: Fixing up device %s\n", pci_name(dev));
52  
53         /* Fix up interrupt lines */
54 -       dev->irq = bcma_core_mips_irq(pc_host->pdev->core) + 2;
55 +       dev->irq = bcma_core_irq(pc_host->pdev->core);
56         pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
57  
58         return 0;
59 @@ -596,6 +596,6 @@ int bcma_core_pci_pcibios_map_irq(const
60  
61         pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host,
62                                pci_ops);
63 -       return bcma_core_mips_irq(pc_host->pdev->core) + 2;
64 +       return bcma_core_irq(pc_host->pdev->core);
65  }
66  EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq);
67 --- a/arch/mips/bcm47xx/gpio.c
68 +++ b/arch/mips/bcm47xx/gpio.c
69 @@ -94,7 +94,7 @@ int gpio_to_irq(unsigned gpio)
70  #endif
71  #ifdef CONFIG_BCM47XX_BCMA
72         case BCM47XX_BUS_TYPE_BCMA:
73 -               return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2;
74 +               return bcma_core_irq(bcm47xx_bus.bcma.bus.drv_cc.core);
75  #endif
76         }
77         return -EINVAL;
78 --- a/arch/mips/bcm47xx/serial.c
79 +++ b/arch/mips/bcm47xx/serial.c
80 @@ -62,7 +62,7 @@ static int __init uart8250_init_bcma(voi
81  
82                 p->mapbase = (unsigned int) bcma_port->regs;
83                 p->membase = (void *) bcma_port->regs;
84 -               p->irq = bcma_port->irq + 2;
85 +               p->irq = bcma_port->irq;
86                 p->uartclk = bcma_port->baud_base;
87                 p->regshift = bcma_port->reg_shift;
88                 p->iotype = UPIO_MEM;