From patchwork Fri Jul 7 20:37:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 700290 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 230B2C04A6A for ; Fri, 7 Jul 2023 20:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232282AbjGGUiB (ORCPT ); Fri, 7 Jul 2023 16:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232467AbjGGUh4 (ORCPT ); Fri, 7 Jul 2023 16:37:56 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1301F1FEB for ; Fri, 7 Jul 2023 13:37:55 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fc02a92dcfso5692735e9.0 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=Y/r4ptv6DwBi1XAuTnUrxucJ8sh3oUDviK8UHDNjic+DTfbA6RGwfHNpxvRHmWvnYA Ot5hYZoGSeZHb8vC4NxmPF2vKbBj4jRxnzOhiw0YCkhGGpYe+TC4srueDET6RIsU/P/N I6ldl5ZH7YCTKq/HTuuXi2BlSyDqSArsyfgGP78EWj6Xk61jEy1iRLmun91+n5DDS1Zl BZAQwj311G5nUgEsM32lOn/WbFiKvALrI2YFJjn0pPmzh7Kd2o0Z8hNfF3WrUefFrc7D pZmt2Yx1Rg1Q+GO9M4VpOPBBVpcewYlN7Sw2vEyd/JW9Q5QptcI0VRxvZeVbTqbPPD3m MluA== X-Gm-Message-State: ABy/qLYyazDrhrZWIk06yi+suw8def69cqjE0DS98O6oghk8vsbiWUXl /4hKPfxB0PV7J1ejG/EyQ0fc0g== 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_S=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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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/drivers/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 */ enum int3400_thermal_uuid { INT3400_THERMAL_ACTIVE = 0, @@ -453,6 +454,7 @@ static void int3400_notify(acpi_handle handle, void *data) { struct int3400_thermal_priv *priv = data; + struct device *dev; char *thermal_prop[5]; int therm_event; @@ -475,12 +477,14 @@ static void int3400_notify(acpi_handle handle, return; } - thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", priv->thermal->type); - thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", priv->thermal->temperature); + dev = thermal_zone_device(priv->thermal); + + thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", thermal_zone_device_type(priv->thermal)); + thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", INT3400_FAKE_TEMP); thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP="); thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event); thermal_prop[4] = 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 = 20 * 1000; /* faked temp sensor with 20C */ + *temp = INT3400_FAKE_TEMP; return 0; }