diff options
author | David Lechner <dlechner@baylibre.com> | 2024-11-01 17:17:09 -0500 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2024-11-03 20:33:45 +0000 |
commit | dff100b0f3ac0f666902e65b2b5dd2580a6146cb (patch) | |
tree | 6f619682f1b5a14991ea8038c3d748640960c233 | |
parent | c4d4f112bb5869dc356e513ff3876c10ed6f86c7 (diff) |
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 <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-2-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/accel/mma9553.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 43ba04c606a4..8536743a6886 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -1031,9 +1031,9 @@ static irqreturn_t mma9553_event_handler(int irq, void *private) if (ev_step_detect->enabled && (stepcnt != data->stepcnt)) { data->stepcnt = stepcnt; iio_push_event(indio_dev, - IIO_EVENT_CODE(IIO_STEPS, 0, IIO_NO_MOD, - IIO_EV_DIR_NONE, - IIO_EV_TYPE_CHANGE, 0, 0, 0), + IIO_UNMOD_EVENT_CODE(IIO_STEPS, 0, + IIO_EV_TYPE_CHANGE, + IIO_EV_DIR_NONE), data->timestamp); } @@ -1042,20 +1042,18 @@ static irqreturn_t mma9553_event_handler(int irq, void *private) /* ev_activity can be NULL if activity == ACTIVITY_UNKNOWN */ if (ev_prev_activity && ev_prev_activity->enabled) iio_push_event(indio_dev, - IIO_EVENT_CODE(IIO_ACTIVITY, 0, - ev_prev_activity->info->mod, - IIO_EV_DIR_FALLING, - IIO_EV_TYPE_THRESH, 0, 0, - 0), + IIO_MOD_EVENT_CODE(IIO_ACTIVITY, 0, + ev_prev_activity->info->mod, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), data->timestamp); if (ev_activity && ev_activity->enabled) iio_push_event(indio_dev, - IIO_EVENT_CODE(IIO_ACTIVITY, 0, - ev_activity->info->mod, - IIO_EV_DIR_RISING, - IIO_EV_TYPE_THRESH, 0, 0, - 0), + IIO_MOD_EVENT_CODE(IIO_ACTIVITY, 0, + ev_activity->info->mod, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), data->timestamp); } mutex_unlock(&data->mutex); |