x86, intel-mid: Check get_gpio_by_name() error code on platform code
authorDavid Cohen <david.a.cohen@linux.intel.com>
Thu, 16 Jan 2014 23:07:03 +0000 (15:07 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Thu, 16 Jan 2014 23:06:58 +0000 (15:06 -0800)
This patch does cleanup on all intel mid platform code that uses
gpio_get_by_name() function. From now on they should check for any error
code instead of only hardcoded -1.

There are no functional changes from this change.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Link: http://lkml.kernel.org/r/1389913624-9149-3-git-send-email-david.a.cohen@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
arch/x86/platform/intel-mid/device_libs/platform_lis331.c
arch/x86/platform/intel-mid/device_libs/platform_max7315.c
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
arch/x86/platform/intel-mid/device_libs/platform_pmic_gpio.c
arch/x86/platform/intel-mid/device_libs/platform_tca6416.c

index 0d942c1d26d578f2229d981c367d50a51cee9730..69a783689d21b7c2c7ac9db8c21f10b6582a318d 100644 (file)
@@ -22,7 +22,9 @@ static void __init *emc1403_platform_data(void *info)
        int intr = get_gpio_by_name("thermal_int");
        int intr2nd = get_gpio_by_name("thermal_alert");
 
-       if (intr == -1 || intr2nd == -1)
+       if (intr < 0)
+               return NULL;
+       if (intr2nd < 0)
                return NULL;
 
        i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
index a013a4834bbe7d8eb8fec5413551dad090a7b484..dccae6b0413f86a2f5fd91bfe3d8384553829d25 100644 (file)
@@ -66,7 +66,7 @@ static int __init pb_keys_init(void)
                gb[i].gpio = get_gpio_by_name(gb[i].desc);
                pr_debug("info[%2d]: name = %s, gpio = %d\n", i, gb[i].desc,
                                        gb[i].gpio);
-               if (gb[i].gpio == -1)
+               if (gb[i].gpio < 0)
                        continue;
 
                if (i != good)
index 15278c11f7147b16e39b043bc68f0cbd07212728..54226de7541a7f43149b068657184e04b10f123f 100644 (file)
@@ -21,7 +21,9 @@ static void __init *lis331dl_platform_data(void *info)
        int intr = get_gpio_by_name("accel_int");
        int intr2nd = get_gpio_by_name("accel_2");
 
-       if (intr == -1 || intr2nd == -1)
+       if (intr < 0)
+               return NULL;
+       if (intr2nd < 0)
                return NULL;
 
        i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
index 94ade10024ae01c6934b1f64d209005d495ec438..2c8acbc1e9ad906840d85269de5a428e45c4838f 100644 (file)
@@ -48,7 +48,7 @@ static void __init *max7315_platform_data(void *info)
        gpio_base = get_gpio_by_name(base_pin_name);
        intr = get_gpio_by_name(intr_pin_name);
 
-       if (gpio_base == -1)
+       if (gpio_base < 0)
                return NULL;
        max7315->gpio_base = gpio_base;
        if (intr != -1) {
index dd28d63c84fb1ba345aeab89c7fa547c40a9c8fc..cfe9a47a1e8778409d2819e6ed20823ad5b299b6 100644 (file)
@@ -19,7 +19,7 @@ static void *mpu3050_platform_data(void *info)
        struct i2c_board_info *i2c_info = info;
        int intr = get_gpio_by_name("mpu3050_int");
 
-       if (intr == -1)
+       if (intr < 0)
                return NULL;
 
        i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
index d87182a09263156147c706286bcb2a68bbefb44f..65c2a9a19db4d0f69378ff2effc390f3ad48f8ef 100644 (file)
@@ -26,7 +26,7 @@ static void __init *pmic_gpio_platform_data(void *info)
        static struct intel_pmic_gpio_platform_data pmic_gpio_pdata;
        int gpio_base = get_gpio_by_name("pmic_gpio_base");
 
-       if (gpio_base == -1)
+       if (gpio_base < 0)
                gpio_base = 64;
        pmic_gpio_pdata.gpio_base = gpio_base;
        pmic_gpio_pdata.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
index 22881c9a6737b1ae4a0e7d20f163a0de553ec7de..33be0b3be6e12080fd63ae249829b93504174cc6 100644 (file)
@@ -34,10 +34,10 @@ static void *tca6416_platform_data(void *info)
        gpio_base = get_gpio_by_name(base_pin_name);
        intr = get_gpio_by_name(intr_pin_name);
 
-       if (gpio_base == -1)
+       if (gpio_base < 0)
                return NULL;
        tca6416.gpio_base = gpio_base;
-       if (intr != -1) {
+       if (intr >= 0) {
                i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
                tca6416.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
        } else {