From nobody Mon Apr 6 15:38:33 2026 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 98772C38145 for ; Tue, 6 Sep 2022 17:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239163AbiIFRCK (ORCPT ); Tue, 6 Sep 2022 13:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238789AbiIFRA2 (ORCPT ); Tue, 6 Sep 2022 13:00:28 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C32A51A83F for ; Tue, 6 Sep 2022 09:47:55 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id t7so11325355wrm.10 for ; Tue, 06 Sep 2022 09:47:55 -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=/DpVb9+AKUGgq8A4EZDNel0xrsv5+R31U81PHZWHu7A=; b=X1YQe4f852MWDEDIbxLyzt5EWKhqVbyY6KreD6n8q9N6gvC4i5WIAkAzHEI8dxRQw2 T4b4m7BwfLcHYcdzVERs6l2W8E+H4GpJhLC8IrZYCL528FKDWNHlWXC6PTvkSj6jbCpm VCmB3xaFeU0IFsA/r9xJ92FaeOzlD9rTbJUN0L9w1QOY77nEKGDBTYH2+HsDyR7R3ssd JLEUG/KkypsRIDRloNuetGhHaNobFHXm4VCxBtHscQYXC2wf9BJtse7X+THpJ5rz10JD 3jcOl3Mk1zLbgjzqFTdPpzHhw7uYKsp2+pj102XoPdHncWPhOWf/46R+CSvdlP8UCEXO +h5w== 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=/DpVb9+AKUGgq8A4EZDNel0xrsv5+R31U81PHZWHu7A=; b=H1Wlt6RwDzxw2y2YBl+30uF3W84/ooUt7Hcb5vvYzwxqiZORcKRd6aPD6STmaueQkE 3z6KhzKdymDYY6Z1WIPU2CLDP/yFE68HeVprhVKOutF+beDy+nCmmVPmcgE1Dc4tohVC wRDNkfkBXJjWLS2ClNniFfhiqTnYyXU/+QqbeyIiBlhDURyQAuSadTbpGV1NhZ93N/ZS sqQgSMVt9W7Me91Iy3gPivYgogqmJQa8AEOaIk0JCQJA5Nvs62+PMxgzi/zJob1XqTbz jCFNT+BZRdhpphE4m25gxGY2LGumUAc66645RMvjhjcjVNx3su0JdOTw12mlvdCMG9wm swsw== X-Gm-Message-State: ACgBeo2y5UrPRImm8W5gCcmR52fLG71pYqvivfAKqW+H8nmCLykMKJ5L kZ6dlNeKAPYyrUK+YYtSxn564Q== X-Google-Smtp-Source: AA6agR7726/EhQnxyUAI0pB44o1EaZhJhbR16yBCc7vE9TFIiuCwg9pWS0Hms7JxnJjgbdDiSwJYdQ== X-Received: by 2002:adf:ec03:0:b0:228:76bd:76fc with SMTP id x3-20020adfec03000000b0022876bd76fcmr6904673wrn.533.1662482875286; Tue, 06 Sep 2022 09:47:55 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id e27-20020adf9bdb000000b0021f0ff1bc6csm7426600wrc.41.2022.09.06.09.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 09:47:54 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , Zhang Rui , linux-arm-msm@vger.kernel.org (open list:QUALCOMM TSENS THERMAL DRIVER) Subject: [PATCH v3 14/30] thermal/drivers/qcom: Use generic thermal_zone_get_trip() function Date: Tue, 6 Sep 2022 18:47:04 +0200 Message-Id: <20220906164720.330701-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220906164720.330701-1-daniel.lezcano@linaro.org> References: <20220906164720.330701-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 t= he thermal zone. Signed-off-by: Daniel Lezcano Acked-by: Amit Kucheria --- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 39 +++++++++------------ 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/= qcom/qcom-spmi-temp-alarm.c index be785ab37e53..127e8c90211c 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -263,17 +263,17 @@ static int qpnp_tm_update_critical_trip_temp(struct q= pnp_tm_chip *chip, return qpnp_tm_write(chip, QPNP_TM_REG_SHUTDOWN_CTRL1, reg); } =20 -static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip,= int temp) +static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_= id, int temp) { struct qpnp_tm_chip *chip =3D tz->devdata; - const struct thermal_trip *trip_points; + struct thermal_trip trip; int ret; =20 - trip_points =3D of_thermal_get_trip_points(chip->tz_dev); - if (!trip_points) - return -EINVAL; + ret =3D thermal_zone_get_trip(chip->tz_dev, trip_id, &trip); + if (ret) + return ret; =20 - if (trip_points[trip].type !=3D THERMAL_TRIP_CRITICAL) + if (trip.type !=3D THERMAL_TRIP_CRITICAL) return 0; =20 mutex_lock(&chip->lock); @@ -299,22 +299,17 @@ static irqreturn_t qpnp_tm_isr(int irq, void *data) =20 static int qpnp_tm_get_critical_trip_temp(struct qpnp_tm_chip *chip) { - int ntrips; - const struct thermal_trip *trips; - int i; - - ntrips =3D of_thermal_get_ntrips(chip->tz_dev); - if (ntrips <=3D 0) - return THERMAL_TEMP_INVALID; - - trips =3D of_thermal_get_trip_points(chip->tz_dev); - if (!trips) - return THERMAL_TEMP_INVALID; - - for (i =3D 0; i < ntrips; i++) { - if (of_thermal_is_trip_valid(chip->tz_dev, i) && - trips[i].type =3D=3D THERMAL_TRIP_CRITICAL) - return trips[i].temperature; + struct thermal_trip trip; + int i, ret; + + for (i =3D 0; i < thermal_zone_get_num_trips(chip->tz_dev); i++) { + + ret =3D thermal_zone_get_trip(chip->tz_dev, i, &trip); + if (ret) + continue; + + if (trip.type =3D=3D THERMAL_TRIP_CRITICAL) + return trip.temperature; } =20 return THERMAL_TEMP_INVALID; --=20 2.34.1