From nobody Thu Apr 2 21:30:15 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 21D87ECAAD8 for ; Wed, 21 Sep 2022 09:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbiIUJpq (ORCPT ); Wed, 21 Sep 2022 05:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbiIUJnx (ORCPT ); Wed, 21 Sep 2022 05:43:53 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F33923F8 for ; Wed, 21 Sep 2022 02:43:52 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id s14so6917470wro.0 for ; Wed, 21 Sep 2022 02:43:52 -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=YlKrfk8RE2F5000dDu+v0V/biI5dCrVqLGu7QlklQ2VQZuUtUPB5hZtQ7bxnTZLqR4 ZxJI97ai6fONmSjjXj8o5u48bIuIamdK2YkasqKqvBQrEsDhjWEG1peqy40CKTtjkuYc RC+XXmUlOhzDi+ooD3s/96IiEoaFSV7NL8U3HYIi831eYtzdXA95/H9gks84YH0+R3xU QINJ8jsNEhqQ7F1YDJJLf9j/U97dGOXwHyV64yOrPcDGLCIGHBaMxriHlK/kh5PL7j80 hPMHAZPYizCKtptGr+Ae1FM/7ZjpteBiqCm6GaLBALN+yreIxImDNotIOz1DA1FFQACy HRbQ== 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=aM/TXvaz6P/XGOvYHKOYlPrR6q9N0rng7IhuyRpgnTtnVDfOERWPBLKCDNN/RsjMx7 RB26c7uMszvfH7gKwvGtBXdwLs90JwiPqLHSbcEZ93gF9LDgLcTGqId0fJ9umoZyuC2B XXG0uVLFWi+2oBfEvlwNhyqUHfyo3RknWjOpNOwS9NtsGOJbOrW0t/pGiLjhaOpxbFNA OvRPj9yQUpAU5InBErPSTqiMEnw9LoHtz2cjvvC/TWX2VGTT4Xyx9nma8p+Fmp5563rg UznfDacBj0NZ14mODw+GyxYqLV6NvbYFoYRAvCj6RIllwfpTAI0jtr8Lzj+KTJImUXi/ udlQ== X-Gm-Message-State: ACrzQf0AZS/a1ySiGz7a9Rk1xC96cJxt5s6J0C4cjEz3n+JGJ8GnoIDi 2pSYpIdPUjcFYnXs0I/MSkMKmQ== X-Google-Smtp-Source: AMsMyM5lA2FlwPWZwjhbhB8WsnWSj7OG43VpvJgzm7PuJax9Ul+507ve7BJiR4MCIGWCzUJanqIL9w== X-Received: by 2002:a5d:5942:0:b0:225:7425:4e39 with SMTP id e2-20020a5d5942000000b0022574254e39mr16213887wri.566.1663753432145; Wed, 21 Sep 2022 02:43:52 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id r123-20020a1c2b81000000b003a62052053csm2763917wmr.18.2022.09.21.02.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 02:43:51 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rui.zhang@intel.com, Amit Kucheria Subject: [PATCH v4 21/30] thermal/drivers/st: Use generic trip points Date: Wed, 21 Sep 2022 11:42:34 +0200 Message-Id: <20220921094244.606948-22-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921094244.606948-1-daniel.lezcano@linaro.org> References: <20220921094244.606948-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