From nobody Sat Apr 11 17:07:12 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 8DB98C32765 for ; Tue, 9 Aug 2022 22:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbiHIWFz (ORCPT ); Tue, 9 Aug 2022 18:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbiHIWFB (ORCPT ); Tue, 9 Aug 2022 18:05:01 -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 2D8C1E00D for ; Tue, 9 Aug 2022 15:05:00 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso126578wma.2 for ; Tue, 09 Aug 2022 15:05:00 -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; bh=p+Fs/P7gXsm/5qHeFX0rzCcy4XeIXDeOEwU0TTt39+U=; b=Q10d+Kj+4+QxPnASk+OFQkMzHet7iJEXepHq9lMZ/GsOjz41BKrdhSTNwCO1ITIyGG Ue/MRMgPagk/uraL1/ICfJGRDzXV4JR70963kdB41Il1yEQ7dq/KS44IFgWwLfgaxDla RluTYe88k6LbQ7tvibgpSEsxkwQiyvYndL7PHn+QrLSeRIeyLg8rbXXcQJngEIWKMWXo lIIh/BO2YztdinupBHIFMte1EZ4Xj9FS5MVkDpoB7SBIDyhGapYV6o7bsAjppxQu6pZL 4IJVGhg1X+5E5OGdBCM2aL1nJ9xetphQ/m9YcSwcMYJEb/t3d2URg77u1CyeiQRvM2cn IJzQ== 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; bh=p+Fs/P7gXsm/5qHeFX0rzCcy4XeIXDeOEwU0TTt39+U=; b=hUMpZaOSmap3hQ+shynJMrph68r1viUVPgp3+EasRDgC97gTgYqiLz+cbuSiXEx1R/ 2Z2eKQa2w9GLyiD70EQyMSHQxWeWzphrKtix/ka9IPXObuBL+a94VoFHhpgw79lSieWj Ol2hpRU321GHYimVn6pTsZKSUDS7DnQSRKfQ+7lwfYTJEahruURK+LnO1y7FLGcxEbSa f4g3xtOqJohtRbUj+ot37LrVJhVU22fMpWBugtFzT5tr5wp3sV3s1lXq3B4OHp9IhoH5 OSAiwqj3hWkEsO3f0T85IHEpr4m5jIYLYqNKVF1p13xiW0IrHFgOUjmkAdhDKbEql9i/ qZGg== X-Gm-Message-State: ACgBeo2qctQnifP83KhX3etBfh5xfrSLucK7FxLecDwte0lXTYFO58XJ okSMQSCFQhhnfEMQvdDyfVAD72xg/VDjaw== X-Google-Smtp-Source: AA6agR5CO+KUXGsg/6WoplZ/mFRti+YTNqdCa1P1PXUwBEm6Au6L8KxbMD6+x5Sb8PTDWwU5FoVH9Q== X-Received: by 2002:a05:600c:3b02:b0:3a5:2460:f059 with SMTP id m2-20020a05600c3b0200b003a52460f059mr266889wms.129.1660082698606; Tue, 09 Aug 2022 15:04:58 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c3b1500b003a317ee3036sm293583wms.2.2022.08.09.15.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 15:04:58 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria Subject: [PATCH v2 04/26] thermal/drivers/st: Use generic trip points Date: Wed, 10 Aug 2022 00:04:14 +0200 Message-Id: <20220809220436.711020-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220809220436.711020-1-daniel.lezcano@linaro.org> References: <20220809220436.711020-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