Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: David Jander <david@protonic.nl>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by

David Jander and committed by
Grant Likely
a57339b4 c6dcf592

+9 -2
+9 -2
drivers/gpio/gpio-pca953x.c
··· 21 21 #include <linux/slab.h> 22 22 #ifdef CONFIG_OF_GPIO 23 23 #include <linux/of_platform.h> 24 - #include <linux/of_gpio.h> 25 24 #endif 26 25 27 26 #define PCA953X_INPUT 0 ··· 544 545 #ifdef CONFIG_OF_GPIO 545 546 /* 546 547 * Translate OpenFirmware node properties into platform_data 548 + * WARNING: This is DEPRECATED and will be removed eventually! 547 549 */ 548 550 void 549 551 pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) ··· 559 559 560 560 *gpio_base = -1; 561 561 val = of_get_property(node, "linux,gpio-base", &size); 562 + WARN(val, "%s: device-tree property 'linux,gpio-base' is deprecated!", __func__); 562 563 if (val) { 563 564 if (size != sizeof(*val)) 564 565 dev_warn(&client->dev, "%s: wrong linux,gpio-base\n", ··· 569 568 } 570 569 571 570 val = of_get_property(node, "polarity", NULL); 571 + WARN(val, "%s: device-tree property 'polarity' is deprecated!", __func__); 572 572 if (val) 573 573 *invert = *val; 574 574 } ··· 638 636 { 639 637 struct pca953x_platform_data *pdata; 640 638 struct pca953x_chip *chip; 641 - int irq_base=-1, invert=0; 639 + int irq_base=0, invert=0; 642 640 int ret = 0; 643 641 644 642 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); ··· 653 651 chip->names = pdata->names; 654 652 } else { 655 653 pca953x_get_alt_pdata(client, &chip->gpio_start, &invert); 654 + #ifdef CONFIG_OF_GPIO 655 + /* If I2C node has no interrupts property, disable GPIO interrupts */ 656 + if (of_find_property(client->dev.of_node, "interrupts", NULL) == NULL) 657 + irq_base = -1; 658 + #endif 656 659 } 657 660 658 661 chip->client = client;