From 219eeed5f80596c8ae402f3769297dfd1ad63d1c Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Fri, 9 Jan 2015 12:46:09 +0000 Subject: [PATCH] x86.c: remove duplicate case statement Signed-off-by: Brendan Le Foll --- src/x86/intel_minnow_max.c | 4 ++-- src/x86/x86.c | 29 ++++++++--------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/x86/intel_minnow_max.c b/src/x86/intel_minnow_max.c index 38afd9f..e1a1320 100644 --- a/src/x86/intel_minnow_max.c +++ b/src/x86/intel_minnow_max.c @@ -40,11 +40,11 @@ mraa_set_pininfo(mraa_board_t* board, int mraa_index, char *name, mraa_pincapabi { if (mraa_index < board->phy_pin_count) { // adjust mraa_index for ARCH_NR_GPIOS value - mraa_pininfo_t* pin_info = &board->pins[(mraa_index)]; + mraa_pininfo_t* pin_info = &board->pins[mraa_index]; strncpy(pin_info->name, name, 7); pin_info->capabilites = caps; if (caps.gpio) - pin_info->gpio.pinmap = sysfs_pin; + pin_info->gpio.pinmap = sysfs_pin | arch_nr_gpios_adjust; if (caps.i2c) { pin_info->i2c.pinmap = 1; pin_info->i2c.mux_total = 0; diff --git a/src/x86/x86.c b/src/x86/x86.c index 88473a9..55de9d5 100644 --- a/src/x86/x86.c +++ b/src/x86/x86.c @@ -43,44 +43,31 @@ mraa_x86_platform() if (getline(&line, &len, fh) != -1) { if (strncmp(line, "GalileoGen2", 11) == 0) { platform_type = MRAA_INTEL_GALILEO_GEN2; + plat = mraa_intel_galileo_gen2(); } else if (strncmp(line, "BODEGA BAY", 10) == 0) { platform_type = MRAA_INTEL_EDISON_FAB_C; + plat = mraa_intel_edison_fab_c(); } else if (strncmp(line, "SALT BAY", 8) == 0) { platform_type = MRAA_INTEL_EDISON_FAB_C; + plat = mraa_intel_edison_fab_c(); } else if (strncmp(line, "DE3815", 6) == 0) { platform_type = MRAA_INTEL_DE3815; + plat = mraa_intel_de3815(); } else if (strncmp(line, "NOTEBOOK", 8) == 0) { platform_type = MRAA_INTEL_MINNOWBOARD_MAX; + plat = mraa_intel_minnow_max(); } else if (strncasecmp(line, "MinnowBoard MAX", 15) == 0) { platform_type = MRAA_INTEL_MINNOWBOARD_MAX; + plat = mraa_intel_minnow_max(); } else { + syslog(LOG_ERR, "Platform not supported, initialising as MRAA_INTEL_GALILEO_GEN1"); platform_type = MRAA_INTEL_GALILEO_GEN1; + plat = mraa_intel_galileo_rev_d(); } free(line); } fclose(fh); } - switch(platform_type) { - case MRAA_INTEL_GALILEO_GEN2: - plat = mraa_intel_galileo_gen2(); - break; - case MRAA_INTEL_GALILEO_GEN1: - plat = mraa_intel_galileo_rev_d(); - break; - case MRAA_INTEL_EDISON_FAB_C: - plat = mraa_intel_edison_fab_c(); - break; - case MRAA_INTEL_DE3815: - plat = mraa_intel_de3815(); - break; - case MRAA_INTEL_MINNOWBOARD_MAX: - plat = mraa_intel_minnow_max(); - break; - - default: - plat = mraa_intel_galileo_rev_d(); - syslog(LOG_ERR, "Platform not supported, initialising as MRAA_INTEL_GALILEO_GEN1"); - } return platform_type; }