From: David Jander <david@protonic.nl>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, David Jander <david@protonic.nl>
Subject: [PATCH v5 3/5] GPIO: pca953x.c: Deprecate meaningless device-tree bindings
Date: Tue, 14 Jun 2011 11:00:56 +0200 [thread overview]
Message-ID: <1308042058-20107-4-git-send-email-david@protonic.nl> (raw)
In-Reply-To: <1308042058-20107-1-git-send-email-david@protonic.nl>
The property 'polarity' is handled by the GPIO core, and the 'gpio-base'
should be assigned automatically. It is meaningless in the device-tree,
since GPIO's are identified by the "chip-name"/offset pair.
This way, the whole pca953x_get_alt_pdata() can hopefully soon go away.
We still need to check whether we really want GPIO-interrupt functionality
by simply looking if the I2C node has an interrupts property defined, since
this property is not used for anything else.
Signed-off-by: David Jander <david@protonic.nl>
---
drivers/gpio/pca953x.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index db69d9e..c28fc98 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -21,7 +21,6 @@
#include <linux/slab.h>
#ifdef CONFIG_OF_GPIO
#include <linux/of_platform.h>
-#include <linux/of_gpio.h>
#endif
#define PCA953X_INPUT 0
@@ -546,6 +545,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
#ifdef CONFIG_OF_GPIO
/*
* Translate OpenFirmware node properties into platform_data
+ * WARNING: This is DEPRECATED and will be removed eventually!
*/
void
pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
@@ -560,6 +560,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
*gpio_base = -1;
val = of_get_property(node, "linux,gpio-base", &size);
+ WARN(val, "%s: device-tree property 'linux,gpio-base' is deprecated!", __func__);
if (val) {
if (size != sizeof(*val))
dev_warn(&client->dev, "%s: wrong linux,gpio-base\n",
@@ -569,6 +570,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
}
val = of_get_property(node, "polarity", NULL);
+ WARN(val, "%s: device-tree property 'polarity' is deprecated!", __func__);
if (val)
*invert = *val;
}
@@ -637,7 +639,7 @@ static int __devinit pca953x_probe(struct i2c_client *client,
{
struct pca953x_platform_data *pdata;
struct pca953x_chip *chip;
- int irq_base=-1, invert=0;
+ int irq_base=0, invert=0;
int ret = 0;
chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
@@ -652,6 +654,11 @@ static int __devinit pca953x_probe(struct i2c_client *client,
chip->names = pdata->names;
} else {
pca953x_get_alt_pdata(client, &chip->gpio_start, &invert);
+#ifdef CONFIG_OF_GPIO
+ /* If I2C node has no interrupts property, disable GPIO interrupts */
+ if (of_find_property(client->dev.of_node, "interrupts", NULL) == NULL)
+ irq_base = -1;
+#endif
}
chip->client = client;
--
1.7.4.1
next prev parent reply other threads:[~2011-06-14 9:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 9:00 [PATCH v5 0/5] GPIO: pca953x.c: Fix IRQ support and OF " David Jander
2011-06-14 9:00 ` [PATCH v5 1/5] GPIO: pca953x.c: Fix IRQ support David Jander
2011-06-16 19:45 ` Grant Likely
2011-06-14 9:00 ` [PATCH v5 2/5] GPIO: pca953x.c: Remove dynamic platform data pointer David Jander
2011-06-16 19:45 ` Grant Likely
2011-06-14 9:00 ` David Jander [this message]
2011-06-16 19:45 ` [PATCH v5 3/5] GPIO: pca953x.c: Deprecate meaningless device-tree bindings Grant Likely
2011-06-14 9:00 ` [PATCH v5 4/5] GPIO: pca953x.c: Interrupt pin is active-low David Jander
2011-06-14 9:00 ` [PATCH v5 5/5] GPIO: pca953x.c: Fix warning of enabled interrupts in handler David Jander
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=1308042058-20107-4-git-send-email-david@protonic.nl \
--to=david@protonic.nl \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®