From mboxrd@z Thu Jan 1 00:00:00 1970 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 07C2DC07E9D for ; Mon, 26 Sep 2022 15:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236248AbiIZPUb (ORCPT ); Mon, 26 Sep 2022 11:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236444AbiIZPTP (ORCPT ); Mon, 26 Sep 2022 11:19:15 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A6005D0D3 for ; Mon, 26 Sep 2022 07:06:39 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id z6so10444829wrq.1 for ; Mon, 26 Sep 2022 07:06:39 -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=yg0w3HEfNXGtnBBhO8Cz9xNPnCqn8b9SdcuxEqWkp0YubNFanaltpZ00oRcemcsH3D k64GiXeXxW47t8afssig/+CNlxxvrbMBDg/R9eUS0Eq4zb8kcht8bEA/uyXUXcm4dTqo ISO3f+0KUPHO5wpalccaBQLy8I9wRuL3ESHXrp4LjnIU1V34M9vPxq9D39v8kW0PDAxe 0T7EoTI/PEyXd0DayS6FWCRtP7/Iyy1dhKs+JS1IApCv9/bjHi0k8HcmDBlD20jdsA28 OAHoQLfpP/7bMBIA/cmoxCut/rb4LQsT5YsXcha6pdgycnuNPxVQvT4kS9v/C04SA2+V e2CA== 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=X/qwGoGVgiNjG9yqjDlib+1BCNqmzLrUma5OwmW08ry7K9LwstTll30uVy/1LG3Kqr q8eOqQc+QHE6Tgl+CUNoLy6a7mtLsCGC0W2ccyJ0pDGAEwk5sWm6YUvuo3/aZ8XcZ3Pv JDbSNdyNwWMzvdfwq1SeJn+UTTSqsKZyHypqA+lgP18QNwx4hgkCiNEvmWYz+ioOk74h Iu+CwboU7Joq+dru/lsA+mE0audpMuJu0ePQkT1xZ2OeMQvquZ6oJJY86b2Mpjm6Wx5s Uui97yoC1l6AmJ36b/zs4x7r8SsX/yjl7xlApIKZPeAuQ7UIO6wDBzxmCkYI2M7n26b9 u7UQ== X-Gm-Message-State: ACrzQf03Sc0Rsccnz5wMJWEMiLpl2JtKWXrrduKDbWyiXnQuEeji7cjZ WYayQJmx7QP/gg/PdvfrWgBhjg== X-Google-Smtp-Source: AMsMyM4zW+nU32TzlZYB7xZBNRPL1pZLN8fPKdGijDdPGplygM302nIxXzt0O6PYvnsGBLrTPdtgTQ== X-Received: by 2002:adf:d0d2:0:b0:22a:daf4:87e8 with SMTP id z18-20020adfd0d2000000b0022adaf487e8mr13523497wrh.167.1664201197751; Mon, 26 Sep 2022 07:06:37 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id v3-20020adfebc3000000b0022adf321d22sm14310731wrn.92.2022.09.26.07.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 07:06:37 -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, Miquel Raynal , Amit Kucheria Subject: [PATCH v5 15/30] thermal/drivers/armada: Use generic thermal_zone_get_trip() function Date: Mon, 26 Sep 2022 16:05:49 +0200 Message-Id: <20220926140604.4173723-16-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220926140604.4173723-1-daniel.lezcano@linaro.org> References: <20220926140604.4173723-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@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