From patchwork Tue Feb 21 18:07:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 60202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp151966wrd; Tue, 21 Feb 2023 10:11:05 -0800 (PST) X-Google-Smtp-Source: AK7set/NLhCsvTJFiaIHsapRjtKQR0WV1tfHd9FyrdvZvawxbMRMD2Ny/tZsAOLsgvKeZiYGVaBd X-Received: by 2002:a05:6a20:4425:b0:c7:45c6:d344 with SMTP id ce37-20020a056a20442500b000c745c6d344mr6746514pzb.43.1677003065601; Tue, 21 Feb 2023 10:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677003065; cv=none; d=google.com; s=arc-20160816; b=qlrn5vXBavSZCm16HNYXMuuvsaDuC2O5wzKUH/KVTZb4esoavTvQIM7WdW7CEqX4FR 8F0L0dixaV3QjEbtYPeZjGzwRPFoJFGLX6joeECRjAbtIJ2hP3STwdhm2HwzsASPJ53d s+zE4OXm1wlgsQBLm2aKlojHyF/PJ2ZjBiNznVEHFsecP9puVtiIu281Tk1qn+275JVA w4gRNLxe8Ck0xHmpT2Saw41vAl9SEK6sCieJZEdkBQdt6JS+WjCSYEeomhs3llAgbGgG Cp5WW39Vu/eDFG2cmaqycmWimeffdEAC5L5LJmFglrhPlLiPxPK0ZRBl4jR6ASClnssH FyJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WxOjXV0BQvNs4//4eyybGdilzG1LzEaF0NAq/aqNM8Q=; b=RXIz0TFKozRPp3Sf2E/zyhHFtHBxfpCTX5ToP1l77Cbn2Y+fMKiOeRzQXvhpVFukFv Bf7ij/Y76PkakixStWVERudbA7A3tV2PYnj9pJ8pzUvkXSpi9nqz7EbAwAohg5HNapaO lKfBo3UpkSQBSxXFNdPWL9Ji7W8LLMxx3cSnpYW7iDejF+qwGv62Nw3KOJTYR/q6F8jE oNhpvR0HVWXKXd2GsW4d/sOQcd/+uxM5ZUji+PNrVKwdBh2rLpTSUKWq675fHbqSCvPb GL+GuBNN7TAToz+jSdE/yJnOvSAl6mtD4URgP0Of/Lgzu6YN5CsGroQIpZ595E1wS2zq BoSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JT/vx6hF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g65-20020a636b44000000b004fbfc2b436bsi17834347pgc.517.2023.02.21.10.10.52; Tue, 21 Feb 2023 10:11:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JT/vx6hF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232766AbjBUSJO (ORCPT + 99 others); Tue, 21 Feb 2023 13:09:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbjBUSIi (ORCPT ); Tue, 21 Feb 2023 13:08:38 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 101302DE57 for ; Tue, 21 Feb 2023 10:08:03 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id az11-20020a05600c600b00b003dc4fd6e61dso4307366wmb.5 for ; Tue, 21 Feb 2023 10:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WxOjXV0BQvNs4//4eyybGdilzG1LzEaF0NAq/aqNM8Q=; b=JT/vx6hFSQYN4c2jk7Stt6InjzZQMM0mhvzlKkKPuYT9DPtfKOsHXrx+sSqzXKmhV4 HN9xhbOFiCrS189gTkrTh3E/RW3s6hpY+u7m940QJwtr7wmvT2sHJgPehcPVIAtCT9Ar UvMyL2S1IWn42TvYQkGPwwU2DBDYMgEKb20wEvg9ToEv2NoLp3mQIxqQuWfeiY3V5b/I 2zg1mNJz3D0JZ/hfVvnCeFQxlgDbwpf4fEKFFTn1Cai6l+oQ4gBe3C4iqhC5UlQd3siB bXcwe4EyQwybr4voCX90kNGpz+328NTLLnNegXxxDf/8Vb5ETwX+XfqbHLZlVLoRRRe5 z12A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WxOjXV0BQvNs4//4eyybGdilzG1LzEaF0NAq/aqNM8Q=; b=hoidkDlWKVp02Omaq4T6p5up3nkvt3K8lg/WPOKFZ6EOwlfHT0DHkiFIJfXfczaGkp m46k9IdYVNC3TxMPeNAm8SOWBtDRbjiEuxKa68DVrbrUsszk+QVL/cBM4jnrmtQRVPem ISMaJPy08feKTsFYFKmIO+leQzBjDtxgOiZf4t+2nwpzDtZGE7Uxh75o76sIkpXvtDzh cDhc93agveVD0OfjtW10LSKQ8divr5ejOEQAe7fOpPpDk0doFfl7aaVSt+i+pYv5lUfw 3KCyUCH4iKEZRfONxmYse8C/wBcl0mqdJ2B19Uu6xooxi05hiZW27ob2zSWqrObDYY+v 4t4A== X-Gm-Message-State: AO0yUKU73yhyXjvcFjfAi7ydo7pI1HdG5xKfgXWG14I07qgI4N7c5jlk wqhl+Rw0OEvYXt+fORqps6EQA8ou5TZoHcZXA1I= X-Received: by 2002:a05:600c:16d3:b0:3dc:5950:b358 with SMTP id l19-20020a05600c16d300b003dc5950b358mr10858363wmn.14.1677002883410; Tue, 21 Feb 2023 10:08:03 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:1e9:315c:bb40:e382]) by smtp.gmail.com with ESMTPSA id c128-20020a1c3586000000b003e21558ee9dsm5107815wma.2.2023.02.21.10.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 10:08:03 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ido Schimmel , Zhang Rui , Len Brown , Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Amit Kucheria , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno , Balsam CHIHI , Baolin Wang , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER), netdev@vger.kernel.org (open list:MELLANOX ETHERNET SWITCH DRIVERS), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v2 09/16] thermal: Do not access 'type' field, use the tz id instead Date: Tue, 21 Feb 2023 19:07:03 +0100 Message-Id: <20230221180710.2781027-10-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230221180710.2781027-1-daniel.lezcano@linaro.org> References: <20230221180710.2781027-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758465166329594348?= X-GMAIL-MSGID: =?utf-8?q?1758465166329594348?= The 'type' field is used as a name in the message. However we can have multiple thermal zone with the same type. The information is not accurate. Moreover, the thermal zone device structure is directly accessed while we want to improve the self-encapsulation of the code. Replace the 'type' in the message by the thermal zone id. Signed-off-by: Daniel Lezcano Reviewed-by: Ido Schimmel #mlxsw Reviewed-by: AngeloGioacchino Del Regno Acked-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 4 ++-- drivers/thermal/mediatek/lvts_thermal.c | 5 +---- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 392b73b3e269..b55a3b0ad9ed 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -842,7 +842,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) goto acpi_bus_detach; dev_info(&tz->device->dev, "registered as thermal_zone%d\n", - tz->thermal_zone->id); + thermal_zone_device_get_id(tz->thermal_zone)); return 0; diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index 722e4a40afef..a997fca211ba 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -176,8 +176,8 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core, } if (crit_temp > emerg_temp) { - dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %d\n", - tz->tzdev->type, crit_temp, emerg_temp); + dev_warn(dev, "tz id %d: Critical threshold %d is above emergency threshold %d\n", + thermal_zone_device_get_id(tz->tzdev), crit_temp, emerg_temp); return 0; } diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index beb835d644e2..155cef8ed3f5 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -304,10 +304,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - if (low != -INT_MAX) { - pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low); + if (low != -INT_MAX) writel(raw_low, LVTS_H2NTHRE(base)); - } /* * Hot temperature threshold @@ -318,7 +316,6 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high); writel(raw_high, LVTS_HTHRE(base)); return 0; diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 060f46cea5ff..488b08fc20e4 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -43,8 +43,8 @@ static void ti_thermal_work(struct work_struct *work) thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); - dev_dbg(data->bgp->dev, "updated thermal zone %s\n", - data->ti_thermal->type); + dev_dbg(data->bgp->dev, "updated thermal zone id %d\n", + thermal_zone_device_get_id(data->ti_thermal)); } /**