Commit a0722d05 authored by Brian Masney's avatar Brian Masney Committed by Jonathan Cameron

staging: iio: tsl2x7x: convert mutex_trylock() to mutex_lock()

The driver uses mutex_lock() and mutex_trylock() in several places.
Convert the mutex_trylock() to mutex_lock() for consistency with other
IIO light drivers in mainline.
Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f5d9bca6
...@@ -350,8 +350,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) ...@@ -350,8 +350,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev)
u32 ch0lux = 0; u32 ch0lux = 0;
u32 ch1lux = 0; u32 ch1lux = 0;
if (mutex_trylock(&chip->als_mutex) == 0) mutex_lock(&chip->als_mutex);
return chip->als_cur_info.lux; /* busy, so return LAST VALUE */
if (chip->tsl2x7x_chip_status != TSL2X7X_CHIP_WORKING) { if (chip->tsl2x7x_chip_status != TSL2X7X_CHIP_WORKING) {
/* device is not enabled */ /* device is not enabled */
...@@ -478,11 +477,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev) ...@@ -478,11 +477,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev)
u8 chdata[2]; u8 chdata[2];
struct tsl2X7X_chip *chip = iio_priv(indio_dev); struct tsl2X7X_chip *chip = iio_priv(indio_dev);
if (mutex_trylock(&chip->prox_mutex) == 0) { mutex_lock(&chip->prox_mutex);
dev_err(&chip->client->dev,
"%s: Can't get prox mutex\n", __func__);
return -EBUSY;
}
ret = tsl2x7x_read_status(chip); ret = tsl2x7x_read_status(chip);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment