Skip to content

Commit c4d4f11

Browse files
dlechjic23
authored andcommitted
iio: dummy: use specialized event code macros
Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE instead of IIO_EVENT_CODE. Signed-off-by: David Lechner <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 7f4f3c4 commit c4d4f11

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

drivers/iio/dummy/iio_simple_dummy_events.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,36 +183,34 @@ static irqreturn_t iio_simple_dummy_event_handler(int irq, void *private)
183183
switch (st->regs->reg_data) {
184184
case 0:
185185
iio_push_event(indio_dev,
186-
IIO_EVENT_CODE(IIO_VOLTAGE, 0, 0,
187-
IIO_EV_DIR_RISING,
188-
IIO_EV_TYPE_THRESH, 0, 0, 0),
186+
IIO_UNMOD_EVENT_CODE(IIO_VOLTAGE, 0,
187+
IIO_EV_TYPE_THRESH,
188+
IIO_EV_DIR_RISING),
189189
st->event_timestamp);
190190
break;
191191
case 1:
192192
if (st->activity_running > st->event_val)
193193
iio_push_event(indio_dev,
194-
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
195-
IIO_MOD_RUNNING,
196-
IIO_EV_DIR_RISING,
197-
IIO_EV_TYPE_THRESH,
198-
0, 0, 0),
194+
IIO_MOD_EVENT_CODE(IIO_ACTIVITY, 0,
195+
IIO_MOD_RUNNING,
196+
IIO_EV_TYPE_THRESH,
197+
IIO_EV_DIR_RISING),
199198
st->event_timestamp);
200199
break;
201200
case 2:
202201
if (st->activity_walking < st->event_val)
203202
iio_push_event(indio_dev,
204-
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
205-
IIO_MOD_WALKING,
206-
IIO_EV_DIR_FALLING,
207-
IIO_EV_TYPE_THRESH,
208-
0, 0, 0),
203+
IIO_MOD_EVENT_CODE(IIO_ACTIVITY, 0,
204+
IIO_MOD_WALKING,
205+
IIO_EV_TYPE_THRESH,
206+
IIO_EV_DIR_FALLING),
209207
st->event_timestamp);
210208
break;
211209
case 3:
212210
iio_push_event(indio_dev,
213-
IIO_EVENT_CODE(IIO_STEPS, 0, IIO_NO_MOD,
214-
IIO_EV_DIR_NONE,
215-
IIO_EV_TYPE_CHANGE, 0, 0, 0),
211+
IIO_UNMOD_EVENT_CODE(IIO_STEPS, 0,
212+
IIO_EV_TYPE_CHANGE,
213+
IIO_EV_DIR_NONE),
216214
st->event_timestamp);
217215
break;
218216
default:

0 commit comments

Comments
 (0)