[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <afb895b597037a635acc4a1dc44b88598268a19b.1637592133.git.geert+renesas@glider.be>
Date: Mon, 22 Nov 2021 16:54:00 +0100
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: Tony Lindgren <tony@...mide.com>,
Russell King <linux@...linux.org.uk>,
Rajendra Nayak <rnayak@...eaurora.org>,
Paul Walmsley <paul@...an.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
Tero Kristo <kristo@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Lorenzo Bianconi <lorenzo.bianconi83@...il.com>,
Benoit Parrot <bparrot@...com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Andrew Jeffery <andrew@...id.au>,
Ulf Hansson <ulf.hansson@...aro.org>,
Joel Stanley <joel@....id.au>,
Ping-Ke Shih <pkshih@...ltek.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Magnus Damm <magnus.damm@...il.com>,
Eduardo Valentin <edubezval@...il.com>,
Keerthy <j-keerthy@...com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amitk@...nel.org>,
Zhang Rui <rui.zhang@...el.com>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-omap@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, linux-iio@...r.kernel.org,
linux-media@...r.kernel.org, linux-mmc@...r.kernel.org,
linux-aspeed@...ts.ozlabs.org, openbmc@...ts.ozlabs.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-pm@...r.kernel.org,
alsa-devel@...a-project.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH/RFC 07/17] iio: st_sensors: Use bitfield helpers
Use the field_prep() helper, instead of open-coding the same operation.
Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
Compile-tested only.
Marked RFC, as this depends on [PATCH 01/17], but follows a different
path to upstream.
---
drivers/iio/common/st_sensors/st_sensors_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 1de395bda03eb6d3..b11c3f474d299b96 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -7,6 +7,7 @@
* Denis Ciocca <denis.ciocca@...com>
*/
+#include <linux/bitfield.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -26,8 +27,8 @@ int st_sensors_write_data_with_mask(struct iio_dev *indio_dev,
{
struct st_sensor_data *sdata = iio_priv(indio_dev);
- return regmap_update_bits(sdata->regmap,
- reg_addr, mask, data << __ffs(mask));
+ return regmap_update_bits(sdata->regmap, reg_addr, mask,
+ field_prep(mask, data));
}
int st_sensors_debugfs_reg_access(struct iio_dev *indio_dev,
--
2.25.1
Powered by blists - more mailing lists