Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-1-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
c4d4f112 7f4f3c4e

+14 -16
+14 -16
drivers/iio/dummy/iio_simple_dummy_events.c
··· 183 183 switch (st->regs->reg_data) { 184 184 case 0: 185 185 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), 189 189 st->event_timestamp); 190 190 break; 191 191 case 1: 192 192 if (st->activity_running > st->event_val) 193 193 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), 199 198 st->event_timestamp); 200 199 break; 201 200 case 2: 202 201 if (st->activity_walking < st->event_val) 203 202 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), 209 207 st->event_timestamp); 210 208 break; 211 209 case 3: 212 210 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), 216 214 st->event_timestamp); 217 215 break; 218 216 default: