From patchwork Wed Jul 27 21:02:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 593975 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 468BCC19F21 for ; Wed, 27 Jul 2022 21:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234225AbiG0VDT (ORCPT ); Wed, 27 Jul 2022 17:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234028AbiG0VDN (ORCPT ); Wed, 27 Jul 2022 17:03:13 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98F8564F9 for ; Wed, 27 Jul 2022 14:03:11 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id q18so15655797wrx.8 for ; Wed, 27 Jul 2022 14:03:11 -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=bz/lScjS2r5eiJBmhXqz7XXESXnUSGQTobnQ+AXj6SVXsjgKUvdIxRIRgLWSqVDBRH 4H7OXypueV2yxW2VXw/wAPlApBRResMD2SlmrqgH9JdE/sb9nrHecPbeFpNwvRymaEXE VmGBKnQEhoqMfgPzELArqsWBadqMsXtnZUZ6/pMaQgYew/E9P6ptEiq9byMJ7+oJFNHU df4NqORwHPgTsjRv8pZIaehxAqxoMH/J29Q4cuZSfTKHN3NSzajJeh8QqjGX17tgX4Yz YN6GELTlN5uB6lItbmYrI+L/hnuulLyGSX0/o7t5KE4iHlGC0U8jzsSdBsz1lfNNcH6/ URMw== 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=wdquH1hWA4j//6rnqfyWGe3nV2ySl4tMt2HDDCG6SGn4Mxho4ws2o8Ik3n3GZfn/mE 0krCl/Gt4VYmH2eRNVcEj6UfSksZ46Ut8ThUFMfK5h1lXyuSh83qiO9hNQ2D3LhySwqG B6smPJwy6cvdZKOph9ov0B/Z28Icb0GhLXTM9KdA53fANG1GLcibyinfhnOgIAxgX814 bDbgQGihRX/OiCPCGbF+pk29IAhGqnrIw5pYf4b6p1lFRsyWQ10P6VeD6DyQrCAb0kz6 d13LP5Eje6W2VL0fPB1iWfFd1CN2tr2kD8BJqPCf1pXyK5WQQsZCK7fA3MRulG+1th8t HoWw== X-Gm-Message-State: AJIora/40tA/fJtNu8Btyu+Nu+C4Xtxx3MbE75dCPigXZAmyQyXKsZQh YFl/Rl2LRwKlH3mo8hAV2V1Vgw== X-Google-Smtp-Source: AGRyM1vZ2lRLRCtHktVcM48vdHmMcbzE87n3HFKflTsV0i8Ro7ZyuQKlnf4EAcxxZpYg/vhH41BWCg== X-Received: by 2002:a5d:5986:0:b0:21e:811c:f688 with SMTP id n6-20020a5d5986000000b0021e811cf688mr12538003wri.8.1658955790382; Wed, 27 Jul 2022 14:03:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 14:03:09 -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 v3 03/32] thermal/drivers/rockchip: Switch to new of API Date: Wed, 27 Jul 2022 23:02:24 +0200 Message-Id: <20220727210253.3794069-4-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/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",