Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2191311imn; Mon, 1 Aug 2022 14:46:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tm/w9aGQJj7NIM+QUv5t0cBz8mW7xpZiqNAUSjISoN9JRw2e517qcGDxXB84z+xuWttk7x X-Received: by 2002:a63:f304:0:b0:41a:9bcd:88a8 with SMTP id l4-20020a63f304000000b0041a9bcd88a8mr14189655pgh.520.1659390391200; Mon, 01 Aug 2022 14:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659390391; cv=none; d=google.com; s=arc-20160816; b=T3pI73cOX5hAMTGtoayuOnonOglwK4YUoNrieSXHX1Ef4MjKK2sBwvKM0JQ8yAhxa7 n1Mce1TRqBJxe7Eob5wVnorqP1nJHLNbsY8slmjzESbYPelnwSPKVYT7wHKYRC7NA61O F70TGuogGfbldSVZwKmxQaPf0VG2Bm8qoKMw16IFTuddaHtzBATO9Q5jgymgTv311Vwc zs5s2nWP6T9+NKERsSiX5dhZ1UgUUQKQAtqNlypsmJcOXKAZH2XriWJ1IP2js6ny1meg xTPInyxMSJ3vm/1i66pTqrcXWgeH98zEdPqAVD6W5LzXlb/2f4MIvP4KAhOZFJGYMdPL YYKQ== 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=Y+8gnJ68hJod6uvQUR4L1wvFSKnRgzdO4yxaDxG616M=; b=yOAbTCDNvmQprViVz6mR4PaUYLJSiqT+prYyN81LAUn8/m1kWjdvGTXNcQYbuDUmBV ++oJsg090655bWJrrHRl39eCcT3/M6YkLRo+32Yye7kI1dZBn4p+oFJBGNjMHRTwERNU 0s7KYtX2VPMOFVDlmzmSMGixmmvF9XNGGVfUcf9D4rpShZyO7Fsv/ATKP7dQuMJrxkSP B3TNt7IV4qmQaBRGswDi13h/TpxL+j3Sj+Zz9+LGvJbGxSyn9jsDq8qhPlJC/kNK5ObB vkkL6sMSwX8eIkemGVU5LfvDubPDGIAJOTFRgB6kvl8dqsARgBJN46oFmaCRQCkLCv0F ehPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=NBHfTUiQ; 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 v71-20020a63894a000000b0041c2f89c052si3274571pgd.438.2022.08.01.14.46.16; Mon, 01 Aug 2022 14:46:31 -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=NBHfTUiQ; 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 S229787AbiHAV0H (ORCPT + 99 others); Mon, 1 Aug 2022 17:26:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235085AbiHAVY7 (ORCPT ); Mon, 1 Aug 2022 17:24:59 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7818647BA6 for ; Mon, 1 Aug 2022 14:24:04 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id j7so15612044wrh.3 for ; Mon, 01 Aug 2022 14:24:04 -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=Y+8gnJ68hJod6uvQUR4L1wvFSKnRgzdO4yxaDxG616M=; b=NBHfTUiQ4g3pInNgtGa6G+ZzcWU2vJeUc9ioYtj8Zb2LMyDSXbT6NExwerc573eAAv rX6veJRX3zBYYgajn2kLXYMe5hVUyvvKRnpccYvYlWZmvgmDesMaZhTDERcCtV4pUY4i 2ee6jzKv+E6p72MB/g5umhdvq36XAutBV9UY6fGdDnwb/lLoZBjGCi4NUFx8ZMLkf716 VM6PlkvqWkExrqrX6iEcDVlDRGJyEYyTu4TQqk64NKXmWkhZ9SHFxFYM72EjhHLQF5tI iov5GDdVBgOeL6+XZf4tNOtflC5twMQXWr3IkjDT5CfFl+JUIVkqN0wS0cVqhrBqoiVy qAiA== 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=Y+8gnJ68hJod6uvQUR4L1wvFSKnRgzdO4yxaDxG616M=; b=quz99crdmlBwobw4HxzpyMz3ObdP3bsqGfNUPt9bLuktH24zVZUJ0++lNrf5LWtqGx GT1yKHYUaUTtp60x/LWVQO/LL8/r/HaROno6j/GODk9LP0fhzjD+xC/D0awJ4OyZQ8kn szAFaqEq/rFi9uzOgcTBEaTL+0C2iRPnCy/VKOEyS1kk3VCjAh0PVQQSLr11a12U3ed2 Yy+L7y6JMSsYUSAahPSq7X4Q7m3brKp2Y52c62r4WEcipXBB8mPBCP+unKzeq8+qomBy Q2dy7iWFNUOV78FxFurTaeQHBu7hdo30gWjJaTxv/OXLql4OvgWYbb4hXn1EAs9va3op sRmw== X-Gm-Message-State: ACgBeo3vzLA12w1BQ2G39EqpL+dAp4RZrE9d8I5HrzC0hflcCvyCTQi9 j//yUHXQRUzcprsuzoAgzOjW0g== X-Received: by 2002:a05:6000:1447:b0:21d:b22b:e5d with SMTP id v7-20020a056000144700b0021db22b0e5dmr10663693wrx.189.1659389043799; Mon, 01 Aug 2022 14:24:03 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 14:24:03 -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 v4 25/32] ata/drivers/ahci_imx: Switch to new of thermal API Date: Mon, 1 Aug 2022 23:22:37 +0200 Message-Id: <20220801212244.1124867-26-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. 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 --- 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)); } -- 2.25.1