Skip to content

Commit 7f4f3c4

Browse files
justephjic23
authored andcommitted
iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper
The IIO_DIFF_EVENT_CODE macro helper was introduced to provide a more specific alternative to the generic IIO_EVENT_CODE macro for handling differential channels. This commit updates the code to use IIO_DIFF_EVENT_CODE for better clarity and maintainability. However, the current implementation incorrectly sets both chan1 and chan2 to 0. To maintain compatibility and avoid breaking existing user space applications, this behavior is preserved for now. Signed-off-by: Julien Stephan <[email protected]> Reviewed-by: David Lechner <[email protected]> Link: https://patch.msgid.link/20241028-iio-add-macro-for-even-identifier-for-differential-channels-v1-2-b452c90f7ea6@baylibre.com Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 5d8173b commit 7f4f3c4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/iio/adc/ad7280a.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -822,17 +822,15 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
822822
if (FIELD_GET(AD7280A_TRANS_READ_CONV_CHANADDR_MSK, channels[i]) <=
823823
AD7280A_CELL_VOLTAGE_6_REG) {
824824
if (val >= st->cell_threshhigh) {
825-
u64 tmp = IIO_EVENT_CODE(IIO_VOLTAGE, 1, 0,
826-
IIO_EV_DIR_RISING,
827-
IIO_EV_TYPE_THRESH,
828-
0, 0, 0);
825+
u64 tmp = IIO_DIFF_EVENT_CODE(IIO_VOLTAGE, 0, 0,
826+
IIO_EV_TYPE_THRESH,
827+
IIO_EV_DIR_RISING);
829828
iio_push_event(indio_dev, tmp,
830829
iio_get_time_ns(indio_dev));
831830
} else if (val <= st->cell_threshlow) {
832-
u64 tmp = IIO_EVENT_CODE(IIO_VOLTAGE, 1, 0,
833-
IIO_EV_DIR_FALLING,
834-
IIO_EV_TYPE_THRESH,
835-
0, 0, 0);
831+
u64 tmp = IIO_DIFF_EVENT_CODE(IIO_VOLTAGE, 0, 0,
832+
IIO_EV_TYPE_THRESH,
833+
IIO_EV_DIR_FALLING);
836834
iio_push_event(indio_dev, tmp,
837835
iio_get_time_ns(indio_dev));
838836
}

0 commit comments

Comments
 (0)