From patchwork Mon Jul 25 21:26:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 594005 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 803D1C43334 for ; Mon, 25 Jul 2022 21:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237333AbiGYV11 (ORCPT ); Mon, 25 Jul 2022 17:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237307AbiGYV1I (ORCPT ); Mon, 25 Jul 2022 17:27:08 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27CB0248C7 for ; Mon, 25 Jul 2022 14:27:05 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id b26so17729280wrc.2 for ; Mon, 25 Jul 2022 14:27:05 -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=0qNXTGFtlOgyRJms2wUe/LQRkw+99ki5ct4br/6n4uE=; b=XdQdxFqdCPRzQjqkYI9DJuVc0edMPZ6KXjrhfZq41nvJ1DD5Stjy5OW6vWLvh5lem0 OmuFjP2dNETxSp5XVdR0mZYgdmGnedKJ5udZOLSEEPfujrHhogtWIVkUdBhHsruxwKtz 803ilMtRg+QvItwk9rfhwDnMWBSjGZaqh/CjQDfNfuFEjqDUTK8cHunW2MMHU8fAVZQK AvBEfKfnxziiPWZrb+9jb2DjZJjZBRi9mpSx/RcjUUnbR0/sdQ/s5hTCjlI1LHi54RrL w/dqG9YFPMFvyuDgvZkRLM2zl6o3xCGgvpWeRvb3Qrronq7LKdiJn4nAYcdC6I0etC/R 0rig== 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=0qNXTGFtlOgyRJms2wUe/LQRkw+99ki5ct4br/6n4uE=; b=YZfQu1Us0U2HqKkdM+ItHEIm4nYi2U52SHDbEg6BXJXoLoQf0StGHxqNpg1g6OX0t2 TbWIWxIoBDFNIZ/COYuN8ZFGsegqHIBLp6csNV0TwmGP0ur+2Q+JkUGo6E+ZXQP8n4Zr r/bIum8UHEARvb21JZlnnJ/XYXsPsPn9EOZAemY60Co1KD27HaIKxkRTttLd6tvYfunt pDrmvuWVvLWSmW5phznwH9oKfs+kE0JZ3ZjXoZ5hxQYfQpfRHHI2ommmGm9YSyDG9c2O dSCDt6lsDIf2jNpJfHgqnm0Oj2YQSmHpfb05BccijkEiKQ7wqHEWR221L+pDeP5QfLja Fbjg== X-Gm-Message-State: AJIora8OnSf/D0AL6+7itENQ5OPsmGrg6eqhFaouGW9Ndu3sPSL68kLc kXuPEDW1VwQ6xO2PLhfhkdIQ6Q== X-Google-Smtp-Source: AGRyM1sLUT0joL0hR1OfWCgGnX88VgtKmYJJhqTtx7xvxYTVrSdiXGRDwqWfdapBTU9hc2NeKn4Qkg== X-Received: by 2002:adf:ce0c:0:b0:21d:929e:1522 with SMTP id p12-20020adfce0c000000b0021d929e1522mr8332671wrn.126.1658784423697; Mon, 25 Jul 2022 14:27:03 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:03 -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 Subject: [PATCH v2 06/32] thermal/drivers/mmio: Switch to new of API Date: Mon, 25 Jul 2022 23:26:11 +0200 Message-Id: <20220725212637.2818207-7-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/thermal_mmio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c index 360b0dfdc3b0..1bf1a16533da 100644 --- a/drivers/thermal/thermal_mmio.c +++ b/drivers/thermal/thermal_mmio.c @@ -20,11 +20,10 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base) return readb(mmio_base); } -static int thermal_mmio_get_temperature(void *private, int *temp) +static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, int *temp) { int t; - struct thermal_mmio *sensor = - (struct thermal_mmio *)private; + struct thermal_mmio *sensor = tz->devdata; t = sensor->read_mmio(sensor->mmio_base) & sensor->mask; t *= sensor->factor; @@ -34,7 +33,7 @@ static int thermal_mmio_get_temperature(void *private, int *temp) return 0; } -static const struct thermal_zone_of_device_ops thermal_mmio_ops = { +static const struct thermal_zone_device_ops thermal_mmio_ops = { .get_temp = thermal_mmio_get_temperature, }; @@ -68,10 +67,10 @@ static int thermal_mmio_probe(struct platform_device *pdev) } } - thermal_zone = devm_thermal_zone_of_sensor_register(&pdev->dev, - 0, - sensor, - &thermal_mmio_ops); + thermal_zone = devm_thermal_of_zone_register(&pdev->dev, + 0, + sensor, + &thermal_mmio_ops); if (IS_ERR(thermal_zone)) { dev_err(&pdev->dev, "failed to register sensor (%ld)\n", @@ -79,7 +78,7 @@ static int thermal_mmio_probe(struct platform_device *pdev) return PTR_ERR(thermal_zone); } - thermal_mmio_get_temperature(sensor, &temperature); + thermal_mmio_get_temperature(thermal_zone, &temperature); dev_info(&pdev->dev, "thermal mmio sensor %s registered, current temperature: %d\n", pdev->name, temperature);