iio: light: adux1020: make use of regmap_clear_bits(), regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-28-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
0e59dc9e6b
commit
1131f1e720
@ -539,9 +539,8 @@ static int adux1020_write_event_config(struct iio_dev *indio_dev,
|
||||
* Trigger proximity interrupt when the intensity is above
|
||||
* or below threshold
|
||||
*/
|
||||
ret = regmap_update_bits(data->regmap, ADUX1020_REG_PROX_TYPE,
|
||||
ADUX1020_PROX_TYPE,
|
||||
ADUX1020_PROX_TYPE);
|
||||
ret = regmap_set_bits(data->regmap, ADUX1020_REG_PROX_TYPE,
|
||||
ADUX1020_PROX_TYPE);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
@ -748,8 +747,8 @@ static int adux1020_chip_init(struct adux1020_data *data)
|
||||
|
||||
dev_dbg(&client->dev, "Detected ADUX1020 with chip id: 0x%04x\n", val);
|
||||
|
||||
ret = regmap_update_bits(data->regmap, ADUX1020_REG_SW_RESET,
|
||||
ADUX1020_SW_RESET, ADUX1020_SW_RESET);
|
||||
ret = regmap_set_bits(data->regmap, ADUX1020_REG_SW_RESET,
|
||||
ADUX1020_SW_RESET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -764,8 +763,8 @@ static int adux1020_chip_init(struct adux1020_data *data)
|
||||
return ret;
|
||||
|
||||
/* Use LED_IREF for proximity mode */
|
||||
ret = regmap_update_bits(data->regmap, ADUX1020_REG_LED_CURRENT,
|
||||
ADUX1020_LED_PIREF_EN, 0);
|
||||
ret = regmap_clear_bits(data->regmap, ADUX1020_REG_LED_CURRENT,
|
||||
ADUX1020_LED_PIREF_EN);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user