From patchwork Wed Jul 27 21:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 594291 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 4D97BC19F21 for ; Wed, 27 Jul 2022 21:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiG0VDa (ORCPT ); Wed, 27 Jul 2022 17:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234159AbiG0VDT (ORCPT ); Wed, 27 Jul 2022 17:03:19 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E04E564F9 for ; Wed, 27 Jul 2022 14:03:18 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id bn9so15197681wrb.9 for ; Wed, 27 Jul 2022 14:03:18 -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=QPHAvvQkj70Y803XO/PVmLOMcqwmSt5eOVTiGxW2Qx92bhC5Cph0f5iuO3Z6NUdnBl HrayMHWWgdq6NDxPwLIkgAN5g0Fuj0BAFFevscZ3priNoJMtSzHLpt0zpRrUB6NY6F2E IAWrrL89tl1w8JNQADd1CHG8sY+r92EVszvnuiUCxO77ctb2bdS7w3YGK0Vt8EZh7kQI idVkJO8bZMNX25FwECOR1cE+/1UWl19L3ZXVlhFGe46nAIqGhx+/fL4m/qEpWS8Pfff4 APBruzthgSN+cVpzRUZLSdIDIpk9qXXuMQwJCTCsYn5OsBoazXC1AemMB9a3Tfc/UK9F q92w== 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=pvbVHfPQm9IFuWtMzE++y4FFAGdZfaW9gCAmDvPCyd0s6klw0tbjxP4nWfdB4d1cs7 l2gsp3Kpl/PKhsyAey4STUHS6/Gcjft2FU/86AvDZWdS9KWUJppdeNssuK5lj3pUnOKL fGm2xN/ex558bhp1vO90UfuOnkjwZCSsVThwBgaKzwovVESvFXed9hnUsPLZGCQVr5Ph IwSig3UbLLTEqItGAsA+G42HwJPaHKkmlSOBQ61Xry+h2ULDpV6xB1lK9zeTkoGYsevE mXdYrBxnxxjs49TaCoFD5hALIQD+wo7jTROUv3nEg2NSbSajGmm/XO/qJEn7EHRIvXrx XJzA== X-Gm-Message-State: AJIora8/dXDN5xJhBsTquD6NPqBk/oKeug14yv7BSsD6Ng6lsRnoqcl6 DDHhp5j+I1lXS9vlxaUgXZL3SA== X-Google-Smtp-Source: AGRyM1u62p/rY229sA+4Ohz9Ha2FoxypBBltUN5/AlW8l3lQClXZB3VbR6iNS2o8SjNZ5nd9VhwX/w== X-Received: by 2002:adf:f90c:0:b0:21e:5293:4390 with SMTP id b12-20020adff90c000000b0021e52934390mr15255954wrr.167.1658955797002; Wed, 27 Jul 2022 14:03:17 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 14:03:16 -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 v3 06/32] thermal/drivers/mmio: Switch to new of API Date: Wed, 27 Jul 2022 23:02:27 +0200 Message-Id: <20220727210253.3794069-7-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/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);