Skip to content

Commit

Permalink
x86, intel-mid: Check get_gpio_by_name() error code on platform code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Cohen authored and H. Peter Anvin committed Jan 16, 2014
1 parent acb20d7 commit a957a14
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion arch/x86/platform/intel-mid/device_libs/platform_lis331.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/platform/intel-mid/device_libs/platform_max7315.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/platform/intel-mid/device_libs/platform_tca6416.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a957a14

Please sign in to comment.