summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorBrian Masney2017-01-17 10:24:50 +0100
committerJonathan Cameron2017-01-22 14:21:32 +0100
commitb44b1f3193ff8f442c844035815d7b2ebc26366b (patch)
tree346aa56392fae33ce4f6d31b7aff8a20c648126a /drivers/staging/iio
parentstaging: iio: isl29028: fix alignment of function arguments (diff)
downloadkernel-qcow2-linux-b44b1f3193ff8f442c844035815d7b2ebc26366b.tar.gz
kernel-qcow2-linux-b44b1f3193ff8f442c844035815d7b2ebc26366b.tar.xz
kernel-qcow2-linux-b44b1f3193ff8f442c844035815d7b2ebc26366b.zip
staging: iio: isl29028: combine isl29028_proxim_get() and isl29028_read_proxim()
isl29028_proxim_get() checks to see if the promixity needs to be enabled on the chip and then calls isl29028_read_proxim(). There are no other callers of isl29028_read_proxim(). The naming between these two functions can be confusing so this patch combines the two to avoid the confusion. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/light/isl29028.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c
index 50a208f368ed..dcec32dc9765 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -201,6 +201,13 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox)
unsigned int data;
int ret;
+ if (!chip->enable_prox) {
+ ret = isl29028_enable_proximity(chip, true);
+ if (ret < 0)
+ return ret;
+ chip->enable_prox = true;
+ }
+
ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, &data);
if (ret < 0) {
dev_err(dev, "Error in reading register %d, error %d\n",
@@ -211,19 +218,6 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox)
return 0;
}
-static int isl29028_proxim_get(struct isl29028_chip *chip, int *prox_data)
-{
- int ret;
-
- if (!chip->enable_prox) {
- ret = isl29028_enable_proximity(chip, true);
- if (ret < 0)
- return ret;
- chip->enable_prox = true;
- }
- return isl29028_read_proxim(chip, prox_data);
-}
-
static int isl29028_als_get(struct isl29028_chip *chip, int *als_data)
{
struct device *dev = regmap_get_device(chip->regmap);
@@ -349,7 +343,7 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
ret = isl29028_ir_get(chip, val);
break;
case IIO_PROXIMITY:
- ret = isl29028_proxim_get(chip, val);
+ ret = isl29028_read_proxim(chip, val);
break;
default:
break;