Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1183834rwb; Wed, 28 Sep 2022 14:35:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7B98xzv3Wwi6+a8cpheexb0Y+b2lbxQwf3y1X1SRC2nPk6ar3igUgINMtkjY2MNBX3FlZP X-Received: by 2002:a65:4bc3:0:b0:439:103b:fc35 with SMTP id p3-20020a654bc3000000b00439103bfc35mr30761914pgr.248.1664400918348; Wed, 28 Sep 2022 14:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664400918; cv=none; d=google.com; s=arc-20160816; b=nNtv5GopLfBFcu0ll31WYbwVcHxcUGMxiIkucUCn/xHuuEvfkxoZG/JElpNbuqOcSN DhncHc84hguet7aygVyOjF5h62UZinGRAkSK2pu4ecEaxRrMW88iUrGTmf4JAd+1Ru/1 m6GjLCWhH8UiGodkNjmwBf9YrDb5sgK56ev7VfHoXErfs0lzX9dhBrXsFtYxbzfptMgh S+4VfjypbDf60vEjoseZgJlnWXttGmaRQAwzfs+czAL5AErVmMXVMt+OGzwykp8tAkVG kBM1Ucs+UfsSIl+8W4OtT74V17UG/09fk4jh2b6wvkDDQmL8QlUSwTgKrnS0QB+/MhJq m0Vw== 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=JSyrRgnp8eF02zm4gW2zAYut1VZ0Ix3IvLdNYe7+d9k4yc4GLSY7EQABBhiL/gTF+I l0VQni2qZwdu4kcZkbQjduMXwfyKZZ4iajpIUUcm2GfcfQSAETvg3DjjdKFJA6x0aMt+ ibJG8XKw+3oN9/iXtZG0AxzJ0Ib0CXAYPwHc6oPYT9FkPN8ps/Joo88AuiTlTgRwriOf NGR8LxlHtbDHCHWW2CMQk368B3wLpRuPMcfKuBUQ/+0jYtThuKESmfFNNSvKZolwmXhF zt0KyALbDYx7Y3Ot+7mgyokreHM1rVeXCcPAcy0qnmmFOtkruz39kYmRB8xUWW96l02q 584Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sp7djfhE; 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 k19-20020a635613000000b00434bfa4c2d7si7264434pgb.317.2022.09.28.14.35.05; Wed, 28 Sep 2022 14:35:18 -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=sp7djfhE; 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 S234151AbiI1VGs (ORCPT + 99 others); Wed, 28 Sep 2022 17:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232900AbiI1VFr (ORCPT ); Wed, 28 Sep 2022 17:05:47 -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 B352FE11C5 for ; Wed, 28 Sep 2022 14:02:23 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id e18so9255303wmq.3 for ; Wed, 28 Sep 2022 14:02:23 -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=sp7djfhEgyu/JAfxAWEO2Bll2o1465QHYaS491Yivzn8m1nnT0QMkfOS8YXY3MA65r N77IhZf6+lUkYYoU6iv7y5fTvA1zF8bSIY7asjOCG8TN5EEelBP7ckHhcoOUYSNAQOhz WHAWgeZbIXEPhs5K8TBT9IrtD7LvUwQLNGD2SsaGWxZR+68NoY014d26cfw4dI/g7UlN 2+udMGfsDvJkvRFANg0ChhKMddvLK2dwCIjbKN0j7T2NUyXSwh5S++vfhO2kt+nUZR/v BIygzwUDhhwnm23r/CQoNA3DkXkzTt8F0YsbOdLJvOqSQ+bp2A2qv4DjsMLTyu16pp/f 9amg== 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=4dfL+PCUDBo8gQUk1QgfQMRFHkrkhJqp9vpLfYQ3OibauNNJmZYA+BRLSRsmbyLQDz rk+ryVxo5WDtlvhGxyG8AVGLvRVTUi+YqcWY5nO2rwvomDD2XXVnndeHNcy493q0QrVd TPcK4ULV4wJXOJNCWd6MYjEViwaaIWHBBEfMT2VqV2yNCxiv5mqb1trj9OEdcn8+wK5h TWhAWGys35y7KDozc1asFXt50gpxQovNhKrxwoVx1iq37kzObYkq0dQ+81BqX22zVmBk A1Q04yl2kj0QZ3cavAnj8zGltAInjuHF0A6t3eeRitrC0s1M4rk50ssQSaXpU3gEzPUt toDg== X-Gm-Message-State: ACrzQf3K5/ApYU/oqQfP1Lk25//+BWti19IpbVdXWbdrpxB3PPSZwAgC /qWpUQgFS3MIWYt6A+baOd1taw== X-Received: by 2002:a05:600c:3d0e:b0:3b4:9bd1:10be with SMTP id bh14-20020a05600c3d0e00b003b49bd110bemr8163991wmb.101.1664398941515; Wed, 28 Sep 2022 14:02:21 -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.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 14:02:21 -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 v7 22/29] thermal/drivers/rcar: Use generic thermal_zone_get_trip() function Date: Wed, 28 Sep 2022 23:00:52 +0200 Message-Id: <20220928210059.891387-23-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-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