Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp43458imn; Wed, 27 Jul 2022 14:40:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1soQzNV+Fnph9aDaWqBDS6KLOq+bxBcjpJLF3dCunDSVo0rleksJoIVpI1+1jBsUlpXdWN+ X-Received: by 2002:a17:906:cc5d:b0:72b:1313:cd09 with SMTP id mm29-20020a170906cc5d00b0072b1313cd09mr18804101ejb.482.1658958057161; Wed, 27 Jul 2022 14:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658958057; cv=none; d=google.com; s=arc-20160816; b=UA0fxJ3zQl+h6oZkg1kkYnRDsRbbpj01/tM8f2MIMZJWx8Dkrbx53uEijNmYW4A5j5 PN1mrRKudd6z+j9SpUnfP1ralUjiPNiame+wtmI2dBb1A0pO0JpQIwoaQYZRJ3QhHI30 4uw0ne4Tep6EuCJpuODsidxwW6jyLXHHO1CzSSoh7RkwZaKnhSI0HZJVi+wolJHPlc1f 3FBzsKMMacWUEzCHk5dpi1Y7o5ZV8RDpuOw5X3QZbUXqe43Xclmrywa7r+WQYy2nCPp9 Sf/oLebn+adLdedU7+GQc4k1A5+uRoftI+u0cVY+bWi/7SFSqwBLul/cDyQx9f6pwfda eZSA== 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=mbd+JoJPzMEqAhgzIi5tr/iVaPhZOmMa+7X85ObFvvtb6Ixe3MP+k8wNVHjZ7z/gYM 0Pkx/Ya+C4grxAm8GCHewN7ovFdOyO6qNvfKDtWY0mjQ0v3nJ/3eeVLVZfqVIejwSfjE xEtxAW1Y2aTxtj4yepIvhKV6wGPn0Y/GXjRp2TIDfKZrzSRnNg7NffJzH0fW9n/hfXAp 6hN1VL39KetJSU8eHAnjosMU/66BRWAh0vMjsHfYVNdUuFFwvpweLyt09B7YTZerFDmS U9trd5N6J+oH3CH3i361Nw2YR5UbXl53UeeRlubuajFDhEqh+SLoR8UzV5OIjDuiPDTP MPWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=Svwhdwfs; 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 g8-20020aa7c588000000b0043c77b9ca58si4461434edq.82.2022.07.27.14.40.32; Wed, 27 Jul 2022 14:40:57 -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=Svwhdwfs; 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 S236941AbiG0VEi (ORCPT + 99 others); Wed, 27 Jul 2022 17:04:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236121AbiG0VD7 (ORCPT ); Wed, 27 Jul 2022 17:03:59 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7705D60527 for ; Wed, 27 Jul 2022 14:03:52 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id v13so18300097wru.12 for ; Wed, 27 Jul 2022 14:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=SvwhdwfsNOvuBHMMHdjl6Atc+dKlr60rsUeADqp96byBmVhAKz+XvDjiROATdcaydb KAckFf67sqIYlI+IcerRWqFC1AduHaG2Q0WEf10ISKxhz2RvT2OwgafCIBAZ8A0h9JmZ 4l/yL0okOygNcS9zipOtl/0po7Bv0IxDWYE9BX6/2hFOviT1iArYWmnBBaeAzhpreLfa hZxdzgtHAey6F7NgnFYaza9uehhCg8XXTRZaq2DYEuKb/sJbmmJGFB4GlzMWR6LGjMyv vdRCginLDkUnp38PW6xmmqSMTxJpTHg/dWT8hHTjQqD0XI3+jVMroV2W5eX5YjoQm6tv xacA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=X34duNVmKBomVJamxExIha8kYOkCLeHmlAc0MLUjiCt6oZIj44Zsd/jIUF4mpiTOPl 9pMihyNbRG/RDpxBIIXnxtMiu5zohs7zhsvFlD6qSmbxoAO+fl2MPrzER+54fqU3ULix KgvV2ipdrtpgKib6xrAeqaqYxRh6oBFUbAzqpoMjtziN+FFXUz4kZME5Ymtm8kXta5HD pIpE7kLMnxvhLtxQYbL/onD2qcvi3RpQkLYfSK3lx5PqSU7MRDyYhGWhEE/E8UxdpQ4x jQ9Tg/cpfB8shBUp5SkfqYPDcpKQtkjbUp1iMZ0DsMbaQ7OFphxOJAwUjUTWuxqQnDVy TISw== X-Gm-Message-State: AJIora8e9ZaKqYLKBXvTVdT6VIO2Pb8hjlHpaBlUeAcEcyyf/Bws6WWr 11LISE8R63GexvrlRnUtvQITFg== X-Received: by 2002:a5d:5986:0:b0:21e:811c:f688 with SMTP id n6-20020a5d5986000000b0021e811cf688mr12539382wri.8.1658955831996; Wed, 27 Jul 2022 14:03:51 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:65a8:ebd8:4098:d9d0]) by smtp.gmail.com with ESMTPSA id h6-20020a05600c350600b003a38606385esm37908wmq.3.2022.07.27.14.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 14:03:51 -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 v3 17/32] thermal/drivers/rcar: Switch to new of API Date: Wed, 27 Jul 2022 23:02:38 +0200 Message-Id: <20220727210253.3794069-18-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220727210253.3794069-1-daniel.lezcano@linexp.org> References: <20220727210253.3794069-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=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 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