Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2192243imn; Mon, 1 Aug 2022 14:48:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vSQDbGK8uThE9fPrcfqO3wu3foBopE/Gs9jgQ2cCkOf24lkrxhFmctWvG5SdY3rHqMyxXU X-Received: by 2002:aa7:d49a:0:b0:43c:fed4:c656 with SMTP id b26-20020aa7d49a000000b0043cfed4c656mr17524559edr.312.1659390513072; Mon, 01 Aug 2022 14:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659390513; cv=none; d=google.com; s=arc-20160816; b=DTZmsY2q7+rt3H83ccK9g+N6bjyMWxnvZO59JyRcPs9BaVqk1vG9weJY9sS7bGcYuI 8IwQQC0mcttpuWOWJoOpRyx2nOi71pZfFipQdKUqiK4O3Zdz34XTyC78ybDsDBvwnyKd KxoNJC52kmlRfmXnjz/dy/yWAd529Ou0QvFoqW2XhThJ0gyl6Ul/PiGDkV4fmYWFhDSH 75pfZutsKWoFjb2dzD2D6BrlZSew2KLhguMUizQ7D00FGFyV2IVGJCWuIy8J+wH4XbJg +EVmXDjxdrQdOIiIIyhdfXHOpOh9z0+o8w/xq9N4oJOlQeE2IDobMreDdrWqPLaUTpjL WIpQ== 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=rnCGi6xpPST6ZeDBqGy3tzDc5ZKe/PTe7JtrBaBAkJQ=; b=x+1wUreX7pYoip8SxDO4b23W7rmpDqMuziU3a3JkaQRCzYmrG7uEA9xX4RyIE/6ac3 ugKyyS8BVhxbuiSi7Yzx5Y22ROPHAeT3VVUvwmFBPItvRWiwc4ul/2TFjq0rwtbdaC4R Lv8+DNuvf0WhqSjCScN4pTScbcVw5nPjNwz2mjQOM9NrywEIAoQ5M8JyTSlRGSokUDmn 3ucCwb/CnMn294/5MVa1H3uzKObBsjYbVJc3n6p12dUVzT1kj9GJIiQZopKO/9jM0qag f0X2PAuZ8B7DH7AOKEO2CBH4uw58KXtOgUFO7MbjpMbSGx4qSnWTeQhLiWR3n2rQA+Ef 9DZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=SPTXGvwr; 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 i8-20020a0564020f0800b0043ce5d3919dsi1276225eda.220.2022.08.01.14.48.08; Mon, 01 Aug 2022 14:48: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=SPTXGvwr; 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 S235409AbiHAV1E (ORCPT + 99 others); Mon, 1 Aug 2022 17:27:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235391AbiHAVZq (ORCPT ); Mon, 1 Aug 2022 17:25:46 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE73546DA9 for ; Mon, 1 Aug 2022 14:24:18 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id n185so6354248wmn.4 for ; Mon, 01 Aug 2022 14:24:18 -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=rnCGi6xpPST6ZeDBqGy3tzDc5ZKe/PTe7JtrBaBAkJQ=; b=SPTXGvwrqZC75iddQvCZdoFNMdrMQEnp75f2dVW24jjojFjGWbEdSpzmge3HOo/QIu +X2bCpf4fYBdc9SfIksH5SGTJb9MNgMzIMNKB0wae1IBfpHrpbYJO4Q6hsjBgFo6BdhE d3S2DMf5qE3fd38lOj4CR2bfb0bJenOWNfOutLKujRlMBP7FlAXn1bSTi1krq4tbOhB7 CHMnBZdUAKV3GRm4PErT71/QJwXGZhWZV7WxmjPzKVgovletFqR/CZOpL1Q2hrKD9wY0 G7915CsOnuK2Q1a68SbRiff0/gfk5vMSsGtVqfX9nsgc1uKpvLWRZZZRjD7cgWJj5sLB gZyw== 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=rnCGi6xpPST6ZeDBqGy3tzDc5ZKe/PTe7JtrBaBAkJQ=; b=kRmCqij0b6uX+0voxFC+7KV2ggsI4nqI0KkTeTSxP3m3k3Z9FGBMApja9ldtybK09r 0rkbBrZVw3iWIQrb06Nh5VI7eGLvZVLUwsv40tDN8xs/UFc9U12h7um2G1l7GfKKAhhX ejcQyzMGX15unr8YN2fzTQo58MHMZcnm6eRy6mpVxxSeM+qH7QYxuJWiV1rnJoeGq3NS T3wnujQNTRODYoQ2biq21+SOnDsI0bU6hrIo+pRcaqNtflZsbyHC9dVDvHKvoYOiaD2K YrOiW+PBVfG9oVxdCoa6JELUeDuBWu2EUov36Ji4jguZp68g3U1Jg9oU22q7eac1JJAe fmxg== X-Gm-Message-State: AJIora8i775PiCmXcamWYt495GCQ9KS1fgGAtgCq852BLCrsX4RNtGyS JOcJ3hnyl6pj/sCJGfkVTt6XfQ== X-Received: by 2002:a05:600c:4f49:b0:3a3:2717:27fc with SMTP id m9-20020a05600c4f4900b003a3271727fcmr12574750wmq.36.1659389056662; Mon, 01 Aug 2022 14:24:16 -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.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 14:24:16 -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, Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Amit Kucheria , Alim Akhtar , linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES) Subject: [PATCH v4 30/32] thermal/drivers/samsung: Switch to new of thermal API Date: Mon, 1 Aug 2022 23:22:42 +0200 Message-Id: <20220801212244.1124867-31-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-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 Reviewed-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index f4ab4c5b4b62..5b1a8a1e193d 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -650,9 +650,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) writel(con, data->base + EXYNOS_TMU_REG_CONTROL); } -static int exynos_get_temp(void *p, int *temp) +static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) { - struct exynos_tmu_data *data = p; + struct exynos_tmu_data *data = tz->devdata; int value, ret = 0; if (!data || !data->tmu_read) @@ -728,9 +728,9 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, writel(val, data->base + emul_con); } -static int exynos_tmu_set_emulation(void *drv_data, int temp) +static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp) { - struct exynos_tmu_data *data = drv_data; + struct exynos_tmu_data *data = tz->devdata; int ret = -EINVAL; if (data->soc == SOC_ARCH_EXYNOS4210) @@ -750,7 +750,7 @@ static int exynos_tmu_set_emulation(void *drv_data, int temp) } #else #define exynos4412_tmu_set_emulation NULL -static int exynos_tmu_set_emulation(void *drv_data, int temp) +static int exynos_tmu_set_emulation(struct thermal_zone *tz, int temp) { return -EINVAL; } #endif /* CONFIG_THERMAL_EMULATION */ @@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *pdev) return 0; } -static const struct thermal_zone_of_device_ops exynos_sensor_ops = { +static const struct thermal_zone_device_ops exynos_sensor_ops = { .get_temp = exynos_get_temp, .set_emul_temp = exynos_tmu_set_emulation, }; @@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *pdev) * data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data, - &exynos_sensor_ops); + data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data, + &exynos_sensor_ops); if (IS_ERR(data->tzd)) { ret = PTR_ERR(data->tzd); if (ret != -EPROBE_DEFER) @@ -1104,21 +1104,19 @@ static int exynos_tmu_probe(struct platform_device *pdev) ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_thermal; + goto err_sclk; } ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - goto err_thermal; + goto err_sclk; } exynos_tmu_control(pdev, true); return 0; -err_thermal: - thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); err_sclk: clk_disable_unprepare(data->sclk); err_clk: @@ -1136,9 +1134,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) static int exynos_tmu_remove(struct platform_device *pdev) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); - struct thermal_zone_device *tzd = data->tzd; - thermal_zone_of_sensor_unregister(&pdev->dev, tzd); exynos_tmu_control(pdev, false); clk_disable_unprepare(data->sclk); -- 2.25.1