]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio: Fix iio_channel_has_info
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Mon, 1 Jul 2013 14:20:00 +0000 (15:20 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 2 Jul 2013 21:08:20 +0000 (22:08 +0100)
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>
include/linux/iio/iio.h

index 8d171f42763261cc15f7944fd3f27f22fb003c1b..3d35b7023591facc722dc58a22e9acbb44302726 100644 (file)
@@ -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)                                         \