[PATCH 19/19] gpio: Enable the tc3298x GPIO expander driver for Device Tree

Linus Walleij linus.walleij at linaro.org
Mon Sep 10 09:20:52 EDT 2012


On Fri, Sep 7, 2012 at 1:14 PM, Lee Jones <lee.jones at linaro.org> wrote:

> Here we provide a means to probe and extract vital information
> from Device Tree when booting with it enabled. Without this
> patch sub-devices wouldn't be able to reference the tc3589x-gpio
> expander from Device Tree.
>
> CC: Grant Likely <grant.likely at secretlab.ca>
> Signed-off-by: Lee Jones <lee.jones at linaro.org>

Basically this looks very good, but:

> @@ -337,9 +343,11 @@ static int __devinit tc3589x_gpio_probe(struct platform_device *pdev)
>         tc3589x_gpio->chip = template_chip;
>         tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>         tc3589x_gpio->chip.dev = &pdev->dev;
> -       tc3589x_gpio->chip.base = pdata->gpio_base;
> +       tc3589x_gpio->chip.base = (pdata) ? pdata->gpio_base : -1;
>
> -       tc3589x_gpio->irq_base = tc3589x->irq_base + TC3589x_INT_GPIO(0);
> +#ifdef CONFIG_OF_GPIO
> +        tc3589x_gpio->chip.of_node = np;
> +#endif

Isn't the newstyle way of doing this something like:

if (IS_ENABLED(CONFIG_OF_GPIO))
  tc3589x_gpio->chip.of_node = np;

I'm a bit uncertain about this since I never quite used
it myself, test it with OF disabled and see if it works.

This construct also accepts modules using OF, see
include/linux/kconfig.h, somebody might be using this as
a module.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list