gpio / ACPI: Don't crash on NULL chip->dev
[firefly-linux-kernel-4.4.55.git] / drivers / gpio / gpio-pca953x.c
index 019b23b955a2884c6f2b63233819cdd4d3beee73..d550d8e58705524b78753289b372abd7ae39818c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  PCA953x 4/8/16 bit I/O ports
+ *  PCA953x 4/8/16/24/40 bit I/O ports
  *
  *  Copyright (C) 2005 Ben Gardner <bgardner@wabtec.com>
  *  Copyright (C) 2007 Marvell International Ltd.
@@ -59,6 +59,7 @@ static const struct i2c_device_id pca953x_id[] = {
        { "pca9557", 8  | PCA953X_TYPE, },
        { "pca9574", 8  | PCA957X_TYPE | PCA_INT, },
        { "pca9575", 16 | PCA957X_TYPE | PCA_INT, },
+       { "pca9698", 40 | PCA953X_TYPE, },
 
        { "max7310", 8  | PCA953X_TYPE, },
        { "max7312", 16 | PCA953X_TYPE | PCA_INT, },
@@ -68,6 +69,7 @@ static const struct i2c_device_id pca953x_id[] = {
        { "tca6408", 8  | PCA953X_TYPE | PCA_INT, },
        { "tca6416", 16 | PCA953X_TYPE | PCA_INT, },
        { "tca6424", 24 | PCA953X_TYPE | PCA_INT, },
+       { "xra1202", 8  | PCA953X_TYPE },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, pca953x_id);
@@ -625,11 +627,12 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
        const __be32 *val;
        int size;
 
+       *gpio_base = -1;
+
        node = client->dev.of_node;
        if (node == NULL)
                return;
 
-       *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) {
@@ -812,6 +815,7 @@ static const struct of_device_id pca953x_dt_ids[] = {
        { .compatible = "nxp,pca9557", },
        { .compatible = "nxp,pca9574", },
        { .compatible = "nxp,pca9575", },
+       { .compatible = "nxp,pca9698", },
 
        { .compatible = "maxim,max7310", },
        { .compatible = "maxim,max7312", },
@@ -822,6 +826,8 @@ static const struct of_device_id pca953x_dt_ids[] = {
        { .compatible = "ti,tca6408", },
        { .compatible = "ti,tca6416", },
        { .compatible = "ti,tca6424", },
+
+       { .compatible = "exar,xra1202", },
        { }
 };