Re: [PATCH 19/19] gpio: Enable the tc3298x GPIO expander driver forDevice Tree

From: Linus Walleij
Date: Mon Sep 10 2012 - 09:20:47 EST


On Fri, Sep 7, 2012 at 1:14 PM, Lee Jones <lee.jones@xxxxxxxxxx> 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@xxxxxxxxxxxx>
> Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/