From mboxrd@z Thu Jan 1 00:00:00 1970 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 84EE0C32789 for ; Tue, 23 Aug 2022 16:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244699AbiHWQWB (ORCPT ); Tue, 23 Aug 2022 12:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244650AbiHWQV2 (ORCPT ); Tue, 23 Aug 2022 12:21:28 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 218539F0D0 for ; Tue, 23 Aug 2022 05:42:57 -0700 (PDT) Date: Tue, 23 Aug 2022 12:42:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1661258575; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hmVYqvk1DiXsHmOw6KdLntGgsCxY/sKdybSDkVswBv8=; b=VOEUxMxF2lLxpLp/jsLGOT+EI/AHb7/9iE5oTGeRO/q4F0WbNeAKwkl6IEAWu3y+1Uc7NH Izu4Bmxt1b0y7n0BsKuAchovvSc22j1l173dTxjUbi6HINPt0xTJ7XYBuaJD4obG+Sf2mI 38HbBdP18WXIPBsAAqUdcsHSVn3IdUhbipxn1Wqgw7umUzcI+zJvYQLdy564nlXuQmhvNS ef52B0QnbXqswPQlfY4wLKKtAvMUMgB2BHmPQ1kvTsdqwvaeVUNejO6JdCAoY599b7Jrl8 TlF/4xy8461BXbRG/iDxp++UHYGg2N8PgBxbqqZYwMa0zCe3iB6f5kVhN0Rmag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1661258575; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hmVYqvk1DiXsHmOw6KdLntGgsCxY/sKdybSDkVswBv8=; b=wfUmXpRHjbrRMK2I6/D052Rk0wR6KowRGyF1ISSX11OfC543Dm0L2xJ+2n8i4Mv2MCJr3Q ktdc8vlIR/QO6gAQ== From: "thermal-bot for Daniel Lezcano" Sender: tip-bot2@linutronix.de Reply-to: linux-pm@vger.kernel.org To: linux-pm@vger.kernel.org Subject: [thermal: thermal/next] ata/drivers/ahci_imx: Switch to new of thermal API Cc: Daniel Lezcano , Damien Le Moal , Daniel Lezcano , rui.zhang@intel.com, amitk@kernel.org In-Reply-To: <20220804224349.1926752-26-daniel.lezcano@linexp.org> References: <20220804224349.1926752-26-daniel.lezcano@linexp.org> MIME-Version: 1.0 Message-ID: <166125857454.401.4884063712283635116.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The following commit has been merged into the thermal/next branch of thermal: Commit-ID: f1d8b5042ecf9e99294109bb5a1566f6a2039c89 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//f1d8b5042ecf9e99294109bb5a1566f6a2039c89 Author: Daniel Lezcano AuthorDate: Fri, 05 Aug 2022 00:43:41 +02:00 Committer: Daniel Lezcano CommitterDate: Wed, 17 Aug 2022 14:09:38 +02:00 ata/drivers/ahci_imx: Switch to new of thermal API 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 Acked-by: Damien Le Moal Link: https://lore.kernel.org/r/20220804224349.1926752-26-daniel.lezcano@linexp.org 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 79aa9f2..b734e06 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)); }