Skip to content

Commit

Permalink
staging: iio: light: isl29028: fix correct mask value
Browse files Browse the repository at this point in the history
The mask value in the read_raw/write_raw is absolute
value, not the bit position value.
Fixing this in the implemented function to check value,
not with the bit position value.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Laxman Dewangan authored and Greg Kroah-Hartman committed Apr 18, 2012
1 parent c5714b5 commit 892cb6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/staging/iio/light/isl29028.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
mutex_lock(&chip->lock);
switch (chan->type) {
case IIO_PROXIMITY:
if (mask != IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT) {
if (mask != IIO_CHAN_INFO_SAMP_FREQ) {
dev_err(chip->dev,
"proximity: mask value 0x%08lx not supported\n",
mask);
Expand All @@ -294,7 +294,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
break;

case IIO_LIGHT:
if (mask != IIO_CHAN_INFO_SCALE_SEPARATE_BIT) {
if (mask != IIO_CHAN_INFO_SCALE) {
dev_err(chip->dev,
"light: mask value 0x%08lx not supported\n",
mask);
Expand Down Expand Up @@ -349,14 +349,14 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
ret = IIO_VAL_INT;
break;

case IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT:
case IIO_CHAN_INFO_SAMP_FREQ:
if (chan->type != IIO_PROXIMITY)
break;
*val = chip->prox_sampling;
ret = IIO_VAL_INT;
break;

case IIO_CHAN_INFO_SCALE_SEPARATE_BIT:
case IIO_CHAN_INFO_SCALE:
if (chan->type != IIO_LIGHT)
break;
*val = chip->lux_scale;
Expand Down

0 comments on commit 892cb6d

Please sign in to comment.