All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Denis Ciocca <denis.ciocca@st.com>,
	Daniel Drake <drake@endlessm.com>,
	Stephan Gerhold <stephan@gerhold.net>
Subject: [PATCH 3/5 v2] iio: accel: st_sensors: Stop copying channels
Date: Tue, 18 May 2021 01:33:20 +0200	[thread overview]
Message-ID: <20210517233322.383043-3-linus.walleij@linaro.org> (raw)
In-Reply-To: <20210517233322.383043-1-linus.walleij@linaro.org>

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 --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;
 
-- 
2.31.1


  parent reply	other threads:[~2021-05-17 23:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 23:33 [PATCH 1/5 v2] iio: st_sensors: Create extended attr macro Linus Walleij
2021-05-17 23:33 ` [PATCH 2/5 v2] iio: accel: st_sensors: Support generic mounting matrix Linus Walleij
2021-05-18 11:03   ` Andy Shevchenko
2021-05-17 23:33 ` Linus Walleij [this message]
2021-05-17 23:33 ` [PATCH 4/5 v2] iio: magnetometer: st_magn: Support mount matrix Linus Walleij
2021-05-18  9:01   ` Stephan Gerhold
2021-05-18 18:09     ` Jonathan Cameron
2021-05-18 11:05   ` Andy Shevchenko
2021-05-17 23:33 ` [PATCH 5/5 v2] iio: gyro: st_gyro: " Linus Walleij
2021-05-18 11:06   ` Andy Shevchenko
2021-05-18 18:06   ` Jonathan Cameron
2021-05-18  9:04 ` [PATCH 1/5 v2] iio: st_sensors: Create extended attr macro Andy Shevchenko
2021-05-18 11:07 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210517233322.383043-3-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=denis.ciocca@st.com \
    --cc=drake@endlessm.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=stephan@gerhold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.