Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2191701imn; Mon, 1 Aug 2022 14:47:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWSIaxSqARJcWc/gq/BP5ZvYbkyr/JNMiK3LoISCpWkNwx7l6QYxoPQLtpV7isyl/08k1l X-Received: by 2002:a17:906:cc17:b0:72b:4561:9153 with SMTP id ml23-20020a170906cc1700b0072b45619153mr13566077ejb.249.1659390453076; Mon, 01 Aug 2022 14:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659390453; cv=none; d=google.com; s=arc-20160816; b=Uz+Y+XLyDGWp1gftkSlTyN3PQdhEntyuim0fzSmMMJQO+LATPT7VHNuM72bZsoqJsd GRtZP9eg495sVo7zpc1zdhJ+pa+k08MQKENahKvX1PGpa197qbP0JPoLAEsEf4u2E6BU xQbjHzehxZMhCRnq5YZNVZqtsNXinVvgt0IKH3oboKA8IuWGIiockBQwj+FeBySW2TDC 2BVWqDpQju54RvCdBXE7tQx1uSJH7gDf4VuAoQQ6QNYpUWCklYP4n6IDa0CyMXVYOcFN vgziuTDlW0I8Vqa5jbzyBBaDqObJDqPu8vwsiyLVLYR39WrIiNyQJ/1xD+gq25PTWx9A Lj6A== 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=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=mIBaZGbdFmDIn2eruqn9/OibJzJZxsUkR/xvX/aCwzopcUxPEev5DTSFCX0GTMDQZp Eokz1QauFhxEQ5V4/ssUiULmA+Jadr8p45LuTX1EG0DcpfvIrIfNTIKUI5rhkNfzQPk4 hKaBhuOzYDN3+aevWJU85Tm1cgXi8Q24YfsT9eyi3Uyg2V1Q9xHquKxB4OtYKrEGNtoJ +tH24pD68w5+95h6Xl8xhuMUGoBMusaZ+241D71jJil54aKh51HhVpu+BjOUZOA2B5PC gZkqEcl4TV3dPXOcTIsnbuy6VfzfoC2B4P7CpIOptEBUdB2v0K0y7qd+QgRtkQ4qKT6i h2KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=ff+LpqaL; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg2-20020a1709072cc200b00730937fae80si2181667ejc.933.2022.08.01.14.47.07; Mon, 01 Aug 2022 14:47:33 -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=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=ff+LpqaL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235276AbiHAVZA (ORCPT + 99 others); Mon, 1 Aug 2022 17:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235126AbiHAVYX (ORCPT ); Mon, 1 Aug 2022 17:24:23 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CFA547B93 for ; Mon, 1 Aug 2022 14:23:47 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id z16so15554731wrh.12 for ; Mon, 01 Aug 2022 14:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=ff+LpqaLWoKlnM8wumShHf45QV7tsQst+bCCtYoUZQ39ybrJuZAWmGig8prF3XA8ng SyjnXnMbyEmWHH6bM+NC3jZ45y3CKJRJ4Cd4HuYl0ut8b3YkDBWKWLoCNWZ6Ct0hp+kY 1BWHy5WMJw+k4fRAzp0rGw0uyI4SLBlz12tBNC0G9N/zqK98EGK2bpSD7uB70o22McRE AA9O2jFwDEYdq4TkmkhD6l7ZzOFGn3eNnKXEXJL/yQyalN2cMtWfWYFu3kitJB+5rPZY kqo2ff3GETMwDZYTOWsXFCh7HOPhkTqIvLg3g5Yon2eGroEr0EfVe2yq0odNM8rT5OA/ kQGA== 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; bh=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=W3+98/lloUzGsDk9GPH6lANOb5WyYC+n34q8aV9TRYmjcnxCvrvm5ii6Qw2jz3R3XI LyQVCW6dvhZfCp4cyjaLLYhpg3aqE2HSZntXpEnt8cZuXUFQ+i+WgXgkTCQhQbkjhdB8 i10Mnvjo16cZYF2bCVKT2QWnJ1QwbTQxjimrMS+76CfTcypjNI5ULSH7GMoeGxCY2w47 Ln6IiP+icoWPRnyLs13nAr/9rDQyKimkuuW496jpiCiTq7FQPuZfA4dCuLoWRRvNvLMj 5oV3RoXcdfP9dWPGCGM/A6kVFY3PU7ie3A/tl2UvIEjUdnexjVhXwj7aKVPKcPmWeoaz 9ulA== X-Gm-Message-State: ACgBeo0p1qviXDksdv+JEAVQUwJzjWK3lmsSCPIq09Pm/r56XGfVF4uk /IhXQziCBaIqLdWlnf8Shnwc1g== X-Received: by 2002:a5d:464c:0:b0:220:26a8:d2f2 with SMTP id j12-20020a5d464c000000b0022026a8d2f2mr7437101wrs.309.1659389026785; Mon, 01 Aug 2022 14:23:46 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:d00:ceb8:9c09:1302]) by smtp.gmail.com with ESMTPSA id c7-20020adffb07000000b0021e501519d3sm12995285wrr.67.2022.08.01.14.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 14:23:46 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Amit Kucheria , linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS) Subject: [PATCH v4 17/32] thermal/drivers/rcar: Switch to new of API Date: Mon, 1 Aug 2022 23:22:29 +0200 Message-Id: <20220801212244.1124867-18-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220801212244.1124867-1-daniel.lezcano@linexp.org> References: <20220801212244.1124867-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Tested-by: Niklas Söderlund --- drivers/thermal/rcar_gen3_thermal.c | 16 ++++++++-------- drivers/thermal/rcar_thermal.c | 13 +++---------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index e2020c6308cc..40ec63ad0a1b 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -164,9 +164,9 @@ static int rcar_gen3_thermal_round(int temp) return result * RCAR3_THERMAL_GRAN; } -static int rcar_gen3_thermal_get_temp(void *devdata, int *temp) +static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct rcar_gen3_thermal_tsc *tsc = devdata; + struct rcar_gen3_thermal_tsc *tsc = tz->devdata; int mcelsius, val; int reg; @@ -203,9 +203,9 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc, return INT_FIXPT(val); } -static int rcar_gen3_thermal_set_trips(void *devdata, int low, int high) +static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct rcar_gen3_thermal_tsc *tsc = devdata; + struct rcar_gen3_thermal_tsc *tsc = tz->devdata; u32 irqmsk = 0; if (low != -INT_MAX) { @@ -225,7 +225,7 @@ static int rcar_gen3_thermal_set_trips(void *devdata, int low, int high) return 0; } -static struct thermal_zone_of_device_ops rcar_gen3_tz_of_ops = { +static struct thermal_zone_device_ops rcar_gen3_tz_of_ops = { .get_temp = rcar_gen3_thermal_get_temp, .set_trips = rcar_gen3_thermal_set_trips, }; @@ -504,8 +504,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) for (i = 0; i < priv->num_tscs; i++) { struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; - zone = devm_thermal_zone_of_sensor_register(dev, i, tsc, - &rcar_gen3_tz_of_ops); + zone = devm_thermal_of_zone_register(dev, i, tsc, + &rcar_gen3_tz_of_ops); if (IS_ERR(zone)) { dev_err(dev, "Sensor %u: Can't register thermal zone\n", i); ret = PTR_ERR(zone); @@ -556,7 +556,7 @@ static int __maybe_unused rcar_gen3_thermal_resume(struct device *dev) priv->thermal_init(tsc); if (zone->ops->set_trips) - rcar_gen3_thermal_set_trips(tsc, zone->prev_low_trip, + rcar_gen3_thermal_set_trips(zone, zone->prev_low_trip, zone->prev_high_trip); } diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 1d729ed4d685..4df42d70d867 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -271,13 +271,6 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv, return 0; } -static int rcar_thermal_of_get_temp(void *data, int *temp) -{ - struct rcar_thermal_priv *priv = data; - - return rcar_thermal_get_current_temp(priv, temp); -} - static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) { struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); @@ -323,8 +316,8 @@ static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone, return 0; } -static const struct thermal_zone_of_device_ops rcar_thermal_zone_of_ops = { - .get_temp = rcar_thermal_of_get_temp, +static struct thermal_zone_device_ops rcar_thermal_zone_of_ops = { + .get_temp = rcar_thermal_get_temp, }; static struct thermal_zone_device_ops rcar_thermal_zone_ops = { @@ -534,7 +527,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) goto error_unregister; if (chip->use_of_thermal) { - priv->zone = devm_thermal_zone_of_sensor_register( + priv->zone = devm_thermal_of_zone_register( dev, i, priv, &rcar_thermal_zone_of_ops); } else { -- 2.25.1