From patchwork Mon Jul 25 21:26:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 594002 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 04EDFC43334 for ; Mon, 25 Jul 2022 21:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237068AbiGYV2Z (ORCPT ); Mon, 25 Jul 2022 17:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237216AbiGYV1q (ORCPT ); Mon, 25 Jul 2022 17:27:46 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37608248DF for ; Mon, 25 Jul 2022 14:27:29 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id d13so10055564wrn.10 for ; Mon, 25 Jul 2022 14:27:28 -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=Dxp2C7hOahM111jOQKxvW4vMPiwlgfAm7+eoRoP/H0c=; b=s0JsTCXNvt2WXkcPVxGiAIXsDZBIj5/AZesH2AAmCTyIEv16R//Vuw19MnW0bj3ZRG XuDTksIpw4MlrYs/cjNUee35Kgmoe3mzLas8SPOGTENfmGVbH62AekMDGcRqLfQfWx47 QHIJhEK+pvoQ3OsvU0bIKjNE0bSLJAMh1vWLYkZRZ1FM0BBm/fy51sDs8JmlHV2m1ZWk uGOZ46cC8LTcgJ2lt0ZmOzv5Is22R7LxCyO8G3Ly7NxpLMANhOBsRN4SMSvI3Ld25F+S /xlPKQnTOzN6Ag/mIT7OrSfged+na2T1jYMqAO/K8bndS3mUwyKaqU4VBTJR8Fqq3L01 eW7A== 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=Dxp2C7hOahM111jOQKxvW4vMPiwlgfAm7+eoRoP/H0c=; b=kzVcsmYB8i6y7IrdCvwfbimrKZWay0u159A5/6EOPRgFPEa71ctM0YTlgXm9bgs6jt aBubemzItRKq85ALzmIyTVOKhmUS5BcVvcRf3Bf3h1b2PKDFCkU02aGNTZivI5PH3wdP KpayAtOtFk3n6um71kWHgsrDQyQHT7uCPE50k/gfKTEyg6BN6gnS9j1zJLDvqGgTnHWj DlTz5kNmy9rYD8WhQJt/VoHNiEssOnZ2OLMubF2R+K3xkAuFTHs08FjWLHhGm7lNbHjO g8aTY45y2bu1KFIcs9/Gd3ECy8aK2AzkQyrUD6OAEjdBec1icycJRczmvzKDTmq9pJwJ bMpw== X-Gm-Message-State: AJIora8KJIzAWquYbS9/c1pZmHS6GJFI0VrtkJN3TjPc0agc5FD1zplQ WB3Y1+NpMjouI5mmGX7veNcKSQ== X-Google-Smtp-Source: AGRyM1tLUg/TxD3ibkRz8emLONGbMJ+9j8IhiFQVSF+CzEDj/RrI348CxZMU0187ugCaQfxFAjyrsQ== X-Received: by 2002:a05:6000:1a85:b0:21e:88f9:848d with SMTP id f5-20020a0560001a8500b0021e88f9848dmr4392788wry.82.1658784447240; Mon, 25 Jul 2022 14:27:27 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:26 -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 , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com (moderated list:ARM/STM32 ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:ARM/STM32 ARCHITECTURE) Subject: [PATCH v2 12/32] thermal/drivers/st: Switch to new of API Date: Mon, 25 Jul 2022 23:26:17 +0200 Message-Id: <20220725212637.2818207-13-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. Signed-off-by: Daniel Lezcano --- drivers/thermal/st/stm_thermal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 5fd3fb8912a6..e4ca0d504a4f 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -302,9 +302,9 @@ static int stm_disable_irq(struct stm_thermal_sensor *sensor) return 0; } -static int stm_thermal_set_trips(void *data, int low, int high) +static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct stm_thermal_sensor *sensor = data; + struct stm_thermal_sensor *sensor = tz->devdata; u32 itr1, th; int ret; @@ -350,9 +350,9 @@ static int stm_thermal_set_trips(void *data, int low, int high) } /* Callback to get temperature from HW */ -static int stm_thermal_get_temp(void *data, int *temp) +static int stm_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct stm_thermal_sensor *sensor = data; + struct stm_thermal_sensor *sensor = tz->devdata; u32 periods; int freqM, ret; @@ -474,7 +474,7 @@ static int stm_thermal_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, stm_thermal_suspend, stm_thermal_resume); -static const struct thermal_zone_of_device_ops stm_tz_ops = { +static const struct thermal_zone_device_ops stm_tz_ops = { .get_temp = stm_thermal_get_temp, .set_trips = stm_thermal_set_trips, }; @@ -539,9 +539,9 @@ static int stm_thermal_probe(struct platform_device *pdev) return ret; } - sensor->th_dev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, - sensor, - &stm_tz_ops); + sensor->th_dev = devm_thermal_of_zone_register(&pdev->dev, 0, + sensor, + &stm_tz_ops); if (IS_ERR(sensor->th_dev)) { dev_err(&pdev->dev, "%s: thermal zone sensor registering KO\n",