Skip to content

Commit dff100b

Browse files
dlechjic23
authored andcommitted
iio: accel: mma9553: 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 c4d4f11 commit dff100b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

drivers/iio/accel/mma9553.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,9 +1031,9 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
10311031
if (ev_step_detect->enabled && (stepcnt != data->stepcnt)) {
10321032
data->stepcnt = stepcnt;
10331033
iio_push_event(indio_dev,
1034-
IIO_EVENT_CODE(IIO_STEPS, 0, IIO_NO_MOD,
1035-
IIO_EV_DIR_NONE,
1036-
IIO_EV_TYPE_CHANGE, 0, 0, 0),
1034+
IIO_UNMOD_EVENT_CODE(IIO_STEPS, 0,
1035+
IIO_EV_TYPE_CHANGE,
1036+
IIO_EV_DIR_NONE),
10371037
data->timestamp);
10381038
}
10391039

@@ -1042,20 +1042,18 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
10421042
/* ev_activity can be NULL if activity == ACTIVITY_UNKNOWN */
10431043
if (ev_prev_activity && ev_prev_activity->enabled)
10441044
iio_push_event(indio_dev,
1045-
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
1046-
ev_prev_activity->info->mod,
1047-
IIO_EV_DIR_FALLING,
1048-
IIO_EV_TYPE_THRESH, 0, 0,
1049-
0),
1045+
IIO_MOD_EVENT_CODE(IIO_ACTIVITY, 0,
1046+
ev_prev_activity->info->mod,
1047+
IIO_EV_TYPE_THRESH,
1048+
IIO_EV_DIR_FALLING),
10501049
data->timestamp);
10511050

10521051
if (ev_activity && ev_activity->enabled)
10531052
iio_push_event(indio_dev,
1054-
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
1055-
ev_activity->info->mod,
1056-
IIO_EV_DIR_RISING,
1057-
IIO_EV_TYPE_THRESH, 0, 0,
1058-
0),
1053+
IIO_MOD_EVENT_CODE(IIO_ACTIVITY, 0,
1054+
ev_activity->info->mod,
1055+
IIO_EV_TYPE_THRESH,
1056+
IIO_EV_DIR_RISING),
10591057
data->timestamp);
10601058
}
10611059
mutex_unlock(&data->mutex);

0 commit comments

Comments
 (0)