From patchwork Sun Feb 19 14:36:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 59172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp880261wrn; Sun, 19 Feb 2023 06:57:09 -0800 (PST) X-Google-Smtp-Source: AK7set8eZjqbQFwfYEj4VKcUsmpk4XOR3rs2OxYQ10iYy5Y9Kat03hGxc2RDNoevzK3lJ14cA690 X-Received: by 2002:a17:90a:cf8e:b0:22c:8686:5f04 with SMTP id i14-20020a17090acf8e00b0022c86865f04mr1207519pju.15.1676818629415; Sun, 19 Feb 2023 06:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676818629; cv=none; d=google.com; s=arc-20160816; b=Yu2i+vsWYUW9PMZ27JT7nir8pcoThhn+MElqyPgN/CSLKKS2zehJ2a4gJhejT9NJLh kc7vW/GJVCPcUaSwma03unX3NSu6Ul7EE7Eo8CZy8T6X9TD0FbKObTES131U2q1W/Gv+ dtq0MEeqoMDv+YB+2rxThdSx6SK13ZdEdina7nxl6PYLQ7XYiNbJaZ4kpEyGv/llWkZq 5/ofPoRaGdQzypiXqSVojWszf28jOwyIckzU6Gs6JG183K/0g+JT0baRN4AcDmJuVkNj NA/6HM2FEmVnTYD+mXJ0S8a7IWsv0Me74pDjOGogP6/XHVu8bO6DUISnoHTAU4fIMwms uEIg== 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=BDzCeDjhe5THr9kYy7urFayWf0fqGV769f7YqEQHSUI=; b=quWA65+66YDsj9xQEvyY/FOgxBj+WikLRtQJP4E7fkuGScEXmHwYUHG4G+TevyLIAe Cwgm0pkJHm5w6ikz9ucx0QOuWxDgMTdXYb28x65lwZRb1dSsWSbJVuvuuaF4TvvMmF71 GRwCb5BiI3iVKRFuriEdyssSuKLK49uZ12Hbm3D4FnAsvwwSl3rNh3nSJF9eFH7/fNJ2 SvJy5yWinjlQ080HEX6oC7n5RsseGWCxGHjtJQasBRlRtptgjSSd0sJCakZogXBnRomZ gpBqJOuGbaFVnyIcdcPzPPj2960pUiBHQxoM077Z3SIOd50slPjHFPItSF+EUePYRQ/a GTCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z8AUw1H7; 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 q8-20020a17090aa00800b00234b66e3df3si9448907pjp.153.2023.02.19.06.56.56; Sun, 19 Feb 2023 06:57:09 -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=Z8AUw1H7; 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 S230280AbjBSOjP (ORCPT + 99 others); Sun, 19 Feb 2023 09:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbjBSOif (ORCPT ); Sun, 19 Feb 2023 09:38:35 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED84130 for ; Sun, 19 Feb 2023 06:38:11 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id c17so334788wrx.0 for ; Sun, 19 Feb 2023 06:38:11 -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=BDzCeDjhe5THr9kYy7urFayWf0fqGV769f7YqEQHSUI=; b=Z8AUw1H7XELv4lEQit2NEoHxzkJGSQ9zsP1UD7S8vitx8spwRUH0oFv8bdDtDUB7q2 SNRmLHoRxwEVKUl/VsrqK9RNCaH1gzMo9ynsfKIN7MspMhv2+OTXNw37ASDMyG5rXg2S E4Z8d+o6VcMFeBKRdCVTonKE+IY8nNVYPK2nknixLzkYkiwB0kOvd3pxmsL81HwsRRyQ FMb1mye/6YaO4vwnZKZHlVFKOf2bqSAxGetjMoXF4eR6pMEN9xUyRa8XwLBt76MGZ8Ix JC0hsXx6gJMOWvCqGmj33vrE4QmloGXxa3PKyoElUOscBWJHqe2D7w8dhVej9RVybn8O JXxA== 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=BDzCeDjhe5THr9kYy7urFayWf0fqGV769f7YqEQHSUI=; b=FqLWhdqN9ya3DrcYhOAjMiQaBuz6u4Hb9LP3Gs271+YI3PZzytc+G2CRgA0+ElfQ2Q LHKI2RA+KooXt8obJeFZwtsECZnwGKNYfbQbdmvfmO9dpfp7ey41oHbbg0bgrvFZmldV Byx4DTZ+SWqaTF2sf+pN0sl6nldk3FmhtueL4b1xkF0ZXeeqokDsw3GlHzm1hY/buqst 9zU3r5CVPxPTLa1KS5YJLUv6NyfTNdKyOlikp6fdYrN4EQ36c2jL0UymV3Wtvu/5x4Jm 0/n8IXx8OzsVcy205GCHHzO0P6aZT9LSMPBcPrVdue13rfpTR+vf2YMjipdKjdwpsRtr 0ilg== X-Gm-Message-State: AO0yUKVQQOzJo4sVtH79nwsiDrv8868iGjsEDfcO4C54otZtEiCk32kw s84SDjMuefJkH0f1Fj6WzgxMKw== X-Received: by 2002:adf:db01:0:b0:2c3:e07d:46cc with SMTP id s1-20020adfdb01000000b002c3e07d46ccmr1488574wri.41.1676817489911; Sun, 19 Feb 2023 06:38:09 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b002be505ab59asm86176wrn.97.2023.02.19.06.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 06:38:09 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , Len Brown , Ido Schimmel , Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Amit Kucheria , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno , Balsam CHIHI , 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 v1 10/17] thermal: Do not access 'type' field, use the tz id instead Date: Sun, 19 Feb 2023 15:36:50 +0100 Message-Id: <20230219143657.241542-11-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219143657.241542-1-daniel.lezcano@linaro.org> References: <20230219143657.241542-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?1758271771021547417?= X-GMAIL-MSGID: =?utf-8?q?1758271771021547417?= 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 --- 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 69d0da6456d5..4b5afaf843e2 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 228b6ffaef98..8dbb1c15b842 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 a65a81114cc5..90aab92a4185 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 8586cfe92df6..eda6d3af7b67 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)); } /**