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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 971E9C32771 for ; Mon, 26 Sep 2022 14:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=78F2AfKVLdhe780bioU2XER+/Bp346Ozc5UfLQJ1tlo=; b=MW7ll4wQ1Cm+8+ W2vz6M3NSxGHiK7sXQjVn4bdlzfa9PktptP3IrGF2Z/ZdfSaCwLTNJZTZ36C553uBly6Z4EGAUHeC 9sugk1YPI4iTDlRyz8TrsMcQL5FmSTm7+rr3mrq6X16uQStbGWYyr7zswmTYLtPXC+gIQGuTd63Bh MjNempc44Qi5ne/XZpOEeHGKHbY5BWyZ4Ntvx1R3G2GFj8Gtau7BpvKetpaFY2DHpgKOGE3rh8fgA AmLdwsJYNlJV5kkQt2sjx8rKNGdZOfXEGeAD3kzbjrUZ5nA7xGu3FR8+XGvoAprDhxfaqRkeWFJnA CWyyWfG2x2ow0VTU0gEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocolB-005Goc-0U; Mon, 26 Sep 2022 14:07:01 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocokl-005Ghy-Na for linux-arm-kernel@lists.infradead.org; Mon, 26 Sep 2022 14:06:37 +0000 Received: by mail-wm1-x32f.google.com with SMTP id u16-20020a05600c211000b003b5152ebf09so5018529wml.5 for ; Mon, 26 Sep 2022 07:06:35 -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=sqO/O1aFXJtFOKef2CLDy2KKoGo8mS1jDc0v38LlO4RsfpXxavOpN1TxtCAobC4yO3 kNv2B00br95zTYjJS9brJ+w5p6aI1B2nSj1JtpnHAoQqcKTO+B3NZht/kub2MfdwOxet Evm4oMZyp6uCsSlcx+dSf7ZvAADUW2jSacn8Y74kT7yhK8gG5sL92VCKetIy/uef5lNI 0MkUVZCHihEcwswFI6nNmpVOJ8Ke0AgMDB+K5q3xHGBwtIYohPQtlDZg1/kDkpndeiVw Jhih4H1DDmdVMIr+2pSA9TCh9m1wGYQGKyVGAJiAsyXkbcBmaVWQoPmZJb0sZA/2SvDE b/KA== 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=0otTHIRIBGxdZYk7vpLikGSmj1xk6g96IH2uy5MKhH8FPSX00gby3uKmvcGysuazwH S7mJ346X1uQunTbrRIvX+ZNMhNTGG/kO4BulEEJykm6Ohe/8dw8aQ20IoZxii518dNOw YTjKqJ63RSSJ3mfuFF6RaOBtVYDk4nW4rQptL/5TgbtUdQxw46n83xyPc9uepZBOm3S5 +sRKNqrEhrYNHx5sBiigJoemEFic1HF4gvCuT1aK25y4Qnh+m0ev49zrxr5oQWZzYIHL Ylj+GnCVUfro2BdnfP7UEbrsYg5amcWlacHLH3++clslTx6QCyMRz2zoTMrWmBO8/qHM tVVw== X-Gm-Message-State: ACrzQf0wcYLZRrM6J1VQpUxEBYGEimJM0EXpCpqNiteQbvXf828aLEVP tYbvpk7P4M9X7EDaulxNAv5CDQ== X-Google-Smtp-Source: AMsMyM6HXTifdgRuNXtogg59dwFlxvk/9EzRjUIZBwKpxkvtUZNRBVRRWpFOp6S2LnET4G2WYaRKQw== X-Received: by 2002:a7b:cbc4:0:b0:3b4:fd67:d70d with SMTP id n4-20020a7bcbc4000000b003b4fd67d70dmr16957755wmi.98.1664201193975; Mon, 26 Sep 2022 07:06:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 07:06:33 -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, Kunihiko Hayashi , Amit Kucheria , Masami Hiramatsu , linux-arm-kernel@lists.infradead.org (moderated list:ARM/UNIPHIER ARCHITECTURE) Subject: [PATCH v5 12/30] thermal/drivers/uniphier: Use generic thermal_zone_get_trip() function Date: Mon, 26 Sep 2022 16:05:46 +0200 Message-Id: <20220926140604.4173723-13-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220926_070635_790735_7A85BEEA X-CRM114-Status: GOOD ( 14.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 E7309C32771 for ; Mon, 26 Sep 2022 15:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236239AbiIZPU3 (ORCPT ); Mon, 26 Sep 2022 11:20:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236395AbiIZPTK (ORCPT ); Mon, 26 Sep 2022 11:19:10 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5DB5C9CD for ; Mon, 26 Sep 2022 07:06:35 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id r3-20020a05600c35c300b003b4b5f6c6bdso3791100wmq.2 for ; Mon, 26 Sep 2022 07:06:35 -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=sqO/O1aFXJtFOKef2CLDy2KKoGo8mS1jDc0v38LlO4RsfpXxavOpN1TxtCAobC4yO3 kNv2B00br95zTYjJS9brJ+w5p6aI1B2nSj1JtpnHAoQqcKTO+B3NZht/kub2MfdwOxet Evm4oMZyp6uCsSlcx+dSf7ZvAADUW2jSacn8Y74kT7yhK8gG5sL92VCKetIy/uef5lNI 0MkUVZCHihEcwswFI6nNmpVOJ8Ke0AgMDB+K5q3xHGBwtIYohPQtlDZg1/kDkpndeiVw Jhih4H1DDmdVMIr+2pSA9TCh9m1wGYQGKyVGAJiAsyXkbcBmaVWQoPmZJb0sZA/2SvDE b/KA== 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=Gd0E2dOphIlsRJiIAm6GQhEwuhHEWCNuMg2pQDSQjtVeKmKfrWO/D4M7LciFGBbmzD Pc4U1wOfyXh8ZKcvGIWWN6jmqTsKOeF+t5wfwc+pNBPIOAZ3SOc7aMmz771mpt1VSri9 EdVuuWUJzCkL6KnKkjqeuCwMEe7sQNsibp+33yktES6PAbVriN/RIpPyGmXj3sJUgam2 7PwoJUlqioTY1rsJnG93tLzE3Mh7dE8yMC0ew4UAEX6wL0qbi7S9xmqPq9okxZiStCrd N3MRCoDngChVl5CUCUKH9AiN4Qfiqor6ARfKz/thQhlptoQjSiYbOxQkj7+lh1O5X2kp C0Xw== X-Gm-Message-State: ACrzQf2OtWAk+IWMyh2LBNVJ5/jdVADKlgt2DJvZpvzc2PvXgfXyU9TS xKehzsNf6hsHvrFLirovDXnluw== X-Google-Smtp-Source: AMsMyM6HXTifdgRuNXtogg59dwFlxvk/9EzRjUIZBwKpxkvtUZNRBVRRWpFOp6S2LnET4G2WYaRKQw== X-Received: by 2002:a7b:cbc4:0:b0:3b4:fd67:d70d with SMTP id n4-20020a7bcbc4000000b003b4fd67d70dmr16957755wmi.98.1664201193975; Mon, 26 Sep 2022 07:06:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 07:06:33 -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, Kunihiko Hayashi , Amit Kucheria , Masami Hiramatsu , linux-arm-kernel@lists.infradead.org (moderated list:ARM/UNIPHIER ARCHITECTURE) Subject: [PATCH v5 12/30] thermal/drivers/uniphier: Use generic thermal_zone_get_trip() function Date: Mon, 26 Sep 2022 16:05:46 +0200 Message-Id: <20220926140604.4173723-13-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-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