Skip to content

Commit

Permalink
iio:adc:ad799x: Return more meaningful event enabled state
Browse files Browse the repository at this point in the history
only report an event as enabled if it actually is enabled

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Peter Meerwald authored and Jonathan Cameron committed Jul 13, 2014
1 parent 8235841 commit 1d15330
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/iio/adc/ad799x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1d15330

Please sign in to comment.