Commit a57339b4 authored by David Jander's avatar David Jander Committed by Grant Likely

gpio/pca953x: Deprecate meaningless device-tree bindings

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: default avatarDavid Jander <david@protonic.nl>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent c6dcf592
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#ifdef CONFIG_OF_GPIO #ifdef CONFIG_OF_GPIO
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_gpio.h>
#endif #endif
#define PCA953X_INPUT 0 #define PCA953X_INPUT 0
...@@ -545,6 +544,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip) ...@@ -545,6 +544,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
#ifdef CONFIG_OF_GPIO #ifdef CONFIG_OF_GPIO
/* /*
* Translate OpenFirmware node properties into platform_data * Translate OpenFirmware node properties into platform_data
* WARNING: This is DEPRECATED and will be removed eventually!
*/ */
void void
pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
...@@ -559,6 +559,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) ...@@ -559,6 +559,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
*gpio_base = -1; *gpio_base = -1;
val = of_get_property(node, "linux,gpio-base", &size); val = of_get_property(node, "linux,gpio-base", &size);
WARN(val, "%s: device-tree property 'linux,gpio-base' is deprecated!", __func__);
if (val) { if (val) {
if (size != sizeof(*val)) if (size != sizeof(*val))
dev_warn(&client->dev, "%s: wrong linux,gpio-base\n", dev_warn(&client->dev, "%s: wrong linux,gpio-base\n",
...@@ -568,6 +569,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) ...@@ -568,6 +569,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
} }
val = of_get_property(node, "polarity", NULL); val = of_get_property(node, "polarity", NULL);
WARN(val, "%s: device-tree property 'polarity' is deprecated!", __func__);
if (val) if (val)
*invert = *val; *invert = *val;
} }
...@@ -636,7 +638,7 @@ static int __devinit pca953x_probe(struct i2c_client *client, ...@@ -636,7 +638,7 @@ static int __devinit pca953x_probe(struct i2c_client *client,
{ {
struct pca953x_platform_data *pdata; struct pca953x_platform_data *pdata;
struct pca953x_chip *chip; struct pca953x_chip *chip;
int irq_base=-1, invert=0; int irq_base=0, invert=0;
int ret = 0; int ret = 0;
chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
...@@ -651,6 +653,11 @@ static int __devinit pca953x_probe(struct i2c_client *client, ...@@ -651,6 +653,11 @@ static int __devinit pca953x_probe(struct i2c_client *client,
chip->names = pdata->names; chip->names = pdata->names;
} else { } else {
pca953x_get_alt_pdata(client, &chip->gpio_start, &invert); 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; chip->client = client;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment