All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Use devm helpers for regulator get and enable
@ 2022-10-21 13:17 ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:17 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

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

Simplify couple of drivers by using the new devm_regulator_*get_enable*()

These patches were previously part of the series:
https://lore.kernel.org/lkml/cover.1660934107.git.mazziesaccount@gmail.com/
"Devm helpers for regulator get and enable". I did keep the patch series
versioning even though I changed the series name (subject of this mail)
to "Use devm helpers for regulator get and enable". Name was changed
because the devm helpers are already in 6.1-rc1.

Also, most of the patches in the series are already merged to subsystem
trees so this series now contains only the patches that have not yet
been merged. I hope they can be now directly taken sirectly into
respective subsystem trees as the dependencies should be in v6.1-rc1.

Please note that these changes are only compile-tested as I don't have
the HW to do proper testing. Thus, reviewing / testing is highly
appreciated.

Revision history:

v3 => v4:
	- Drop applied patches
	- rewrite cover-letter
	- rebase on v6.1-rc1
	- split meson and sii902x into own patches as requested.
	- slightly modify dev_err_probe() return in sii902x.

---

Matti Vaittinen (4):
  gpu: drm: meson: Use devm_regulator_*get_enable*()
  gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  hwmon: lm90: simplify using devm_regulator_get_enable()
  hwmon: adm1177: simplify using devm_regulator_get_enable()

 drivers/gpu/drm/bridge/sii902x.c      | 26 ++++----------------------
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 drivers/hwmon/adm1177.c               | 27 +++------------------------
 drivers/hwmon/lm90.c                  | 20 ++------------------
 4 files changed, 12 insertions(+), 84 deletions(-)


base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
-- 
2.37.3


-- 
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] 60+ messages in thread

* [PATCH v4 0/4] Use devm helpers for regulator get and enable
@ 2022-10-21 13:17 ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:17 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare, linux-hwmon,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, Andrzej Hajda,
	linux-amlogic, Jerome Brunet, Guenter Roeck, Laurent Pinchart

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

Simplify couple of drivers by using the new devm_regulator_*get_enable*()

These patches were previously part of the series:
https://lore.kernel.org/lkml/cover.1660934107.git.mazziesaccount@gmail.com/
"Devm helpers for regulator get and enable". I did keep the patch series
versioning even though I changed the series name (subject of this mail)
to "Use devm helpers for regulator get and enable". Name was changed
because the devm helpers are already in 6.1-rc1.

Also, most of the patches in the series are already merged to subsystem
trees so this series now contains only the patches that have not yet
been merged. I hope they can be now directly taken sirectly into
respective subsystem trees as the dependencies should be in v6.1-rc1.

Please note that these changes are only compile-tested as I don't have
the HW to do proper testing. Thus, reviewing / testing is highly
appreciated.

Revision history:

v3 => v4:
	- Drop applied patches
	- rewrite cover-letter
	- rebase on v6.1-rc1
	- split meson and sii902x into own patches as requested.
	- slightly modify dev_err_probe() return in sii902x.

---

Matti Vaittinen (4):
  gpu: drm: meson: Use devm_regulator_*get_enable*()
  gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  hwmon: lm90: simplify using devm_regulator_get_enable()
  hwmon: adm1177: simplify using devm_regulator_get_enable()

 drivers/gpu/drm/bridge/sii902x.c      | 26 ++++----------------------
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 drivers/hwmon/adm1177.c               | 27 +++------------------------
 drivers/hwmon/lm90.c                  | 20 ++------------------
 4 files changed, 12 insertions(+), 84 deletions(-)


base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
-- 
2.37.3


-- 
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] 60+ messages in thread

* [PATCH v4 0/4] Use devm helpers for regulator get and enable
@ 2022-10-21 13:17 ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:17 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2143 bytes --]

Simplify couple of drivers by using the new devm_regulator_*get_enable*()

These patches were previously part of the series:
https://lore.kernel.org/lkml/cover.1660934107.git.mazziesaccount@gmail.com/
"Devm helpers for regulator get and enable". I did keep the patch series
versioning even though I changed the series name (subject of this mail)
to "Use devm helpers for regulator get and enable". Name was changed
because the devm helpers are already in 6.1-rc1.

Also, most of the patches in the series are already merged to subsystem
trees so this series now contains only the patches that have not yet
been merged. I hope they can be now directly taken sirectly into
respective subsystem trees as the dependencies should be in v6.1-rc1.

Please note that these changes are only compile-tested as I don't have
the HW to do proper testing. Thus, reviewing / testing is highly
appreciated.

Revision history:

v3 => v4:
	- Drop applied patches
	- rewrite cover-letter
	- rebase on v6.1-rc1
	- split meson and sii902x into own patches as requested.
	- slightly modify dev_err_probe() return in sii902x.

---

Matti Vaittinen (4):
  gpu: drm: meson: Use devm_regulator_*get_enable*()
  gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  hwmon: lm90: simplify using devm_regulator_get_enable()
  hwmon: adm1177: simplify using devm_regulator_get_enable()

 drivers/gpu/drm/bridge/sii902x.c      | 26 ++++----------------------
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 drivers/hwmon/adm1177.c               | 27 +++------------------------
 drivers/hwmon/lm90.c                  | 20 ++------------------
 4 files changed, 12 insertions(+), 84 deletions(-)


base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 0/4] Use devm helpers for regulator get and enable
@ 2022-10-21 13:17 ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:17 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2143 bytes --]

Simplify couple of drivers by using the new devm_regulator_*get_enable*()

These patches were previously part of the series:
https://lore.kernel.org/lkml/cover.1660934107.git.mazziesaccount@gmail.com/
"Devm helpers for regulator get and enable". I did keep the patch series
versioning even though I changed the series name (subject of this mail)
to "Use devm helpers for regulator get and enable". Name was changed
because the devm helpers are already in 6.1-rc1.

Also, most of the patches in the series are already merged to subsystem
trees so this series now contains only the patches that have not yet
been merged. I hope they can be now directly taken sirectly into
respective subsystem trees as the dependencies should be in v6.1-rc1.

Please note that these changes are only compile-tested as I don't have
the HW to do proper testing. Thus, reviewing / testing is highly
appreciated.

Revision history:

v3 => v4:
	- Drop applied patches
	- rewrite cover-letter
	- rebase on v6.1-rc1
	- split meson and sii902x into own patches as requested.
	- slightly modify dev_err_probe() return in sii902x.

---

Matti Vaittinen (4):
  gpu: drm: meson: Use devm_regulator_*get_enable*()
  gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  hwmon: lm90: simplify using devm_regulator_get_enable()
  hwmon: adm1177: simplify using devm_regulator_get_enable()

 drivers/gpu/drm/bridge/sii902x.c      | 26 ++++----------------------
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 drivers/hwmon/adm1177.c               | 27 +++------------------------
 drivers/hwmon/lm90.c                  | 20 ++------------------
 4 files changed, 12 insertions(+), 84 deletions(-)


base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-10-21 13:17 ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 13:18   ` Matti Vaittinen
  -1 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

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

Simplify using the devm_regulator_get_enable_optional(). Also drop the
seemingly unused struct member 'hdmi_supply'.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>

---
v3 => v4:
- split meson part to own patch

RFCv1 => v2:
- Change also sii902x to use devm_regulator_bulk_get_enable()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated.
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 5cd2b2ebbbd3..7642f740272b 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -140,7 +140,6 @@ struct meson_dw_hdmi {
 	struct reset_control *hdmitx_apb;
 	struct reset_control *hdmitx_ctrl;
 	struct reset_control *hdmitx_phy;
-	struct regulator *hdmi_supply;
 	u32 irq_stat;
 	struct dw_hdmi *hdmi;
 	struct drm_bridge *bridge;
@@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
 
 }
 
-static void meson_disable_regulator(void *data)
-{
-	regulator_disable(data);
-}
-
 static void meson_disable_clk(void *data)
 {
 	clk_disable_unprepare(data);
@@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	meson_dw_hdmi->data = match;
 	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
 
-	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
-	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
-		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		meson_dw_hdmi->hdmi_supply = NULL;
-	} else {
-		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
-					       meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(dev, "hdmi");
+	if (ret != -ENODEV)
+		return ret;
 
 	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
 						"hdmitx_apb");
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare, linux-hwmon,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, Andrzej Hajda,
	linux-amlogic, Jerome Brunet, Guenter Roeck, Laurent Pinchart

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

Simplify using the devm_regulator_get_enable_optional(). Also drop the
seemingly unused struct member 'hdmi_supply'.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>

---
v3 => v4:
- split meson part to own patch

RFCv1 => v2:
- Change also sii902x to use devm_regulator_bulk_get_enable()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated.
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 5cd2b2ebbbd3..7642f740272b 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -140,7 +140,6 @@ struct meson_dw_hdmi {
 	struct reset_control *hdmitx_apb;
 	struct reset_control *hdmitx_ctrl;
 	struct reset_control *hdmitx_phy;
-	struct regulator *hdmi_supply;
 	u32 irq_stat;
 	struct dw_hdmi *hdmi;
 	struct drm_bridge *bridge;
@@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
 
 }
 
-static void meson_disable_regulator(void *data)
-{
-	regulator_disable(data);
-}
-
 static void meson_disable_clk(void *data)
 {
 	clk_disable_unprepare(data);
@@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	meson_dw_hdmi->data = match;
 	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
 
-	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
-	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
-		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		meson_dw_hdmi->hdmi_supply = NULL;
-	} else {
-		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
-					       meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(dev, "hdmi");
+	if (ret != -ENODEV)
+		return ret;
 
 	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
 						"hdmitx_apb");
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2525 bytes --]

Simplify using the devm_regulator_get_enable_optional(). Also drop the
seemingly unused struct member 'hdmi_supply'.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>

---
v3 => v4:
- split meson part to own patch

RFCv1 => v2:
- Change also sii902x to use devm_regulator_bulk_get_enable()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated.
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 5cd2b2ebbbd3..7642f740272b 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -140,7 +140,6 @@ struct meson_dw_hdmi {
 	struct reset_control *hdmitx_apb;
 	struct reset_control *hdmitx_ctrl;
 	struct reset_control *hdmitx_phy;
-	struct regulator *hdmi_supply;
 	u32 irq_stat;
 	struct dw_hdmi *hdmi;
 	struct drm_bridge *bridge;
@@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
 
 }
 
-static void meson_disable_regulator(void *data)
-{
-	regulator_disable(data);
-}
-
 static void meson_disable_clk(void *data)
 {
 	clk_disable_unprepare(data);
@@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	meson_dw_hdmi->data = match;
 	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
 
-	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
-	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
-		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		meson_dw_hdmi->hdmi_supply = NULL;
-	} else {
-		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
-					       meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(dev, "hdmi");
+	if (ret != -ENODEV)
+		return ret;
 
 	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
 						"hdmitx_apb");
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2525 bytes --]

Simplify using the devm_regulator_get_enable_optional(). Also drop the
seemingly unused struct member 'hdmi_supply'.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>

---
v3 => v4:
- split meson part to own patch

RFCv1 => v2:
- Change also sii902x to use devm_regulator_bulk_get_enable()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated.
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 5cd2b2ebbbd3..7642f740272b 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -140,7 +140,6 @@ struct meson_dw_hdmi {
 	struct reset_control *hdmitx_apb;
 	struct reset_control *hdmitx_ctrl;
 	struct reset_control *hdmitx_phy;
-	struct regulator *hdmi_supply;
 	u32 irq_stat;
 	struct dw_hdmi *hdmi;
 	struct drm_bridge *bridge;
@@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
 
 }
 
-static void meson_disable_regulator(void *data)
-{
-	regulator_disable(data);
-}
-
 static void meson_disable_clk(void *data)
 {
 	clk_disable_unprepare(data);
@@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	meson_dw_hdmi->data = match;
 	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
 
-	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
-	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
-		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		meson_dw_hdmi->hdmi_supply = NULL;
-	} else {
-		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
-					       meson_dw_hdmi->hdmi_supply);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(dev, "hdmi");
+	if (ret != -ENODEV)
+		return ret;
 
 	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
 						"hdmitx_apb");
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  2022-10-21 13:17 ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 13:18   ` Matti Vaittinen
  -1 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare, linux-hwmon,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, Andrzej Hajda,
	linux-amlogic, Jerome Brunet, Guenter Roeck, Laurent Pinchart

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

Simplify using devm_regulator_bulk_get_enable()

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>

---
v3 => v4:
- split to own patch.
- return directly the value returned by the dev_err_probe()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated
---
 drivers/gpu/drm/bridge/sii902x.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 878fb7d3732b..f6e8b401069b 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -171,7 +171,6 @@ struct sii902x {
 	struct drm_connector connector;
 	struct gpio_desc *reset_gpio;
 	struct i2c_mux_core *i2cmux;
-	struct regulator_bulk_data supplies[2];
 	bool sink_is_hdmi;
 	/*
 	 * Mutex protects audio and video functions from interfering
@@ -1072,6 +1071,7 @@ static int sii902x_probe(struct i2c_client *client,
 	struct device *dev = &client->dev;
 	struct device_node *endpoint;
 	struct sii902x *sii902x;
+	static const char * const supplies[] = {"iovcc", "cvcc12"};
 	int ret;
 
 	ret = i2c_check_functionality(client->adapter,
@@ -1122,27 +1122,11 @@ static int sii902x_probe(struct i2c_client *client,
 
 	mutex_init(&sii902x->mutex);
 
-	sii902x->supplies[0].supply = "iovcc";
-	sii902x->supplies[1].supply = "cvcc12";
-	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies),
-				      sii902x->supplies);
+	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), supplies);
 	if (ret < 0)
-		return ret;
-
-	ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies),
-				    sii902x->supplies);
-	if (ret < 0) {
-		dev_err_probe(dev, ret, "Failed to enable supplies");
-		return ret;
-	}
+		return dev_err_probe(dev, ret, "Failed to enable supplies");
 
-	ret = sii902x_init(sii902x);
-	if (ret < 0) {
-		regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-				       sii902x->supplies);
-	}
-
-	return ret;
+	return sii902x_init(sii902x);
 }
 
 static void sii902x_remove(struct i2c_client *client)
@@ -1152,8 +1136,6 @@ static void sii902x_remove(struct i2c_client *client)
 
 	i2c_mux_del_adapters(sii902x->i2cmux);
 	drm_bridge_remove(&sii902x->bridge);
-	regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-			       sii902x->supplies);
 }
 
 static const struct of_device_id sii902x_dt_ids[] = {
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

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

Simplify using devm_regulator_bulk_get_enable()

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>

---
v3 => v4:
- split to own patch.
- return directly the value returned by the dev_err_probe()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated
---
 drivers/gpu/drm/bridge/sii902x.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 878fb7d3732b..f6e8b401069b 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -171,7 +171,6 @@ struct sii902x {
 	struct drm_connector connector;
 	struct gpio_desc *reset_gpio;
 	struct i2c_mux_core *i2cmux;
-	struct regulator_bulk_data supplies[2];
 	bool sink_is_hdmi;
 	/*
 	 * Mutex protects audio and video functions from interfering
@@ -1072,6 +1071,7 @@ static int sii902x_probe(struct i2c_client *client,
 	struct device *dev = &client->dev;
 	struct device_node *endpoint;
 	struct sii902x *sii902x;
+	static const char * const supplies[] = {"iovcc", "cvcc12"};
 	int ret;
 
 	ret = i2c_check_functionality(client->adapter,
@@ -1122,27 +1122,11 @@ static int sii902x_probe(struct i2c_client *client,
 
 	mutex_init(&sii902x->mutex);
 
-	sii902x->supplies[0].supply = "iovcc";
-	sii902x->supplies[1].supply = "cvcc12";
-	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies),
-				      sii902x->supplies);
+	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), supplies);
 	if (ret < 0)
-		return ret;
-
-	ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies),
-				    sii902x->supplies);
-	if (ret < 0) {
-		dev_err_probe(dev, ret, "Failed to enable supplies");
-		return ret;
-	}
+		return dev_err_probe(dev, ret, "Failed to enable supplies");
 
-	ret = sii902x_init(sii902x);
-	if (ret < 0) {
-		regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-				       sii902x->supplies);
-	}
-
-	return ret;
+	return sii902x_init(sii902x);
 }
 
 static void sii902x_remove(struct i2c_client *client)
@@ -1152,8 +1136,6 @@ static void sii902x_remove(struct i2c_client *client)
 
 	i2c_mux_del_adapters(sii902x->i2cmux);
 	drm_bridge_remove(&sii902x->bridge);
-	regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-			       sii902x->supplies);
 }
 
 static const struct of_device_id sii902x_dt_ids[] = {
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2886 bytes --]

Simplify using devm_regulator_bulk_get_enable()

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>

---
v3 => v4:
- split to own patch.
- return directly the value returned by the dev_err_probe()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated
---
 drivers/gpu/drm/bridge/sii902x.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 878fb7d3732b..f6e8b401069b 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -171,7 +171,6 @@ struct sii902x {
 	struct drm_connector connector;
 	struct gpio_desc *reset_gpio;
 	struct i2c_mux_core *i2cmux;
-	struct regulator_bulk_data supplies[2];
 	bool sink_is_hdmi;
 	/*
 	 * Mutex protects audio and video functions from interfering
@@ -1072,6 +1071,7 @@ static int sii902x_probe(struct i2c_client *client,
 	struct device *dev = &client->dev;
 	struct device_node *endpoint;
 	struct sii902x *sii902x;
+	static const char * const supplies[] = {"iovcc", "cvcc12"};
 	int ret;
 
 	ret = i2c_check_functionality(client->adapter,
@@ -1122,27 +1122,11 @@ static int sii902x_probe(struct i2c_client *client,
 
 	mutex_init(&sii902x->mutex);
 
-	sii902x->supplies[0].supply = "iovcc";
-	sii902x->supplies[1].supply = "cvcc12";
-	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies),
-				      sii902x->supplies);
+	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), supplies);
 	if (ret < 0)
-		return ret;
-
-	ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies),
-				    sii902x->supplies);
-	if (ret < 0) {
-		dev_err_probe(dev, ret, "Failed to enable supplies");
-		return ret;
-	}
+		return dev_err_probe(dev, ret, "Failed to enable supplies");
 
-	ret = sii902x_init(sii902x);
-	if (ret < 0) {
-		regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-				       sii902x->supplies);
-	}
-
-	return ret;
+	return sii902x_init(sii902x);
 }
 
 static void sii902x_remove(struct i2c_client *client)
@@ -1152,8 +1136,6 @@ static void sii902x_remove(struct i2c_client *client)
 
 	i2c_mux_del_adapters(sii902x->i2cmux);
 	drm_bridge_remove(&sii902x->bridge);
-	regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-			       sii902x->supplies);
 }
 
 static const struct of_device_id sii902x_dt_ids[] = {
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2886 bytes --]

Simplify using devm_regulator_bulk_get_enable()

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>

---
v3 => v4:
- split to own patch.
- return directly the value returned by the dev_err_probe()

Please note - this is only compile-tested due to the lack of HW. Careful
review and testing is _highly_ appreciated
---
 drivers/gpu/drm/bridge/sii902x.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 878fb7d3732b..f6e8b401069b 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -171,7 +171,6 @@ struct sii902x {
 	struct drm_connector connector;
 	struct gpio_desc *reset_gpio;
 	struct i2c_mux_core *i2cmux;
-	struct regulator_bulk_data supplies[2];
 	bool sink_is_hdmi;
 	/*
 	 * Mutex protects audio and video functions from interfering
@@ -1072,6 +1071,7 @@ static int sii902x_probe(struct i2c_client *client,
 	struct device *dev = &client->dev;
 	struct device_node *endpoint;
 	struct sii902x *sii902x;
+	static const char * const supplies[] = {"iovcc", "cvcc12"};
 	int ret;
 
 	ret = i2c_check_functionality(client->adapter,
@@ -1122,27 +1122,11 @@ static int sii902x_probe(struct i2c_client *client,
 
 	mutex_init(&sii902x->mutex);
 
-	sii902x->supplies[0].supply = "iovcc";
-	sii902x->supplies[1].supply = "cvcc12";
-	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies),
-				      sii902x->supplies);
+	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), supplies);
 	if (ret < 0)
-		return ret;
-
-	ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies),
-				    sii902x->supplies);
-	if (ret < 0) {
-		dev_err_probe(dev, ret, "Failed to enable supplies");
-		return ret;
-	}
+		return dev_err_probe(dev, ret, "Failed to enable supplies");
 
-	ret = sii902x_init(sii902x);
-	if (ret < 0) {
-		regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-				       sii902x->supplies);
-	}
-
-	return ret;
+	return sii902x_init(sii902x);
 }
 
 static void sii902x_remove(struct i2c_client *client)
@@ -1152,8 +1136,6 @@ static void sii902x_remove(struct i2c_client *client)
 
 	i2c_mux_del_adapters(sii902x->i2cmux);
 	drm_bridge_remove(&sii902x->bridge);
-	regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies),
-			       sii902x->supplies);
 }
 
 static const struct of_device_id sii902x_dt_ids[] = {
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
  2022-10-21 13:17 ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 13:18   ` Matti Vaittinen
  -1 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare, linux-hwmon,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, Andrzej Hajda,
	linux-amlogic, Jerome Brunet, Guenter Roeck, Laurent Pinchart

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

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable().

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
RFCv1 => v2:
- No changes
---
 drivers/hwmon/lm90.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index db595f7d01f8..a3f95ba00dbf 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2663,11 +2663,6 @@ static void lm90_remove_pec(void *dev)
 	device_remove_file(dev, &dev_attr_pec);
 }
 
-static void lm90_regulator_disable(void *regulator)
-{
-	regulator_disable(regulator);
-}
-
 static int lm90_probe_channel_from_dt(struct i2c_client *client,
 				      struct device_node *child,
 				      struct lm90_data *data)
@@ -2749,24 +2744,13 @@ static int lm90_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct i2c_adapter *adapter = client->adapter;
 	struct hwmon_channel_info *info;
-	struct regulator *regulator;
 	struct device *hwmon_dev;
 	struct lm90_data *data;
 	int err;
 
-	regulator = devm_regulator_get(dev, "vcc");
-	if (IS_ERR(regulator))
-		return PTR_ERR(regulator);
-
-	err = regulator_enable(regulator);
-	if (err < 0) {
-		dev_err(dev, "Failed to enable regulator: %d\n", err);
-		return err;
-	}
-
-	err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+	err = devm_regulator_get_enable(dev, "vcc");
 	if (err)
-		return err;
+		return dev_err_probe(dev, err, "Failed to enable regulator\n");
 
 	data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
 	if (!data)
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

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

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable().

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
RFCv1 => v2:
- No changes
---
 drivers/hwmon/lm90.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index db595f7d01f8..a3f95ba00dbf 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2663,11 +2663,6 @@ static void lm90_remove_pec(void *dev)
 	device_remove_file(dev, &dev_attr_pec);
 }
 
-static void lm90_regulator_disable(void *regulator)
-{
-	regulator_disable(regulator);
-}
-
 static int lm90_probe_channel_from_dt(struct i2c_client *client,
 				      struct device_node *child,
 				      struct lm90_data *data)
@@ -2749,24 +2744,13 @@ static int lm90_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct i2c_adapter *adapter = client->adapter;
 	struct hwmon_channel_info *info;
-	struct regulator *regulator;
 	struct device *hwmon_dev;
 	struct lm90_data *data;
 	int err;
 
-	regulator = devm_regulator_get(dev, "vcc");
-	if (IS_ERR(regulator))
-		return PTR_ERR(regulator);
-
-	err = regulator_enable(regulator);
-	if (err < 0) {
-		dev_err(dev, "Failed to enable regulator: %d\n", err);
-		return err;
-	}
-
-	err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+	err = devm_regulator_get_enable(dev, "vcc");
 	if (err)
-		return err;
+		return dev_err_probe(dev, err, "Failed to enable regulator\n");
 
 	data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
 	if (!data)
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2114 bytes --]

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable().

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
RFCv1 => v2:
- No changes
---
 drivers/hwmon/lm90.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index db595f7d01f8..a3f95ba00dbf 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2663,11 +2663,6 @@ static void lm90_remove_pec(void *dev)
 	device_remove_file(dev, &dev_attr_pec);
 }
 
-static void lm90_regulator_disable(void *regulator)
-{
-	regulator_disable(regulator);
-}
-
 static int lm90_probe_channel_from_dt(struct i2c_client *client,
 				      struct device_node *child,
 				      struct lm90_data *data)
@@ -2749,24 +2744,13 @@ static int lm90_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct i2c_adapter *adapter = client->adapter;
 	struct hwmon_channel_info *info;
-	struct regulator *regulator;
 	struct device *hwmon_dev;
 	struct lm90_data *data;
 	int err;
 
-	regulator = devm_regulator_get(dev, "vcc");
-	if (IS_ERR(regulator))
-		return PTR_ERR(regulator);
-
-	err = regulator_enable(regulator);
-	if (err < 0) {
-		dev_err(dev, "Failed to enable regulator: %d\n", err);
-		return err;
-	}
-
-	err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+	err = devm_regulator_get_enable(dev, "vcc");
 	if (err)
-		return err;
+		return dev_err_probe(dev, err, "Failed to enable regulator\n");
 
 	data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
 	if (!data)
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
@ 2022-10-21 13:18   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:18 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2114 bytes --]

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable().

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
RFCv1 => v2:
- No changes
---
 drivers/hwmon/lm90.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index db595f7d01f8..a3f95ba00dbf 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2663,11 +2663,6 @@ static void lm90_remove_pec(void *dev)
 	device_remove_file(dev, &dev_attr_pec);
 }
 
-static void lm90_regulator_disable(void *regulator)
-{
-	regulator_disable(regulator);
-}
-
 static int lm90_probe_channel_from_dt(struct i2c_client *client,
 				      struct device_node *child,
 				      struct lm90_data *data)
@@ -2749,24 +2744,13 @@ static int lm90_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct i2c_adapter *adapter = client->adapter;
 	struct hwmon_channel_info *info;
-	struct regulator *regulator;
 	struct device *hwmon_dev;
 	struct lm90_data *data;
 	int err;
 
-	regulator = devm_regulator_get(dev, "vcc");
-	if (IS_ERR(regulator))
-		return PTR_ERR(regulator);
-
-	err = regulator_enable(regulator);
-	if (err < 0) {
-		dev_err(dev, "Failed to enable regulator: %d\n", err);
-		return err;
-	}
-
-	err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+	err = devm_regulator_get_enable(dev, "vcc");
 	if (err)
-		return err;
+		return dev_err_probe(dev, err, "Failed to enable regulator\n");
 
 	data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
 	if (!data)
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
  2022-10-21 13:17 ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 13:19   ` Matti Vaittinen
  -1 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:19 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

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

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable() and drop the pointer to the regulator.
This simplifies code and makes it less tempting to add manual control
for the regulator which is also controlled by devm.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
v2 => v3:
New patch
---
 drivers/hwmon/adm1177.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c
index 0c5dbc5e33b4..be17a26a84f1 100644
--- a/drivers/hwmon/adm1177.c
+++ b/drivers/hwmon/adm1177.c
@@ -26,14 +26,12 @@
 /**
  * struct adm1177_state - driver instance specific data
  * @client:		pointer to i2c client
- * @reg:		regulator info for the power supply of the device
  * @r_sense_uohm:	current sense resistor value
  * @alert_threshold_ua:	current limit for shutdown
  * @vrange_high:	internal voltage divider
  */
 struct adm1177_state {
 	struct i2c_client	*client;
-	struct regulator	*reg;
 	u32			r_sense_uohm;
 	u32			alert_threshold_ua;
 	bool			vrange_high;
@@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = {
 	.info = adm1177_info,
 };
 
-static void adm1177_remove(void *data)
-{
-	struct adm1177_state *st = data;
-
-	regulator_disable(st->reg);
-}
-
 static int adm1177_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client)
 
 	st->client = client;
 
-	st->reg = devm_regulator_get_optional(&client->dev, "vref");
-	if (IS_ERR(st->reg)) {
-		if (PTR_ERR(st->reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		st->reg = NULL;
-	} else {
-		ret = regulator_enable(st->reg);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(&client->dev, adm1177_remove,
-					       st);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(&client->dev, "vref");
+	if (ret == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
 
 	if (device_property_read_u32(dev, "shunt-resistor-micro-ohms",
 				     &st->r_sense_uohm))
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
@ 2022-10-21 13:19   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:19 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2619 bytes --]

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable() and drop the pointer to the regulator.
This simplifies code and makes it less tempting to add manual control
for the regulator which is also controlled by devm.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
v2 => v3:
New patch
---
 drivers/hwmon/adm1177.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c
index 0c5dbc5e33b4..be17a26a84f1 100644
--- a/drivers/hwmon/adm1177.c
+++ b/drivers/hwmon/adm1177.c
@@ -26,14 +26,12 @@
 /**
  * struct adm1177_state - driver instance specific data
  * @client:		pointer to i2c client
- * @reg:		regulator info for the power supply of the device
  * @r_sense_uohm:	current sense resistor value
  * @alert_threshold_ua:	current limit for shutdown
  * @vrange_high:	internal voltage divider
  */
 struct adm1177_state {
 	struct i2c_client	*client;
-	struct regulator	*reg;
 	u32			r_sense_uohm;
 	u32			alert_threshold_ua;
 	bool			vrange_high;
@@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = {
 	.info = adm1177_info,
 };
 
-static void adm1177_remove(void *data)
-{
-	struct adm1177_state *st = data;
-
-	regulator_disable(st->reg);
-}
-
 static int adm1177_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client)
 
 	st->client = client;
 
-	st->reg = devm_regulator_get_optional(&client->dev, "vref");
-	if (IS_ERR(st->reg)) {
-		if (PTR_ERR(st->reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		st->reg = NULL;
-	} else {
-		ret = regulator_enable(st->reg);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(&client->dev, adm1177_remove,
-					       st);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(&client->dev, "vref");
+	if (ret == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
 
 	if (device_property_read_u32(dev, "shunt-resistor-micro-ohms",
 				     &st->r_sense_uohm))
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
@ 2022-10-21 13:19   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:19 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon


[-- Attachment #1.1: Type: text/plain, Size: 2619 bytes --]

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable() and drop the pointer to the regulator.
This simplifies code and makes it less tempting to add manual control
for the regulator which is also controlled by devm.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
v2 => v3:
New patch
---
 drivers/hwmon/adm1177.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c
index 0c5dbc5e33b4..be17a26a84f1 100644
--- a/drivers/hwmon/adm1177.c
+++ b/drivers/hwmon/adm1177.c
@@ -26,14 +26,12 @@
 /**
  * struct adm1177_state - driver instance specific data
  * @client:		pointer to i2c client
- * @reg:		regulator info for the power supply of the device
  * @r_sense_uohm:	current sense resistor value
  * @alert_threshold_ua:	current limit for shutdown
  * @vrange_high:	internal voltage divider
  */
 struct adm1177_state {
 	struct i2c_client	*client;
-	struct regulator	*reg;
 	u32			r_sense_uohm;
 	u32			alert_threshold_ua;
 	bool			vrange_high;
@@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = {
 	.info = adm1177_info,
 };
 
-static void adm1177_remove(void *data)
-{
-	struct adm1177_state *st = data;
-
-	regulator_disable(st->reg);
-}
-
 static int adm1177_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client)
 
 	st->client = client;
 
-	st->reg = devm_regulator_get_optional(&client->dev, "vref");
-	if (IS_ERR(st->reg)) {
-		if (PTR_ERR(st->reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		st->reg = NULL;
-	} else {
-		ret = regulator_enable(st->reg);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(&client->dev, adm1177_remove,
-					       st);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(&client->dev, "vref");
+	if (ret == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
 
 	if (device_property_read_u32(dev, "shunt-resistor-micro-ohms",
 				     &st->r_sense_uohm))
-- 
2.37.3


-- 
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
@ 2022-10-21 13:19   ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:19 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare, linux-hwmon,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, Andrzej Hajda,
	linux-amlogic, Jerome Brunet, Guenter Roeck, Laurent Pinchart

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

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable() and drop the pointer to the regulator.
This simplifies code and makes it less tempting to add manual control
for the regulator which is also controlled by devm.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>

---
v2 => v3:
New patch
---
 drivers/hwmon/adm1177.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c
index 0c5dbc5e33b4..be17a26a84f1 100644
--- a/drivers/hwmon/adm1177.c
+++ b/drivers/hwmon/adm1177.c
@@ -26,14 +26,12 @@
 /**
  * struct adm1177_state - driver instance specific data
  * @client:		pointer to i2c client
- * @reg:		regulator info for the power supply of the device
  * @r_sense_uohm:	current sense resistor value
  * @alert_threshold_ua:	current limit for shutdown
  * @vrange_high:	internal voltage divider
  */
 struct adm1177_state {
 	struct i2c_client	*client;
-	struct regulator	*reg;
 	u32			r_sense_uohm;
 	u32			alert_threshold_ua;
 	bool			vrange_high;
@@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = {
 	.info = adm1177_info,
 };
 
-static void adm1177_remove(void *data)
-{
-	struct adm1177_state *st = data;
-
-	regulator_disable(st->reg);
-}
-
 static int adm1177_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client)
 
 	st->client = client;
 
-	st->reg = devm_regulator_get_optional(&client->dev, "vref");
-	if (IS_ERR(st->reg)) {
-		if (PTR_ERR(st->reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		st->reg = NULL;
-	} else {
-		ret = regulator_enable(st->reg);
-		if (ret)
-			return ret;
-		ret = devm_add_action_or_reset(&client->dev, adm1177_remove,
-					       st);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_get_enable_optional(&client->dev, "vref");
+	if (ret == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
 
 	if (device_property_read_u32(dev, "shunt-resistor-micro-ohms",
 				     &st->r_sense_uohm))
-- 
2.37.3


-- 
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 related	[flat|nested] 60+ messages in thread

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  2022-10-21 13:18   ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 13:24     ` Matti Vaittinen
  -1 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

On 10/21/22 16:18, Matti Vaittinen wrote:
> Simplify using devm_regulator_bulk_get_enable()
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Reviewed-by: Robert Foss <robert.foss@linaro.org>

Robert, I did slightly modify the return from probe when using the 
dev_err_probe(). I still decided to keep your RBT - please let me know 
if you disagree.

Eg, this:
> -	if (ret < 0) {
> -		dev_err_probe(dev, ret, "Failed to enable supplies");
> -		return ret;
> -	}

was converted to:
 >   	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to enable supplies");

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-21 13:24     ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare, linux-hwmon,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, Andrzej Hajda,
	linux-amlogic, Jerome Brunet, Guenter Roeck, Laurent Pinchart

On 10/21/22 16:18, Matti Vaittinen wrote:
> Simplify using devm_regulator_bulk_get_enable()
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Reviewed-by: Robert Foss <robert.foss@linaro.org>

Robert, I did slightly modify the return from probe when using the 
dev_err_probe(). I still decided to keep your RBT - please let me know 
if you disagree.

Eg, this:
> -	if (ret < 0) {
> -		dev_err_probe(dev, ret, "Failed to enable supplies");
> -		return ret;
> -	}

was converted to:
 >   	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to enable supplies");

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-21 13:24     ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

On 10/21/22 16:18, Matti Vaittinen wrote:
> Simplify using devm_regulator_bulk_get_enable()
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Reviewed-by: Robert Foss <robert.foss@linaro.org>

Robert, I did slightly modify the return from probe when using the 
dev_err_probe(). I still decided to keep your RBT - please let me know 
if you disagree.

Eg, this:
> -	if (ret < 0) {
> -		dev_err_probe(dev, ret, "Failed to enable supplies");
> -		return ret;
> -	}

was converted to:
 >   	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to enable supplies");

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-21 13:24     ` Matti Vaittinen
  0 siblings, 0 replies; 60+ messages in thread
From: Matti Vaittinen @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: 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, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

On 10/21/22 16:18, Matti Vaittinen wrote:
> Simplify using devm_regulator_bulk_get_enable()
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Reviewed-by: Robert Foss <robert.foss@linaro.org>

Robert, I did slightly modify the return from probe when using the 
dev_err_probe(). I still decided to keep your RBT - please let me know 
if you disagree.

Eg, this:
> -	if (ret < 0) {
> -		dev_err_probe(dev, ret, "Failed to enable supplies");
> -		return ret;
> -	}

was converted to:
 >   	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to enable supplies");

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-10-21 13:18   ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 13:24     ` Neil Armstrong
  -1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On 21/10/2022 15:18, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>   1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>   	struct reset_control *hdmitx_apb;
>   	struct reset_control *hdmitx_ctrl;
>   	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>   	u32 irq_stat;
>   	struct dw_hdmi *hdmi;
>   	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>   
>   }
>   
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>   static void meson_disable_clk(void *data)
>   {
>   	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>   	meson_dw_hdmi->data = match;
>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>   
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;
>   
>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>   						"hdmitx_apb");

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 13:24     ` Neil Armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: linux-arm-kernel, linux-hwmon, Jean Delvare, Michael Hennerich,
	Jonas Karlman, Martin Blumenstingl, Kevin Hilman, dri-devel,
	Liam Girdwood, Jernej Skrabec, linux-kernel, Mark Brown,
	Robert Foss, Andrzej Hajda, linux-amlogic, Jerome Brunet,
	Guenter Roeck, Laurent Pinchart

On 21/10/2022 15:18, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>   1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>   	struct reset_control *hdmitx_apb;
>   	struct reset_control *hdmitx_ctrl;
>   	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>   	u32 irq_stat;
>   	struct dw_hdmi *hdmi;
>   	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>   
>   }
>   
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>   static void meson_disable_clk(void *data)
>   {
>   	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>   	meson_dw_hdmi->data = match;
>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>   
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;
>   
>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>   						"hdmitx_apb");

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 13:24     ` Neil Armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On 21/10/2022 15:18, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>   1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>   	struct reset_control *hdmitx_apb;
>   	struct reset_control *hdmitx_ctrl;
>   	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>   	u32 irq_stat;
>   	struct dw_hdmi *hdmi;
>   	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>   
>   }
>   
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>   static void meson_disable_clk(void *data)
>   {
>   	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>   	meson_dw_hdmi->data = match;
>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>   
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;
>   
>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>   						"hdmitx_apb");

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 13:24     ` Neil Armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:24 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On 21/10/2022 15:18, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>   1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>   	struct reset_control *hdmitx_apb;
>   	struct reset_control *hdmitx_ctrl;
>   	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>   	u32 irq_stat;
>   	struct dw_hdmi *hdmi;
>   	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>   
>   }
>   
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>   static void meson_disable_clk(void *data)
>   {
>   	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>   	meson_dw_hdmi->data = match;
>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>   
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;
>   
>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>   						"hdmitx_apb");

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-10-21 13:18   ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 15:02     ` Laurent Pinchart
  -1 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2022-10-21 15:02 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Michael Hennerich, Jean Delvare, Guenter Roeck, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

Hi Matti,

On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>  drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>  	struct reset_control *hdmitx_apb;
>  	struct reset_control *hdmitx_ctrl;
>  	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>  	u32 irq_stat;
>  	struct dw_hdmi *hdmi;
>  	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>  
>  }
>  
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>  static void meson_disable_clk(void *data)
>  {
>  	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  	meson_dw_hdmi->data = match;
>  	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>  
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;

As noted in the review of the series that introduced
devm_regulator_get_enable_optional(), the right thing to do is to
implement runtime PM in this driver to avoid wasting power.

>  
>  	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>  						"hdmitx_apb");

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 15:02     ` Laurent Pinchart
  0 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2022-10-21 15:02 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Matti Vaittinen, Liam Girdwood,
	Jernej Skrabec, linux-kernel, Mark Brown, Robert Foss,
	Andrzej Hajda, linux-amlogic, linux-hwmon, Guenter Roeck,
	Jerome Brunet

Hi Matti,

On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>  drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>  	struct reset_control *hdmitx_apb;
>  	struct reset_control *hdmitx_ctrl;
>  	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>  	u32 irq_stat;
>  	struct dw_hdmi *hdmi;
>  	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>  
>  }
>  
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>  static void meson_disable_clk(void *data)
>  {
>  	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  	meson_dw_hdmi->data = match;
>  	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>  
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;

As noted in the review of the series that introduced
devm_regulator_get_enable_optional(), the right thing to do is to
implement runtime PM in this driver to avoid wasting power.

>  
>  	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>  						"hdmitx_apb");

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 15:02     ` Laurent Pinchart
  0 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2022-10-21 15:02 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Michael Hennerich, Jean Delvare, Guenter Roeck, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

Hi Matti,

On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>  drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>  	struct reset_control *hdmitx_apb;
>  	struct reset_control *hdmitx_ctrl;
>  	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>  	u32 irq_stat;
>  	struct dw_hdmi *hdmi;
>  	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>  
>  }
>  
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>  static void meson_disable_clk(void *data)
>  {
>  	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  	meson_dw_hdmi->data = match;
>  	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>  
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;

As noted in the review of the series that introduced
devm_regulator_get_enable_optional(), the right thing to do is to
implement runtime PM in this driver to avoid wasting power.

>  
>  	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>  						"hdmitx_apb");

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 15:02     ` Laurent Pinchart
  0 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2022-10-21 15:02 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Michael Hennerich, Jean Delvare, Guenter Roeck, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

Hi Matti,

On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
> Simplify using the devm_regulator_get_enable_optional(). Also drop the
> seemingly unused struct member 'hdmi_supply'.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> ---
> v3 => v4:
> - split meson part to own patch
> 
> RFCv1 => v2:
> - Change also sii902x to use devm_regulator_bulk_get_enable()
> 
> Please note - this is only compile-tested due to the lack of HW. Careful
> review and testing is _highly_ appreciated.
> ---
>  drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 5cd2b2ebbbd3..7642f740272b 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>  	struct reset_control *hdmitx_apb;
>  	struct reset_control *hdmitx_ctrl;
>  	struct reset_control *hdmitx_phy;
> -	struct regulator *hdmi_supply;
>  	u32 irq_stat;
>  	struct dw_hdmi *hdmi;
>  	struct drm_bridge *bridge;
> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>  
>  }
>  
> -static void meson_disable_regulator(void *data)
> -{
> -	regulator_disable(data);
> -}
> -
>  static void meson_disable_clk(void *data)
>  {
>  	clk_disable_unprepare(data);
> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  	meson_dw_hdmi->data = match;
>  	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>  
> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		meson_dw_hdmi->hdmi_supply = NULL;
> -	} else {
> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> -					       meson_dw_hdmi->hdmi_supply);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
> +	if (ret != -ENODEV)
> +		return ret;

As noted in the review of the series that introduced
devm_regulator_get_enable_optional(), the right thing to do is to
implement runtime PM in this driver to avoid wasting power.

>  
>  	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>  						"hdmitx_apb");

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-10-21 15:02     ` Laurent Pinchart
  (?)
  (?)
@ 2022-10-21 15:29       ` Neil Armstrong
  -1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 15:29 UTC (permalink / raw)
  To: Laurent Pinchart, Matti Vaittinen
  Cc: linux-arm-kernel, linux-hwmon, Jean Delvare, Michael Hennerich,
	Jonas Karlman, Martin Blumenstingl, Kevin Hilman, dri-devel,
	Matti Vaittinen, Liam Girdwood, Jernej Skrabec, linux-kernel,
	Mark Brown, Robert Foss, Andrzej Hajda, linux-amlogic,
	Guenter Roeck, Jerome Brunet

Hi,

On 21/10/2022 17:02, Laurent Pinchart wrote:
> Hi Matti,
> 
> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>> seemingly unused struct member 'hdmi_supply'.
>>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>
>> ---
>> v3 => v4:
>> - split meson part to own patch
>>
>> RFCv1 => v2:
>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>
>> Please note - this is only compile-tested due to the lack of HW. Careful
>> review and testing is _highly_ appreciated.
>> ---
>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> index 5cd2b2ebbbd3..7642f740272b 100644
>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>   	struct reset_control *hdmitx_apb;
>>   	struct reset_control *hdmitx_ctrl;
>>   	struct reset_control *hdmitx_phy;
>> -	struct regulator *hdmi_supply;
>>   	u32 irq_stat;
>>   	struct dw_hdmi *hdmi;
>>   	struct drm_bridge *bridge;
>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>>   
>>   }
>>   
>> -static void meson_disable_regulator(void *data)
>> -{
>> -	regulator_disable(data);
>> -}
>> -
>>   static void meson_disable_clk(void *data)
>>   {
>>   	clk_disable_unprepare(data);
>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>>   	meson_dw_hdmi->data = match;
>>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>   
>> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
>> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>> -			return -EPROBE_DEFER;
>> -		meson_dw_hdmi->hdmi_supply = NULL;
>> -	} else {
>> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>> -					       meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -	}
>> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
>> +	if (ret != -ENODEV)
>> +		return ret;
> 
> As noted in the review of the series that introduced
> devm_regulator_get_enable_optional(), the right thing to do is to
> implement runtime PM in this driver to avoid wasting power.

While I agree, it's not really the same level of effort as this patch
should be functionally equivalent.

> 
>>   
>>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>>   						"hdmitx_apb");
> 

Neil

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 15:29       ` Neil Armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 15:29 UTC (permalink / raw)
  To: Laurent Pinchart, Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Robert Foss, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

Hi,

On 21/10/2022 17:02, Laurent Pinchart wrote:
> Hi Matti,
> 
> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>> seemingly unused struct member 'hdmi_supply'.
>>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>
>> ---
>> v3 => v4:
>> - split meson part to own patch
>>
>> RFCv1 => v2:
>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>
>> Please note - this is only compile-tested due to the lack of HW. Careful
>> review and testing is _highly_ appreciated.
>> ---
>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> index 5cd2b2ebbbd3..7642f740272b 100644
>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>   	struct reset_control *hdmitx_apb;
>>   	struct reset_control *hdmitx_ctrl;
>>   	struct reset_control *hdmitx_phy;
>> -	struct regulator *hdmi_supply;
>>   	u32 irq_stat;
>>   	struct dw_hdmi *hdmi;
>>   	struct drm_bridge *bridge;
>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>>   
>>   }
>>   
>> -static void meson_disable_regulator(void *data)
>> -{
>> -	regulator_disable(data);
>> -}
>> -
>>   static void meson_disable_clk(void *data)
>>   {
>>   	clk_disable_unprepare(data);
>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>>   	meson_dw_hdmi->data = match;
>>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>   
>> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
>> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>> -			return -EPROBE_DEFER;
>> -		meson_dw_hdmi->hdmi_supply = NULL;
>> -	} else {
>> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>> -					       meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -	}
>> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
>> +	if (ret != -ENODEV)
>> +		return ret;
> 
> As noted in the review of the series that introduced
> devm_regulator_get_enable_optional(), the right thing to do is to
> implement runtime PM in this driver to avoid wasting power.

While I agree, it's not really the same level of effort as this patch
should be functionally equivalent.

> 
>>   
>>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>>   						"hdmitx_apb");
> 

Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 15:29       ` Neil Armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 15:29 UTC (permalink / raw)
  To: Laurent Pinchart, Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Robert Foss, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

Hi,

On 21/10/2022 17:02, Laurent Pinchart wrote:
> Hi Matti,
> 
> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>> seemingly unused struct member 'hdmi_supply'.
>>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>
>> ---
>> v3 => v4:
>> - split meson part to own patch
>>
>> RFCv1 => v2:
>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>
>> Please note - this is only compile-tested due to the lack of HW. Careful
>> review and testing is _highly_ appreciated.
>> ---
>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> index 5cd2b2ebbbd3..7642f740272b 100644
>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>   	struct reset_control *hdmitx_apb;
>>   	struct reset_control *hdmitx_ctrl;
>>   	struct reset_control *hdmitx_phy;
>> -	struct regulator *hdmi_supply;
>>   	u32 irq_stat;
>>   	struct dw_hdmi *hdmi;
>>   	struct drm_bridge *bridge;
>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>>   
>>   }
>>   
>> -static void meson_disable_regulator(void *data)
>> -{
>> -	regulator_disable(data);
>> -}
>> -
>>   static void meson_disable_clk(void *data)
>>   {
>>   	clk_disable_unprepare(data);
>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>>   	meson_dw_hdmi->data = match;
>>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>   
>> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
>> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>> -			return -EPROBE_DEFER;
>> -		meson_dw_hdmi->hdmi_supply = NULL;
>> -	} else {
>> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>> -					       meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -	}
>> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
>> +	if (ret != -ENODEV)
>> +		return ret;
> 
> As noted in the review of the series that introduced
> devm_regulator_get_enable_optional(), the right thing to do is to
> implement runtime PM in this driver to avoid wasting power.

While I agree, it's not really the same level of effort as this patch
should be functionally equivalent.

> 
>>   
>>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>>   						"hdmitx_apb");
> 

Neil

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-21 15:29       ` Neil Armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2022-10-21 15:29 UTC (permalink / raw)
  To: Laurent Pinchart, Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Robert Foss, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Michael Hennerich,
	Jean Delvare, Guenter Roeck, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

Hi,

On 21/10/2022 17:02, Laurent Pinchart wrote:
> Hi Matti,
> 
> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>> seemingly unused struct member 'hdmi_supply'.
>>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>
>> ---
>> v3 => v4:
>> - split meson part to own patch
>>
>> RFCv1 => v2:
>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>
>> Please note - this is only compile-tested due to the lack of HW. Careful
>> review and testing is _highly_ appreciated.
>> ---
>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> index 5cd2b2ebbbd3..7642f740272b 100644
>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>   	struct reset_control *hdmitx_apb;
>>   	struct reset_control *hdmitx_ctrl;
>>   	struct reset_control *hdmitx_phy;
>> -	struct regulator *hdmi_supply;
>>   	u32 irq_stat;
>>   	struct dw_hdmi *hdmi;
>>   	struct drm_bridge *bridge;
>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>>   
>>   }
>>   
>> -static void meson_disable_regulator(void *data)
>> -{
>> -	regulator_disable(data);
>> -}
>> -
>>   static void meson_disable_clk(void *data)
>>   {
>>   	clk_disable_unprepare(data);
>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>>   	meson_dw_hdmi->data = match;
>>   	dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>   
>> -	meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
>> -	if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>> -		if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>> -			return -EPROBE_DEFER;
>> -		meson_dw_hdmi->hdmi_supply = NULL;
>> -	} else {
>> -		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>> -					       meson_dw_hdmi->hdmi_supply);
>> -		if (ret)
>> -			return ret;
>> -	}
>> +	ret = devm_regulator_get_enable_optional(dev, "hdmi");
>> +	if (ret != -ENODEV)
>> +		return ret;
> 
> As noted in the review of the series that introduced
> devm_regulator_get_enable_optional(), the right thing to do is to
> implement runtime PM in this driver to avoid wasting power.

While I agree, it's not really the same level of effort as this patch
should be functionally equivalent.

> 
>>   
>>   	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
>>   						"hdmitx_apb");
> 

Neil

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
  2022-10-21 13:18   ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 17:21     ` Guenter Roeck
  -1 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:21 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, 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, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On Fri, Oct 21, 2022 at 04:18:43PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable().
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

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

* Re: [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
@ 2022-10-21 17:21     ` Guenter Roeck
  0 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:21 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: dri-devel, Neil Armstrong, Jernej Skrabec, Michael Hennerich,
	Jonas Karlman, Martin Blumenstingl, Kevin Hilman, Mark Brown,
	Matti Vaittinen, Liam Girdwood, Robert Foss, linux-kernel,
	Jean Delvare, Laurent Pinchart, Andrzej Hajda, linux-amlogic,
	linux-hwmon, linux-arm-kernel, Jerome Brunet

On Fri, Oct 21, 2022 at 04:18:43PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable().
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

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

* Re: [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
@ 2022-10-21 17:21     ` Guenter Roeck
  0 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:21 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, 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, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On Fri, Oct 21, 2022 at 04:18:43PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable().
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable()
@ 2022-10-21 17:21     ` Guenter Roeck
  0 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:21 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, 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, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On Fri, Oct 21, 2022 at 04:18:43PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable().
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
  2022-10-21 13:19   ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-21 17:22     ` Guenter Roeck
  -1 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:22 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, 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, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On Fri, Oct 21, 2022 at 04:19:04PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable() and drop the pointer to the regulator.
> This simplifies code and makes it less tempting to add manual control
> for the regulator which is also controlled by devm.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

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

* Re: [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
@ 2022-10-21 17:22     ` Guenter Roeck
  0 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:22 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: dri-devel, Neil Armstrong, Jernej Skrabec, Michael Hennerich,
	Jonas Karlman, Martin Blumenstingl, Kevin Hilman, Mark Brown,
	Matti Vaittinen, Liam Girdwood, Robert Foss, linux-kernel,
	Jean Delvare, Laurent Pinchart, Andrzej Hajda, linux-amlogic,
	linux-hwmon, linux-arm-kernel, Jerome Brunet

On Fri, Oct 21, 2022 at 04:19:04PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable() and drop the pointer to the regulator.
> This simplifies code and makes it less tempting to add manual control
> for the regulator which is also controlled by devm.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

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

* Re: [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
@ 2022-10-21 17:22     ` Guenter Roeck
  0 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:22 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, 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, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On Fri, Oct 21, 2022 at 04:19:04PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable() and drop the pointer to the regulator.
> This simplifies code and makes it less tempting to add manual control
> for the regulator which is also controlled by devm.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable()
@ 2022-10-21 17:22     ` Guenter Roeck
  0 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2022-10-21 17:22 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, 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, Liam Girdwood, Mark Brown,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel,
	linux-hwmon

On Fri, Oct 21, 2022 at 04:19:04PM +0300, Matti Vaittinen wrote:
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable() and drop the pointer to the regulator.
> This simplifies code and makes it less tempting to add manual control
> for the regulator which is also controlled by devm.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to hwmon-next.

Thanks,
Guenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-10-21 15:29       ` Neil Armstrong
  (?)
  (?)
@ 2022-10-24  4:40         ` Vaittinen, Matti
  -1 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-10-24  4:40 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---

//Snip

>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.
> 

Exactly. As I wrote, I do not have the HW to test this change. This 
intends to bring no functional changes. It is just a minor 
simplification while also making it harder to create a bug with the 
regulator control. (Registering the devm_action and leaving the handle 
to the regulator is more fragile than using this new API which does not 
give user the handle).

I am in no way against someone further improving the functionality here 
(by adding runtime PM) but this someone is not me. Yet, I don't see how 
this patch prevents runtime PM being implemented? The first thing that 
needs to be done is removing the devm-action assuming someone did 
implement power-saving by disabling the regulator(s) at runtime. After 
this patch is applied, the action removal is automatically a necessity 
in order to get the handle for regulator control.

I know this helper is not preferred by all but it is still safer than 
the current code which registers the action while allowing the regulator 
control.

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-24  4:40         ` Vaittinen, Matti
  0 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-10-24  4:40 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: linux-arm-kernel, linux-hwmon, Jean Delvare, Andrzej Hajda,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, linux-amlogic,
	Guenter Roeck, Jerome Brunet

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---

//Snip

>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.
> 

Exactly. As I wrote, I do not have the HW to test this change. This 
intends to bring no functional changes. It is just a minor 
simplification while also making it harder to create a bug with the 
regulator control. (Registering the devm_action and leaving the handle 
to the regulator is more fragile than using this new API which does not 
give user the handle).

I am in no way against someone further improving the functionality here 
(by adding runtime PM) but this someone is not me. Yet, I don't see how 
this patch prevents runtime PM being implemented? The first thing that 
needs to be done is removing the devm-action assuming someone did 
implement power-saving by disabling the regulator(s) at runtime. After 
this patch is applied, the action removal is automatically a necessity 
in order to get the handle for regulator control.

I know this helper is not preferred by all but it is still safer than 
the current code which registers the action while allowing the regulator 
control.

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-24  4:40         ` Vaittinen, Matti
  0 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-10-24  4:40 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---

//Snip

>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.
> 

Exactly. As I wrote, I do not have the HW to test this change. This 
intends to bring no functional changes. It is just a minor 
simplification while also making it harder to create a bug with the 
regulator control. (Registering the devm_action and leaving the handle 
to the regulator is more fragile than using this new API which does not 
give user the handle).

I am in no way against someone further improving the functionality here 
(by adding runtime PM) but this someone is not me. Yet, I don't see how 
this patch prevents runtime PM being implemented? The first thing that 
needs to be done is removing the devm-action assuming someone did 
implement power-saving by disabling the regulator(s) at runtime. After 
this patch is applied, the action removal is automatically a necessity 
in order to get the handle for regulator control.

I know this helper is not preferred by all but it is still safer than 
the current code which registers the action while allowing the regulator 
control.

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-10-24  4:40         ` Vaittinen, Matti
  0 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-10-24  4:40 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---

//Snip

>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.
> 

Exactly. As I wrote, I do not have the HW to test this change. This 
intends to bring no functional changes. It is just a minor 
simplification while also making it harder to create a bug with the 
regulator control. (Registering the devm_action and leaving the handle 
to the regulator is more fragile than using this new API which does not 
give user the handle).

I am in no way against someone further improving the functionality here 
(by adding runtime PM) but this someone is not me. Yet, I don't see how 
this patch prevents runtime PM being implemented? The first thing that 
needs to be done is removing the devm-action assuming someone did 
implement power-saving by disabling the regulator(s) at runtime. After 
this patch is applied, the action removal is automatically a necessity 
in order to get the handle for regulator control.

I know this helper is not preferred by all but it is still safer than 
the current code which registers the action while allowing the regulator 
control.

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
  2022-10-21 13:24     ` Matti Vaittinen
  (?)
  (?)
@ 2022-10-24 15:47       ` Robert Foss
  -1 siblings, 0 replies; 60+ messages in thread
From: Robert Foss @ 2022-10-24 15:47 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: linux-arm-kernel, Neil Armstrong, Jean Delvare,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Matti Vaittinen, Liam Girdwood,
	Jernej Skrabec, linux-kernel, Mark Brown, Laurent Pinchart,
	Andrzej Hajda, linux-amlogic, linux-hwmon, Guenter Roeck,
	Jerome Brunet

On Fri, 21 Oct 2022 at 15:24, Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
> On 10/21/22 16:18, Matti Vaittinen wrote:
> > Simplify using devm_regulator_bulk_get_enable()
> >
> > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> > Reviewed-by: Robert Foss <robert.foss@linaro.org>
>
> Robert, I did slightly modify the return from probe when using the
> dev_err_probe(). I still decided to keep your RBT - please let me know
> if you disagree.

Not a problem. In fact, feel free to upgrade it to an acked-by, to
simplify merging this series.

Acked-by: Robert Foss <robert.foss@linaro.org>

>
> Eg, this:
> > -     if (ret < 0) {
> > -             dev_err_probe(dev, ret, "Failed to enable supplies");
> > -             return ret;
> > -     }
>
> was converted to:
>  >      if (ret < 0)
> > +             return dev_err_probe(dev, ret, "Failed to enable supplies");
>
> Yours
>         -- Matti
>
> --
> Matti Vaittinen
> Linux kernel developer at ROHM Semiconductors
> Oulu Finland
>
> ~~ When things go utterly wrong vim users can always type :help! ~~
>

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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-24 15:47       ` Robert Foss
  0 siblings, 0 replies; 60+ messages in thread
From: Robert Foss @ 2022-10-24 15:47 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Michael Hennerich, Jean Delvare, Guenter Roeck, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

On Fri, 21 Oct 2022 at 15:24, Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
> On 10/21/22 16:18, Matti Vaittinen wrote:
> > Simplify using devm_regulator_bulk_get_enable()
> >
> > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> > Reviewed-by: Robert Foss <robert.foss@linaro.org>
>
> Robert, I did slightly modify the return from probe when using the
> dev_err_probe(). I still decided to keep your RBT - please let me know
> if you disagree.

Not a problem. In fact, feel free to upgrade it to an acked-by, to
simplify merging this series.

Acked-by: Robert Foss <robert.foss@linaro.org>

>
> Eg, this:
> > -     if (ret < 0) {
> > -             dev_err_probe(dev, ret, "Failed to enable supplies");
> > -             return ret;
> > -     }
>
> was converted to:
>  >      if (ret < 0)
> > +             return dev_err_probe(dev, ret, "Failed to enable supplies");
>
> Yours
>         -- Matti
>
> --
> Matti Vaittinen
> Linux kernel developer at ROHM Semiconductors
> Oulu Finland
>
> ~~ When things go utterly wrong vim users can always type :help! ~~
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-24 15:47       ` Robert Foss
  0 siblings, 0 replies; 60+ messages in thread
From: Robert Foss @ 2022-10-24 15:47 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Michael Hennerich, Jean Delvare, Guenter Roeck, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

On Fri, 21 Oct 2022 at 15:24, Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
> On 10/21/22 16:18, Matti Vaittinen wrote:
> > Simplify using devm_regulator_bulk_get_enable()
> >
> > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> > Reviewed-by: Robert Foss <robert.foss@linaro.org>
>
> Robert, I did slightly modify the return from probe when using the
> dev_err_probe(). I still decided to keep your RBT - please let me know
> if you disagree.

Not a problem. In fact, feel free to upgrade it to an acked-by, to
simplify merging this series.

Acked-by: Robert Foss <robert.foss@linaro.org>

>
> Eg, this:
> > -     if (ret < 0) {
> > -             dev_err_probe(dev, ret, "Failed to enable supplies");
> > -             return ret;
> > -     }
>
> was converted to:
>  >      if (ret < 0)
> > +             return dev_err_probe(dev, ret, "Failed to enable supplies");
>
> Yours
>         -- Matti
>
> --
> Matti Vaittinen
> Linux kernel developer at ROHM Semiconductors
> Oulu Finland
>
> ~~ When things go utterly wrong vim users can always type :help! ~~
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable()
@ 2022-10-24 15:47       ` Robert Foss
  0 siblings, 0 replies; 60+ messages in thread
From: Robert Foss @ 2022-10-24 15:47 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Michael Hennerich, Jean Delvare, Guenter Roeck, Liam Girdwood,
	Mark Brown, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, linux-hwmon

On Fri, 21 Oct 2022 at 15:24, Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
> On 10/21/22 16:18, Matti Vaittinen wrote:
> > Simplify using devm_regulator_bulk_get_enable()
> >
> > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> > Reviewed-by: Robert Foss <robert.foss@linaro.org>
>
> Robert, I did slightly modify the return from probe when using the
> dev_err_probe(). I still decided to keep your RBT - please let me know
> if you disagree.

Not a problem. In fact, feel free to upgrade it to an acked-by, to
simplify merging this series.

Acked-by: Robert Foss <robert.foss@linaro.org>

>
> Eg, this:
> > -     if (ret < 0) {
> > -             dev_err_probe(dev, ret, "Failed to enable supplies");
> > -             return ret;
> > -     }
>
> was converted to:
>  >      if (ret < 0)
> > +             return dev_err_probe(dev, ret, "Failed to enable supplies");
>
> Yours
>         -- Matti
>
> --
> Matti Vaittinen
> Linux kernel developer at ROHM Semiconductors
> Oulu Finland
>
> ~~ When things go utterly wrong vim users can always type :help! ~~
>

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-10-21 15:29       ` Neil Armstrong
  (?)
  (?)
@ 2022-11-16 12:02         ` Vaittinen, Matti
  -1 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-11-16 12:02 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: linux-arm-kernel, linux-hwmon, Jean Delvare, Andrzej Hajda,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, linux-amlogic,
	Guenter Roeck, Jerome Brunet

Hi dee Ho Laurent & All,

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---
>>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>       struct reset_control *hdmitx_apb;
>>>       struct reset_control *hdmitx_ctrl;
>>>       struct reset_control *hdmitx_phy;
>>> -    struct regulator *hdmi_supply;
>>>       u32 irq_stat;
>>>       struct dw_hdmi *hdmi;
>>>       struct drm_bridge *bridge;
>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct 
>>> meson_dw_hdmi *meson_dw_hdmi)
>>>   }
>>> -static void meson_disable_regulator(void *data)
>>> -{
>>> -    regulator_disable(data);
>>> -}
>>> -
>>>   static void meson_disable_clk(void *data)
>>>   {
>>>       clk_disable_unprepare(data);
>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device 
>>> *dev, struct device *master,
>>>       meson_dw_hdmi->data = match;
>>>       dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, 
>>> "hdmi");
>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>> -            return -EPROBE_DEFER;
>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>> -    } else {
>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>> -                           meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -    }
>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>> +    if (ret != -ENODEV)
>>> +        return ret;
>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.

While we all agree that power savings gained by runtime PM would be 
great - I don't think we should stop minor improvements while waiting 
for that to magically happen ;)

I like the saying I first heard from Jonathan Cameron - "Don't let the 
perfect be an enemy of good".

After that being said, should I re-spin this or just drop it? (I am 
cleaning up my local git from old stuff, and these are about to vanish 
from my books).

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-11-16 12:02         ` Vaittinen, Matti
  0 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-11-16 12:02 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

Hi dee Ho Laurent & All,

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---
>>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>       struct reset_control *hdmitx_apb;
>>>       struct reset_control *hdmitx_ctrl;
>>>       struct reset_control *hdmitx_phy;
>>> -    struct regulator *hdmi_supply;
>>>       u32 irq_stat;
>>>       struct dw_hdmi *hdmi;
>>>       struct drm_bridge *bridge;
>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct 
>>> meson_dw_hdmi *meson_dw_hdmi)
>>>   }
>>> -static void meson_disable_regulator(void *data)
>>> -{
>>> -    regulator_disable(data);
>>> -}
>>> -
>>>   static void meson_disable_clk(void *data)
>>>   {
>>>       clk_disable_unprepare(data);
>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device 
>>> *dev, struct device *master,
>>>       meson_dw_hdmi->data = match;
>>>       dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, 
>>> "hdmi");
>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>> -            return -EPROBE_DEFER;
>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>> -    } else {
>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>> -                           meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -    }
>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>> +    if (ret != -ENODEV)
>>> +        return ret;
>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.

While we all agree that power savings gained by runtime PM would be 
great - I don't think we should stop minor improvements while waiting 
for that to magically happen ;)

I like the saying I first heard from Jonathan Cameron - "Don't let the 
perfect be an enemy of good".

After that being said, should I re-spin this or just drop it? (I am 
cleaning up my local git from old stuff, and these are about to vanish 
from my books).

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-11-16 12:02         ` Vaittinen, Matti
  0 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-11-16 12:02 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

Hi dee Ho Laurent & All,

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---
>>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>       struct reset_control *hdmitx_apb;
>>>       struct reset_control *hdmitx_ctrl;
>>>       struct reset_control *hdmitx_phy;
>>> -    struct regulator *hdmi_supply;
>>>       u32 irq_stat;
>>>       struct dw_hdmi *hdmi;
>>>       struct drm_bridge *bridge;
>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct 
>>> meson_dw_hdmi *meson_dw_hdmi)
>>>   }
>>> -static void meson_disable_regulator(void *data)
>>> -{
>>> -    regulator_disable(data);
>>> -}
>>> -
>>>   static void meson_disable_clk(void *data)
>>>   {
>>>       clk_disable_unprepare(data);
>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device 
>>> *dev, struct device *master,
>>>       meson_dw_hdmi->data = match;
>>>       dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, 
>>> "hdmi");
>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>> -            return -EPROBE_DEFER;
>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>> -    } else {
>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>> -                           meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -    }
>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>> +    if (ret != -ENODEV)
>>> +        return ret;
>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.

While we all agree that power savings gained by runtime PM would be 
great - I don't think we should stop minor improvements while waiting 
for that to magically happen ;)

I like the saying I first heard from Jonathan Cameron - "Don't let the 
perfect be an enemy of good".

After that being said, should I re-spin this or just drop it? (I am 
cleaning up my local git from old stuff, and these are about to vanish 
from my books).

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-11-16 12:02         ` Vaittinen, Matti
  0 siblings, 0 replies; 60+ messages in thread
From: Vaittinen, Matti @ 2022-11-16 12:02 UTC (permalink / raw)
  To: neil.armstrong, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

Hi dee Ho Laurent & All,

On 10/21/22 18:29, Neil Armstrong wrote:
> Hi,
> 
> On 21/10/2022 17:02, Laurent Pinchart wrote:
>> Hi Matti,
>>
>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>> seemingly unused struct member 'hdmi_supply'.
>>>
>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>
>>> ---
>>> v3 => v4:
>>> - split meson part to own patch
>>>
>>> RFCv1 => v2:
>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>
>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>> review and testing is _highly_ appreciated.
>>> ---
>>>   drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>   1 file changed, 3 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>       struct reset_control *hdmitx_apb;
>>>       struct reset_control *hdmitx_ctrl;
>>>       struct reset_control *hdmitx_phy;
>>> -    struct regulator *hdmi_supply;
>>>       u32 irq_stat;
>>>       struct dw_hdmi *hdmi;
>>>       struct drm_bridge *bridge;
>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct 
>>> meson_dw_hdmi *meson_dw_hdmi)
>>>   }
>>> -static void meson_disable_regulator(void *data)
>>> -{
>>> -    regulator_disable(data);
>>> -}
>>> -
>>>   static void meson_disable_clk(void *data)
>>>   {
>>>       clk_disable_unprepare(data);
>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device 
>>> *dev, struct device *master,
>>>       meson_dw_hdmi->data = match;
>>>       dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, 
>>> "hdmi");
>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>> -            return -EPROBE_DEFER;
>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>> -    } else {
>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>> -                           meson_dw_hdmi->hdmi_supply);
>>> -        if (ret)
>>> -            return ret;
>>> -    }
>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>> +    if (ret != -ENODEV)
>>> +        return ret;
>>
>> As noted in the review of the series that introduced
>> devm_regulator_get_enable_optional(), the right thing to do is to
>> implement runtime PM in this driver to avoid wasting power.
> 
> While I agree, it's not really the same level of effort as this patch
> should be functionally equivalent.

While we all agree that power savings gained by runtime PM would be 
great - I don't think we should stop minor improvements while waiting 
for that to magically happen ;)

I like the saying I first heard from Jonathan Cameron - "Don't let the 
perfect be an enemy of good".

After that being said, should I re-spin this or just drop it? (I am 
cleaning up my local git from old stuff, and these are about to vanish 
from my books).

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
  2022-11-16 12:02         ` Vaittinen, Matti
  (?)
  (?)
@ 2022-11-16 12:23           ` neil.armstrong
  -1 siblings, 0 replies; 60+ messages in thread
From: neil.armstrong @ 2022-11-16 12:23 UTC (permalink / raw)
  To: Vaittinen, Matti, Laurent Pinchart, Matti Vaittinen
  Cc: linux-arm-kernel, linux-hwmon, Jean Delvare, Andrzej Hajda,
	Michael Hennerich, Jonas Karlman, Martin Blumenstingl,
	Kevin Hilman, dri-devel, Liam Girdwood, Jernej Skrabec,
	linux-kernel, Mark Brown, Robert Foss, linux-amlogic,
	Guenter Roeck, Jerome Brunet

On 16/11/2022 13:02, Vaittinen, Matti wrote:
> Hi dee Ho Laurent & All,
> 
> On 10/21/22 18:29, Neil Armstrong wrote:
>> Hi,
>>
>> On 21/10/2022 17:02, Laurent Pinchart wrote:
>>> Hi Matti,
>>>
>>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>>> seemingly unused struct member 'hdmi_supply'.
>>>>
>>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>>
>>>> ---
>>>> v3 => v4:
>>>> - split meson part to own patch
>>>>
>>>> RFCv1 => v2:
>>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>>
>>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>>> review and testing is _highly_ appreciated.
>>>> ---
>>>>    drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>>    1 file changed, 3 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>>        struct reset_control *hdmitx_apb;
>>>>        struct reset_control *hdmitx_ctrl;
>>>>        struct reset_control *hdmitx_phy;
>>>> -    struct regulator *hdmi_supply;
>>>>        u32 irq_stat;
>>>>        struct dw_hdmi *hdmi;
>>>>        struct drm_bridge *bridge;
>>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct
>>>> meson_dw_hdmi *meson_dw_hdmi)
>>>>    }
>>>> -static void meson_disable_regulator(void *data)
>>>> -{
>>>> -    regulator_disable(data);
>>>> -}
>>>> -
>>>>    static void meson_disable_clk(void *data)
>>>>    {
>>>>        clk_disable_unprepare(data);
>>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device
>>>> *dev, struct device *master,
>>>>        meson_dw_hdmi->data = match;
>>>>        dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev,
>>>> "hdmi");
>>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>>> -            return -EPROBE_DEFER;
>>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>>> -    } else {
>>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>>> -                           meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -    }
>>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>>> +    if (ret != -ENODEV)
>>>> +        return ret;
>>>
>>> As noted in the review of the series that introduced
>>> devm_regulator_get_enable_optional(), the right thing to do is to
>>> implement runtime PM in this driver to avoid wasting power.
>>
>> While I agree, it's not really the same level of effort as this patch
>> should be functionally equivalent.
> 
> While we all agree that power savings gained by runtime PM would be
> great - I don't think we should stop minor improvements while waiting
> for that to magically happen ;)
> 
> I like the saying I first heard from Jonathan Cameron - "Don't let the
> perfect be an enemy of good".
> 
> After that being said, should I re-spin this or just drop it? (I am
> cleaning up my local git from old stuff, and these are about to vanish
> from my books).

I'm ok with you, please re-spin it.

Neil

> 
> Yours,
> 	-- Matti
> 


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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-11-16 12:23           ` neil.armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: neil.armstrong @ 2022-11-16 12:23 UTC (permalink / raw)
  To: Vaittinen, Matti, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

On 16/11/2022 13:02, Vaittinen, Matti wrote:
> Hi dee Ho Laurent & All,
> 
> On 10/21/22 18:29, Neil Armstrong wrote:
>> Hi,
>>
>> On 21/10/2022 17:02, Laurent Pinchart wrote:
>>> Hi Matti,
>>>
>>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>>> seemingly unused struct member 'hdmi_supply'.
>>>>
>>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>>
>>>> ---
>>>> v3 => v4:
>>>> - split meson part to own patch
>>>>
>>>> RFCv1 => v2:
>>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>>
>>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>>> review and testing is _highly_ appreciated.
>>>> ---
>>>>    drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>>    1 file changed, 3 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>>        struct reset_control *hdmitx_apb;
>>>>        struct reset_control *hdmitx_ctrl;
>>>>        struct reset_control *hdmitx_phy;
>>>> -    struct regulator *hdmi_supply;
>>>>        u32 irq_stat;
>>>>        struct dw_hdmi *hdmi;
>>>>        struct drm_bridge *bridge;
>>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct
>>>> meson_dw_hdmi *meson_dw_hdmi)
>>>>    }
>>>> -static void meson_disable_regulator(void *data)
>>>> -{
>>>> -    regulator_disable(data);
>>>> -}
>>>> -
>>>>    static void meson_disable_clk(void *data)
>>>>    {
>>>>        clk_disable_unprepare(data);
>>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device
>>>> *dev, struct device *master,
>>>>        meson_dw_hdmi->data = match;
>>>>        dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev,
>>>> "hdmi");
>>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>>> -            return -EPROBE_DEFER;
>>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>>> -    } else {
>>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>>> -                           meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -    }
>>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>>> +    if (ret != -ENODEV)
>>>> +        return ret;
>>>
>>> As noted in the review of the series that introduced
>>> devm_regulator_get_enable_optional(), the right thing to do is to
>>> implement runtime PM in this driver to avoid wasting power.
>>
>> While I agree, it's not really the same level of effort as this patch
>> should be functionally equivalent.
> 
> While we all agree that power savings gained by runtime PM would be
> great - I don't think we should stop minor improvements while waiting
> for that to magically happen ;)
> 
> I like the saying I first heard from Jonathan Cameron - "Don't let the
> perfect be an enemy of good".
> 
> After that being said, should I re-spin this or just drop it? (I am
> cleaning up my local git from old stuff, and these are about to vanish
> from my books).

I'm ok with you, please re-spin it.

Neil

> 
> Yours,
> 	-- Matti
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-11-16 12:23           ` neil.armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: neil.armstrong @ 2022-11-16 12:23 UTC (permalink / raw)
  To: Vaittinen, Matti, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

On 16/11/2022 13:02, Vaittinen, Matti wrote:
> Hi dee Ho Laurent & All,
> 
> On 10/21/22 18:29, Neil Armstrong wrote:
>> Hi,
>>
>> On 21/10/2022 17:02, Laurent Pinchart wrote:
>>> Hi Matti,
>>>
>>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>>> seemingly unused struct member 'hdmi_supply'.
>>>>
>>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>>
>>>> ---
>>>> v3 => v4:
>>>> - split meson part to own patch
>>>>
>>>> RFCv1 => v2:
>>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>>
>>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>>> review and testing is _highly_ appreciated.
>>>> ---
>>>>    drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>>    1 file changed, 3 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>>        struct reset_control *hdmitx_apb;
>>>>        struct reset_control *hdmitx_ctrl;
>>>>        struct reset_control *hdmitx_phy;
>>>> -    struct regulator *hdmi_supply;
>>>>        u32 irq_stat;
>>>>        struct dw_hdmi *hdmi;
>>>>        struct drm_bridge *bridge;
>>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct
>>>> meson_dw_hdmi *meson_dw_hdmi)
>>>>    }
>>>> -static void meson_disable_regulator(void *data)
>>>> -{
>>>> -    regulator_disable(data);
>>>> -}
>>>> -
>>>>    static void meson_disable_clk(void *data)
>>>>    {
>>>>        clk_disable_unprepare(data);
>>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device
>>>> *dev, struct device *master,
>>>>        meson_dw_hdmi->data = match;
>>>>        dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev,
>>>> "hdmi");
>>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>>> -            return -EPROBE_DEFER;
>>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>>> -    } else {
>>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>>> -                           meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -    }
>>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>>> +    if (ret != -ENODEV)
>>>> +        return ret;
>>>
>>> As noted in the review of the series that introduced
>>> devm_regulator_get_enable_optional(), the right thing to do is to
>>> implement runtime PM in this driver to avoid wasting power.
>>
>> While I agree, it's not really the same level of effort as this patch
>> should be functionally equivalent.
> 
> While we all agree that power savings gained by runtime PM would be
> great - I don't think we should stop minor improvements while waiting
> for that to magically happen ;)
> 
> I like the saying I first heard from Jonathan Cameron - "Don't let the
> perfect be an enemy of good".
> 
> After that being said, should I re-spin this or just drop it? (I am
> cleaning up my local git from old stuff, and these are about to vanish
> from my books).

I'm ok with you, please re-spin it.

Neil

> 
> Yours,
> 	-- Matti
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*()
@ 2022-11-16 12:23           ` neil.armstrong
  0 siblings, 0 replies; 60+ messages in thread
From: neil.armstrong @ 2022-11-16 12:23 UTC (permalink / raw)
  To: Vaittinen, Matti, Laurent Pinchart, Matti Vaittinen
  Cc: Andrzej Hajda, Robert Foss, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Michael Hennerich, Jean Delvare,
	Guenter Roeck, Liam Girdwood, Mark Brown, dri-devel,
	linux-kernel, linux-amlogic, linux-arm-kernel, linux-hwmon

On 16/11/2022 13:02, Vaittinen, Matti wrote:
> Hi dee Ho Laurent & All,
> 
> On 10/21/22 18:29, Neil Armstrong wrote:
>> Hi,
>>
>> On 21/10/2022 17:02, Laurent Pinchart wrote:
>>> Hi Matti,
>>>
>>> On Fri, Oct 21, 2022 at 04:18:01PM +0300, Matti Vaittinen wrote:
>>>> Simplify using the devm_regulator_get_enable_optional(). Also drop the
>>>> seemingly unused struct member 'hdmi_supply'.
>>>>
>>>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>>>>
>>>> ---
>>>> v3 => v4:
>>>> - split meson part to own patch
>>>>
>>>> RFCv1 => v2:
>>>> - Change also sii902x to use devm_regulator_bulk_get_enable()
>>>>
>>>> Please note - this is only compile-tested due to the lack of HW. Careful
>>>> review and testing is _highly_ appreciated.
>>>> ---
>>>>    drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
>>>>    1 file changed, 3 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> index 5cd2b2ebbbd3..7642f740272b 100644
>>>> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
>>>> @@ -140,7 +140,6 @@ struct meson_dw_hdmi {
>>>>        struct reset_control *hdmitx_apb;
>>>>        struct reset_control *hdmitx_ctrl;
>>>>        struct reset_control *hdmitx_phy;
>>>> -    struct regulator *hdmi_supply;
>>>>        u32 irq_stat;
>>>>        struct dw_hdmi *hdmi;
>>>>        struct drm_bridge *bridge;
>>>> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct
>>>> meson_dw_hdmi *meson_dw_hdmi)
>>>>    }
>>>> -static void meson_disable_regulator(void *data)
>>>> -{
>>>> -    regulator_disable(data);
>>>> -}
>>>> -
>>>>    static void meson_disable_clk(void *data)
>>>>    {
>>>>        clk_disable_unprepare(data);
>>>> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device
>>>> *dev, struct device *master,
>>>>        meson_dw_hdmi->data = match;
>>>>        dw_plat_data = &meson_dw_hdmi->dw_plat_data;
>>>> -    meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev,
>>>> "hdmi");
>>>> -    if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
>>>> -        if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
>>>> -            return -EPROBE_DEFER;
>>>> -        meson_dw_hdmi->hdmi_supply = NULL;
>>>> -    } else {
>>>> -        ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -        ret = devm_add_action_or_reset(dev, meson_disable_regulator,
>>>> -                           meson_dw_hdmi->hdmi_supply);
>>>> -        if (ret)
>>>> -            return ret;
>>>> -    }
>>>> +    ret = devm_regulator_get_enable_optional(dev, "hdmi");
>>>> +    if (ret != -ENODEV)
>>>> +        return ret;
>>>
>>> As noted in the review of the series that introduced
>>> devm_regulator_get_enable_optional(), the right thing to do is to
>>> implement runtime PM in this driver to avoid wasting power.
>>
>> While I agree, it's not really the same level of effort as this patch
>> should be functionally equivalent.
> 
> While we all agree that power savings gained by runtime PM would be
> great - I don't think we should stop minor improvements while waiting
> for that to magically happen ;)
> 
> I like the saying I first heard from Jonathan Cameron - "Don't let the
> perfect be an enemy of good".
> 
> After that being said, should I re-spin this or just drop it? (I am
> cleaning up my local git from old stuff, and these are about to vanish
> from my books).

I'm ok with you, please re-spin it.

Neil

> 
> Yours,
> 	-- Matti
> 


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

end of thread, other threads:[~2022-11-16 12:27 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 13:17 [PATCH v4 0/4] Use devm helpers for regulator get and enable Matti Vaittinen
2022-10-21 13:17 ` Matti Vaittinen
2022-10-21 13:17 ` Matti Vaittinen
2022-10-21 13:17 ` Matti Vaittinen
2022-10-21 13:18 ` [PATCH v4 1/4] gpu: drm: meson: Use devm_regulator_*get_enable*() Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:24   ` Neil Armstrong
2022-10-21 13:24     ` Neil Armstrong
2022-10-21 13:24     ` Neil Armstrong
2022-10-21 13:24     ` Neil Armstrong
2022-10-21 15:02   ` Laurent Pinchart
2022-10-21 15:02     ` Laurent Pinchart
2022-10-21 15:02     ` Laurent Pinchart
2022-10-21 15:02     ` Laurent Pinchart
2022-10-21 15:29     ` Neil Armstrong
2022-10-21 15:29       ` Neil Armstrong
2022-10-21 15:29       ` Neil Armstrong
2022-10-21 15:29       ` Neil Armstrong
2022-10-24  4:40       ` Vaittinen, Matti
2022-10-24  4:40         ` Vaittinen, Matti
2022-10-24  4:40         ` Vaittinen, Matti
2022-10-24  4:40         ` Vaittinen, Matti
2022-11-16 12:02       ` Vaittinen, Matti
2022-11-16 12:02         ` Vaittinen, Matti
2022-11-16 12:02         ` Vaittinen, Matti
2022-11-16 12:02         ` Vaittinen, Matti
2022-11-16 12:23         ` neil.armstrong
2022-11-16 12:23           ` neil.armstrong
2022-11-16 12:23           ` neil.armstrong
2022-11-16 12:23           ` neil.armstrong
2022-10-21 13:18 ` [PATCH v4 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable() Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:24   ` Matti Vaittinen
2022-10-21 13:24     ` Matti Vaittinen
2022-10-21 13:24     ` Matti Vaittinen
2022-10-21 13:24     ` Matti Vaittinen
2022-10-24 15:47     ` Robert Foss
2022-10-24 15:47       ` Robert Foss
2022-10-24 15:47       ` Robert Foss
2022-10-24 15:47       ` Robert Foss
2022-10-21 13:18 ` [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable() Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 13:18   ` Matti Vaittinen
2022-10-21 17:21   ` Guenter Roeck
2022-10-21 17:21     ` Guenter Roeck
2022-10-21 17:21     ` Guenter Roeck
2022-10-21 17:21     ` Guenter Roeck
2022-10-21 13:19 ` [PATCH v4 4/4] hwmon: adm1177: " Matti Vaittinen
2022-10-21 13:19   ` Matti Vaittinen
2022-10-21 13:19   ` Matti Vaittinen
2022-10-21 13:19   ` Matti Vaittinen
2022-10-21 17:22   ` Guenter Roeck
2022-10-21 17:22     ` Guenter Roeck
2022-10-21 17:22     ` Guenter Roeck
2022-10-21 17:22     ` Guenter Roeck

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.