Re: [PATCH v3 11/12] iio:adc:ad799x: Return more meaningful event enabled state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/12/2014 06:54 AM, Peter Meerwald wrote:
only report an event as enabled if it actually is enabled

Signed-off-by: Peter Meerwald <pmeerw@xxxxxxxxxx>

Acked-by: Lars-Peter Clausen <lars@xxxxxxxxxx>

Thanks.

---
  drivers/iio/adc/ad799x.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index abc36c8..08bcada3 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -364,7 +364,15 @@ static int ad799x_read_event_config(struct iio_dev *indio_dev,
  				    enum iio_event_type type,
  				    enum iio_event_direction dir)
  {
-	return 1;
+	struct ad799x_state *st = iio_priv(indio_dev);
+
+	if (!(st->config & AD7998_ALERT_EN))
+		return 0;
+
+	if ((st->config >> AD799X_CHANNEL_SHIFT) & BIT(chan->scan_index))
+		return 1;
+
+	return 0;
  }

  static unsigned int ad799x_threshold_reg(const struct iio_chan_spec *chan,


--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux