[PATCH] of_gpio: enchance simple gpio binding with remove function

Anton Vorontsov avorontsov at ru.mvista.com
Tue Nov 17 01:50:33 EST 2009


On Mon, Nov 16, 2009 at 04:47:32PM +0300, Dmitry Eremin-Solenikov wrote:
> Add of_simple_gpiochip_remove() - a pair to of_simple_gpiochip_add that
> can remove simple gpiochip binding.
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
> ---
[...]
> +int of_simple_gpiochip_add(struct device_node *np,
> +		       struct of_gpio_chip *of_gc)
> +{
> +	int ret = -ENOMEM;
> +	struct gpio_chip *gc = &of_gc->gc;
> +
> +	gc->base = -1;
> +
> +	if (!of_gc->xlate)
> +		of_gc->xlate = of_gpio_simple_xlate;
> +
> +	np->data = of_gc;
> +
> +	/* We don't want to lose the node and its ->data */
> +	of_node_get(np);
> +
> +	ret = gpiochip_add(gc);
> +	if (ret)
> +		goto err;

I don't think OF stuff should register gpiochips.

Previously we did this, but if you look into platform gpio
drivers (e.g. drivers/gpio/pc{a,f}*.c), you'll notice that
they already register GPIO chips, and call pdata hooks
afterwards.

Our aim is to only register OF part in the pdata hook, and
don't mess with generic gpiochip handling.

I started the work, but never actually find time to continue.
I'm attaching the unfinished patches as an example of how I
think it should be done, but I doubt they apply to the latest
kernels, but nonetheless you might want to borrow some ideas.

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-of-gpio-add-support-for-two-stage-registration-for-t.patch
Type: text/x-diff
Size: 3327 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20091116/2d4d4d4a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-of-gpio-implement-of_dev_gpiochip_-add-remove-calls.patch
Type: text/x-diff
Size: 2950 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20091116/2d4d4d4a/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-i2c-mcu_mpc8349emitx-Use-new-OF-GPIO-helpers.patch
Type: text/x-diff
Size: 4336 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20091116/2d4d4d4a/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-gpio-pca953x-pass-gpio_chip-pointer-to-the-setup-tea.patch
Type: text/x-diff
Size: 2366 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20091116/2d4d4d4a/attachment-0003.patch>


More information about the devicetree-discuss mailing list