Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1186157rwb; Wed, 28 Sep 2022 14:37:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PTNYebrDOM5mBXQ7rsUzlxvOnr6Uh0qY3aS/TA1HIfzwzya7RKBv07wxtdQJVjr5ZGvfz X-Received: by 2002:a17:90b:3c8a:b0:200:b874:804 with SMTP id pv10-20020a17090b3c8a00b00200b8740804mr12815365pjb.151.1664401066577; Wed, 28 Sep 2022 14:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664401066; cv=none; d=google.com; s=arc-20160816; b=QJhjtneoNZarodar2LyjgxJeQ2uTgpyrwWOSdFz8Y9LG9u26oMcs8RrL7efDq5TEle 0Is5gcw15QcTQEMCkMed3s2ISstjBThELFmBtgOILQxUT78OsGR52UNJXKFzLlQzlITE nsEkCM8jlh3FPqhYRnTtPevef9UmQD+ztrJNCVRjkYovbm51eG1GNbyZor3f/iOX22Pq yh0BBCk7HSVsilA0JXVY0OS6Wsp4LClYhBriehEQSdNf5aXyj4h02LG3DGxDJm37pN8d /Vl87HTxb/FV/7UGmX+I6k6xdahMJCQS26FlKsA8LTUDfALBg8QTePZjpF656mDvoot0 FybA== 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=vV+oXB5Q8RlmUzJ86cGKyQY3gTrRXmAoHypWSj9EMlHGRuWcINkSnMJpa7R8H0uQuJ C3UaXpLWulGq72ttLM4S2AY1GwIl5d6YLrEawHZG54DHhd5G/NoG4E2BFG5ao5hFMKhR JfzVClyyEbuGabF32FCsg69CoJ+/2mgQASL6q3NZtZ7ZQODoMsHvYfvIOqNHBi/4is1V uIelGj8DPZq8LbyqG4n34YEJJ39/KZRWv+PAoOsYWYsp879bQ990q4UDhh6sIvMyD4A6 seInfp14QfvuMpu8tPriOgokR9SsdMQDLNbmn8MZWmXjT3VIlW1L+mIecbMDXBk4BONA TBJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tNlS7wZD; 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 19-20020a630213000000b0043905e9ec2dsi7144113pgc.823.2022.09.28.14.37.35; Wed, 28 Sep 2022 14:37:46 -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=tNlS7wZD; 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 S233638AbiI1VEp (ORCPT + 99 others); Wed, 28 Sep 2022 17:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234401AbiI1VDk (ORCPT ); Wed, 28 Sep 2022 17:03:40 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BCB7DB947 for ; Wed, 28 Sep 2022 14:01:57 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id x18so21606886wrm.7 for ; Wed, 28 Sep 2022 14:01:57 -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=tNlS7wZDICNPcYcfX9y/qrmvuzI+t2UKOHXKgSLuebRqObT3aj4tT5S6IiGu5MYX35 opoh7Qoh6SkXfeDmrJeU6HEfNsw59JgDhdFFeu4PwwrLxCHyyY4lL5ofzvZzRzKjsITW O+wGJSYJ+w719A2IKjTNORWIBWSOAjLH6I/EbKRXKPgxp/qque7j3qcBR3mf2gl0U1UR AfM5PYMbMvEtMHZN9GxSeaKcGytkkcKZh6Yc9YFFUUqa0t7AfdklkSi4voeSZDtwNcvA gxGpg1k1MXlUW2xJ5ArBExWqRRZgtg5QdQQib/EZgIAoeVkTVRTsHLsZ39Iocw9pueVL 6CDw== 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=BN3R0JnSRb8sVLL6SIv3SNu4uJrRo8y4A5RQQGW4CQRj6WZJpoVy2/EJ3tpjTmL61k 4gjkvBF3Fj3CVJ/YP6rGLGjFy6gCHWmQrVz/av3Ght+90UuypiVINDUcqnJrtWuGc1c9 WaeBTQF6o+195i+2dHWleiwG0t0XmAfp4RnGSAKFVXZEPJR5P6suJ28mrw9U1wli2roy qYiwKhjoDA4yHNqQoHdpxDkxV2yrZCuY+8oHmL16iM2C6TBdHUb+QgHvA4a3R2ySpbxe GJua2b+r9AjSSGiTsfLI4Vx6MYdVnXaPUyjM1dhDOMXNkGxSVOasNBuYs8tUNBIOXPF3 e51w== X-Gm-Message-State: ACrzQf06ZRjxQh4qVMPd0OV1OdgRuAH7vHoi8vVxSofFww8+3zF11m/p Dx8qrnYzNV0ccZatRJtIUg3e+A== X-Received: by 2002:a05:6000:1204:b0:22b:3359:4112 with SMTP id e4-20020a056000120400b0022b33594112mr21948792wrx.700.1664398916163; Wed, 28 Sep 2022 14:01:56 -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.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 14:01:55 -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 14/29] thermal/drivers/armada: Use generic thermal_zone_get_trip() function Date: Wed, 28 Sep 2022 23:00:44 +0200 Message-Id: <20220928210059.891387-15-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=ham 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