From: Jonathan Cameron Date: Wed, 18 May 2011 13:42:13 +0000 (+0100) Subject: staging:iio:adc:ad7150 fix event codes. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d91a0ab06ca27ec552233b5225e80661125fe1b2;p=linux-beck.git staging:iio:adc:ad7150 fix event codes. I won't guarantee I got these right, but they are certainly closer than the abuse of buffer event codes that was perviously in here. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c index cbd1f96188c3..e23bb9960019 100644 --- a/drivers/staging/iio/adc/ad7150.c +++ b/drivers/staging/iio/adc/ad7150.c @@ -642,11 +642,6 @@ static const struct attribute_group ad7150_attribute_group = { * threshold events */ -#define IIO_EVENT_CODE_CH1_HIGH IIO_BUFFER_EVENT_CODE(0) -#define IIO_EVENT_CODE_CH1_LOW IIO_BUFFER_EVENT_CODE(1) -#define IIO_EVENT_CODE_CH2_HIGH IIO_BUFFER_EVENT_CODE(2) -#define IIO_EVENT_CODE_CH2_LOW IIO_BUFFER_EVENT_CODE(3) - static irqreturn_t ad7150_event_handler(int irq, void *private) { struct iio_dev *indio_dev = private; @@ -658,21 +653,33 @@ static irqreturn_t ad7150_event_handler(int irq, void *private) if ((int_status & AD7150_STATUS_OUT1) && !(chip->old_state & AD7150_STATUS_OUT1)) iio_push_event(indio_dev, 0, - IIO_EVENT_CODE_CH1_HIGH, + IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), timestamp); else if ((!(int_status & AD7150_STATUS_OUT1)) && (chip->old_state & AD7150_STATUS_OUT1)) iio_push_event(indio_dev, 0, - IIO_EVENT_CODE_CH1_LOW, - timestamp); + IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, + 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), + timestamp); if ((int_status & AD7150_STATUS_OUT2) && !(chip->old_state & AD7150_STATUS_OUT2)) iio_push_event(indio_dev, 0, - IIO_EVENT_CODE_CH2_HIGH, - timestamp); + IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, + 1, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), + timestamp); else if ((!(int_status & AD7150_STATUS_OUT2)) && (chip->old_state & AD7150_STATUS_OUT2)) iio_push_event(indio_dev, 0, - IIO_EVENT_CODE_CH2_LOW, - timestamp); + IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, + 1, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), + timestamp); return IRQ_HANDLED; }