From patchwork Fri Dec 9 15:26:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thermal-bot for Julien Panis X-Patchwork-Id: 632779 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 A5319C3DA6D for ; Fri, 9 Dec 2022 15:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbiLIP1W (ORCPT ); Fri, 9 Dec 2022 10:27:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230455AbiLIP0n (ORCPT ); Fri, 9 Dec 2022 10:26:43 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4793192300 for ; Fri, 9 Dec 2022 07:26:37 -0800 (PST) Date: Fri, 09 Dec 2022 15:26:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670599594; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hzVwJSX5pEKcAgUuGe53dl4uJp9go2HvW9cfJnbgICA=; b=oo0iwqlptnX9GVCg+Bc+bCP3R8+o6KS440ECthpVDX+jkiUrLe10R5INM3LzywF5doKwRW FrzTbxRL0Gw281JrgrQPnPMk8p0UTHEVYSY+G8h20Cv1ItB4xd1RErsLn1sfLF50w4NKX7 xL3LLwEw85QLg21zg4eHOD4Fs3YBoiSg6BO9tWwlDgb2dBDshsGGAwT8QwJa4TmzMqJk0p Jny0HL56ZZ1QnNnzzq2i4XVe6YcoWaKxz1l9QhiFbsTHCRQDGWygoNU3LKHOW+EmUzqqgI MDMMXMSh4CB1KNkvZyDKWEyw5X0LA/L1eKhXV8SGGD63EVjFrp3AM6ofOYIJJg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670599594; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hzVwJSX5pEKcAgUuGe53dl4uJp9go2HvW9cfJnbgICA=; b=ri8UNr1mEb8bo43K8ZtIqHJbYASM1BQYHkBV4db4KBIdODE+FN7lNfNIHt08Ys38zifT1t INNHo4T58P+uFmDg== From: "thermal-bot for Daniel Lezcano" Sender: tip-bot2@linutronix.de Reply-to: linux-pm@vger.kernel.org To: linux-pm@vger.kernel.org Subject: [thermal: thermal/next] thermal/drivers/armada: Use generic thermal_zone_get_trip() function Cc: Daniel Lezcano , rui.zhang@intel.com, amitk@kernel.org In-Reply-To: <20221003092602.1323944-15-daniel.lezcano@linaro.org> References: <20221003092602.1323944-15-daniel.lezcano@linaro.org> MIME-Version: 1.0 Message-ID: <167059959441.4906.13766676550501587988.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The following commit has been merged into the thermal/next branch of thermal: Commit-ID: 79162ca505adc1cf8d44474c349e27da9813908d Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//79162ca505adc1cf8d44474c349e27da9813908d Author: Daniel Lezcano AuthorDate: Mon, 03 Oct 2022 11:25:47 +02:00 Committer: Daniel Lezcano CommitterDate: Thu, 08 Dec 2022 14:30:42 +01:00 thermal/drivers/armada: Use generic thermal_zone_get_trip() function 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 Link: https://lore.kernel.org/r/20221003092602.1323944-15-daniel.lezcano@linaro.org --- drivers/thermal/armada_thermal.c | 37 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 52d63b3..b28695a 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 < thermal_zone_get_num_trips(tz); i++) { - for (i = 0; i < of_thermal_get_ntrips(tz); i++) - if (trips[i].type == THERMAL_TRIP_CRITICAL) - break; + ret = thermal_zone_get_trip(tz, i, &trip); + if (ret) + return ret; - if (i == of_thermal_get_ntrips(tz)) - return -EINVAL; + 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, - trips[i].temperature, - trips[i].hysteresis); - priv->overheat_sensor = tz; - priv->interrupt_source = sensor_id; + armada_set_overheat_thresholds(priv, trip.temperature, + trip.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)