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 > --- [...] > +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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org irc://irc.freenode.net/bd2