Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2191192imn; Mon, 1 Aug 2022 14:46:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR6upL1u0+dtLVD8mktj3b3nhC00qrUoQGgOjL9181+cU4VKQH1dbPwlNoqfrWz/KrUj949E X-Received: by 2002:a17:90a:e2cc:b0:1f3:1151:e0ff with SMTP id fr12-20020a17090ae2cc00b001f31151e0ffmr21512943pjb.50.1659390373819; Mon, 01 Aug 2022 14:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659390373; cv=none; d=google.com; s=arc-20160816; b=ux5hTolZ3QtwxQf+xj2+MC7yZMUb7sVciAWT8Tmzx6GvtQi+19KLZj1e9P11R66A4G FTkXFfwURMwp3uiEZdvmRhuj0Efgp32dtsEJFQ6EMLZ1iZtteFszdZ32RV/ddXkOzK7I dAllx72d3tmDvSwtfm2kirMFe1CeqBNjYl+7PWOsv1vc+YR0hSEpSvWktBoP8vTUh7aE Q/V04PT6Yo34UCmRwObtCckBCLN0D1osQKrNGzm9TaPDLfP5yuQIb6ocfu8Dtre3gQpD tk/Wwdfpo07EJfiVMXjeZhZVj4/W3Ulyuuqkcoo7Qi0p/dhZ54A0ew1ZkE1rxoq+7kXO Fqfw== 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=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=j6aG8Q8dBxvklMd4udFpAVttdftUTod1Ww5da3Ey+dx9Dlx4BpdLtzsbcfAMoV5MIl pZH1dAkDq+Ro8/5O0qWF0ttFDrBPDnF+eLoPx7TwiI4ErxI8zjfav3h5QPIkXkoJinLb AiAV/r7b07Ccr9zgLSwS6CxVOUqZID+DvfYsonn8Rbw5E8+MchBdCRVIiESB/znAgRf4 YfIjKCqjwCKeUV1hQGal3xbC2HG9nuVIOs1fSJ8ybGrsv1IDYUjdL4ds2zR+8X4td5wC a0dJoxXSNOQDmCOnMqnD5fOdvetA7EnRunnWZzKorte/aVVwH/4lKxhBt49m4aO123EL 58+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=MQvKPtV4; 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 y28-20020a056a00181c00b0052abeeb020asi14563999pfa.19.2022.08.01.14.45.59; Mon, 01 Aug 2022 14:46:13 -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=MQvKPtV4; 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 S234722AbiHAVZI (ORCPT + 99 others); Mon, 1 Aug 2022 17:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235201AbiHAVYZ (ORCPT ); Mon, 1 Aug 2022 17:24:25 -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 7126847B9F for ; Mon, 1 Aug 2022 14:23:48 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id ay36-20020a05600c1e2400b003a4e30d7995so14638wmb.5 for ; Mon, 01 Aug 2022 14:23:48 -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=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=MQvKPtV4cPPEtqd/ru50OXpBq4jq0ulTt5NSEP09xq72xFaWr232eUefJriOb/A9bb xfvsOYLpwXf8xwGZq1jAlqow7Jkb1JiHLXFGgB38LUsRwyM7eVEJDvtL296RZXsNtTtX 1EyaL9B1CRTQuQyfXqO3bz5+jxJYC6rNbhQ1DlTKicMHjZzeisU9iqLanCVGBznNQfm3 wmKQKpxl4zWQA12Lhn9ezXFVgOoNbc5IUDLQMSJbRgO3N5exjcmd2/6qOYw+S54ORXQ6 kATUJxgOKU4Ox1pCLqpTOMNd/dR16uD9DhQWWzODtLvllXGDMkCSdRWGQQNsxesLTUq6 gHPw== 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=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=DgQypQ9qjGMQOldReZkzz7luiULJDuJ+Tw+NPSokZL65MQjTM7fp1rYXz0KlRGAM0m B8UF9Z2REh44WCDaolri7JfL+mPzVe+neQl64EAh0yHfimSjpllMEdzFFbky8iXK+5tZ 6fqVozof2pOrqI4A/OU8O2FATXpOjkL7o+Fq1bca39ehF5/QS3MeKKgvD9+02uckKs73 7vFDHaH3oNWKiO7Xm+MEFO8nNPRlVt86fGOlSKKgYUL0PYWlDTskTjWCtaT4nWyI0aaP qy+hWH1ScJ7ZKixbFFNh+KlOOtyrCVoN8Pu2JTuMop3tcUdVzw/WGetUgeMUCQTa1r7x EIjg== X-Gm-Message-State: AJIora/8sPA5851Ry4fOuiZwIpn37DFuff79EvyiPkZ6AuWB/RH3J3r0 KcH/DOczRM/MUzi0+mZMbP+qzg== X-Received: by 2002:a7b:ca47:0:b0:3a3:1874:648 with SMTP id m7-20020a7bca47000000b003a318740648mr11738181wml.139.1659389024629; Mon, 01 Aug 2022 14:23:44 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 14:23:44 -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, Amit Kucheria , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v4 16/32] thermal/drivers/imx: Switch to new of API Date: Mon, 1 Aug 2022 23:22:28 +0200 Message-Id: <20220801212244.1124867-17-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=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 --- drivers/thermal/imx8mm_thermal.c | 14 +++++++------- drivers/thermal/imx_sc_thermal.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c index af666bd9e8d4..e2c2673025a7 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -96,15 +96,15 @@ static int imx8mp_tmu_get_temp(void *data, int *temp) return 0; } -static int tmu_get_temp(void *data, int *temp) +static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tmu_sensor *sensor = data; + struct tmu_sensor *sensor = tz->devdata; struct imx8mm_tmu *tmu = sensor->priv; - return tmu->socdata->get_temp(data, temp); + return tmu->socdata->get_temp(sensor, temp); } -static struct thermal_zone_of_device_ops tmu_tz_ops = { +static const struct thermal_zone_device_ops tmu_tz_ops = { .get_temp = tmu_get_temp, }; @@ -165,9 +165,9 @@ static int imx8mm_tmu_probe(struct platform_device *pdev) for (i = 0; i < data->num_sensors; i++) { tmu->sensors[i].priv = tmu; tmu->sensors[i].tzd = - devm_thermal_zone_of_sensor_register(&pdev->dev, i, - &tmu->sensors[i], - &tmu_tz_ops); + devm_thermal_of_zone_register(&pdev->dev, i, + &tmu->sensors[i], + &tmu_tz_ops); if (IS_ERR(tmu->sensors[i].tzd)) { ret = PTR_ERR(tmu->sensors[i].tzd); dev_err(&pdev->dev, diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index 331a241eb0ef..10bfa6507eb4 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -43,11 +43,11 @@ struct imx_sc_msg_misc_get_temp { } data; } __packed __aligned(4); -static int imx_sc_thermal_get_temp(void *data, int *temp) +static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { struct imx_sc_msg_misc_get_temp msg; struct imx_sc_rpc_msg *hdr = &msg.hdr; - struct imx_sc_sensor *sensor = data; + struct imx_sc_sensor *sensor = tz->devdata; int ret; msg.data.req.resource_id = sensor->resource_id; @@ -70,7 +70,7 @@ static int imx_sc_thermal_get_temp(void *data, int *temp) return 0; } -static const struct thermal_zone_of_device_ops imx_sc_thermal_ops = { +static const struct thermal_zone_device_ops imx_sc_thermal_ops = { .get_temp = imx_sc_thermal_get_temp, }; @@ -109,10 +109,10 @@ static int imx_sc_thermal_probe(struct platform_device *pdev) break; } - sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->resource_id, - sensor, - &imx_sc_thermal_ops); + sensor->tzd = devm_thermal_of_zone_register(&pdev->dev, + sensor->resource_id, + sensor, + &imx_sc_thermal_ops); if (IS_ERR(sensor->tzd)) { dev_err(&pdev->dev, "failed to register thermal zone\n"); ret = PTR_ERR(sensor->tzd); -- 2.25.1