Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1188567rwb; Wed, 28 Sep 2022 14:40:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ADM21b4hYqKnoaqL4dQ4lEofJJELSzOBVe2z+e0xji9fqwxdMhro87pZD7AyTsIEGLHLZ X-Received: by 2002:a17:902:8693:b0:17a:f71:98fd with SMTP id g19-20020a170902869300b0017a0f7198fdmr17625plo.25.1664401238392; Wed, 28 Sep 2022 14:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664401238; cv=none; d=google.com; s=arc-20160816; b=Duv6drCVpX4BssnaXlQG8EosSLoV7qXu7nULnALShMdSgthBFh9aXnR/0uvCqdJjg6 sNrohnS7U74hzg9nPQ+1BErt7TZSKgOvUp/ZyLuerqRjyxjQMsGTr4tVeMe3vipkoKXF s64RKhplsh2voOcvA/1KLFvWKsEEEmwjvBmxpCubMvD4zv0czF0gkh7sj132vmXAzSj/ 7DQM2eSQOGr6V4NkCboreA9QGd6WdJabqoAVVvkCikyQ3jR834xlHOgf3lzSRNKuFFvc dSj3AtK25+gx5aNoQdSiWnrVdNzKMSGa6GHuliSwIf1i+gojG3K7cRD5a8EkitK6rWTq Xa4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p+Fs/P7gXsm/5qHeFX0rzCcy4XeIXDeOEwU0TTt39+U=; b=HSPIEedXYZKPvAijvhRCyq9QKxE22R5eBtDXZZy7M/C9bh235wr7PGvopOAPshYARr yb8OYEICAT2SWgkSwfOFyZahis2KSGUZSspm32xkQ6/m0dyN0CfEt/78BAXzpUMkhyoP SkpNt6ULLXchuGhf0SnZIMmbFehrFlEiEAKdpokSWMLQf9/I1zzvZ98XMWIjTF6FGT/W ZPiXQqXEYBZGpLpBN1R1lc9oq9akSjFfk/DhEXtQRHf7zsyK6sNxzKBJ5CVOHzf9RjsB unEHVU8W9Z9TKvrzwn/VDzK84HzbHTjxGqAU4EXUwXdGIPGj70AGKSqg/Y9v8T+LY8g9 ZEew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="kl/8HYut"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a63b94d000000b0043496fee126si6805300pgo.652.2022.09.28.14.40.27; Wed, 28 Sep 2022 14:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="kl/8HYut"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234738AbiI1VGP (ORCPT + 99 others); Wed, 28 Sep 2022 17:06:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234654AbiI1VFD (ORCPT ); Wed, 28 Sep 2022 17:05:03 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B996FA2A for ; Wed, 28 Sep 2022 14:02:17 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id iv17so9248658wmb.4 for ; Wed, 28 Sep 2022 14:02:16 -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=kl/8HYut/BjVRmiajQhWuVah/Mvave2DkDTk4QV/mUZ1d4NlWRZCsC6Xv9fcT3d/KL JUrm02i6Luax2k5pJwH2VhcIZkcBy8IUiskfMWh1xjyAQ6i9wHeXaNJwnV+EzDZHN+Xw o3xsI5ukbSLfyWZIaS1v7ddFSjtKEDnlJBSPA+7JDpI7LMy3+C7dGap4n9ZPVe2vOUgy 3T0IbepxHzZTjp9U4paondALuYszOBiAzGAM6/axVED1PbbjtmBh5YTUzWc3WP7Zwe+t B1sMuQHHSNKyc63WeDK18OmSo67QA7s3hKh12OG2m/gcOVC8l8dS/yr71TqrK9LdF6pR FuWw== 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=ShrXnKaiKOAO9QbcARtcfX0N5JuKwjX9JcvXiZsFBKjbzHUs0iN1SpLMozp2NcCQ55 fxTzOd0s78Hl8hZI8b1YiyypUUP10Qculygi4WZISyAGLU3Sdou5SQ3skb2jvw88lw5G Py9PCWLLdbT2B5eO0UtNiXUbrrStYNkWzPFrubwI692Hp/fGqjAsr44sCzobyx6JBduM aSrLmmqFcaUNxPHHJjhQ04Ap8L+QeUGD+okiD8PnxRQGFkzORr2zh3CvKF8m8AXmbLWq CmtwF9spD7jUFqRBjtHj06qaIqY1d0VxIn1BA5gt5Pjswe4RoxEbzLqIZZvFghWLEjDp USog== X-Gm-Message-State: ACrzQf239s671qbD61srI/k6+JTX5H8OHv0r5+mpBQ/D93wn+MH3t0Fl p4mhR04MDPZmHQmSEZfzG6w85Q== X-Received: by 2002:a05:600c:5128:b0:3b5:d6:eb8f with SMTP id o40-20020a05600c512800b003b500d6eb8fmr8477661wms.65.1664398935481; Wed, 28 Sep 2022 14:02:15 -0700 (PDT) Received: from mai.. ([2a05:6e02:1041:c10:48a2:39eb:9d1b:8b8d]) by smtp.gmail.com with ESMTPSA id g20-20020a05600c4ed400b003b4931eb435sm2874300wmq.26.2022.09.28.14.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 14:02:15 -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, Raju Rangoju , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Kaestle , Hans de Goede , Mark Gross , Miquel Raynal , Amit Kucheria , Nicolas Saenz Julienne , Broadcom Kernel Team , Florian Fainelli , Ray Jui , Scott Branden , Support Opensource , Lukasz Luba , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thara Gopinath , Andy Gross , Bjorn Andersson , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , Eduardo Valentin , Keerthy , Kunihiko Hayashi , Masami Hiramatsu , Antoine Tenart , Srinivas Pandruvada , Dmitry Osipenko , netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH v7 20/29] thermal/drivers/st: Use generic trip points Date: Wed, 28 Sep 2022 23:00:50 +0200 Message-Id: <20220928210059.891387-21-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220928210059.891387-1-daniel.lezcano@linaro.org> References: <20220928210059.891387-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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_thermal.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_device *th, int *temperature) return 0; } -static int st_thermal_get_trip_type(struct thermal_zone_device *th, - int trip, enum thermal_trip_type *type) -{ - struct st_thermal_sensor *sensor = th->devdata; - struct device *dev = sensor->dev; - - switch (trip) { - case 0: - *type = 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 = th->devdata; - struct device *dev = sensor->dev; - - switch (trip) { - case 0: - *temp = 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 = { .get_temp = st_thermal_get_temp, - .get_trip_type = st_thermal_get_trip_type, - .get_trip_temp = st_thermal_get_trip_temp, }; +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, polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; + trip.temperature = sensor->cdata->crit_temp; + trip.type = THERMAL_TRIP_CRITICAL; + sensor->thermal_dev = - 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, sensor, + &st_tz_ops, NULL, 0, polling_delay); if (IS_ERR(sensor->thermal_dev)) { dev_err(dev, "failed to register thermal zone device\n"); ret = PTR_ERR(sensor->thermal_dev); -- 2.34.1