From nobody Mon Feb 9 04:12:39 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 161A1C0015E for ; Fri, 7 Jul 2023 20:38:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232501AbjGGUiJ (ORCPT ); Fri, 7 Jul 2023 16:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232505AbjGGUh4 (ORCPT ); Fri, 7 Jul 2023 16:37:56 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF111FF9 for ; Fri, 7 Jul 2023 13:37:55 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so25173055e9.3 for ; Fri, 07 Jul 2023 13:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688762273; x=1691354273; 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=4NdrIPZwt9L1R1mzbxg8AqWIw5JoVMckhgJN4c8/wnI=; b=lS/hWwIUxlty3HHUhlAuObfrgH4Jvwy9c3m8808D+Sa1W04cmibz+dprPxGFLRJfD5 W+wubkN7FxqE+wSeBI/DIswpWhMYf1en1KrYUdqAHKAYxrdLZyzQJT19ej4LZNwPM5y/ ZrsJ3C5koE1MLodgKLTYDAy+79K0NZPeRyY1Rj1ldBio79paAud9ZWQ5MIT0TWBdyckH bbcedRSySKXS8FsEedvn01rjtFuLfP4gUzjCTaxW2l35Z9scX7UFu3TG1V5syVOd38CX IYOkVDx18SOY/L3Wgjswx8TNv0yh3ORCSyHK2iYewJd+w5fcnGpLYVAekQ0+fQ1+LzwR 6uJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688762273; x=1691354273; 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=4NdrIPZwt9L1R1mzbxg8AqWIw5JoVMckhgJN4c8/wnI=; b=Qds8eN5Z228PCJG05h6EeItv4ZtTiF4HwYxUZDmlVCQVjmmiy8OFk7dUpq1y9negGr w8SxJ6IET10fA7YYulP3v/L+x578NCtkAQvWCeE0SB1wb/IGxiy2ZntOLzFM9zi3yMhj b6oTM8npJwjmMdBlbduieJAqKR8pg3f2/Uz0dprHUjx8bwdrhYz+y46kH0X9VJzbvE0f BFaYSBjWJPfMsWxP1eOuEw7yiBVdRs3ozm7uTQZJ2hcZGJcNQHRSM/JhqGlSAgFlYY6q RoW/aLfVXmhTbXCJ0D4NplNTT0qXp3d2f7hoRMsRHHFi9yaKeDZK4kPioGwVzEeWN34n Nvsg== X-Gm-Message-State: ABy/qLbhOlfygfZ9IWS/I14cajxZuEksnyB/46Jl1W0X9LQ0qxAVG9Ay IWtFwgWZjmBLZa0KnkRIpnvrgA== X-Google-Smtp-Source: APBJJlFKy90SQJfbzMCfQRUyEu++iSwKiRNqGMM+51YZXrEdLEoPbgj+mk7637fvbLt3uMXQa4kXQg== X-Received: by 2002:a05:600c:2252:b0:3fb:c9f4:14f3 with SMTP id a18-20020a05600c225200b003fbc9f414f3mr4828743wmm.2.1688762273628; Fri, 07 Jul 2023 13:37:53 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id i4-20020adfefc4000000b003143be36d99sm5260674wrp.58.2023.07.07.13.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 13:37:53 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, thierry.reding@gmail.com, linux-kernel@vger.kernel.org, srinivas.pandruvada@linux.intel.com, Amit Kucheria , Zhang Rui , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Baolin Wang , ye xingchen , "Lee, Chun-Yi" Subject: [PATCH v2 3/4] thermal/drivers/int3400: Use thermal zone device wrappers Date: Fri, 7 Jul 2023 22:37:30 +0200 Message-Id: <20230707203731.848188-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707203731.848188-1-daniel.lezcano@linaro.org> References: <20230707203731.848188-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the thermal core API to access the thermal zone "type" field instead of directly using the structure field. While here, remove access to the temperature field, as this driver is reporting fake temperature, which can be replaced with INT3400_FAKE_TEMP. Also replace hardcoded 20C with INT3400_FAKE_TEMP Acked-by: srinivas pandruvada Signed-off-by: Daniel Lezcano --- .../thermal/intel/int340x_thermal/int3400_thermal.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/driv= ers/thermal/intel/int340x_thermal/int3400_thermal.c index 5e1164226ada..72a6e28ded2e 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -15,6 +15,7 @@ #define INT3400_THERMAL_TABLE_CHANGED 0x83 #define INT3400_ODVP_CHANGED 0x88 #define INT3400_KEEP_ALIVE 0xA0 +#define INT3400_FAKE_TEMP (20 * 1000) /* faked temp sensor with 20C */ =20 enum int3400_thermal_uuid { INT3400_THERMAL_ACTIVE =3D 0, @@ -453,6 +454,7 @@ static void int3400_notify(acpi_handle handle, void *data) { struct int3400_thermal_priv *priv =3D data; + struct device *dev; char *thermal_prop[5]; int therm_event; =20 @@ -475,12 +477,14 @@ static void int3400_notify(acpi_handle handle, return; } =20 - thermal_prop[0] =3D kasprintf(GFP_KERNEL, "NAME=3D%s", priv->thermal->typ= e); - thermal_prop[1] =3D kasprintf(GFP_KERNEL, "TEMP=3D%d", priv->thermal->tem= perature); + dev =3D thermal_zone_device(priv->thermal); +=09 + thermal_prop[0] =3D kasprintf(GFP_KERNEL, "NAME=3D%s", thermal_zone_devic= e_type(priv->thermal)); + thermal_prop[1] =3D kasprintf(GFP_KERNEL, "TEMP=3D%d", INT3400_FAKE_TEMP); thermal_prop[2] =3D kasprintf(GFP_KERNEL, "TRIP=3D"); thermal_prop[3] =3D kasprintf(GFP_KERNEL, "EVENT=3D%d", therm_event); thermal_prop[4] =3D NULL; - kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop= ); + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, thermal_prop); kfree(thermal_prop[0]); kfree(thermal_prop[1]); kfree(thermal_prop[2]); @@ -490,7 +494,7 @@ static void int3400_notify(acpi_handle handle, static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, int *temp) { - *temp =3D 20 * 1000; /* faked temp sensor with 20C */ + *temp =3D INT3400_FAKE_TEMP; return 0; } =20 --=20 2.34.1