Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1081785rwb; Thu, 4 Aug 2022 17:03:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5VLRBH6MMad8D/1JtQI4BCfwTfAO8Ciyh19Z56tLaX7SNyB4nfmsvkYliOIMBDAi7ArH0C X-Received: by 2002:a17:902:f641:b0:16d:351d:c1ea with SMTP id m1-20020a170902f64100b0016d351dc1eamr4011672plg.174.1659657833038; Thu, 04 Aug 2022 17:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659657833; cv=none; d=google.com; s=arc-20160816; b=v5cw7Of1cSkcdGn5ITj/p4dagVt6LR8BAjupSzLotZvR0cteLytkgCbFyd/t+5srKt rLCFmv2KlXXpYKGxIQsm68ZBzi9zZHeg19SlnboTlFUH8++ZPGvTBkjrzldtlkQvfq9B +c9puf2sONg48+1vlT/3beAejpWPchEisnlh88ACvcZp8fCfczFrnxf3ENdGRL5JgyNY YyNbBJqlNmM4X8BCrm9miLFQtXcNEfLJR2ArFPfkGgFp4JcK8WeYu4pwRCWWr1D++irc RzhrRcBSxYznWBdBTewxu4YQSfcN0X9IHjSbXEHzxO5kIic+Mb22C4XUZ8xBwRy5q8dh TfYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=ZVda0R65jWvtyXW491e4d8Lqe4wRnx4BCv9U5owRev8c3cEIi8jeSi5jdZdTt7E8B2 Q37nEp5EvoOfccpiPYtZNcsI806bYXK12UjjMSQxX7lLt2MytVduu4JCMT+8nVV3zStC l3lPKauj3EFej41aEsFDDwbeyiODN8qFqdrLpiSeHn2PZFyk3+eaWydvEX0Jd4GvVySQ QNj0bNGoKdVd0fJV5koBxxkMBa2bNRtiuIugu4cMnVH7bdHRcXttWShWycK/XaMc7Ng4 1cauQSY+ylHm/20Idj4402PzOx0nRlOeSIlJh9Mw7KOJHlxE5RX3G/oy+D75iROjYhG3 Rlyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b="wQo/UV9m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp11-20020a17090b4a8b00b001f03b623ed9si7530984pjb.129.2022.08.04.17.03.35; Thu, 04 Aug 2022 17:03:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b="wQo/UV9m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240421AbiHDWzg (ORCPT + 99 others); Thu, 4 Aug 2022 18:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240433AbiHDWyb (ORCPT ); Thu, 4 Aug 2022 18:54:31 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8956774CC3 for ; Thu, 4 Aug 2022 15:53:03 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id c22so615092wmr.2 for ; Thu, 04 Aug 2022 15:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=wQo/UV9mshrZkcNDdjalDKNxK63vlfmQjhNxevBHCxrFdsMT7nB90i1ZE6huszQ/db 2bl8ZrWoUnMQJhVWhbw8Q/cKmO/0nt2z4svjTvqbUUY0tQ7fXuI4fcdsSiGl67GACG1n bSMGo7EjTT0N8vsk5TsxgVEDLH3cwt/P9BpYOJ6Z/kwcEwWWk23H2GdFzVF9PoC3iB8O 760MdX6i3YhxrwszI6CwkNH0YgSTqG1hckIvey/rwgjFdQELdtDtIrz/saHyXZO5h/eO by8fOA6f7Q2assdrf+1iuG+Q38rAred/Dsh7mcOEEMwB3Ygh21+2eneqL2IZG8ngs08k l/Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=YMk1xKaoeUSA2butYWQtTrixKnDZnHqdmF19whBxnshr7Zyp2HjH1FKvI9y9WzhNOu FCnKgjiNfO7uSbvUoD6uBi13ie6bftxI3OByoTzuzqv0BxX5IaNaNAxUdse4RqRi+cbY Q0rm+uGUrhmA5OrvaesxuuDW1adaNuC+iwQMZTIQxb5jmdLpo/R/kt0zkBPVnMSq+h3x 0WSPm7qrqOOLrOC6A0PrMF0Mm7flmNBWDk06IsO7cLU6nJm/3XeIRSw3cmcDgLHscpPt GZC5RkxMl66DlmpcsPYtWfTKTvoRUE11KIty4DhAXheis3bCPVdMSx99JtPcnV5N7S09 YO1A== X-Gm-Message-State: ACgBeo01LCpTdNEg5huGQbrA6BOKIC155uHOArTvoWkJNtmapaeuUs9a e2V0tWgt8kpMfTgBv+WIRTHTfg== X-Received: by 2002:a05:600c:4f07:b0:3a3:2277:7064 with SMTP id l7-20020a05600c4f0700b003a322777064mr2707995wmq.181.1659653578896; Thu, 04 Aug 2022 15:52:58 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:58 -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, Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v5 27/33] hwmon/drivers/core: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:43 +0200 Message-Id: <20220804224349.1926752-28-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Acked-by: Guenter Roeck --- drivers/hwmon/hwmon.c | 14 +++++++------- drivers/hwmon/scpi-hwmon.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 2e2cd79d89eb..4218750d5a66 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -151,9 +151,9 @@ static DEFINE_IDA(hwmon_ida); * between hwmon and thermal_sys modules. */ #ifdef CONFIG_THERMAL_OF -static int hwmon_thermal_get_temp(void *data, int *temp) +static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hwmon_thermal_data *tdata = data; + struct hwmon_thermal_data *tdata = tz->devdata; struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); int ret; long t; @@ -168,9 +168,9 @@ static int hwmon_thermal_get_temp(void *data, int *temp) return 0; } -static int hwmon_thermal_set_trips(void *data, int low, int high) +static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct hwmon_thermal_data *tdata = data; + struct hwmon_thermal_data *tdata = tz->devdata; struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); const struct hwmon_chip_info *chip = hwdev->chip; const struct hwmon_channel_info **info = chip->info; @@ -203,7 +203,7 @@ static int hwmon_thermal_set_trips(void *data, int low, int high) return 0; } -static const struct thermal_zone_of_device_ops hwmon_thermal_ops = { +static const struct thermal_zone_device_ops hwmon_thermal_ops = { .get_temp = hwmon_thermal_get_temp, .set_trips = hwmon_thermal_set_trips, }; @@ -227,8 +227,8 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index) tdata->dev = dev; tdata->index = index; - tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata, - &hwmon_thermal_ops); + tzd = devm_thermal_of_zone_register(dev, index, tdata, + &hwmon_thermal_ops); if (IS_ERR(tzd)) { if (PTR_ERR(tzd) != -ENODEV) return PTR_ERR(tzd); diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index 5187c6dd5a4f..4d75385f7d5e 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -62,9 +62,9 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor) } } -static int scpi_read_temp(void *dev, int *temp) +static int scpi_read_temp(struct thermal_zone_device *tz, int *temp) { - struct scpi_thermal_zone *zone = dev; + struct scpi_thermal_zone *zone = tz->devdata; struct scpi_sensors *scpi_sensors = zone->scpi_sensors; struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops; struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id]; @@ -121,7 +121,7 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf) return sprintf(buf, "%s\n", sensor->info.name); } -static const struct thermal_zone_of_device_ops scpi_sensor_ops = { +static const struct thermal_zone_device_ops scpi_sensor_ops = { .get_temp = scpi_read_temp, }; @@ -275,10 +275,10 @@ static int scpi_hwmon_probe(struct platform_device *pdev) zone->sensor_id = i; zone->scpi_sensors = scpi_sensors; - z = devm_thermal_zone_of_sensor_register(dev, - sensor->info.sensor_id, - zone, - &scpi_sensor_ops); + z = devm_thermal_of_zone_register(dev, + sensor->info.sensor_id, + zone, + &scpi_sensor_ops); /* * The call to thermal_zone_of_sensor_register returns * an error for sensors that are not associated with -- 2.25.1