summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorBrian Masney <masneyb@onstation.org>2018-04-20 20:41:44 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-04-28 16:17:59 +0100
commitd8e24a31cc537f77b56ad21aa048078783907e22 (patch)
tree7f1246d55d2cc6a95e38617ade8734258633e73d /drivers/staging
parent3605dfb8510c52b3b2b5e0390cba29d54847a7b7 (diff)
staging: iio: tsl2x7x: simplify tsl2x7x_clear_interrupts function
tsl2x7x_clear_interrupts() takes a reg argument but there are only two callers to this function and both callers pass the same value. Since this function was introduced, interrupts are now working properly for this driver, and several unnecessary calls to tsl2x7x_clear_interrupts() were removed. This patch removes the tsl2x7x_clear_interrupts() function and replaces the two callers with the i2c_smbus_write_byte() call instead. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/iio/light/tsl2x7x.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
index 955a08e57cf3..bc884dca4f41 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -279,20 +279,6 @@ static const u8 device_channel_config[] = {
ALSPRX2
};
-static int tsl2x7x_clear_interrupts(struct tsl2X7X_chip *chip, int reg)
-{
- int ret;
-
- ret = i2c_smbus_write_byte(chip->client,
- TSL2X7X_CMD_REG | TSL2X7X_CMD_SPL_FN | reg);
- if (ret < 0)
- dev_err(&chip->client->dev,
- "%s: failed to clear interrupt status %x: %d\n",
- __func__, reg, ret);
-
- return ret;
-}
-
static int tsl2x7x_read_status(struct tsl2X7X_chip *chip)
{
int ret;
@@ -722,9 +708,15 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
if (ret < 0)
return ret;
- ret = tsl2x7x_clear_interrupts(chip, TSL2X7X_CMD_PROXALS_INT_CLR);
- if (ret < 0)
+ ret = i2c_smbus_write_byte(chip->client,
+ TSL2X7X_CMD_REG | TSL2X7X_CMD_SPL_FN |
+ TSL2X7X_CMD_PROXALS_INT_CLR);
+ if (ret < 0) {
+ dev_err(&chip->client->dev,
+ "%s: failed to clear interrupt status: %d\n",
+ __func__, ret);
return ret;
+ }
chip->tsl2x7x_chip_status = TSL2X7X_CHIP_WORKING;
@@ -1349,7 +1341,13 @@ static irqreturn_t tsl2x7x_event_handler(int irq, void *private)
timestamp);
}
- tsl2x7x_clear_interrupts(chip, TSL2X7X_CMD_PROXALS_INT_CLR);
+ ret = i2c_smbus_write_byte(chip->client,
+ TSL2X7X_CMD_REG | TSL2X7X_CMD_SPL_FN |
+ TSL2X7X_CMD_PROXALS_INT_CLR);
+ if (ret < 0)
+ dev_err(&chip->client->dev,
+ "%s: failed to clear interrupt status: %d\n",
+ __func__, ret);
return IRQ_HANDLED;
}