Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1188049rwb; Wed, 28 Sep 2022 14:40:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FhcnRn+8hU2rdSbKxXeP1BbP42oYGXcZ2fH4DxbiQ4QFfjRKp9IMvjvUjZSPAJzd1VBns X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:6302 with SMTP id b12-20020a056a00114c00b005282c7a6302mr36759051pfm.37.1664401199693; Wed, 28 Sep 2022 14:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664401199; cv=none; d=google.com; s=arc-20160816; b=q6v2p0CmnTUwgS/koYoEgPQ5n/D1q1nkpYyQqooPtyctzml4qXYzJ2MP2UYYSi5ur8 VZb/XuE5LPRYzOMkHf3SqeTvcCe5OXuG/oy86U50U7bca8ymcbPanCI8cvFRflNKd3xJ dgLi2h8ZTpS0JrfWciUsfYo/4Xgn0yAtJJEKnofu9Uu1HurGBSKEExZPMt08uztMnATy Ai7T2uODLEO4VIP5w7L793OV1ViemtBpOZoDbHNByUfgCuajRqmjxcfiZLQ+1PJtUBAY IP5PrbQolqDrNj0A5FM/jy8OEifLig4Vrc/Qv6oVfH7NMVL+F5u9b3QOFrAnEWpJAohQ ZTEQ== 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=zhkHfGU+506U13gs0KttMlfYYtmPZTAW+1/ApMCut14=; b=Qd+ES426gU24tV/1G89dZ82W0JjuQoVKKvzyMiQBn7SGOIEzbTqRX+pQXeQ963dIcJ 4bCAzQlkiV//KLt9nxRNquwlId0NNINa5QviDke2V75h55iT3mCcY1PV3UxLNHFQSedu 4wGcYCPCGaimvsF7FrrCSXWA6Q+f5XVMuUbwJSYRVo1QGa/QCJy5aP1w+AMRmHEPnLDk 69BLVHU2hrirx0SgYrQKVjavZR2D25dpOKsObN8a50mNNV1ea6PRlJGhGOAzWkPmXkK4 +sTLq85PxYTAQCEMR5PWXRDGy1yO8mDiXRepebjvo463mybTG/tUq2Gc5DU7m5NuFD3V thpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wZV2rEDw; 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 w12-20020a1709027b8c00b00178b7f8c5c5si4482188pll.598.2022.09.28.14.39.48; Wed, 28 Sep 2022 14:39:59 -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=wZV2rEDw; 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 S234264AbiI1VEB (ORCPT + 99 others); Wed, 28 Sep 2022 17:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234346AbiI1VC5 (ORCPT ); Wed, 28 Sep 2022 17:02:57 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68229D589A for ; Wed, 28 Sep 2022 14:01:48 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id cc5so21617491wrb.6 for ; Wed, 28 Sep 2022 14:01:48 -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=zhkHfGU+506U13gs0KttMlfYYtmPZTAW+1/ApMCut14=; b=wZV2rEDwrDw5kpAU9+Bi9dO9ZBdeVO8J/+L+RijbP1djAwa+2xn+Y12ZGq1moDyERY 5ir5QR5AurdNpU95A/SrJ11fv0cWt+FB2m7hdjb1F+7aoIYlYtIxSJ70dGTjp39mhSAm EDG9q2/XGan2YiYfzRDm1yTPpzdA4shtv63P90POOS8+2ZhQ4zrspnYeNge35+tTXSum J0nkc1RO8S+Jjrna4Ap3ZxU3fNBMBaiEzLZnB+6LjiHpkK91sdtKiuatFzg853H4Acdl 1BRQrycuByu4yBf1cATx0bEcc1ZNnPCsmKjHoc9hpBCdX6tPASFnMqQBRN5pgl+2dqjl hX3g== 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=zhkHfGU+506U13gs0KttMlfYYtmPZTAW+1/ApMCut14=; b=h3ePicnHZW5hP/1kk22wK1UwvXY3bUDrsUjy3QsOqMHQvddsJyTIdkeUR6dL+rwnC0 qNWfXTr/EF9l9vd5eVOIaRjdERztmHOI5tKfQcEVR2aQcFpuf1bjUaV6SuVorpFqOxKC 0GC/hVEhMM4ABEa2OtnDAWgRJoJ5OcrU+CeFudq0Pux0G0kjzOBJ2wtYw4VQweK1hauG HtjebyXrlvB+dndeV5m6MdOIR03AnqimRPOGysbIVU483dVpW8WnLaka17xWUdPhYn9O k6Rnw9rPJ6mHT1ElTwT5CS5qtQ9aOkiDDUs5zUrHkgwOIsF6kHpmDwzJtu+AfVyLAwi6 SKzQ== X-Gm-Message-State: ACrzQf1GVQedWzeMeowyB1tVCIGrhfAsyBd6N7iYqBJrfV4WzLC6o5bV C0EZmD257W373sU9UuSJDECfWkabyQxiaGZV X-Received: by 2002:a05:6000:78a:b0:22a:c9d9:4449 with SMTP id bu10-20020a056000078a00b0022ac9d94449mr21102804wrb.189.1664398906644; Wed, 28 Sep 2022 14:01:46 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 14:01:46 -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 11/29] thermal/drivers/uniphier: Use generic thermal_zone_get_trip() function Date: Wed, 28 Sep 2022 23:00:41 +0200 Message-Id: <20220928210059.891387-12-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=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 Reviewed-by: Kunihiko Hayashi --- drivers/thermal/uniphier_thermal.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index 4111d99ef50e..277ae300c5b1 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -248,8 +248,7 @@ static int uniphier_tm_probe(struct platform_device *pdev) struct regmap *regmap; struct device_node *parent; struct uniphier_tm_dev *tdev; - const struct thermal_trip *trips; - int i, ret, irq, ntrips, crit_temp = INT_MAX; + int i, ret, irq, crit_temp = INT_MAX; tdev = devm_kzalloc(dev, sizeof(*tdev), GFP_KERNEL); if (!tdev) @@ -296,20 +295,18 @@ static int uniphier_tm_probe(struct platform_device *pdev) return PTR_ERR(tdev->tz_dev); } - /* get trip points */ - trips = of_thermal_get_trip_points(tdev->tz_dev); - ntrips = of_thermal_get_ntrips(tdev->tz_dev); - if (ntrips > ALERT_CH_NUM) { - dev_err(dev, "thermal zone has too many trips\n"); - return -E2BIG; - } - /* set alert temperatures */ - for (i = 0; i < ntrips; i++) { - if (trips[i].type == THERMAL_TRIP_CRITICAL && - trips[i].temperature < crit_temp) - crit_temp = trips[i].temperature; - uniphier_tm_set_alert(tdev, i, trips[i].temperature); + for (i = 0; i < thermal_zone_get_num_trips(tdev->tz_dev); i++) { + struct thermal_trip trip; + + ret = thermal_zone_get_trip(tdev->tz_dev, i, &trip); + if (ret) + return ret; + + if (trip.type == THERMAL_TRIP_CRITICAL && + trip.temperature < crit_temp) + crit_temp = trip.temperature; + uniphier_tm_set_alert(tdev, i, trip.temperature); tdev->alert_en[i] = true; } if (crit_temp > CRITICAL_TEMP_LIMIT) { -- 2.34.1