Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2874273ybc; Wed, 20 Nov 2019 23:03:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzByYWHHGN3vT/PsR/7nrVXWy9dBtuIEvJxtnZR0z7x9/HMKrAlacFMKj+b7dO3K6ectPic X-Received: by 2002:a1c:41c2:: with SMTP id o185mr7530915wma.34.1574319817243; Wed, 20 Nov 2019 23:03:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574319817; cv=none; d=google.com; s=arc-20160816; b=kz0CQTSwA+j3JzdP8/0uRolFQhhpOwHK2oiCYuV86H39yh0Z7fzyS7ae0tbU62lDWE OhMIBp9sGa+1Y9iJisc8W70JIl0gw732FMQIBdAFlrcacIfQZDNGBPXa26/whUaMeOua uP9zrHX0OBabpXy72jql6DSZ0DJ7SGzNO2ixzXsGBbpn4hTPHFd5t3hCYKLhkXUnvK89 ct/ZI/HCbypKBEHedAW0rUNR3pPvpjxXsn90PJ7bqIghIusQRiBiRa0uGGCWhFwL5m4P VaGFXvZmXGKlank/S38gJ7zqNJ55AAcJi+buX5GX4B6v6NPmVUCqKO5gUKpGRQXA/fiG fLrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=70XhVJoIf0CSjHrTRztFdyaZcM5N+1vNz44dhwcRPXw=; b=RpiCxUt2MrKbBkn3jFR9E6jkSjmZRUFNqEu6J8hIwH5umCHVTowCqtYnDZsntYv09b hpOf095sRQwIsruCI4l9a0LhUA5k080mbnssKIllQvk+ncBzLaprzHxgQrz/miSjBL4h XEPSe1QPOshkN1gaui5764HRue9N3spC/m2j8l2uJAmbEYcmKjQkPlDbQgq1mQp6CjKe pnVepLNIZIi63ILnDsY+zKVO4BvwDvyoKCf4lAAr3LBcPs26kp+F1tMMgX38DAWAbxwS TRMiTy6kDKH/l8qqvhUyaUKvwnWvqtMCI+1CxEIrTObZ+9bwrWvVWnv892emlk0eDIv/ Z9dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SLYBtyri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si1494456edf.32.2019.11.20.23.03.12; Wed, 20 Nov 2019 23:03:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SLYBtyri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725842AbfKUHA7 (ORCPT + 99 others); Thu, 21 Nov 2019 02:00:59 -0500 Received: from mail-il1-f174.google.com ([209.85.166.174]:36906 "EHLO mail-il1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726454AbfKUHA6 (ORCPT ); Thu, 21 Nov 2019 02:00:58 -0500 Received: by mail-il1-f174.google.com with SMTP id s5so2259878iln.4 for ; Wed, 20 Nov 2019 23:00:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=70XhVJoIf0CSjHrTRztFdyaZcM5N+1vNz44dhwcRPXw=; b=SLYBtyriQY7seuHEQlL2JSt3ilAFTLCs46gN0dKVPB6PjkBZRqNh7NltQlrIcE52WM NS1NEPu5eptOkKJvpE2HSpv/lFbdetda9B7b5w8JK7jknek+pKEqkv06FYxZ3lzN0R6J Cwg+Cbs8vlomam8/SjUZutICyodcTjUUrT+50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=70XhVJoIf0CSjHrTRztFdyaZcM5N+1vNz44dhwcRPXw=; b=K2ikpfv2gtIEH6fx55b3AZ+BkkJXQpspzKlPCaSGWh9IjxgCT9FPbl+kP9b6qBXJxa H98oGTpOMzBnU3YA5hR/Xm4Aw7zAqRLykSV7g1BePl7S5u5QQGVo8F1+rn1xXQBO10qg n6/vzgqw+hrTXhoXI93CwqhGDwmg7DiriIk46ABSld3PJml3RK39G0psRdkaIUE6uTkZ shKf0SpqLcTV7WTx2ANDk9SvHyX1oNJzcNGu6V4dNny6mVR92podb1lz/uS39Jh62nna S4wnAXmLq4ZYgBtt0AwBb8Pw3U+/iLDU/XqqDG0bHd21C1C3U2FbM1SswLGFyC7Lej+K Whxg== X-Gm-Message-State: APjAAAXAkwNTKrZ3ivEq6skn1HvkaxS+FIaprhhnDSiML4hNd7883Nu2 IPPJ7W/MfVISJapOvOLu7r7L1znEo5cLtHSLaid+mQ== X-Received: by 2002:a92:5d08:: with SMTP id r8mr8154845ilb.283.1574319657713; Wed, 20 Nov 2019 23:00:57 -0800 (PST) MIME-Version: 1.0 References: <1557494826-6044-1-git-send-email-michael.kao@mediatek.com> <1557494826-6044-8-git-send-email-michael.kao@mediatek.com> In-Reply-To: <1557494826-6044-8-git-send-email-michael.kao@mediatek.com> From: Hsin-Yi Wang Date: Thu, 21 Nov 2019 15:00:31 +0800 Message-ID: Subject: Re: [PATCH v2 7/8] thermal: mediatek: add another get_temp ops for thermal sensors To: "michael.kao" Cc: Zhang Rui , Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Matthias Brugger , linux-pm@vger.kernel.org, Devicetree List , lkml , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 10, 2019 at 9:27 PM michael.kao wrote: > - tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, > - &mtk_thermal_ops); > - if (IS_ERR(tzdev)) { > - ret = PTR_ERR(tzdev); > - goto err_disable_clk_peri_therm; > + for (i = 0; i < mt->conf->num_sensors + 1; i++) { > + tz = kmalloc(sizeof(*tz), GFP_KERNEL); > + if (!tz) > + return -ENOMEM; > + > + tz->mt = mt; > + tz->id = i; > + > + tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, i, > + tz, (i == 0) ? > + &mtk_thermal_ops : &mtk_thermal_sensor_ops); > + > + if (IS_ERR(tzdev)) { > + if (IS_ERR(tzdev) != -EACCES) { PTR_ERR(tzdev) > + ret = PTR_ERR(tzdev); > + goto err_disable_clk_peri_therm; > + } > + } This for loop adding thermal zone sensors will not work for mt8173. It assumes that thermal-zones in dts have subnodes (eg. cpu_thermal, tzts..) amount equal to num_sensors+1. Otherwise tzdev would be -ENODEV and thermal failed to be probed. In mt8183 this is fine, since each thermal zone only has one sensor, but in mt8173, some sensor appears in multiple thermal zones. In order to let the change also works for 8173, I think if the error is -ENODEV, and the id is not 0 (0 is cpu_thermal), prompt a warning instead of failing. Eg. if (IS_ERR(tzdev)) { + if (i > 0 && PTR_ERR(tzdev) == -ENODEV) { + dev_warn(&pdev->dev, "can't find thermal sensor %d\n", i); + continue; + } if (PTR_ERR(tzdev) != -EACCES) {