From nobody Fri Apr 10 09:17:45 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 B9E83ECAAD5 for ; Tue, 6 Sep 2022 17:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238558AbiIFRC4 (ORCPT ); Tue, 6 Sep 2022 13:02:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234303AbiIFRAx (ORCPT ); Tue, 6 Sep 2022 13:00:53 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 184266E2DC for ; Tue, 6 Sep 2022 09:48:05 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id bp20so15869930wrb.9 for ; Tue, 06 Sep 2022 09:48:05 -0700 (PDT) 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; bh=p+Fs/P7gXsm/5qHeFX0rzCcy4XeIXDeOEwU0TTt39+U=; b=EKosuhPmamKh8eudEZ2RzXf5XbSruIwibMeFNYl82Yy+t7A4utedR5Ygq9u1JiPtiF EWtFH+tYTimbNnYMMd0othiT7OZmLs+jTvY7gGZ1DaLD4EHI69QLUnBZn3ebykybLjhm yACddMSIDxxOR1w+XBrtrcM6BBng9p5eKv82pX/mfzUMPnWuqjfWe/hPvUVXA3JGV/N2 FipS2jzylHOn5naGFC9Jr3ISmvXSXKhNgFXUT9UtkVGEg4Yf22kuZ96u/0lb9A8b4UWa /HhZjZcyk3zeJXR9wAQfWPCU2K9dR6xbBta1NRKp06O2vzn6jsbBe/Z8V3okVVl+1cwp 8o1Q== 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; bh=p+Fs/P7gXsm/5qHeFX0rzCcy4XeIXDeOEwU0TTt39+U=; b=78cTPslwGDhp6zkXc9bnEVeSuK19MsH2f9vEu8B67WlOrvimnC5Kiqxr9u6Kaf3+WU MFOrx165m/6M08JQy7+oVX1UPagor3G0HBbpONe0ejQLCzeZ7uuZHBlwRxa1StnoyyIS 1fm4zbNfAzYTARwvIpP1G+jCZlD8YV+pdtV+uRRhAw/IRh/4tZmZ0a7/bIb81AbNAecK w4YinupDA7HXcRhYmEIQKjCcenXcLMizzC+M9Nv4uJnCtp9CfXLcjVzMuVGc8/P3eNyi EH2wzr5cLaLIu/bBnPymDX4HD6VunZFWKfRn/DhSukhataVRC8uzMv1eqTXqHbTp8/L8 8V8A== X-Gm-Message-State: ACgBeo0eC+dePMAWDrbcaUlt4SF+tWxX+aMoICa86d5xr34uCS2UrNMU ZPlHK0jyyeSBpyYSVTVyWfPmzw== X-Google-Smtp-Source: AA6agR4J05UbRmdHYPYTJtZXUoFCiI/16fLjg7zBs9gpPVM5ZWo/WW23zG1rT35tPKwOfxAKuz3wkw== X-Received: by 2002:a5d:6d8f:0:b0:225:6285:47fb with SMTP id l15-20020a5d6d8f000000b00225628547fbmr29029509wrs.211.1662482883567; Tue, 06 Sep 2022 09:48:03 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id e27-20020adf9bdb000000b0021f0ff1bc6csm7426600wrc.41.2022.09.06.09.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 09:48:03 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v3 21/30] thermal/drivers/st: Use generic trip points Date: Tue, 6 Sep 2022 18:47:11 +0200 Message-Id: <20220906164720.330701-22-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220906164720.330701-1-daniel.lezcano@linaro.org> References: <20220906164720.330701-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" The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert to the generic trip points Signed-off-by: Daniel Lezcano --- drivers/thermal/st/st_thermal.c | 47 +++++---------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_therma= l.c index 1276b95604fe..c0d45cdd1c2f 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -134,48 +134,12 @@ static int st_thermal_get_temp(struct thermal_zone_de= vice *th, int *temperature) return 0; } =20 -static int st_thermal_get_trip_type(struct thermal_zone_device *th, - int trip, enum thermal_trip_type *type) -{ - struct st_thermal_sensor *sensor =3D th->devdata; - struct device *dev =3D sensor->dev; - - switch (trip) { - case 0: - *type =3D THERMAL_TRIP_CRITICAL; - break; - default: - dev_err(dev, "invalid trip point\n"); - return -EINVAL; - } - - return 0; -} - -static int st_thermal_get_trip_temp(struct thermal_zone_device *th, - int trip, int *temp) -{ - struct st_thermal_sensor *sensor =3D th->devdata; - struct device *dev =3D sensor->dev; - - switch (trip) { - case 0: - *temp =3D mcelsius(sensor->cdata->crit_temp); - break; - default: - dev_err(dev, "Invalid trip point\n"); - return -EINVAL; - } - - return 0; -} - static struct thermal_zone_device_ops st_tz_ops =3D { .get_temp =3D st_thermal_get_temp, - .get_trip_type =3D st_thermal_get_trip_type, - .get_trip_temp =3D st_thermal_get_trip_temp, }; =20 +static struct thermal_trip trip; + int st_thermal_register(struct platform_device *pdev, const struct of_device_id *st_thermal_of_match) { @@ -238,9 +202,12 @@ int st_thermal_register(struct platform_device *pdev, =20 polling_delay =3D sensor->ops->register_enable_irq ? 0 : 1000; =20 + trip.temperature =3D sensor->cdata->crit_temp; + trip.type =3D THERMAL_TRIP_CRITICAL; +=09 sensor->thermal_dev =3D - thermal_zone_device_register(dev_name(dev), 1, 0, sensor, - &st_tz_ops, NULL, 0, polling_delay); + thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, 0, sens= or, + &st_tz_ops, NULL, 0, polling_delay); if (IS_ERR(sensor->thermal_dev)) { dev_err(dev, "failed to register thermal zone device\n"); ret =3D PTR_ERR(sensor->thermal_dev); --=20 2.34.1