| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * STMicroelectronics sensors buffer library driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2012-2013 STMicroelectronics Inc. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Denis Ciocca <denis.ciocca@st.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * Licensed under the GPL-2. |
|---|
| 9 | 8 | */ |
|---|
| 10 | 9 | |
|---|
| 11 | 10 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 18 | 17 | #include <linux/iio/trigger_consumer.h> |
|---|
| 19 | 18 | #include <linux/iio/triggered_buffer.h> |
|---|
| 20 | 19 | #include <linux/irqreturn.h> |
|---|
| 20 | +#include <linux/regmap.h> |
|---|
| 21 | 21 | |
|---|
| 22 | 22 | #include <linux/iio/common/st_sensors.h> |
|---|
| 23 | 23 | |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | static int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf) |
|---|
| 26 | 26 | { |
|---|
| 27 | | - int i; |
|---|
| 28 | 27 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
|---|
| 29 | 28 | unsigned int num_data_channels = sdata->num_data_channels; |
|---|
| 29 | + int i; |
|---|
| 30 | 30 | |
|---|
| 31 | 31 | for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) { |
|---|
| 32 | 32 | const struct iio_chan_spec *channel = &indio_dev->channels[i]; |
|---|
| .. | .. |
|---|
| 37 | 37 | channel->scan_type.storagebits >> 3; |
|---|
| 38 | 38 | |
|---|
| 39 | 39 | buf = PTR_ALIGN(buf, storage_bytes); |
|---|
| 40 | | - if (sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev, |
|---|
| 41 | | - channel->address, |
|---|
| 42 | | - bytes_to_read, buf, |
|---|
| 43 | | - sdata->multiread_bit) < |
|---|
| 44 | | - bytes_to_read) |
|---|
| 40 | + if (regmap_bulk_read(sdata->regmap, channel->address, |
|---|
| 41 | + buf, bytes_to_read) < 0) |
|---|
| 45 | 42 | return -EIO; |
|---|
| 46 | 43 | |
|---|
| 47 | 44 | /* Advance the buffer pointer */ |
|---|