Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2558934rwb; Mon, 3 Oct 2022 02:32:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6V6N8l9VNuZzCLeb3QDm6tUE5ZkmUjQaMKlBM81cophJCygH1qDlViR+NMqi4CMTDi9ymh X-Received: by 2002:a05:6402:518d:b0:451:6655:5fb4 with SMTP id q13-20020a056402518d00b0045166555fb4mr17798506edd.150.1664789571320; Mon, 03 Oct 2022 02:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664789571; cv=none; d=google.com; s=arc-20160816; b=TcQkiCO8h7Yv6clzjwZ6Rnl0JlfKVAYH8azvmu0t9+sfs0IZL79AN3CjJCRxvUIdGx k8pOZuC/Z98XYtIacdaK/LWmVTNVWZrZeUQtBqlDuTpHsGf91ub7GgHXmx/f7OHv1QIh ObqAEfoxpE/GHZuYAbBHf10rNtDbbuAFJxkETc7k437TKhfyi0KnO11ljBzzfMKuexPt Ewx3bWV3ow6uZRwyw4lt6EOMrQR1lug5eeoR2fKpqelFQISTz0HpJAnbplcsZBT+yynI K/+EocRjefmp5T7DGB6dRn7+v4zpgfy7jEz5zSokDQNvtU/up2g5EDdqKO24YlnuQSIP L7Cw== 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=cMvv+kIwS7Npnyybgo7TEwbxPHKi63Y9shqXlNy7AcU=; b=TzYApPiDVe6cs4iiwwAVa2EDHIoPT/ZEaiXqYplwligvEJy+bsPGvZF4MTOyVU5Gvy 52SNNGjG4w28Blc6UWKXf1//Yc/B6KZgcpQ9BB813HHXvfA3Erbv8UiQf8Ey3zOkfsYR LjZiLnu8bDVYh/0ux0/dclNDtLcvBoclf7YIOiBuocN3OmwSe1Ej7zC9gzQ6EIvy9rXe OQ+jeRYePX8WoVDEJYCO3eYyb7REgwYoDb5bd9C+rLIBUJS02jEYUG/MSfNLWLmstRGg Q0Ov3j0nPhXniDL6Y8F9OBCbjKZjwxoWTb4yzHlQsxcjNZUbOKWtQMD6P+cTmcDW+ySd 9/rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yi4VTCWl; 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 g3-20020a170906594300b00782e437a368si6936092ejr.160.2022.10.03.02.32.18; Mon, 03 Oct 2022 02:32:51 -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=yi4VTCWl; 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 S229959AbiJCJ3w (ORCPT + 99 others); Mon, 3 Oct 2022 05:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbiJCJ3F (ORCPT ); Mon, 3 Oct 2022 05:29:05 -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 2E32B4BD23 for ; Mon, 3 Oct 2022 02:27:20 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id j7so10422240wrr.3 for ; Mon, 03 Oct 2022 02:27:19 -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=cMvv+kIwS7Npnyybgo7TEwbxPHKi63Y9shqXlNy7AcU=; b=yi4VTCWl66asZJGgOiCtWes+qE0VnkocHkD0eBBeny1MYYN+R3rTKORSVOaC88Q2oX JRsM3CLMkQwSIHa5y3FFOcz4ltlIgM05/xPu813pIFXaPXqa3zCTtwDVbOQDxaux+5L5 JiXxieD7E/R3HZ6soWRzOn0AWkTUDkf8zsDqnxvOH7OHQeNgKaE0jGjkDO/3dVCkFifm mQm5VsPQdRcsJTAO9xBeDmfrPQsZSAQu+3TcGJp00T4WGA+U0ePr4unggjF9AwECDhaN aG/Ru7kk+KPAVk2IaiuxPMovsRwtACIw4UlNcJwnnMFkbksYC4RDckPqkwRukdetxXJL XaqA== 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=cMvv+kIwS7Npnyybgo7TEwbxPHKi63Y9shqXlNy7AcU=; b=jvOyXQe9lEGhBVvtVcy+gwG9JRSQqb3j9IreCVI9ZX4GRuM3nXkid9MeqHakL/5T6t 9J6k1srButyq/D7uu/5vmQpl/UUwy3KAJzClHb4UdEoW31bb9qQa4ulva4LbkBiUdg8+ hN7ps3ozBkORDhKZ43jRgRjYA7XL41rzfqTZByCnyt0rEh//avxeURjALQCxGfV6Zs9Y qjFq3hAx6Q+4Q2eXLio9RM1u/q6OtvI7yqLfr4PwCnOPzAD+KShwK9zYF0rWGG5mqPIF RVxlzIyrCd0LEfBJ9AKhrYh+aEiDh3r4oHBTpFshtKj2sAJs/CkZcCFPh4Q0EqrwYXFl +ewg== X-Gm-Message-State: ACrzQf2txZ2LUPp0xCaFU0pwTaNVG7mpfhbQhNOiNzI8ZKN5s8ucMB0c shSIe9aXrBE6k0pI5T/0zypDfQ== X-Received: by 2002:adf:f48f:0:b0:22e:4244:970e with SMTP id l15-20020adff48f000000b0022e4244970emr1125977wro.140.1664789221410; Mon, 03 Oct 2022 02:27:01 -0700 (PDT) Received: from mai.. ([2a05:6e02:1041:c10:f3a:9f5e:1605:a75a]) by smtp.gmail.com with ESMTPSA id ay3-20020a5d6f03000000b0022cc157bf26sm9707520wrb.85.2022.10.03.02.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 02:27:00 -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 v8 14/29] thermal/drivers/armada: Use generic thermal_zone_get_trip() function Date: Mon, 3 Oct 2022 11:25:47 +0200 Message-Id: <20221003092602.1323944-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221003092602.1323944-1-daniel.lezcano@linaro.org> References: <20221003092602.1323944-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 ops content logic into generic trip points and register them with the thermal zone. Signed-off-by: Daniel Lezcano --- drivers/thermal/armada_thermal.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 52d63b3997fe..9444e5a22ca0 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -785,33 +785,34 @@ static int armada_configure_overheat_int(struct armada_thermal_priv *priv, int sensor_id) { /* Retrieve the critical trip point to enable the overheat interrupt */ - const struct thermal_trip *trips = of_thermal_get_trip_points(tz); + struct thermal_trip trip; int ret; int i; - if (!trips) - return -EINVAL; - - for (i = 0; i < of_thermal_get_ntrips(tz); i++) - if (trips[i].type == THERMAL_TRIP_CRITICAL) - break; + for (i = 0; i < thermal_zone_get_num_trips(tz); i++) { - if (i == of_thermal_get_ntrips(tz)) - return -EINVAL; + ret = thermal_zone_get_trip(tz, i, &trip); + if (ret) + return ret; + + if (trip.type != THERMAL_TRIP_CRITICAL) + continue; - ret = armada_select_channel(priv, sensor_id); - if (ret) - return ret; + ret = armada_select_channel(priv, sensor_id); + if (ret) + return ret; + + armada_set_overheat_thresholds(priv, trip.temperature, + trip.hysteresis); + priv->overheat_sensor = tz; + priv->interrupt_source = sensor_id; - armada_set_overheat_thresholds(priv, - trips[i].temperature, - trips[i].hysteresis); - priv->overheat_sensor = tz; - priv->interrupt_source = sensor_id; + armada_enable_overheat_interrupt(priv); - armada_enable_overheat_interrupt(priv); + return 0; + } - return 0; + return -EINVAL; } static int armada_thermal_probe(struct platform_device *pdev) -- 2.34.1