[PATCH 2/2] thermal: imx_scu_thermal: fix getting DT alert property value

Peng Fan
2020-05-19T11:45:55Z

+Simon

> -----Original Message-----
> From: Anatolij Gustschin <agust@denx.de>
> Sent: 2020?5?19? 18:27
> To: Peng Fan <peng.fan@nxp.com>
> Cc: u-boot at lists.denx.de; Ye Li <ye.li@nxp.com>; Frank Li
> <frank.li@nxp.com>; sbabic at denx.de
> Subject: Re: [PATCH 2/2] thermal: imx_scu_thermal: fix getting DT alert
> property value
>
> On Tue, 19 May 2020 10:05:21 +0000
> Peng Fan peng.fan at nxp.com wrote:
> ...
> > Would this help?
> >
> > diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c index
> > 95c14c98d8..6c949ccbd4 100644
> > --- a/drivers/cpu/imx8_cpu.c
> > +++ b/drivers/cpu/imx8_cpu.c
> > @@ -68,10 +68,13 @@ static int cpu_imx_get_temp(struct
> cpu_imx_platdata *plat)
> > struct udevice *thermal_dev;
> > int cpu_tmp, ret;
> >
> > - if (!strcmp(plat->name, "A72"))
> > - ret = uclass_get_device(UCLASS_THERMAL, 1,
> &thermal_dev);
> > - else
> > - ret = uclass_get_device(UCLASS_THERMAL, 0,
> &thermal_dev);
> > + if (!strcmp(plat->name, "A72")) {
> > + ret = uclass_get_device_by_name(UCLASS_THERMAL,
> "cpu-thermal1",
> > + &thermal_dev);
> > + } else {
> > + ret = uclass_get_device_by_name(UCLASS_THERMAL,
> "cpu-thermal0",
> > + &thermal_dev);
> > + }
> >
> > if (!ret) {
> > ret = thermal_get_temp(thermal_dev, &cpu_tmp);
>
> Yes, this fixes the problem, thanks!

Do you have more insights about uclass_get_device and uclass_get_device_byname?
uclass_get_device not work, but uclass_get_device_byname work.

Thanks,
Peng.

>
> --
> Anatolij