[U-Boot,3/5] stpmic1: simplify stpmic1_sysreset_request
diff mbox series

Message ID 1563529171-16796-4-git-send-email-patrick.delaunay@st.com
State Changes Requested
Delegated to: Patrick Delaunay
Headers show
Series
  • misc: update drivers for stm32mp1
Related show

Commit Message

Patrick Delaunay July 19, 2019, 9:39 a.m. UTC
Retrieve parent device from dev->parent instead of
calling uclass_get_device_by_driver()

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/power/pmic/stpmic1.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Patch
diff mbox series

diff --git a/drivers/power/pmic/stpmic1.c b/drivers/power/pmic/stpmic1.c
index 9f20c31..b644176 100644
--- a/drivers/power/pmic/stpmic1.c
+++ b/drivers/power/pmic/stpmic1.c
@@ -232,19 +232,12 @@  U_BOOT_DRIVER(stpmic1_nvm) = {
 #ifdef CONFIG_SYSRESET
 static int stpmic1_sysreset_request(struct udevice *dev, enum sysreset_t type)
 {
-	struct udevice *pmic_dev;
+	struct udevice *pmic_dev = dev->parent;
 	int ret;
 
 	if (type != SYSRESET_POWER)
 		return -EPROTONOSUPPORT;
 
-	ret = uclass_get_device_by_driver(UCLASS_PMIC,
-					  DM_GET_DRIVER(pmic_stpmic1),
-					  &pmic_dev);
-
-	if (ret)
-		return -EOPNOTSUPP;
-
 	ret = pmic_reg_read(pmic_dev, STPMIC1_MAIN_CR);
 	if (ret < 0)
 		return ret;