[PATCH 1/2] Create a struct of_i2c_gpio_chip, for i2c-based GPIO devices

Bill Gatliff bgat at billgatliff.com
Wed Jan 6 14:51:37 EST 2010


Signed-off-by: Bill Gatliff <bgat at billgatliff.com>
---
 include/linux/of_gpio.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index fc2472c..0c39242 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -102,4 +102,27 @@ static inline int of_get_gpio(struct device_node *np, int index)
 	return of_get_gpio_flags(np, index, NULL);
 }
 
+
+
+
+/*
+ * OF GPIO chip for I2C-based devices
+ */
+struct of_i2c_gpio_chip {
+	struct of_gpio_chip of_gc;
+};
+
+static inline struct of_i2c_gpio_chip *to_of_i2c_gpio_chip(struct gpio_chip *gc)
+{
+	struct of_gpio_chip *of_gc = to_of_gpio_chip(gc);
+
+	return container_of(of_gc, struct of_i2c_gpio_chip, of_gc);
+}
+
+extern int of_i2c_gpiochip_add(struct device_node *np,
+			       struct of_i2c_gpio_chip *gc);
+
+
+
+
 #endif /* __LINUX_OF_GPIO_H */
-- 
1.6.5



More information about the Linuxppc-dev mailing list