diff options
Diffstat (limited to 'drivers/staging/iio/trigger')
-rw-r--r-- | drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 23 | ||||
-rw-r--r-- | drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 4 |
2 files changed, 11 insertions, 16 deletions
diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c index 38a158b..ebb189c 100644 --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c @@ -83,32 +83,28 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, { struct iio_trigger *trig = to_iio_trigger(dev); struct bfin_tmr_state *st = iio_trigger_get_drvdata(trig); - unsigned long val; + unsigned int val; bool enabled; int ret; - ret = strict_strtoul(buf, 10, &val); + ret = kstrtouint(buf, 10, &val); if (ret) - goto error_ret; + return ret; if (val > 100000) { - ret = -EINVAL; - goto error_ret; - } + return -EINVAL; enabled = get_enabled_gptimers() & st->t->bit; if (enabled) disable_gptimers(st->t->bit); - if (!val) - goto error_ret; + if (val == 0) + return count; val = get_sclk() / val; - if (val <= 4 || val <= st->duty) { - ret = -EINVAL; - goto error_ret; - } + if (val <= 4 || val <= st->duty) + return -EINVAL; set_gptimer_period(st->t->id, val); set_gptimer_pwidth(st->t->id, val - st->duty); @@ -116,8 +112,7 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, if (enabled) enable_gptimers(st->t->bit); -error_ret: - return ret ? ret : count; + return count; } static ssize_t iio_bfin_tmr_frequency_show(struct device *dev, diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index 7969597..48a6afa 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -53,10 +53,10 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev, { struct iio_trigger *trig = to_iio_trigger(dev); struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig); - unsigned long val; + int val; int ret; - ret = strict_strtoul(buf, 10, &val); + ret = kstrtoint(buf, 10, &val); if (ret) goto error_ret; |