Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2593361rwb; Mon, 3 Oct 2022 03:09:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BHacePZyTVS0V+qD1BUN49hge57kS2bm7s/o1iKvY/kduzEEkNM7YEo60ffklgGIkatWx X-Received: by 2002:a17:907:1b12:b0:72f:9b44:f9e with SMTP id mp18-20020a1709071b1200b0072f9b440f9emr14631348ejc.653.1664791768308; Mon, 03 Oct 2022 03:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664791768; cv=none; d=google.com; s=arc-20160816; b=Vf6MwnOKsQZ4HO6Mn4K7hQr8fOdZDfZCXmCF9D8o8CaHSmQCNGj5RC2pCE2Qt0+RKq 0lQ7LZMmFN/kRFvn7Olxh1Wv1caUI4L0gSWu1WlSjbkQXNJO71BIwCpQrG8eViCBsGQj ZLkVXsRWBI26qpJ/z7BBt9jE6ooQO8nEOdPLFl7s85SFPl3Fo9h16iq4gYsmHYEB8M8K k9pzBRMcX0p+aal60DMz0Xqg9HiQJ8CE2k+lOb+u3RV3BiEiv5cXX09HdiRvhiPRX3c6 swqZXXkRpDk8j/3Pw7dVHQqdfnWzBkmG2l6Astm/sXXQ9KP6+bQ2tVa2sh+uro2qMAWc zDWw== 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=9Ogs5/BdK1Y/lDDyEmjA88qgr/D6i26XcRmp1g6reCg=; b=w7kEetRzgsvXGMgz3VT+EBLsACZDIKvuFpbJTbPZl9wq0ksUxVHpKkTzbEtXQKp1b2 0dvMdzFsNCxZ/C73VnWr5jHFF0vlfS9+L5v4yZ86EwtLYbfNwJjg+BJ4faHppLwevJsr iy/gm+IKJ8N3yRmOmNbHXDhqhopUO8ozbmlpvB7uru9RBUMPKw8vVq9xE6unf7uP+dOx ME/jFnVtydYx5AOCzmwRvsvyywDAdv10EmhpUJYB4NCbMnqT76RnHfLJ8zrEbqAv2S24 EUBPq1MpqZD6Ro+C5NVoA012kJAgo/66JbYkZ3hnL6dFDwsln5RtlR2v4uIBqqLCRc4o foZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l9koF9bF; 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 f15-20020a50a6cf000000b0044869b3886bsi6918764edc.194.2022.10.03.03.09.03; Mon, 03 Oct 2022 03:09:28 -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=l9koF9bF; 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 S231509AbiJCJc2 (ORCPT + 99 others); Mon, 3 Oct 2022 05:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbiJCJaX (ORCPT ); Mon, 3 Oct 2022 05:30:23 -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 7E984543F2 for ; Mon, 3 Oct 2022 02:27:51 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id a3so3520606wrt.0 for ; Mon, 03 Oct 2022 02:27:51 -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=9Ogs5/BdK1Y/lDDyEmjA88qgr/D6i26XcRmp1g6reCg=; b=l9koF9bF965NaCuA+Ntkb2Pm9axOdp3LETpP2GojpFRy9GhKkGTVqUxLJZzVehHC3W CqEj+nWMVltstLhaGqZ9V496HAk8l7VO/0LTKCwV8plbbwg0w8CyKy47Idz1EovHVLGs DqLQVLukkGTCeYGul5OcJB3aRk7gNy7holm+NytTRlhiIZ/OLz5bhDfJ91CSy/MrHiuK EOVqtMdHxaYm1b0BCxHczrqlpfPb925t7aFSwqe3eQUjtjQWMyoSyzSXSOXnA00rRbVf RcT+Fideb8DNO8Y6yg75DzykXNiubqyHcdLcw+FanyBuAOndMuI6ev+igalUTLBGe8zc TBqw== 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=9Ogs5/BdK1Y/lDDyEmjA88qgr/D6i26XcRmp1g6reCg=; b=vScHYdC7aI5F2zXK+hPi+EDIYVBJi4P6zRbFFcyoLSA/fxIKSq0UK0lrsC/l4Vt7Zi /Th2WU00ADcwh6xmepv8rtNq+LrrjkZ0FiDN2fQxBwtfbCYmGRBkEdQoG+jCZR+JrVPD gaxERU3GhaTAHXtjTRSc+CVM0Lptmu7lyde2rEN/Ob054LQvtxoJsKEJT7AvdbTcjwxB XiXXFHs8TVSDlSc3BofKENT/jz9qbBCUMTxMzEo1sNXclGG0zUwEPu9cgvon0MWefJ0c xZnIP74ki1W4rz2pPE51aa+5rWB46TpLXXJ2ZiV+/Dw12CJmpUgqc2Lmwtl2VnW5BFBw yUJg== X-Gm-Message-State: ACrzQf3hToUO4L5bl6jJXygZPuUA4rTc5wPgcLY42PMQrdQ7wN1MQEvH 3CWHcNHYZfMPuxebE04RSMvI7A== X-Received: by 2002:a5d:4cc2:0:b0:22e:372d:9c9 with SMTP id c2-20020a5d4cc2000000b0022e372d09c9mr3386176wrt.576.1664789247627; Mon, 03 Oct 2022 02:27:27 -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.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 02:27:27 -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, =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v8 22/29] thermal/drivers/rcar: Use generic thermal_zone_get_trip() function Date: Mon, 3 Oct 2022 11:25:55 +0200 Message-Id: <20221003092602.1323944-23-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-Type: text/plain; charset=UTF-8 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: Niklas Söderlund --- drivers/thermal/rcar_thermal.c | 53 ++++------------------------------ 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 61c2b8855cb8..436f5f9cf729 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -278,52 +278,12 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) return rcar_thermal_get_current_temp(priv, temp); } -static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone, - int trip, enum thermal_trip_type *type) -{ - struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); - struct device *dev = rcar_priv_to_dev(priv); - - /* see rcar_thermal_get_temp() */ - switch (trip) { - case 0: /* +90 <= temp */ - *type = THERMAL_TRIP_CRITICAL; - break; - default: - dev_err(dev, "rcar driver trip error\n"); - return -EINVAL; - } - - return 0; -} - -static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone, - int trip, int *temp) -{ - struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); - struct device *dev = rcar_priv_to_dev(priv); - - /* see rcar_thermal_get_temp() */ - switch (trip) { - case 0: /* +90 <= temp */ - *temp = MCELSIUS(90); - break; - default: - dev_err(dev, "rcar driver trip error\n"); - return -EINVAL; - } - - return 0; -} - -static const struct thermal_zone_device_ops rcar_thermal_zone_of_ops = { +static struct thermal_zone_device_ops rcar_thermal_zone_ops = { .get_temp = rcar_thermal_get_temp, }; -static struct thermal_zone_device_ops rcar_thermal_zone_ops = { - .get_temp = rcar_thermal_get_temp, - .get_trip_type = rcar_thermal_get_trip_type, - .get_trip_temp = rcar_thermal_get_trip_temp, +static struct thermal_trip trips[] = { + { .type = THERMAL_TRIP_CRITICAL, .temperature = 90000 } }; /* @@ -529,11 +489,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) if (chip->use_of_thermal) { priv->zone = devm_thermal_of_zone_register( dev, i, priv, - &rcar_thermal_zone_of_ops); + &rcar_thermal_zone_ops); } else { - priv->zone = thermal_zone_device_register( - "rcar_thermal", - 1, 0, priv, + priv->zone = thermal_zone_device_register_with_trips( + "rcar_thermal", trips, ARRAY_SIZE(trips), 0, priv, &rcar_thermal_zone_ops, NULL, 0, idle); -- 2.34.1