From patchwork Mon Jul 25 21:26:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 593996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E92ACC43334 for ; Mon, 25 Jul 2022 21:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236574AbiGYV3Y (ORCPT ); Mon, 25 Jul 2022 17:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbiGYV2w (ORCPT ); Mon, 25 Jul 2022 17:28:52 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0AC252B3 for ; Mon, 25 Jul 2022 14:27:55 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id d8so17622479wrp.6 for ; Mon, 25 Jul 2022 14:27:55 -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=GCM3yQVLWF86sbYiyvudiotSwDPj8nChQ6qnbaMqhHs=; b=vDf+UJQ90Y1OWcD9jAnPyUDj6PkXAIzUZs8Stl2T8Wwp2Ny/rUiqSVophvD3G96yuQ lESLHGbb59gI+rUi0Hcjr6568aF+hmWk0pf4X7Ix7akWPPeBUYA/2MoqKJ8BPp9tHw/c n/u7RiY1/D7LNPLFE07I49c5y1wM6T5stX3lsJAM54XHJ73/SS6PoNp7Do2wrqbjKfcJ Af04ZoPkKxUoECcmKBsZpL4vMk9H3L2qnaiG2l4o5MepqTlXXhnZ2s4eOWJpUp/zYETY ke945GH7Dk3mEnAD/zhFbqCnIJzUWsPLq9gsZJw2I+YA8eHItz2G43rEI/AIxfsdVwnm PZyA== 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=GCM3yQVLWF86sbYiyvudiotSwDPj8nChQ6qnbaMqhHs=; b=QuFlmB3uhaXGLXlZCsd6RfrbEi51VjyT1xvjr1AJQYJBAr1y2vqBHuCF9+dddXTo/6 Ei0s++Ge1btFKTm6JVLm6VVi2HMmta1XClK4sjOk+gUabRbzVHqOGFCG/fqHCwkzXcvM ffrcL459Wgqhmm3AXa8iMxxE4eVdrUKNqBN9J1Wg2PryoN4hC8wVlzABQlbTfiCKXRcv 06NbLqD+ElcUb7/o2x85JipMZnoJAt/QEEV0hSWvxX6ElF650JTdrbcWLiOIsdRcsWW/ eagv7NbReCH1x3wTvMCgOyCGfozyjJKjrXTB4KgSSSczKuiZGopI//vgzxUBaBxw5nX9 oBHQ== X-Gm-Message-State: AJIora+i/YxPQ6o2/Q4rZFcLBpLVhF9cX150gtM4lh0u+tuVX9vNp/87 gZjRVORwHuyq4JOrdxCQAGNY3g== X-Google-Smtp-Source: AGRyM1uxSmqjc+KicVfEox4C6+Jx/zNXBWMGNOe4hpzsYpYRTzP2OOFmX4pTibti8j4IRFLYXUoFzA== X-Received: by 2002:a05:6000:2ab:b0:21e:2e68:52f4 with SMTP id l11-20020a05600002ab00b0021e2e6852f4mr8435661wry.236.1658784475211; Mon, 25 Jul 2022 14:27:55 -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.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:54 -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, Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v2 25/32] ata/drivers/ahci_imx: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:30 +0200 Message-Id: <20220725212637.2818207-26-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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. sata_ahci_read_temperature() is used by sata_ahci_show_temp() also. So in order to change the function prototype for the get_temp ops which does not take a void* but a thermal_zone_device* structure, this function wraps the call. Signed-off-by: Daniel Lezcano --- drivers/ata/ahci_imx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 79aa9f285312..b734e069034d 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio) } /* SATA AHCI temperature monitor */ -static int sata_ahci_read_temperature(void *dev, int *temp) +static int __sata_ahci_read_temperature(void *dev, int *temp) { u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum; u32 str1, str2, str3, str4; @@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *temp) return 0; } +static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp) +{ + return __sata_ahci_read_temperature(tz->devdata, temp); +} + static ssize_t sata_ahci_show_temp(struct device *dev, struct device_attribute *da, char *buf) @@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev, unsigned int temp = 0; int err; - err = sata_ahci_read_temperature(dev, &temp); + err = __sata_ahci_read_temperature(dev, &temp); if (err < 0) return err; return sprintf(buf, "%u\n", temp); } -static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = { +static const struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = { .get_temp = sata_ahci_read_temperature, }; @@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pdev) ret = PTR_ERR(hwmon_dev); goto disable_clk; } - devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, - &fsl_sata_ahci_of_thermal_ops); + devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev, + &fsl_sata_ahci_of_thermal_ops); dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev)); }