Re: [PATCH] phylib: make mdio-gpio work without OF (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 04 November 2008, Grant Likely wrote:
> At this point, instead of #ifdeffing the function signature, I would
> much rather see this generalized as something like
> 'mdio_gpio_setup()'.  Then move the OF and non-OF specific bits into
> two new functions; mdio_ofgpio_probe() and mdio_gpio_probe().  The two
> new functions should be placed with the appropriate bus binding in the
> #ifdef/#else block at the bottom of the file.

Or if possible something that creates a single #ifdef that
ensures dead code elimination will remove the "other" branch,
but ensures all platforms will build both versions:

    #ifdef OF
    #define using_of	true
    #else
    #define using_of	false
    #endif

    ...

    static int __init mdio_gpio_init(void)
    {
	if (using_of)
		return register mdio_ofgpio driver;
	else
		return register mdio_gpio driver;
    }
    subsys_initcall(mdio_gpio_init);

    ...

That's generally the preferred way to handle #ifdeffery.
But I could imagine OF isn't (yet?) set up to handle it.

- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Gstreamer Embedded]     [Linux MMC Devel]     [U-Boot V2]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux ARM Kernel]     [Linux OMAP]     [Linux SCSI]

  Powered by Linux