Skip to content

Commit

Permalink
iio: Fix iio_channel_has_info
Browse files Browse the repository at this point in the history
Since the info_mask split, iio_channel_has_info() is not working correctly.
info_mask_separate and info_mask_shared_by_type, it is not possible to compare
them directly with the iio_chan_info_enum enum. Correct that bit using the BIT()
macro.

Cc: <stable@vger.kernel.org> # 3.10.x
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Alexandre Belloni authored and Jonathan Cameron committed Jul 2, 2013
1 parent 8bade40 commit 1c297a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/iio/iio.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ struct iio_chan_spec {
static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
enum iio_chan_info_enum type)
{
return (chan->info_mask_separate & type) |
(chan->info_mask_shared_by_type & type);
return (chan->info_mask_separate & BIT(type)) |
(chan->info_mask_shared_by_type & BIT(type));
}

#define IIO_ST(si, rb, sb, sh) \
Expand Down

0 comments on commit 1c297a6

Please sign in to comment.