From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatolij Gustschin Date: Wed, 20 May 2020 00:05:01 +0200 Subject: [PATCH 2/2] thermal: imx_scu_thermal: fix getting DT alert property value In-Reply-To: References: <20200516203420.24409-1-agust@denx.de> <20200516203420.24409-2-agust@denx.de> <20200517131828.2c3686e5@crub> <20200517165317.662d7ae2@crub> <20200519113542.52b30bdf@crub> <20200519122632.3435285f@crub> Message-ID: <20200520000501.6a03d99b@crub> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 19 May 2020 11:45:55 +0000 Peng Fan peng.fan at nxp.com wrote: ... > 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. well, we have three thermal uclass devices on i.MX8QXP: thermal 0 [ ] imx_sc_thermal |-- thermal-sensor thermal 1 [ ] imx_sc_thermal | |-- cpu-thermal0 thermal 2 [ ] imx_sc_thermal | `-- drc-thermal0 when using uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev), the first device ("thermal-sensor") is matching and for this device imx_sc_thermal_ofdata_to_platdata() will be called, it then tries to get the "thermal-sensors" list in the node of "thermal-sensor" device (dev_of_offset(dev)), but this is wrong, since this list is a property of the "cpu-thermal0" node according to bindings. Therefore ofdata_to_platdata() can't find the "thermal-sensors" list and does not initialize alert/critical pdata values. When uclass_get_device_by_name() is used, then imx_sc_thermal_ofdata_to_platdata() is called for "cpu-thermal0" device, here getting the list works and alert/critical pdata values are initialized properly. -- Anatolij