From patchwork Wed Jul 27 21:02: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: 593972 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 C7D92C19F21 for ; Wed, 27 Jul 2022 21:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234722AbiG0VDl (ORCPT ); Wed, 27 Jul 2022 17:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234184AbiG0VDd (ORCPT ); Wed, 27 Jul 2022 17:03:33 -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 3D56856B80 for ; Wed, 27 Jul 2022 14:03:30 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id h8so26063109wrw.1 for ; Wed, 27 Jul 2022 14:03:30 -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=3rC2SEgtKSVYrTT7ru1qnZcNbf0y/uFQwB+BT2UAJtk=; b=p63s96nLXYTWShwkb3HveYC0wkd/lEVcTmY2Q5o4FA4IK0014u0g5vrlXI6K6w2lVE hIIHPXMoQYIuBWWGCApeJ7mz3m0XWMohh+0JDjVs9B9zrUW4/Y3U8ZOBAuvAhequS5l6 FbkluvrI9BRS1pmsot1hIl6eMEOyGiS4gwt9SAE77zaIb69fvcIPjOE+PpEWuf95XT1S ObtHpbpF1H352sTctBt3q+iVuyOzArfvsq4dw5oYWVuCTvTs+Qa2VvsatLqQekDSIR8S lyTLo5N1gVcLhc24OHoUGkGhANMKGTlHK5/EsikQnzvmgXxMO1aPfBcZb2SvFSHv02Tp Bubw== 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=3rC2SEgtKSVYrTT7ru1qnZcNbf0y/uFQwB+BT2UAJtk=; b=CAULpsiKfA0NRNFcMvTNo0p9hC0Z5cv/P0k166aSmruNSHucfDmSaihqg5rZmhWN9w 8NjHmL3bLOD9M1yFZhNZw+f8dwYCPf2mA4gSisD/LEIyB00DLDBVS07kT9Y8XDwmSk4O uF9O6/yJRqKbKjom/gV6c9E9TelV5KK2zkGG/MvUaU/+8dDdOBeiNlSjmlUMcnC0nnwE nRxtSMj6ebL39NWDs4WW5FfJmydlu+3zZqQmDbYSp+wMq1nYKjju2Dyy7aWW7Ayf9hXZ pwdiOT6b+xvduYS9caQMGnSaZcmCn28x6GAERsYOHOJChZg/eTda09+2OCunoe81dp5f O4ow== X-Gm-Message-State: AJIora9gAUbDKf+yGPI+YNhAJCwv3quifVx5jLL1vSei8QCtGrBNeojm e8ygkIT+EC97KY9uOiE7EeyOfw== X-Google-Smtp-Source: AGRyM1vQb9Z86kPxNJ7n+LQMTHrUrGuInE6ax98pWLxqN9sI/+rRfh27NczTMyZzSKOSKsPjmCwl4A== X-Received: by 2002:adf:ce0c:0:b0:21d:929e:1522 with SMTP id p12-20020adfce0c000000b0021d929e1522mr14544199wrn.126.1658955808783; Wed, 27 Jul 2022 14:03:28 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:65a8:ebd8:4098:d9d0]) by smtp.gmail.com with ESMTPSA id h6-20020a05600c350600b003a38606385esm37908wmq.3.2022.07.27.14.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 14:03:28 -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 , Orson Zhai , Chunyan Zhang Subject: [PATCH v3 09/32] thermal/drivers/sprd: Switch to new of API Date: Wed, 27 Jul 2022 23:02:30 +0200 Message-Id: <20220727210253.3794069-10-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220727210253.3794069-1-daniel.lezcano@linexp.org> References: <20220727210253.3794069-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/sprd_thermal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index fff80fc18002..ac884514f116 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -204,9 +204,9 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen) return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); } -static int sprd_thm_read_temp(void *devdata, int *temp) +static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) { - struct sprd_thermal_sensor *sen = devdata; + struct sprd_thermal_sensor *sen = tz->devdata; u32 data; data = readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & @@ -217,7 +217,7 @@ static int sprd_thm_read_temp(void *devdata, int *temp) return 0; } -static const struct thermal_zone_of_device_ops sprd_thm_ops = { +static const struct thermal_zone_device_ops sprd_thm_ops = { .get_temp = sprd_thm_read_temp, }; @@ -408,10 +408,10 @@ static int sprd_thm_probe(struct platform_device *pdev) sprd_thm_sensor_init(thm, sen); - sen->tzd = devm_thermal_zone_of_sensor_register(sen->dev, - sen->id, - sen, - &sprd_thm_ops); + sen->tzd = devm_thermal_of_zone_register(sen->dev, + sen->id, + sen, + &sprd_thm_ops); if (IS_ERR(sen->tzd)) { dev_err(&pdev->dev, "register thermal zone failed %d\n", sen->id); @@ -523,8 +523,8 @@ static int sprd_thm_remove(struct platform_device *pdev) for (i = 0; i < thm->nr_sensors; i++) { sprd_thm_toggle_sensor(thm->sensor[i], false); - devm_thermal_zone_of_sensor_unregister(&pdev->dev, - thm->sensor[i]->tzd); + devm_thermal_of_zone_unregister(&pdev->dev, + thm->sensor[i]->tzd); } clk_disable_unprepare(thm->clk);