diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 6b74c2b04c15..71f85a3e525b 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -959,17 +959,20 @@ static int bma180_data_rdy_trigger_set_state(struct iio_trigger *trig, return bma180_set_new_data_intr_state(data, state); } -static int bma180_trig_try_reen(struct iio_trigger *trig) +static void bma180_trig_reen(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct bma180_data *data = iio_priv(indio_dev); + int ret; - return bma180_reset_intr(data); + ret = bma180_reset_intr(data); + if (ret) + dev_err(&data->client->dev, "failed to reset interrupt\n"); } static const struct iio_trigger_ops bma180_trigger_ops = { .set_trigger_state = bma180_data_rdy_trigger_set_state, - .try_reenable = bma180_trig_try_reen, + .reenable = bma180_trig_reen, }; static int bma180_probe(struct i2c_client *client, diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index 20dc7bc291f8..9a552d11ea27 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -1151,7 +1151,7 @@ err_read: return IRQ_HANDLED; } -static int bmc150_accel_trig_try_reen(struct iio_trigger *trig) +static void bmc150_accel_trig_reen(struct iio_trigger *trig) { struct bmc150_accel_trigger *t = iio_trigger_get_drvdata(trig); struct bmc150_accel_data *data = t->data; @@ -1160,7 +1160,7 @@ static int bmc150_accel_trig_try_reen(struct iio_trigger *trig) /* new data interrupts don't need ack */ if (t == &t->data->triggers[BMC150_ACCEL_TRIGGER_DATA_READY]) - return 0; + return; mutex_lock(&data->mutex); /* clear any latched interrupt */ @@ -1168,12 +1168,8 @@ static int bmc150_accel_trig_try_reen(struct iio_trigger *trig) BMC150_ACCEL_INT_MODE_LATCH_INT | BMC150_ACCEL_INT_MODE_LATCH_RESET); mutex_unlock(&data->mutex); - if (ret < 0) { + if (ret < 0) dev_err(dev, "Error writing reg_int_rst_latch\n"); - return ret; - } - - return 0; } static int bmc150_accel_trigger_set_state(struct iio_trigger *trig, @@ -1213,7 +1209,7 @@ static int bmc150_accel_trigger_set_state(struct iio_trigger *trig, static const struct iio_trigger_ops bmc150_accel_trigger_ops = { .set_trigger_state = bmc150_accel_trigger_set_state, - .try_reenable = bmc150_accel_trig_try_reen, + .reenable = bmc150_accel_trig_reen, }; static int bmc150_accel_handle_roc_event(struct iio_dev *indio_dev) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 560a3373ff20..e92c7e6766e1 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1105,19 +1105,15 @@ err: return IRQ_HANDLED; } -static int kxcjk1013_trig_try_reen(struct iio_trigger *trig) +static void kxcjk1013_trig_reen(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct kxcjk1013_data *data = iio_priv(indio_dev); int ret; ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_INT_REL); - if (ret < 0) { + if (ret < 0) dev_err(&data->client->dev, "Error reading reg_int_rel\n"); - return ret; - } - - return 0; } static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig, @@ -1161,7 +1157,7 @@ static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig, static const struct iio_trigger_ops kxcjk1013_trigger_ops = { .set_trigger_state = kxcjk1013_data_rdy_trigger_set_state, - .try_reenable = kxcjk1013_trig_try_reen, + .reenable = kxcjk1013_trig_reen, }; static void kxcjk1013_report_motion_event(struct iio_dev *indio_dev) diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c index f877263dc6ef..0f8fd687866d 100644 --- a/drivers/iio/accel/mxc4005.c +++ b/drivers/iio/accel/mxc4005.c @@ -310,19 +310,15 @@ err: return IRQ_HANDLED; } -static int mxc4005_clr_intr(struct mxc4005_data *data) +static void mxc4005_clr_intr(struct mxc4005_data *data) { int ret; /* clear interrupt */ ret = regmap_write(data->regmap, MXC4005_REG_INT_CLR1, MXC4005_REG_INT_CLR1_BIT_DRDYC); - if (ret < 0) { + if (ret < 0) dev_err(data->dev, "failed to write to reg_int_clr1\n"); - return ret; - } - - return 0; } static int mxc4005_set_trigger_state(struct iio_trigger *trig, @@ -353,20 +349,20 @@ static int mxc4005_set_trigger_state(struct iio_trigger *trig, return 0; } -static int mxc4005_trigger_try_reen(struct iio_trigger *trig) +static void mxc4005_trigger_reen(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct mxc4005_data *data = iio_priv(indio_dev); if (!data->dready_trig) - return 0; + return; - return mxc4005_clr_intr(data); + mxc4005_clr_intr(data); } static const struct iio_trigger_ops mxc4005_trigger_ops = { .set_trigger_state = mxc4005_set_trigger_state, - .try_reenable = mxc4005_trigger_try_reen, + .reenable = mxc4005_trigger_reen, }; static int mxc4005_chip_init(struct mxc4005_data *data) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 6edcc99009d1..a7826f097b95 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -742,26 +742,24 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) return 0; } -static int at91_adc_reenable_trigger(struct iio_trigger *trig) +static void at91_adc_reenable_trigger(struct iio_trigger *trig) { struct iio_dev *indio = iio_trigger_get_drvdata(trig); struct at91_adc_state *st = iio_priv(indio); /* if we are using DMA, we must not reenable irq after each trigger */ if (st->dma_st.dma_chan) - return 0; + return; enable_irq(st->irq); /* Needed to ACK the DRDY interruption */ at91_adc_readl(st, AT91_SAMA5D2_LCDR); - - return 0; } static const struct iio_trigger_ops at91_adc_trigger_ops = { .set_trigger_state = &at91_adc_configure_trigger, - .try_reenable = &at91_adc_reenable_trigger, + .reenable = &at91_adc_reenable_trigger, .validate_device = iio_trigger_validate_own_device, }; diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c index ca6fc234076e..c45d8226cc2b 100644 --- a/drivers/iio/gyro/adxrs290.c +++ b/drivers/iio/gyro/adxrs290.c @@ -478,7 +478,7 @@ static int adxrs290_data_rdy_trigger_set_state(struct iio_trigger *trig, return ret; } -static int adxrs290_reset_trig(struct iio_trigger *trig) +static void adxrs290_reset_trig(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); int val; @@ -491,14 +491,12 @@ static int adxrs290_reset_trig(struct iio_trigger *trig) */ adxrs290_get_rate_data(indio_dev, ADXRS290_READ_REG(ADXRS290_REG_DATAY0), &val); - - return 0; } static const struct iio_trigger_ops adxrs290_trigger_ops = { .set_trigger_state = &adxrs290_data_rdy_trigger_set_state, .validate_device = &iio_trigger_validate_own_device, - .try_reenable = &adxrs290_reset_trig, + .reenable = &adxrs290_reset_trig, }; static irqreturn_t adxrs290_trigger_handler(int irq, void *p) diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c index 8ddda96455fc..2d5015801a75 100644 --- a/drivers/iio/gyro/bmg160_core.c +++ b/drivers/iio/gyro/bmg160_core.c @@ -893,7 +893,7 @@ err: return IRQ_HANDLED; } -static int bmg160_trig_try_reen(struct iio_trigger *trig) +static void bmg160_trig_reen(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct bmg160_data *data = iio_priv(indio_dev); @@ -902,18 +902,14 @@ static int bmg160_trig_try_reen(struct iio_trigger *trig) /* new data interrupts don't need ack */ if (data->dready_trigger_on) - return 0; + return; /* Set latched mode interrupt and clear any latched interrupt */ ret = regmap_write(data->regmap, BMG160_REG_INT_RST_LATCH, BMG160_INT_MODE_LATCH_INT | BMG160_INT_MODE_LATCH_RESET); - if (ret < 0) { + if (ret < 0) dev_err(dev, "Error writing reg_rst_latch\n"); - return ret; - } - - return 0; } static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig, @@ -961,7 +957,7 @@ static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig, static const struct iio_trigger_ops bmg160_trigger_ops = { .set_trigger_state = bmg160_data_rdy_trigger_set_state, - .try_reenable = bmg160_trig_try_reen, + .reenable = bmg160_trig_reen, }; static irqreturn_t bmg160_event_handler(int irq, void *private) diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c index 61885e99d3fc..4377047d503a 100644 --- a/drivers/iio/imu/kmx61.c +++ b/drivers/iio/imu/kmx61.c @@ -1063,24 +1063,20 @@ err_unlock: return ret; } -static int kmx61_trig_try_reenable(struct iio_trigger *trig) +static void kmx61_trig_reenable(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct kmx61_data *data = kmx61_get_data(indio_dev); int ret; ret = i2c_smbus_read_byte_data(data->client, KMX61_REG_INL); - if (ret < 0) { + if (ret < 0) dev_err(&data->client->dev, "Error reading reg_inl\n"); - return ret; - } - - return 0; } static const struct iio_trigger_ops kmx61_trigger_ops = { .set_trigger_state = kmx61_data_rdy_trigger_set_state, - .try_reenable = kmx61_trig_try_reenable, + .reenable = kmx61_trig_reenable, }; static irqreturn_t kmx61_event_handler(int irq, void *private) diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index f902be90980b..ea3c9859b258 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -203,8 +203,8 @@ EXPORT_SYMBOL(iio_trigger_poll_chained); void iio_trigger_notify_done(struct iio_trigger *trig) { if (atomic_dec_and_test(&trig->use_count) && trig->ops && - trig->ops->try_reenable) - trig->ops->try_reenable(trig); + trig->ops->reenable) + trig->ops->reenable(trig); } EXPORT_SYMBOL(iio_trigger_notify_done); diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index 73e55ec815ec..fa09fcab620a 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -766,20 +766,20 @@ static int bmc150_magn_reset_intr(struct bmc150_magn_data *data) return regmap_read(data->regmap, BMC150_MAGN_REG_X_L, &tmp); } -static int bmc150_magn_trig_try_reen(struct iio_trigger *trig) +static void bmc150_magn_trig_reen(struct iio_trigger *trig) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct bmc150_magn_data *data = iio_priv(indio_dev); int ret; if (!data->dready_trigger_on) - return 0; + return; mutex_lock(&data->mutex); ret = bmc150_magn_reset_intr(data); mutex_unlock(&data->mutex); - - return ret; + if (ret) + dev_err(data->dev, "Failed to reset interrupt\n"); } static int bmc150_magn_data_rdy_trigger_set_state(struct iio_trigger *trig, @@ -817,7 +817,7 @@ err_unlock: static const struct iio_trigger_ops bmc150_magn_trigger_ops = { .set_trigger_state = bmc150_magn_data_rdy_trigger_set_state, - .try_reenable = bmc150_magn_trig_try_reen, + .reenable = bmc150_magn_trig_reen, }; static int bmc150_magn_buffer_preenable(struct iio_dev *indio_dev) diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index f930c4ccf378..055890b6ffcf 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -21,7 +21,7 @@ struct iio_trigger; /** * struct iio_trigger_ops - operations structure for an iio_trigger. * @set_trigger_state: switch on/off the trigger on demand - * @try_reenable: function to reenable the trigger when the + * @reenable: function to reenable the trigger when the * use count is zero (may be NULL) * @validate_device: function to validate the device when the * current trigger gets changed. @@ -31,7 +31,7 @@ struct iio_trigger; **/ struct iio_trigger_ops { int (*set_trigger_state)(struct iio_trigger *trig, bool state); - int (*try_reenable)(struct iio_trigger *trig); + void (*reenable)(struct iio_trigger *trig); int (*validate_device)(struct iio_trigger *trig, struct iio_dev *indio_dev); };