Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp233079imn; Mon, 25 Jul 2022 14:55:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ulPAIGmi8UAlBrhAPXgxf+OHX437sgKN5PdceAgAzphmqqFU7lyL2EAj+iQQKxL0WQdTgp X-Received: by 2002:a17:907:96ac:b0:72f:1dea:5b66 with SMTP id hd44-20020a17090796ac00b0072f1dea5b66mr11950804ejc.266.1658786127153; Mon, 25 Jul 2022 14:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658786127; cv=none; d=google.com; s=arc-20160816; b=piMPMimphQqjBPqepb08x+p5kRWUOEZ5E23xiNZC71AH9S783u72AUXDG/+WZhfMC7 Z5EPnimhyjBC4IgKct3a9AUoH1Oeho4Zq+OHpm0eogg/KrxL+dw5JV8pC0TDlBHIV+lq 50u4nUT7E4pgIDC4tstKvlywTSXmEsFia8rVJyIbOPm946Gd4L8cEH79gJoGXpQfRBTQ lYSx7Vr49alnhoGGxlTedLlsKf3DFfBjL1I84hhoNYlZDRB5g1c6g7dO3Bp1XiIA0V+n BdBIklD/DcAoY3OMqOubR7yh8B3koXPsDllqXs5bCklO2hz30PR7kINsSwje/Xh44mNH zMyw== 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=5ySF+b0toG9yTVS3ACVkkX+IpUHvtJQ/EOrRyNhrRXg=; b=wRxFKdOJln+DBjeOaNcYSvjLkqAiaqKwE6/KRy/FqVV6Wk1d3LcTymSWL9Pg7B+nRN DlJeV+bVWZOZ3lrqAlKJhqjTH8/88Nw//aJ+gpwSnWJOW7YbFW/3tX5lqQg2RXPyjqXF RDXaqFBdYO/7ZkinygiFeSCWI4U5TY+sf2Ydai/gtlhfbVMnKIaS/2cxe5mRHn+foX/o KbIrF0rD/bTzsG8SdACvknjbZ4hzSFFNP96tLlHf/lRAztLtdhrp8s+9xQ8sVU766Pth V3sCimzQl/RHnxbUcY/tvTTkzJy+nreegc/6t3GnrJw+ASmsfXc8QuWtpJef8oVDHYsQ FL1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=s6z7yoSV; 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 d22-20020a170906371600b0072b67a788a3si12165455ejc.381.2022.07.25.14.55.02; Mon, 25 Jul 2022 14:55:27 -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=s6z7yoSV; 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 S237017AbiGYVaS (ORCPT + 99 others); Mon, 25 Jul 2022 17:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237360AbiGYV3T (ORCPT ); Mon, 25 Jul 2022 17:29:19 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 031FE255AA for ; Mon, 25 Jul 2022 14:28:10 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id f24-20020a1cc918000000b003a30178c022so10200844wmb.3 for ; Mon, 25 Jul 2022 14:28:09 -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=5ySF+b0toG9yTVS3ACVkkX+IpUHvtJQ/EOrRyNhrRXg=; b=s6z7yoSV0rekPzE4RDgRa5y5JvTAMcHuEGlvc5yE01gfsHE/h+bkbXvzMdz4cv830a Yfd8XaLjC5vFDocgKRQ2ft27kY3GJj0TmnODwt2nEtVTEnAvOT5B9NDyjXG+U9wBTsEQ xYyNbPfWhrJlsQo2v9XeM3TZggY9EjSovtTF9kKqARweT1hvK4gU7f0Za9ZD5hFJ1qzP knYiTCcn+JyO8aHU/I2WFS7vDmh3GlpIWRMrYnz8rwouDDnAdwEYTEZs+hBFTOX+jjHP cn2MHZn5jEZ34FBOmrQh0LS7uARU/9FuQj0tN3Yd5TEMCIXkzZv8McogKvYj7dH/TShu Dg0w== 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=5ySF+b0toG9yTVS3ACVkkX+IpUHvtJQ/EOrRyNhrRXg=; b=6R5TxT5Jx2VJb1FZ2Cs0gwqoZlnQ2glJjo7N6gw4CGTUprhLcwf7b6vSijJ1sx5U8+ CVQvwQ4UvaZsUVa8d/vnc9ePrGfVkQ7oSOGFrNpI7p4ALY55UygZtgW7u3gQ5A4FPU1x HVhkrP9GoqHrMVdlNX6kzFY/CFlEP9IM+UdNHt2NO8S/CCOqYThPJKJHjExmWCWwUXrZ 4yIQIUyVXbPLblrdWLFw45XcxF8O9a4YdD3AN8wE4eJs4S8qmNYMQ3B8TM5RN9cB1hZ/ HsQGXpSrUAmWR0HawRpkuRG2MK6R7Yhrzicu4JW1f4b3yOT0a2Gx3P/kmygF9Wypzezs +j1A== X-Gm-Message-State: AJIora8g8kNG0yvFEU4hwvh4oyAuVuO6HeWyosYWNQmC0LG2GX746jfW aLqszbSaoaueZmSqDjQSCg7iCQ== X-Received: by 2002:a1c:2783:0:b0:3a2:fd82:bf46 with SMTP id n125-20020a1c2783000000b003a2fd82bf46mr22261412wmn.29.1658784488465; Mon, 25 Jul 2022 14:28:08 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:1780:8e54:dd38:6668]) by smtp.gmail.com with ESMTPSA id r17-20020a5d52d1000000b0021d68a504cbsm12668772wrv.94.2022.07.25.14.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28:08 -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, Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , 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 v2 30/32] thermal/drivers/samsung: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:35 +0200 Message-Id: <20220725212637.2818207-31-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220725212637.2818207-1-daniel.lezcano@linexp.org> References: <20220725212637.2818207-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 --- 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