]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
stpmic1: simplify stpmic1_sysreset_request
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 2 Aug 2019 11:08:04 +0000 (13:08 +0200)
committerPatrice Chotard <patrice.chotard@st.com>
Tue, 27 Aug 2019 09:19:23 +0000 (11:19 +0200)
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

index 509baed7eca3f3a935aa6c2cd87b4161263a9387..de31934f41a503874e73bd336576ff0b74b26721 100644 (file)
@@ -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 && type != SYSRESET_POWER_OFF)
                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;