Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1055063rwb; Thu, 4 Aug 2022 16:27:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xdlk92cL7vSGRlFbR/HFM7NaLbvsMDhMMBB5XsNvOAIBq3WjmJrusvqpZ5ZqJonT1peIy X-Received: by 2002:a17:90b:1241:b0:1f3:1d9f:a933 with SMTP id gx1-20020a17090b124100b001f31d9fa933mr4347581pjb.221.1659655647726; Thu, 04 Aug 2022 16:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659655647; cv=none; d=google.com; s=arc-20160816; b=AjjRBe21Sryx5xNZPH8VszVe26eKL6fWKWGd2Pj+TRxrcFTY5BeFw4b0xcpFc6rkJp VGEJktsf8Fnrcu9LE3cDHBmQ8B44lZr1wJVlWkNIsULTvO+eXCl0RsRzHNx4zYs4aEl0 O5/oxMNqf90bjqT9dnA447q2qGxM9jT/GII86O0IBz+ekD5V52EM6bPBxlAyzEpPaPf/ IAPFFEdS7HmKb8jVuTgG0wNu1c06Rq3Te4IGRuQTgdwXlynTrfEX4kQe4uow+mBBph4b O3nmPVm5kmI4VmlN36zOQr8ADEXYvs54RwgFkD6ZjRe5gnzkaklOznOZQ239oA57ladT acYg== 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=KIBExQLcyBG/GJnnQKrNb2qKYHW9y3ajqju8i+zzRow45LTqaXIInTkWheJXW2GZP7 P9r2o6C9PBOWSaguwtG5Y+Z+hZ1i+nakPo0jYjbwjvegRc+X6qImp5AUtbpa480gCwVt W2dB9LolYsCMgVnSejP47kfOxTCEALwahdxKG6CHl1V82Ixq3Bd9/GVaw2hW6DCzktOY vwMUmY42j/zO8WmrDspkJxrN5a67GyzZh8YRtnpDHIcMw9GvpmHvSNUx+CAw6QBKEDD8 Nzb7Xc+ISwsjuFxGwwCIarq4t2Uc6xtM9JgGKm3tFQFqr7/HvlJSB90xJi8r7aDAmTJN 6Rjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=dfd1RDzS; 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 m22-20020a17090b069600b001f21b7411f8si5516049pjz.108.2022.08.04.16.27.13; Thu, 04 Aug 2022 16:27: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=dfd1RDzS; 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 S240291AbiHDWzB (ORCPT + 99 others); Thu, 4 Aug 2022 18:55:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240256AbiHDWyE (ORCPT ); Thu, 4 Aug 2022 18:54:04 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05AD71714 for ; Thu, 4 Aug 2022 15:52:56 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id j7so1373142wrh.3 for ; Thu, 04 Aug 2022 15:52:56 -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=dfd1RDzSjLjHExV+EaGPHEXW2HbH1qMEV5PNCZClRbql6yUUuCwFoQgJcS/SRTVrVN h7B2rJDg2Gy3V9EADURhz914xMJYqf4diGNP1Q5DQ0vsoVkiChDVBhu2pYeJ16+0Ew2r W+hhliRFKa9YT0AyAgqsFVeojh4oBpPHcyiiIcRdVa4uMhpT5rjKeeR6P/DStWG2fyio O8xedJQJzpnryKXIRo+azAVUH5qRcAJ4vqsZswN3RdCvQDulevNaAxQTQ6lzaRxlhbc8 cvpCDIV9+6Jq9Dnh3E6KQLox6nn/KQMzCUPZKpC/lExk8aVzf8EVzGia+jmvGsHCFTYx AhxA== 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=jbv/RxiM26H/c9ng3aV6KUCNTDi6WhmgetvjI6jsBtjdEpP1S+QbHZbgydenRgsc2d H1rfXQqJUpyIBQhEGs4qoQJXDGZ5MHVJQt7Xrk7KVU3mTjBFNbTyxM8HRY0PZ8W+MTvY b91bmkhbKFSBjV0pW3pSarqjsu4spbW5f1B6xVMD0XVB7TdFNR2yfJB6PXRkfAcdhy1M dyJTia3b+uI8eo2l230fjvaMxji9s0mE6o35Ixvg9twXO36GJmWgdwiEDsCmzldYGpkZ oFl+ZlSqCxSsqTiuAnfm0Ppoj4yiSgSIgM4TgE8Le8cHMBVAWK9KQLImhW2Kg+Pl0nME GfsA== X-Gm-Message-State: ACgBeo2euz39NSG6TD5NEdmq8QB6zEWHh1E0ro9mFQmeWIBfsMLcs2C6 qXF+ntBUiGC92Ti6vhCGMuZLVg== X-Received: by 2002:adf:fe0d:0:b0:220:5f88:ebef with SMTP id n13-20020adffe0d000000b002205f88ebefmr2462048wrr.349.1659653574611; Thu, 04 Aug 2022 15:52:54 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52: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 v5 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:41 +0200 Message-Id: <20220804224349.1926752-26-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-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. 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