[PATCH 05/11] bcma: add mips driver

Jonas Gorski jonas.gorski at gmail.com
Wed Jul 13 16:39:29 EDT 2011


On 9 July 2011 13:05, Hauke Mehrtens <hauke at hauke-m.de> wrote:
> diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
> index 2ca5eeb..ba9a357 100644
> --- a/drivers/bcma/main.c
> +++ b/drivers/bcma/main.c
> @@ -79,6 +79,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
>                case BCMA_CORE_CHIPCOMMON:
>                case BCMA_CORE_PCI:
>                case BCMA_CORE_PCIE:
> +               case BCMA_CORE_MIPS_74K:
>                        continue;
>                }
>
> @@ -138,6 +139,15 @@ int bcma_bus_register(struct bcma_bus *bus)
>                bcma_core_chipcommon_init(&bus->drv_cc);
>        }
>
> +#ifdef CONFIG_BCMA_DRIVER_MIPS
> +       /* Init MIPS core */
> +       core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
> +       if (core) {
> +               bus->drv_mips.core = core;
> +               bcma_core_mips_init(&bus->drv_mips);
> +       }
> +#endif

You could avoid the ugly ifdefs here by moving it to
bcma_driver_mips.h and change

extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);

to
#ifdef CONFIG_BCMA_DRIVER_MIPS
extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
#else
static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
#endif

assuming the bus->drv_mips.core being set doesn't have any side
effects in the no mips core driver case.

> +
>        /* Init PCIE core */
>        core = bcma_find_core(bus, BCMA_CORE_PCIE);
>        if (core) {
> @@ -200,6 +210,15 @@ int __init bcma_bus_early_register(struct bcma_bus *bus,
>                bcma_core_chipcommon_init(&bus->drv_cc);
>        }
>
> +#ifdef CONFIG_BCMA_DRIVER_MIPS
> +       /* Init MIPS core */
> +       core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
> +       if (core) {
> +               bus->drv_mips.core = core;
> +               bcma_core_mips_init(&bus->drv_mips);
> +       }
> +#endif

Ditto.



More information about the b43-dev mailing list