From: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: David Brownell
<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
"Steven A. Falco"
<sfalco-7/gz0mrWfc7QT0dZR+AlfA@public.gmane.org>,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org,
David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add, remove} calls
Date: Thu, 16 Oct 2008 21:12:59 +0400 [thread overview]
Message-ID: <20081016171259.GD5515@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20081016171222.GA24812-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
Any GPIO controller that have a device associated with it is encouraged to
register/unregister the gpiochips with dev_gpiochip_*() calls.
Platform may redefine these calls to glue the gpiochips with the
architecture-specific code.
Signed-off-by: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
---
include/asm-generic/gpio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 0f99ad3..f31c7ae 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -89,6 +89,50 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
extern int gpiochip_add(struct gpio_chip *chip);
extern int __must_check gpiochip_remove(struct gpio_chip *chip);
+/*
+ * Platforms can define their own __dev_ versions to glue gpio_chips with the
+ * architecture-specific code.
+ */
+#ifndef __dev_gpiochip_add
+#define __dev_gpiochip_add __dev_gpiochip_add
+static inline int __dev_gpiochip_add(struct device *dev,
+ struct gpio_chip *chip)
+{
+ chip->dev = dev;
+ return gpiochip_add(chip);
+}
+#endif /* __dev_gpiochip_add */
+
+#ifndef __dev_gpiochip_remove
+#define __dev_gpiochip_remove __dev_gpiochip_remove
+static inline int __dev_gpiochip_remove(struct device *dev,
+ struct gpio_chip *chip)
+{
+ return gpiochip_remove(chip);
+}
+#endif /* __dev_gpiochip_remove */
+
+/**
+ * dev_gpiochip_add - register a gpio_chip for a device
+ * @dev: device to register gpio_chip for
+ * @chip: the chip to register
+ * Context: potentially before irqs or kmalloc will work
+ *
+ * This function takes the extra @dev argument that is used to associate
+ * the chip with a device. Otherwise it behaves the same way as the
+ * gpiochip_add().
+ */
+#define dev_gpiochip_add(dev, chip) __dev_gpiochip_add((dev), (chip))
+
+/**
+ * dev_gpiochip_remove - unregister a gpio_chip
+ * @dev: device to remove the chip from
+ * @chip: the chip to unregister
+ *
+ * Use this function to unregister the chip that was registered using
+ * dev_gpiochip_add().
+ */
+#define dev_gpiochip_remove(dev, chip) __dev_gpiochip_remove((dev), (chip))
/* Always use the library code for GPIO management calls,
* or when sleeping may be involved.
--
1.5.6.3
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <dbrownell@users.sourceforge.net>,
linuxppc-dev@ozlabs.org, i2c@lm-sensors.org,
Jean Delvare <khali@linux-fr.org>,
David Miller <davem@davemloft.net>
Subject: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls
Date: Thu, 16 Oct 2008 21:12:59 +0400 [thread overview]
Message-ID: <20081016171259.GD5515@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20081016171222.GA24812@oksana.dev.rtsoft.ru>
Any GPIO controller that have a device associated with it is encouraged to
register/unregister the gpiochips with dev_gpiochip_*() calls.
Platform may redefine these calls to glue the gpiochips with the
architecture-specific code.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
include/asm-generic/gpio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 0f99ad3..f31c7ae 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -89,6 +89,50 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
extern int gpiochip_add(struct gpio_chip *chip);
extern int __must_check gpiochip_remove(struct gpio_chip *chip);
+/*
+ * Platforms can define their own __dev_ versions to glue gpio_chips with the
+ * architecture-specific code.
+ */
+#ifndef __dev_gpiochip_add
+#define __dev_gpiochip_add __dev_gpiochip_add
+static inline int __dev_gpiochip_add(struct device *dev,
+ struct gpio_chip *chip)
+{
+ chip->dev = dev;
+ return gpiochip_add(chip);
+}
+#endif /* __dev_gpiochip_add */
+
+#ifndef __dev_gpiochip_remove
+#define __dev_gpiochip_remove __dev_gpiochip_remove
+static inline int __dev_gpiochip_remove(struct device *dev,
+ struct gpio_chip *chip)
+{
+ return gpiochip_remove(chip);
+}
+#endif /* __dev_gpiochip_remove */
+
+/**
+ * dev_gpiochip_add - register a gpio_chip for a device
+ * @dev: device to register gpio_chip for
+ * @chip: the chip to register
+ * Context: potentially before irqs or kmalloc will work
+ *
+ * This function takes the extra @dev argument that is used to associate
+ * the chip with a device. Otherwise it behaves the same way as the
+ * gpiochip_add().
+ */
+#define dev_gpiochip_add(dev, chip) __dev_gpiochip_add((dev), (chip))
+
+/**
+ * dev_gpiochip_remove - unregister a gpio_chip
+ * @dev: device to remove the chip from
+ * @chip: the chip to unregister
+ *
+ * Use this function to unregister the chip that was registered using
+ * dev_gpiochip_add().
+ */
+#define dev_gpiochip_remove(dev, chip) __dev_gpiochip_remove((dev), (chip))
/* Always use the library code for GPIO management calls,
* or when sleeping may be involved.
--
1.5.6.3
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <dbrownell@users.sourceforge.net>,
"Steven A. Falco" <sfalco@harris.com>,
Grant Likely <grant.likely@secretlab.ca>,
Jean Delvare <khali@linux-fr.org>,
David Miller <davem@davemloft.net>,
i2c@lm-sensors.org, linuxppc-dev@ozlabs.org
Subject: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls
Date: Thu, 16 Oct 2008 21:12:59 +0400 [thread overview]
Message-ID: <20081016171259.GD5515@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20081016171222.GA24812@oksana.dev.rtsoft.ru>
Any GPIO controller that have a device associated with it is encouraged to
register/unregister the gpiochips with dev_gpiochip_*() calls.
Platform may redefine these calls to glue the gpiochips with the
architecture-specific code.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
include/asm-generic/gpio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 0f99ad3..f31c7ae 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -89,6 +89,50 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
extern int gpiochip_add(struct gpio_chip *chip);
extern int __must_check gpiochip_remove(struct gpio_chip *chip);
+/*
+ * Platforms can define their own __dev_ versions to glue gpio_chips with the
+ * architecture-specific code.
+ */
+#ifndef __dev_gpiochip_add
+#define __dev_gpiochip_add __dev_gpiochip_add
+static inline int __dev_gpiochip_add(struct device *dev,
+ struct gpio_chip *chip)
+{
+ chip->dev = dev;
+ return gpiochip_add(chip);
+}
+#endif /* __dev_gpiochip_add */
+
+#ifndef __dev_gpiochip_remove
+#define __dev_gpiochip_remove __dev_gpiochip_remove
+static inline int __dev_gpiochip_remove(struct device *dev,
+ struct gpio_chip *chip)
+{
+ return gpiochip_remove(chip);
+}
+#endif /* __dev_gpiochip_remove */
+
+/**
+ * dev_gpiochip_add - register a gpio_chip for a device
+ * @dev: device to register gpio_chip for
+ * @chip: the chip to register
+ * Context: potentially before irqs or kmalloc will work
+ *
+ * This function takes the extra @dev argument that is used to associate
+ * the chip with a device. Otherwise it behaves the same way as the
+ * gpiochip_add().
+ */
+#define dev_gpiochip_add(dev, chip) __dev_gpiochip_add((dev), (chip))
+
+/**
+ * dev_gpiochip_remove - unregister a gpio_chip
+ * @dev: device to remove the chip from
+ * @chip: the chip to unregister
+ *
+ * Use this function to unregister the chip that was registered using
+ * dev_gpiochip_add().
+ */
+#define dev_gpiochip_remove(dev, chip) __dev_gpiochip_remove((dev), (chip))
/* Always use the library code for GPIO management calls,
* or when sleeping may be involved.
--
1.5.6.3
next prev parent reply other threads:[~2008-10-16 17:12 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 17:12 [PATCH 0/7 RFC] Handle I2C GPIO controllers with the OF (was: pca9539 I2C gpio expander) Anton Vorontsov
2008-10-16 17:12 ` Anton Vorontsov
2008-10-16 17:12 ` [PATCH 1/7] powerpc and sparc: introduce dev_archdata node accessors Anton Vorontsov
2008-10-16 17:12 ` Anton Vorontsov
2008-10-16 22:36 ` David Miller
2008-10-16 22:36 ` David Miller
2008-10-16 23:02 ` Grant Likely
2008-10-16 23:02 ` Grant Likely
2008-10-16 17:12 ` [PATCH 2/7] i2c: add info->archdata field Anton Vorontsov
2008-10-16 17:12 ` Anton Vorontsov
2008-10-17 9:21 ` Jean Delvare
2008-10-17 9:21 ` Jean Delvare
[not found] ` <20081017112125.1f2c9d94-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-22 0:27 ` Benjamin Herrenschmidt
2008-10-22 0:27 ` Benjamin Herrenschmidt
2008-10-22 0:27 ` Benjamin Herrenschmidt
2008-10-22 6:50 ` Jean Delvare
2008-10-22 6:50 ` Jean Delvare
2008-10-22 6:50 ` Jean Delvare
[not found] ` <20081022085002.0698e2a8-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-22 7:37 ` Benjamin Herrenschmidt
2008-10-22 7:37 ` Benjamin Herrenschmidt
2008-10-22 7:37 ` Benjamin Herrenschmidt
2008-10-22 10:08 ` Anton Vorontsov
2008-10-22 10:08 ` Anton Vorontsov
2008-10-22 11:07 ` Jean Delvare
2008-10-22 11:07 ` Jean Delvare
2008-10-22 12:50 ` Anton Vorontsov
2008-10-22 12:50 ` Anton Vorontsov
[not found] ` <20081016171222.GA24812-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2008-10-16 17:12 ` [PATCH 3/7] of: fill the archdata for I2C devices Anton Vorontsov
2008-10-16 17:12 ` Anton Vorontsov
2008-10-16 17:12 ` Anton Vorontsov
2008-10-22 4:14 ` Grant Likely
2008-10-22 4:14 ` Grant Likely
2008-10-16 17:12 ` Anton Vorontsov [this message]
2008-10-16 17:12 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls Anton Vorontsov
2008-10-16 17:12 ` Anton Vorontsov
2008-10-17 20:24 ` David Brownell
2008-10-17 20:24 ` David Brownell
2008-10-17 21:29 ` Anton Vorontsov
2008-10-17 21:29 ` Anton Vorontsov
2008-10-20 7:29 ` David Brownell
2008-10-20 7:29 ` David Brownell
2008-10-20 15:48 ` Anton Vorontsov
2008-10-20 15:48 ` Anton Vorontsov
[not found] ` <20081020154835.GA3234-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2008-10-22 0:29 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add, remove} calls Benjamin Herrenschmidt
2008-10-22 0:29 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls Benjamin Herrenschmidt
2008-10-22 0:29 ` Benjamin Herrenschmidt
2008-10-22 1:03 ` Anton Vorontsov
2008-10-22 1:03 ` Anton Vorontsov
2008-10-22 1:42 ` Anton Vorontsov
2008-10-22 1:42 ` Anton Vorontsov
[not found] ` <20081022014243.GA19362-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2008-10-22 2:28 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add, remove} calls Benjamin Herrenschmidt
2008-10-22 2:28 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls Benjamin Herrenschmidt
2008-10-22 2:28 ` Benjamin Herrenschmidt
2008-10-22 4:20 ` Grant Likely
2008-10-22 4:20 ` Grant Likely
2008-10-22 4:22 ` David Brownell
2008-10-22 4:22 ` David Brownell
2008-10-22 10:36 ` Anton Vorontsov
2008-10-22 10:36 ` Anton Vorontsov
2008-10-22 10:46 ` Anton Vorontsov
2008-10-22 10:46 ` Anton Vorontsov
2008-10-22 18:32 ` Anton Vorontsov
2008-10-22 18:32 ` Anton Vorontsov
2008-10-22 21:04 ` David Brownell
2008-10-22 21:04 ` David Brownell
2008-10-22 21:22 ` Anton Vorontsov
2008-10-22 21:22 ` Anton Vorontsov
2008-10-22 21:52 ` David Brownell
2008-10-22 21:52 ` David Brownell
2008-10-22 22:29 ` Anton Vorontsov
2008-10-22 22:29 ` Anton Vorontsov
2008-10-23 5:19 ` David Brownell
2008-10-23 5:19 ` David Brownell
[not found] ` <200810221404.52798.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-10-23 4:45 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add, remove} calls Benjamin Herrenschmidt
2008-10-23 4:45 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls Benjamin Herrenschmidt
2008-10-23 4:45 ` Benjamin Herrenschmidt
2008-10-23 6:06 ` David Brownell
2008-10-23 6:06 ` David Brownell
2008-10-23 6:15 ` David Brownell
2008-10-23 6:15 ` David Brownell
2008-10-28 17:45 ` [PATCH 0/6 RFC] OF-glue devices for I2C/SPI (was: " Anton Vorontsov
2008-10-28 17:45 ` Anton Vorontsov
2008-10-28 17:46 ` [PATCH 1/6] of/base: Add new helper of_should_create_pdev() Anton Vorontsov
2008-10-28 17:46 ` [PATCH 2/6] of/of_i2c: implement of_{,un}register_i2c_device Anton Vorontsov
2008-10-28 17:46 ` [PATCH 3/6] of/of_i2c: add support for dedicated OF I2C devices Anton Vorontsov
2008-10-28 18:41 ` David Miller
2008-10-28 17:46 ` [PATCH 4/6] of/gpio: add support for two-stage registration for the of_gpio_chips Anton Vorontsov
2008-10-28 17:46 ` [PATCH 5/6] gpio/pca953x: pass gpio_chip pointer to the setup/teardown callbacks Anton Vorontsov
2008-10-28 17:46 ` [PATCH 6/6] gpio: OpenFirmware bindings for the pca953x Anton Vorontsov
2008-10-28 17:53 ` [PATCH 0/6 RFC] OF-glue devices for I2C/SPI (was: Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls Grant Likely
2008-10-28 17:53 ` [PATCH 0/6 RFC] OF-glue devices for I2C/SPI (was: Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add, remove} calls Grant Likely
[not found] ` <20081022010347.GA7377-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2008-10-22 2:27 ` Benjamin Herrenschmidt
2008-10-22 2:27 ` [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls Benjamin Herrenschmidt
2008-10-22 2:27 ` Benjamin Herrenschmidt
2008-10-16 17:13 ` [PATCH 5/7] of/gpio: implement of_dev_gpiochip_{add,remove} calls Anton Vorontsov
2008-10-16 17:13 ` Anton Vorontsov
2008-10-17 20:25 ` David Brownell
2008-10-17 20:25 ` [PATCH 5/7] of/gpio: implement of_dev_gpiochip_{add, remove} calls David Brownell
2008-10-17 21:13 ` [PATCH 5/7] of/gpio: implement of_dev_gpiochip_{add,remove} calls Anton Vorontsov
2008-10-17 21:13 ` Anton Vorontsov
2008-10-17 21:13 ` Anton Vorontsov
2008-10-16 17:13 ` [PATCH 6/7] gpio/pca953x: convert to dev_gpiochip_add and make it work with the OF Anton Vorontsov
2008-10-16 17:13 ` Anton Vorontsov
2008-10-16 17:13 ` [PATCH 7/7] i2c/mcu_mpc8349emitx: convert to the new I2C/OF/GPIO infrastructure Anton Vorontsov
2008-10-16 17:13 ` Anton Vorontsov
2008-10-17 16:07 ` [PATCH 0/7 RFC] Handle I2C GPIO controllers with the OF (was: pca9539 I2C gpio expander) Steven A. Falco
2008-10-17 16:07 ` Steven A. Falco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081016171259.GD5515@oksana.dev.rtsoft.ru \
--to=avorontsov-hkdhdckh98+b+jhodadfcq@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
--cc=sfalco-7/gz0mrWfc7QT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.