diff mbox series

[3/5,v2] iio: accel: st_sensors: Stop copying channels

Message ID 20210517233322.383043-3-linus.walleij@linaro.org (mailing list archive)
State Superseded
Headers show
Series [1/5,v2] iio: st_sensors: Create extended attr macro | expand

Commit Message

Linus Walleij May 17, 2021, 11:33 p.m. UTC
The channels were copied only so that the .ext_info member should become
assignable. We now have compile-time static assignment so drop this code.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Daniel Drake <drake@endlessm.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Improvement found by Stephan.
---
 drivers/iio/accel/st_accel_core.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 8044b8ae7ead..fa06a3ef84e7 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -1247,8 +1247,6 @@  int st_accel_common_probe(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *adata = iio_priv(indio_dev);
 	struct st_sensors_platform_data *pdata = dev_get_platdata(adata->dev);
-	struct iio_chan_spec *channels;
-	size_t channels_size;
 	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
@@ -1263,17 +1261,9 @@  int st_accel_common_probe(struct iio_dev *indio_dev)
 		goto st_accel_power_off;
 
 	adata->num_data_channels = ST_ACCEL_NUMBER_DATA_CHANNELS;
+	indio_dev->channels = adata->sensor_settings->ch;
 	indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;
 
-	channels_size = indio_dev->num_channels * sizeof(struct iio_chan_spec);
-	channels = devm_kmemdup(&indio_dev->dev,
-				adata->sensor_settings->ch,
-				channels_size, GFP_KERNEL);
-	if (!channels) {
-		err = -ENOMEM;
-		goto st_accel_power_off;
-	}
-
 	/* First try ACPI orientation then try the generic function */
 	err = apply_acpi_orientation(indio_dev);
 	if (err) {
@@ -1283,7 +1273,6 @@  int st_accel_common_probe(struct iio_dev *indio_dev)
 			goto st_accel_power_off;
 	}
 
-	indio_dev->channels = channels;
 	adata->current_fullscale = &adata->sensor_settings->fs.fs_avl[0];
 	adata->odr = adata->sensor_settings->odr.odr_avl[0].hz;