Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2559820rwb; Mon, 3 Oct 2022 02:33:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM773QCy53PTyc1Y0ufSBNzdZ/AdR6GFj71uEiAHhfytEO8cx1+Q0GC4dsSvbkJFhm3xdoC0 X-Received: by 2002:a05:6402:4411:b0:437:b723:72 with SMTP id y17-20020a056402441100b00437b7230072mr18230118eda.38.1664789629342; Mon, 03 Oct 2022 02:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664789629; cv=none; d=google.com; s=arc-20160816; b=Nn6fgUs2yXFA2ERntjQ4EHkfD7cBJEjH5coqqoBtT38QEz5WXByZmdquxZ2dQGvA08 T4nQx/9iwiklCiKZvOwkWkeG/g3q/+a6e2XPwhD49dfisvvdH1EjNiwQHRiHEign/4lm bKHygspZJp9mqhv82V9h0V2yUFgr/9195DDEwYsvf8c/+XII0e6qbnAqozC5/Cw1ypBV RsRO24qasFaZHK90ISzdPJ8mHUEfmYW0jVC5NYlI4N9Rw0jRcFFfPv7m+v+5O06BNBe7 F+AgEPJJyqr4kiqIeABPFB3O4V7dNkJfIsHkWgkuIpzX/dOhol90iKieqLFs+pm5g1Gb jazg== 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=F16FcP49uIGOwU3Sf8ns9eXu8wz72Lx9ob6lOEA95bs=; b=xaK0nhg0HeDB4lIx6k8vW84jKa//c5Y2kkfGQ/rl5IEgLKwAPs8hJx75gQvBJcW13v UdsUw3PKNiMtL4SGNklovhIf7IBAxsRnZHMr1hoD+VT8GFWrAoS9T7zs61rGG9JfDv7E EEc0GOuTIpxXdcUx+kjr/4QZZ4E4mjw4qGDOByNsLuaaX/y8D4Gr4WI1evhXk+mFKf/D JL7rIV9dtRh3J7Jb6lG3Sp8ndQAnrZfaETr9cY8GuvhszNafZGppqxXIeKb2Ll1m7vcq AA5+jNugr7RHKnLBJV+LuU69Icr0kL+uJz8biURgVmmHEHChdOdvn+is4stBozFcIDCu 97Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qbvAgIVN; 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 ht19-20020a170907609300b007836227b96fsi7022910ejc.888.2022.10.03.02.33.23; Mon, 03 Oct 2022 02:33:49 -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=qbvAgIVN; 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 S229911AbiJCJ3o (ORCPT + 99 others); Mon, 3 Oct 2022 05:29:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbiJCJ27 (ORCPT ); Mon, 3 Oct 2022 05:28:59 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0C524B0FE for ; Mon, 3 Oct 2022 02:27:16 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id c11so15787188wrp.11 for ; Mon, 03 Oct 2022 02:27:16 -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=F16FcP49uIGOwU3Sf8ns9eXu8wz72Lx9ob6lOEA95bs=; b=qbvAgIVN8pR9bpc8A6YQc3Kav1uPnv41gpfo885F25r3l6HQSKcWFyfvq7m1ehbolB sNce3GP551ekqPlESc+yR2kIOzjjbAb6Bk4FXEkYYeJXJqHTeTazDkEHiR+2GggZdS/d dOtxxDaHi/AmQ9lTQ0/zlHm0LKp8CyyD+OqB7qPrIDvA3ZQG7QKn7YxYKNvov/vy6bt5 cOELYeP6a42DkznHUr+6HOyBNX98GlOQukvIjLzyqf2wI4Q9/wYKbTDr+Ija++YA4YGj jFu658zDiqvtLM3ZtWLnJDdn8BzawSgixAKaxtAeS07tZn7leK0nGCdn6cZfiGELl/Nt Jl1w== 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=F16FcP49uIGOwU3Sf8ns9eXu8wz72Lx9ob6lOEA95bs=; b=RQdnSONyDO894sUvOEttoQVYWv3OYB84uNX07SUQJeLOeJx1mqnTK7Ym4+Nsi+MUlB 9Nsot4jylVBSeaqSQl7SzyHVT762Agv8mGG5IagmpRW9ng/klRKRwE9r6zUOScGi5tmp DB06rxMCsfElDgiM6pTXYF4KKKiDZml+df1Q8X3un+OIId5Df5tQuvChEobhDZuweev5 pqjVCugWKOdkyFuR6Rkz3o5LrFtD55P9rDadF7vsKdKYVDfLWAB6RwELOes9LwvwUrSR +Ldy21a/Bmc5yXr/+ZQlF5BuCRB4D7CK/Pd290B2U7jLQdK9R0+7lKjdotGLJ4ubAW7Q ffJA== X-Gm-Message-State: ACrzQf3XmZugtFHl+2ATNRd7nyUdi3aSQ3KDiOYuLh2P2kX+Dqi4cDrI 3kAEeNVc+6VrcJdw97kmhNEfDw== X-Received: by 2002:a05:6000:1541:b0:22a:3b77:6ef4 with SMTP id 1-20020a056000154100b0022a3b776ef4mr12311061wry.303.1664789214190; Mon, 03 Oct 2022 02:26:54 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 02:26:53 -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 12/29] thermal/drivers/hisi: Use generic thermal_zone_get_trip() function Date: Mon, 3 Oct 2022 11:25:45 +0200 Message-Id: <20221003092602.1323944-13-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/hisi_thermal.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index d6974db7aaf7..45226cab466e 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -482,7 +482,7 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, struct hisi_thermal_sensor *sensor) { int ret, i; - const struct thermal_trip *trip; + struct thermal_trip trip; sensor->tzd = devm_thermal_of_zone_register(&pdev->dev, sensor->id, sensor, @@ -495,11 +495,12 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, return ret; } - trip = of_thermal_get_trip_points(sensor->tzd); + for (i = 0; i < thermal_zone_get_num_trips(sensor->tzd); i++) { - for (i = 0; i < of_thermal_get_ntrips(sensor->tzd); i++) { - if (trip[i].type == THERMAL_TRIP_PASSIVE) { - sensor->thres_temp = trip[i].temperature; + thermal_zone_get_trip(sensor->tzd, i, &trip); + + if (trip.type == THERMAL_TRIP_PASSIVE) { + sensor->thres_temp = trip.temperature; break; } } -- 2.34.1