mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 14:41:26 +01:00
stpmic1: simplify stpmic1_sysreset_request
Retrieve parent device from dev->parent instead of calling uclass_get_device_by_driver() Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
234a60244c
commit
ef32dcf119
@ -232,19 +232,12 @@ U_BOOT_DRIVER(stpmic1_nvm) = {
|
|||||||
#ifdef CONFIG_SYSRESET
|
#ifdef CONFIG_SYSRESET
|
||||||
static int stpmic1_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
static int stpmic1_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
||||||
{
|
{
|
||||||
struct udevice *pmic_dev;
|
struct udevice *pmic_dev = dev->parent;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (type != SYSRESET_POWER && type != SYSRESET_POWER_OFF)
|
if (type != SYSRESET_POWER && type != SYSRESET_POWER_OFF)
|
||||||
return -EPROTONOSUPPORT;
|
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);
|
ret = pmic_reg_read(pmic_dev, STPMIC1_MAIN_CR);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user