diff options
-rw-r--r-- | drivers/misc/artik_zb_power.c | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/misc/artik_zb_power.c b/drivers/misc/artik_zb_power.c index 7827abb7189..9caf67de6c3 100644 --- a/drivers/misc/artik_zb_power.c +++ b/drivers/misc/artik_zb_power.c @@ -88,39 +88,34 @@ static int artik_zb_power_control(struct artik_zb_power_platform_data *pdata, return ret; } -static int artik_zb_recovery_control(struct artik_zb_power_platform_data *pdata, +static void artik_zb_recovery_control(struct artik_zb_power_platform_data *pdata, int onoff) { - int ret; - - if (onoff == pdata->recovery_mode) - return 0; - - if (onoff) { - /* Turn off device */ - gpio_set_value(pdata->reset_gpio, 0); - gpio_set_value(pdata->bootloader_gpio, 0); - - /* EM358x chip needs 26usec hold time to reset device */ - udelay(30); - - /* Go to recovery mode */ - gpio_set_value(pdata->reset_gpio, 1); - } else { - /* Turn off */ - gpio_set_value(pdata->reset_gpio, 0); - gpio_set_value(pdata->bootloader_gpio, 0); - - /* EM358x chip needs 26usec hold time to reset device */ - udelay(30); - - /* Go to normal mode */ - gpio_set_value(pdata->bootloader_gpio, 1); - gpio_set_value(pdata->reset_gpio, 1); + if (onoff != pdata->recovery_mode) { + if (onoff) { + /* Turn off device */ + gpio_set_value(pdata->reset_gpio, 0); + gpio_set_value(pdata->bootloader_gpio, 0); + + /* EM358x chip needs 26usec hold time to reset device */ + udelay(30); + + /* Go to recovery mode */ + gpio_set_value(pdata->reset_gpio, 1); + } else { + /* Turn off */ + gpio_set_value(pdata->reset_gpio, 0); + gpio_set_value(pdata->bootloader_gpio, 0); + + /* EM358x chip needs 26usec hold time to reset device */ + udelay(30); + + /* Go to normal mode */ + gpio_set_value(pdata->bootloader_gpio, 1); + gpio_set_value(pdata->reset_gpio, 1); + } + pdata->recovery_mode = onoff; } - pdata->recovery_mode = onoff; - - return ret; } static ssize_t show_zb_power_status(struct device *dev, @@ -178,9 +173,7 @@ static ssize_t set_zb_recovery_status(struct device *dev, if (ret) return -EINVAL; - ret = artik_zb_recovery_control(pdata, !!val); - if (ret) - return -EINVAL; + artik_zb_recovery_control(pdata, !!val); return count; /* if success returns count, if failed returns - */ } |