of/gpio: stop using device_node data pointer to find gpio_chip
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 8 Jun 2010 13:48:16 +0000 (07:48 -0600)
committerGrant Likely <grant.likely@secretlab.ca>
Mon, 5 Jul 2010 22:14:30 +0000 (16:14 -0600)
commit594fa265e084073443390c5b93d5410fd28e9bcd
tree42c0e5536ae2fd016159e1e1bd1f27f0a9f3cac2
parenta19e3da5bc5fc6c10ab73f310bea80f3845b4531
of/gpio: stop using device_node data pointer to find gpio_chip

Currently the kernel uses the struct device_node.data pointer to resolve
a struct gpio_chip pointer from a device tree node.  However, the .data
member doesn't provide any type checking and there aren't any rules
enforced on what it should be used for.  There's no guarantee that the
data stored in it actually points to an gpio_chip pointer.

Instead of relying on the .data pointer, this patch modifies the code
to add a lookup function which scans through the registered gpio_chips
and returns the gpio_chip that has a pointer to the specified
device_node.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Anton Vorontsov <avorontsov@ru.mvista.com>
CC: Grant Likely <grant.likely@secretlab.ca>
CC: David Brownell <dbrownell@users.sourceforge.net>
CC: Bill Gatliff <bgat@billgatliff.com>
CC: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Jean Delvare <khali@linux-fr.org>
CC: linux-kernel@vger.kernel.org
CC: devicetree-discuss@lists.ozlabs.org
arch/microblaze/kernel/reset.c
arch/powerpc/platforms/52xx/mpc52xx_gpt.c
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
arch/powerpc/sysdev/qe_lib/gpio.c
drivers/gpio/gpiolib.c
drivers/of/gpio.c
include/asm-generic/gpio.h
include/linux/of_gpio.h