From patchwork Mon Jul 25 21:26:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 593410 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 EC21ECCA48D for ; Mon, 25 Jul 2022 21:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236799AbiGYV1D (ORCPT ); Mon, 25 Jul 2022 17:27:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237272AbiGYV1B (ORCPT ); Mon, 25 Jul 2022 17:27:01 -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 B510D240BF for ; Mon, 25 Jul 2022 14:26:58 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id z13so17705691wro.13 for ; Mon, 25 Jul 2022 14:26:58 -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=bjRNYXxMr1okCGj2grS3n0YP83rNlXVFleMjal7EwMQ=; b=OIuAB0R9S3R0tuYdjIBG57LQF+mePnOC043+5qSLc1ib/ai4upOfIOdf9MDbpdnNAY 69xcbFujx7clZjtfBx2AUniExqL68WETLo/ro5plYDHF2dm2jcHUCA28R+s5M7sEHYzm qK/QpGx9jxJ5xqBF3xC1QgPtx5U2luys/7100ia1pEVzJFeylfZShNIXVqkEwDKjrkGy 1HAml7bDM5OgPBk4jhKEBRnvThszfIQF2aSegtuyuZ/o8J0brue7cCq9gmoCwjOawwdD zgUCWqGAW4VLdmBLEAJjBI3zC5s5biq0FFb5WW8ngU1liX7hVifrFJkKSJ5/onXXmBvX QHJg== 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=bjRNYXxMr1okCGj2grS3n0YP83rNlXVFleMjal7EwMQ=; b=rNwcuxie8qwsBt75iClq90ZGoFE35lyYXME0Kn4z/ueW8LR8y2UHHAtMDo0F9LGUMr skh9lLJDt+daJdxl9GHNhfOGr4uk7MbM3MEdcRCTkjo7BNmQirGeBSTzF7oyh/KZH6xN eSS5vzyJ2Lmf9D0MGpZGKMFrDxtOgD0C5ElSer9MFmdenwXrxJHO7FZf2Jp0IUBKfqfK Ksz5S2mMio6RZHQpKnj8wSYn8OXc0SSaHpZWZblQjzMjWC4JW/0YJslwGnEa31aF8Onn a2swEAT7GUZdtIYj1uMo90qXewLrgakAN3J+CidKR89N3oumNFOaf8QunqcwQ31b4KRW z4GQ== X-Gm-Message-State: AJIora9GC4K86ge8fBY4FA1Z7ff+J1bL3/jhdGgtLnGwNEFhBikSDk3X 2aLrB3N5DC+V/br1kYFI5iOGvQ== X-Google-Smtp-Source: AGRyM1sGJg6voMCj36V47GPyX5uHOVj+RQfDFEEN855bo6t/AOnZ4PIQMt6CH6kefeVtmha+prt3zA== X-Received: by 2002:a5d:514e:0:b0:21e:4fe8:cbb2 with SMTP id u14-20020a5d514e000000b0021e4fe8cbb2mr8557499wrt.162.1658784417139; Mon, 25 Jul 2022 14:26:57 -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.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:26:56 -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 , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v2 03/32] thermal/drivers/rockchip: Switch to new of API Date: Mon, 25 Jul 2022 23:26:08 +0200 Message-Id: <20220725212637.2818207-4-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/rockchip_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index dc3a9c276a09..819e059cde71 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1211,9 +1211,9 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev) return IRQ_HANDLED; } -static int rockchip_thermal_set_trips(void *_sensor, int low, int high) +static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct rockchip_thermal_sensor *sensor = _sensor; + struct rockchip_thermal_sensor *sensor = tz->devdata; struct rockchip_thermal_data *thermal = sensor->thermal; const struct rockchip_tsadc_chip *tsadc = thermal->chip; @@ -1224,9 +1224,9 @@ static int rockchip_thermal_set_trips(void *_sensor, int low, int high) sensor->id, thermal->regs, high); } -static int rockchip_thermal_get_temp(void *_sensor, int *out_temp) +static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct rockchip_thermal_sensor *sensor = _sensor; + struct rockchip_thermal_sensor *sensor = tz->devdata; struct rockchip_thermal_data *thermal = sensor->thermal; const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; int retval; @@ -1239,7 +1239,7 @@ static int rockchip_thermal_get_temp(void *_sensor, int *out_temp) return retval; } -static const struct thermal_zone_of_device_ops rockchip_of_thermal_ops = { +static const struct thermal_zone_device_ops rockchip_of_thermal_ops = { .get_temp = rockchip_thermal_get_temp, .set_trips = rockchip_thermal_set_trips, }; @@ -1326,8 +1326,8 @@ rockchip_thermal_register_sensor(struct platform_device *pdev, sensor->thermal = thermal; sensor->id = id; - sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, id, - sensor, &rockchip_of_thermal_ops); + sensor->tzd = devm_thermal_of_zone_register(&pdev->dev, id, sensor, + &rockchip_of_thermal_ops); if (IS_ERR(sensor->tzd)) { error = PTR_ERR(sensor->tzd); dev_err(&pdev->dev, "failed to register sensor %d: %d\n",