linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/14] Use devm helpers for regulator get and enable
@ 2022-08-19 19:16 Matti Vaittinen
  2022-08-19 19:17 ` [PATCH v3 01/14] docs: devres: regulator: Add new get_enable functions to devres.rst Matti Vaittinen
                   ` (14 more replies)
  0 siblings, 15 replies; 65+ messages in thread
From: Matti Vaittinen @ 2022-08-19 19:16 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: Jonathan Corbet, Michael Turquette, Stephen Boyd, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Lars-Peter Clausen,
	Alexandru Tachici, Jonathan Cameron, Nuno Sá,
	Lorenzo Bianconi, Liam Girdwood, Mark Brown, Matti Vaittinen,
	Aswath Govindraju, Peter Rosin, Andy Shevchenko, Johan Hovold,
	Alexandru Ardelean, Cai Huoqing, Alexandru Lazar, Miaoqian Lin,
	Xiang wangx, linux-doc, linux-kernel, linux-clk, dri-devel,
	linux-amlogic, linux-arm-kernel, linux-hwmon, linux-iio

[-- Attachment #1: Type: text/plain, Size: 3972 bytes --]

Use devm helpers for regulator get and enable

NOTE: The series depends on commit
ee94aff2628b ("Devm helpers for regulator get and enable")
which currently sits in Mark's regulator/for-next

A few* drivers seem to pattern demonstrated by pseudocode:

- devm_regulator_get()
- regulator_enable()
- devm_add_action_or_reset(regulator_disable())

devm helpers for this pattern were added to remove bunch of code from
drivers. Typically following:

- replace 3 calls (devm_regulator_get[_optional](), regulator_enable(),
  devm_add_action_or_reset()) with just one
  (devm_regulator_get_enable[_optional]()).
- drop disable callback.

I believe this simplifies things by removing some dublicated code.

This series reowrks a few drivers. There is still plenty of fish in the
sea for people who like to improve the code (or count the beans ;]).

Finally - most of the converted drivers have not been tested (other than
compile-tested) due to lack of HW. All reviews and testing is _highly_
appreciated (as always!).

Revision history:

v3:
	- Drop already applied helper patches
	- Add a few more drivers

RFCv1 => v2:
	- Add devm_regulator_bulk_get_enable() and
	  devm_regulator_bulk_put()
	- Convert a couple of drivers to use the new
	  devm_regulator_bulk_get_enable().
	- Squash all IIO patches into one.

Patch 1:
	Add new devm-helper APIs to docs.
Patch 2:
	simplified CLK driver(s)
Patch 3:
	simplified GPU driver(s)
Patch 4 - 5:
	simplified hwmon driver(s)
Patch 6 - 14:
	simplified IIO driver(s)

---

Matti Vaittinen (14):
  docs: devres: regulator: Add new get_enable functions to devres.rst
  clk: cdce925: simplify using devm_regulator_get_enable()
  gpu: drm: simplify drivers using devm_regulator_*get_enable*()
  hwmon: lm90: simplify using devm_regulator_get_enable()
  hwmon: adm1177: simplify using devm_regulator_get_enable()
  iio: ad7192: Simplify using devm_regulator_get_enable()
  iio: ltc2688: Simplify using devm_regulator_*get_enable()
  iio: bmg160_core: Simplify using devm_regulator_*get_enable()
  iio: st_lsm6dsx: Simplify using devm_regulator_*get_enable()
  iio: ad7476: simplify using devm_regulator_get_enable()
  iio: ad7606: simplify using devm_regulator_get_enable()
  iio: max1241: simplify using devm_regulator_get_enable()
  iio: max1363: simplify using devm_regulator_get_enable()
  iio: hmc425a: simplify using devm_regulator_get_enable()

 .../driver-api/driver-model/devres.rst        |  4 +++
 drivers/clk/clk-cdce925.c                     | 21 +++----------
 drivers/gpu/drm/bridge/sii902x.c              | 22 ++------------
 drivers/gpu/drm/meson/meson_dw_hdmi.c         | 23 ++------------
 drivers/hwmon/adm1177.c                       | 27 ++---------------
 drivers/hwmon/lm90.c                          | 15 ++--------
 drivers/iio/adc/ad7192.c                      | 15 ++--------
 drivers/iio/adc/ad7476.c                      | 11 +------
 drivers/iio/adc/ad7606.c                      | 22 ++------------
 drivers/iio/adc/ad7606.h                      |  1 -
 drivers/iio/adc/max1241.c                     | 28 ++---------------
 drivers/iio/adc/max1363.c                     | 11 +------
 drivers/iio/amplifiers/hmc425a.c              | 17 +----------
 drivers/iio/dac/ltc2688.c                     | 23 ++------------
 drivers/iio/gyro/bmg160_core.c                | 24 ++-------------
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h       |  2 --
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  | 30 ++++---------------
 17 files changed, 41 insertions(+), 255 deletions(-)

-- 
2.37.1


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 65+ messages in thread

end of thread, other threads:[~2022-10-17 23:08 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 19:16 [PATCH v3 00/14] Use devm helpers for regulator get and enable Matti Vaittinen
2022-08-19 19:17 ` [PATCH v3 01/14] docs: devres: regulator: Add new get_enable functions to devres.rst Matti Vaittinen
2022-08-19 19:17 ` [PATCH v3 02/14] clk: cdce925: simplify using devm_regulator_get_enable() Matti Vaittinen
2022-10-17 23:07   ` Stephen Boyd
2022-08-19 19:18 ` [PATCH v3 03/14] gpu: drm: simplify drivers using devm_regulator_*get_enable*() Matti Vaittinen
2022-08-29 14:25   ` Robert Foss
2022-08-30  7:04     ` Matti Vaittinen
2022-08-19 19:18 ` [PATCH v3 04/14] hwmon: lm90: simplify using devm_regulator_get_enable() Matti Vaittinen
2022-08-19 19:18 ` [PATCH v3 05/14] hwmon: adm1177: " Matti Vaittinen
2022-08-19 19:36   ` Guenter Roeck
2022-08-19 19:19 ` [PATCH v3 06/14] iio: ad7192: Simplify " Matti Vaittinen
2022-10-16 15:59   ` Jonathan Cameron
2022-08-19 19:19 ` [PATCH v3 07/14] iio: ltc2688: Simplify using devm_regulator_*get_enable() Matti Vaittinen
2022-08-20 11:21   ` Jonathan Cameron
2022-08-20 13:38     ` Matti Vaittinen
2022-08-20 16:09       ` Andy Shevchenko
2022-08-20 17:30         ` Matti Vaittinen
2022-08-20 17:41           ` Andy Shevchenko
2022-08-20 19:00             ` Matti Vaittinen
2022-08-21 13:13               ` Andy Shevchenko
2022-08-22  8:13                 ` Vaittinen, Matti
2022-08-22 19:14                   ` Jonathan Cameron
2022-08-30 11:34   ` Sa, Nuno
2022-10-16 16:04   ` Jonathan Cameron
2022-08-19 19:19 ` [PATCH v3 08/14] iio: bmg160_core: " Matti Vaittinen
2022-08-19 23:30   ` Andy Shevchenko
2022-08-20  6:19     ` Vaittinen, Matti
2022-08-20  6:25       ` Andy Shevchenko
2022-08-20  6:48         ` Vaittinen, Matti
2022-08-20  7:18           ` Andy Shevchenko
2022-08-20 10:05             ` Matti Vaittinen
2022-08-20 16:21               ` Andy Shevchenko
2022-08-20 17:27                 ` Matti Vaittinen
2022-08-21 13:08                   ` Andy Shevchenko
2022-08-22  5:50                     ` Vaittinen, Matti
2022-08-20 11:38       ` Jonathan Cameron
2022-08-20 13:20         ` Matti Vaittinen
2022-08-20 11:22   ` Jonathan Cameron
2022-08-20 13:26     ` Matti Vaittinen
2022-10-16 16:08   ` Jonathan Cameron
2022-10-17  4:28     ` Matti Vaittinen
2022-08-19 19:19 ` [PATCH v3 09/14] iio: st_lsm6dsx: " Matti Vaittinen
2022-10-16 16:11   ` Jonathan Cameron
2022-08-19 19:20 ` [PATCH v3 10/14] iio: ad7476: simplify using devm_regulator_get_enable() Matti Vaittinen
2022-08-30 11:44   ` Sa, Nuno
2022-10-16 16:12     ` Jonathan Cameron
2022-08-19 19:20 ` [PATCH v3 11/14] iio: ad7606: " Matti Vaittinen
2022-08-30 11:46   ` Sa, Nuno
2022-08-30 12:54     ` Matti Vaittinen
2022-10-16 16:15       ` Jonathan Cameron
2022-10-16 16:24         ` Jonathan Cameron
2022-10-17  4:32           ` Matti Vaittinen
2022-08-19 19:20 ` [PATCH v3 12/14] iio: max1241: " Matti Vaittinen
2022-08-19 19:58   ` Alexandru Lazar
2022-10-16 16:17     ` Jonathan Cameron
2022-08-19 19:20 ` [PATCH v3 13/14] iio: max1363: " Matti Vaittinen
2022-08-30 11:50   ` Sa, Nuno
2022-10-16 16:18     ` Jonathan Cameron
2022-10-16 16:37       ` Jonathan Cameron
2022-08-19 19:21 ` [PATCH v3 14/14] iio: hmc425a: " Matti Vaittinen
2022-08-30 11:49   ` Sa, Nuno
2022-08-30 13:00     ` Matti Vaittinen
2022-08-30 13:55       ` Sa, Nuno
2022-10-16 16:20         ` Jonathan Cameron
2022-08-19 23:27 ` [PATCH v3 00/14] Use devm helpers for regulator get and enable Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).