From nobody Wed Apr 15 05:38:31 2026 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 471EACCA48A for ; Mon, 25 Jul 2022 21:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237304AbiGYV1D (ORCPT ); Mon, 25 Jul 2022 17:27:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbiGYV04 (ORCPT ); Mon, 25 Jul 2022 17:26:56 -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 3A4CD240A6 for ; Mon, 25 Jul 2022 14:26:54 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id f24-20020a1cc918000000b003a30178c022so10199451wmb.3 for ; Mon, 25 Jul 2022 14:26:54 -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=865jIPWKjbhre47z+99I5TS/VgPTL1q8f80n+IC5uDA=; b=PsDr8SMYnfddD6X4J0+VYqUIUn7AxQfj0KVNywfyWP+KgXOWVXscrJOh8u9N7PBLbZ ReQ4I+OX0VTmzRGWemhMHhZL9rpPDOf/Da43/CT/gKlfHfcSvoJRM8cyhk61Q+Gw/Jmz eo2cMZzP3UAqkx2KQKZBakVTBXIIQo3+uHPu0ZJw4YV3k5+XQ+GrZlTEzNX+G/o7RnHQ oxY1kd5YobJZHiIsyesrC8sxQY79WK7LYJTRdXZApkkr9j0vulVNhLaccohCU7Alq9CH pgQtY5fE89D3ZGCTZ/W2xAJbKVmc0xa7p9UcgisQoNKI9Z73jG41Wc5jvJFbtWzFpc9v gYRQ== 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=865jIPWKjbhre47z+99I5TS/VgPTL1q8f80n+IC5uDA=; b=6Xn4vrpeN2I10hLw2oGmQ40pW257qJj8ZemsfFIIXuOMO4WYZUpIIlH5KjirTpcWNg YpEmyS+zu3j4JJVTgk4sR0Q4RnuyrUa7Rsfo9Xhuao/J6MCGExMNl+CHtDei6TqboH1U /nRJbmzUecy2CMsRYcAnAUtqgEScI5Q568axaOPI8wQCUuBYVeDK75NEHj5mle5CDp84 nBbefRme8cHAODmOUf6RNZu6PprH2efUTDrURAKJdINV/b1PzL7Kwo3P+yTPqga7iv9l ZDRkTr9V1DcLDW8Gc8TgbV+yk9JPvF9VDGosRthX1N4IferXz4XXYrXmAocERwZW+S2e +DCg== X-Gm-Message-State: AJIora8kBfQd0Aauj6jirQe8s3/tPuZCv3PaCMHAC58eqnGhwvZ9cCm2 8XjYfvl6VNKkw9lxz3UO8d87jw== X-Google-Smtp-Source: AGRyM1vxBWSHH1KxPed7vbDylFlq23TuJPwnrR1l1gcotF1n09K3Nyy157j32JHKwdpN5cMpWC8ukA== X-Received: by 2002:a7b:ca4a:0:b0:3a3:651f:51d8 with SMTP id m10-20020a7bca4a000000b003a3651f51d8mr3351069wml.102.1658784412606; Mon, 25 Jul 2022 14:26:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:26:52 -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 01/32] thermal/of: Rework the thermal device tree initialization Date: Mon, 25 Jul 2022 23:26:06 +0200 Message-Id: <20220725212637.2818207-2-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The following changes are reworking entirely the thermal device tree initialization. The old version is kept until the different drivers using it are converted to the new API. The old approach creates the different actors independently. This approach is the source of the code duplication in the thermal OF because a thermal zone is created but a sensor is registered after. The thermal zones are created unconditionnaly with a fake sensor at init time, thus forcing to provide fake ops and store all the thermal zone related information in duplicated structures. Then the sensor is initialized and the code looks up the thermal zone name using the device tree. Then the sensor is associated to the thermal zone, and the sensor specific ops are called with a second level of indirection from the thermal zone ops. When a sensor is removed (with a module unload), the thermal zone stays there with the fake sensor. The cooling device associated with a thermal zone and a trip point is stored in a list, again duplicating information, using the node name of the device tree to match afterwards the cooling devices. The new approach is simpler, it creates a thermal zone when the sensor is registered and destroys it when the sensor is removed. All the matching between the cooling device, trip points and thermal zones are done using the device tree, as well as bindings. The ops are no longer specific but uses the generic ones provided by the thermal framework. When the old code won't have any users, it can be removed and the remaining thermal OF code will be much simpler. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_of.c | 460 ++++++++++++++++++++++++++++++++++- include/linux/thermal.h | 18 ++ 2 files changed, 468 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 0693edc00f60..7e7713c32e89 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -811,16 +811,6 @@ static int thermal_of_get_trip_type(struct device_node= *np, return -ENODEV; } =20 -/** - * thermal_of_populate_trip - parse and fill one trip point data - * @np: DT node containing a trip point node - * @trip: trip point data structure to be filled up - * - * This function parses a trip point type of node represented by - * @np parameter and fills the read data into @trip data structure. - * - * Return: 0 on success, proper error code otherwise - */ static int thermal_of_populate_trip(struct device_node *np, struct thermal_trip *trip) { @@ -1065,6 +1055,456 @@ static __init void of_thermal_destroy_zones(void) of_node_put(np); } =20 +static struct device_node *of_thermal_zone_find(struct device_node *sensor= , int id) +{ + struct device_node *np, *tz; + struct of_phandle_args sensor_specs; + + np =3D of_find_node_by_name(NULL, "thermal-zones"); + if (!np) { + pr_err("Unable to find thermal zones description\n"); + return ERR_PTR(-EINVAL); + } + + /* + * Search for each thermal zone, a defined sensor + * corresponding to the one passed as parameter + */ + for_each_available_child_of_node(np, tz) { + + int count, i; + + count =3D of_count_phandle_with_args(tz, "thermal-sensors", + "#thermal-sensor-cells"); + if (count <=3D 0) { + pr_err("%pOFn: missing thermal sensor\n", tz); + tz =3D ERR_PTR(-EINVAL); + goto out; + } + + for (i =3D 0; i < count; i++) { + + int ret; + + ret =3D of_parse_phandle_with_args(tz, "thermal-sensors", + "#thermal-sensor-cells", + i, &sensor_specs); + if (ret < 0) { + pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", tz, ret); + tz =3D ERR_PTR(ret); + goto out; + } + + if ((sensor =3D=3D sensor_specs.np) && id =3D=3D (sensor_specs.args_cou= nt ? + sensor_specs.args[0] : 0)) { + pr_debug("sensor %pOFn id=3D%d belongs to %pOFn\n", sensor, id, tz); + goto out; + } + } + } +out: + of_node_put(np); + return tz; +} + +static int thermal_of_monitor_init(struct device_node *np, int *delay, int= *pdelay) +{ + int ret; + + ret =3D of_property_read_u32(np, "polling-delay-passive", pdelay); + if (ret < 0) { + pr_err("%pOFn: missing polling-delay-passive property\n", np); + return ret; + } + + ret =3D of_property_read_u32(np, "polling-delay", delay); + if (ret < 0) { + pr_err("%pOFn: missing polling-delay property\n", np); + return ret; + } + + return 0; +} + +static struct thermal_zone_params *thermal_of_parameters_init(struct devic= e_node *np) +{ + struct thermal_zone_params *tzp; + int coef[2]; + int ncoef =3D ARRAY_SIZE(coef); + int prop, ret; + + tzp =3D kzalloc(sizeof(*tzp), GFP_KERNEL); + if (!tzp) + return ERR_PTR(-ENOMEM); + + tzp->no_hwmon =3D true; + + if (!of_property_read_u32(np, "sustainable-power", &prop)) + tzp->sustainable_power =3D prop; + + /* + * For now, the thermal framework supports only one sensor per + * thermal zone. Thus, we are considering only the first two + * values as slope and offset. + */ + ret =3D of_property_read_u32_array(np, "coefficients", coef, ncoef); + if (ret) { + coef[0] =3D 1; + coef[1] =3D 0; + } + + tzp->slope =3D coef[0]; + tzp->offset =3D coef[1]; + + return tzp; +} + +static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone= _device *tz) +{ + struct device_node *np, *tz_np; + + np =3D of_find_node_by_name(NULL, "thermal-zones"); + if (!np) + return ERR_PTR(-ENODEV); + + tz_np =3D of_get_child_by_name(np, tz->type); + + of_node_put(np); + + if (!tz_np) + return ERR_PTR(-ENODEV); + + return tz_np; +} + +static int __thermal_of_unbind(struct device_node *map_np, int index, int = trip_id, + struct thermal_zone_device *tz, struct thermal_cooling_device *c= dev) +{ + struct of_phandle_args cooling_spec; + int ret; + + ret =3D of_parse_phandle_with_args(map_np, "cooling-device", "#cooling-ce= lls", + index, &cooling_spec); + + of_node_put(cooling_spec.np); + + if (ret < 0) { + pr_err("Invalid cooling-device entry\n"); + return ret; + } + + if (cooling_spec.args_count < 2) { + pr_err("wrong reference to cooling device, missing limits\n"); + return -EINVAL; + } + + if (cooling_spec.np !=3D cdev->np) + return 0; + + ret =3D thermal_zone_unbind_cooling_device(tz, trip_id, cdev); + if (ret) + pr_err("Failed to unbind '%s' with '%s': %d\n", tz->type, cdev->type, re= t); + + return ret; +} + +static int __thermal_of_bind(struct device_node *map_np, int index, int tr= ip_id, + struct thermal_zone_device *tz, struct thermal_cooling_device *cde= v) +{ + struct of_phandle_args cooling_spec; + int ret, weight =3D THERMAL_WEIGHT_DEFAULT; + + of_property_read_u32(map_np, "contribution", &weight); + + ret =3D of_parse_phandle_with_args(map_np, "cooling-device", "#cooling-ce= lls", + index, &cooling_spec); + + of_node_put(cooling_spec.np); + + if (ret < 0) { + pr_err("Invalid cooling-device entry\n"); + return ret; + } + + if (cooling_spec.args_count < 2) { + pr_err("wrong reference to cooling device, missing limits\n"); + return -EINVAL; + } + + if (cooling_spec.np !=3D cdev->np) + return 0; + + ret =3D thermal_zone_bind_cooling_device(tz, trip_id, cdev, cooling_spec.= args[1], + cooling_spec.args[0], + weight); + if (ret) + pr_err("Failed to bind '%s' with '%s': %d\n", tz->type, cdev->type, ret); + + return ret; +} + +static int thermal_of_for_each_cooling_device(struct device_node *tz_np, s= truct device_node *map_np, + struct thermal_zone_device *tz, struct thermal_cooling_device *= cdev, + int (*action)(struct device_node *, int, int, + struct thermal_zone_device *, struct thermal_cooling_device *)) +{ + struct device_node *tr_np; + int count, i, trip_id; + + tr_np =3D of_parse_phandle(map_np, "trip", 0); + if (!tr_np) + return -ENODEV; + + trip_id =3D of_find_trip_id(tz_np, tr_np); + if (trip_id < 0) + return trip_id; + + count =3D of_count_phandle_with_args(map_np, "cooling-device", "#cooling-= cells"); + if (count <=3D 0) { + pr_err("Add a cooling_device property with at least one device\n"); + return -ENOENT; + } + + /* + * At this point, we don't want to bail out when there is an + * error, we will try to bind/unbind as many as possible + * cooling devices + */ + for (i =3D 0; i < count; i++) + action(map_np, i, trip_id, tz, cdev); + + return 0; +} + +static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev, + int (*action)(struct device_node *, int, int, + struct thermal_zone_device *, struct thermal_cooling_device *)) +{ + struct device_node *tz_np, *cm_np, *child; + int ret =3D 0; + + tz_np =3D thermal_of_zone_get_by_name(tz); + if (IS_ERR(tz_np)) { + pr_err("Failed to get node tz by name\n"); + return PTR_ERR(tz_np); + } + + cm_np =3D of_get_child_by_name(tz_np, "cooling-maps"); + if (!cm_np) + goto out; + + for_each_child_of_node(cm_np, child) { + ret =3D thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, actio= n); + if (ret) + break; + } + + of_node_put(cm_np); +out: + of_node_put(tz_np); + + return ret; +} + +static int thermal_of_bind(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev) +{ + return thermal_of_for_each_cooling_maps(tz, cdev, __thermal_of_bind); +} + +static int thermal_of_unbind(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev) +{ + return thermal_of_for_each_cooling_maps(tz, cdev, __thermal_of_unbind); +} + +/** + * thermal_of_zone_unregister - Cleanup the specific allocated ressources + * + * This function disables the thermal zone and frees the different + * ressources allocated specific to the thermal OF. + * + * @tz: a pointer to the thermal zone structure + */ +void thermal_of_zone_unregister(struct thermal_zone_device *tz) +{ + thermal_zone_device_disable(tz); + thermal_zone_device_unregister(tz); + kfree(tz->trips); + kfree(tz->tzp); + kfree(tz->ops); +} +EXPORT_SYMBOL_GPL(thermal_of_zone_unregister); + +/** + * thermal_of_zone_register - Register a thermal zone with device node + * sensor + * + * The thermal_of_zone_register() parses a device tree given a device + * node sensor and identifier. It searches for the thermal zone + * associated to the couple sensor/id and retrieves all the thermal + * zone properties and registers new thermal zone with those + * properties. + * + * @sensor: A device node pointer corresponding to the sensor in the devic= e tree + * @id: An integer as sensor identifier + * @data: A private data to be stored in the thermal zone dedicated privat= e area + * @ops: A set of thermal sensor ops + * + * Return: a valid thermal zone structure pointer on success. + * - EINVAL: if the device tree thermal description is malformed + * - ENOMEM: if one structure can not be allocated + * - Other negative errors are returned by the underlying called functions + */ +struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, void *data, + const struct thermal_zone_device_ops *ops) +{ + struct thermal_zone_device *tz; + struct thermal_trip *trips; + struct thermal_zone_params *tzp; + struct thermal_zone_device_ops *of_ops; + struct device_node *np; + int delay, pdelay; + int ntrips, mask; + int ret; + + of_ops =3D kmemdup(ops, sizeof(*ops), GFP_KERNEL); + if (!of_ops) + return ERR_PTR(-ENOMEM); +=09 + np =3D of_thermal_zone_find(sensor, id); + if (IS_ERR(np)) { + pr_err("Failed to find thermal zone for %pOFn id=3D%d\n", sensor, id); + return ERR_CAST(np); + } + + trips =3D thermal_of_trips_init(np, &ntrips); + if (IS_ERR(trips)) { + pr_err("Failed to find trip points for %pOFn id=3D%d\n", sensor, id); + return ERR_CAST(trips); + } + + ret =3D thermal_of_monitor_init(np, &delay, &pdelay); + if (ret) { + pr_err("Failed to initialize monitoring delays from %pOFn\n", np); + goto out_kfree_trips; + } + + tzp =3D thermal_of_parameters_init(np); + if (IS_ERR(tzp)) { + ret =3D PTR_ERR(tzp); + pr_err("Failed to initialize parameter from %pOFn: %d\n", np, ret); + goto out_kfree_trips; + } + + of_ops->get_trip_type =3D of_ops->get_trip_type ? : of_thermal_get_trip_t= ype; + of_ops->get_trip_temp =3D of_ops->get_trip_temp ? : of_thermal_get_trip_t= emp; + of_ops->get_trip_hyst =3D of_ops->get_trip_hyst ? : of_thermal_get_trip_h= yst; + of_ops->set_trip_hyst =3D of_ops->set_trip_hyst ? : of_thermal_set_trip_h= yst; + of_ops->get_crit_temp =3D of_ops->get_crit_temp ? : of_thermal_get_crit_t= emp; + of_ops->bind =3D thermal_of_bind; + of_ops->unbind =3D thermal_of_unbind; + + mask =3D GENMASK_ULL((ntrips) - 1, 0); + + tz =3D thermal_zone_device_register_with_trips(np->name, trips, ntrips, + mask, data, of_ops, tzp, + pdelay, delay); + if (IS_ERR(tz)) { + ret =3D PTR_ERR(tz); + pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); + goto out_kfree_tzp; + } + + ret =3D thermal_zone_device_enable(tz); + if (ret) { + pr_err("Failed to enabled thermal zone '%s', id=3D%d: %d\n", + tz->type, tz->id, ret); + thermal_of_zone_unregister(tz); + return ERR_PTR(ret); + } + + return tz; + +out_kfree_tzp: + kfree(tzp); +out_kfree_trips: + kfree(trips); + + return ERR_PTR(ret); +} +EXPORT_SYMBOL_GPL(thermal_of_zone_register); + +static void devm_thermal_of_zone_release(struct device *dev, void *res) +{ + thermal_of_zone_unregister(*(struct thermal_zone_device **)res); +} + +static int devm_thermal_of_zone_match(struct device *dev, void *res, + void *data) +{ + struct thermal_zone_device **r =3D res; + + if (WARN_ON(!r || !*r)) + return 0; + + return *r =3D=3D data; +} + +/** + * devm_thermal_of_zone_register - register a thermal tied with the sensor= life cycle + * + * This function is the device version of the thermal_of_zone_register() f= unction. + * + * @dev: a device structure pointer to sensor to be tied with the thermal = zone OF life cycle + * @sensor_id: the sensor identifier + * @data: a pointer to a private data to be stored in the thermal zone 'de= vdata' field + * @ops: a pointer to the ops structure associated with the sensor + */ +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int sensor_id, void *data, + const struct thermal_zone_device_ops *ops) +{ + struct thermal_zone_device **ptr, *tzd; + + ptr =3D devres_alloc(devm_thermal_of_zone_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tzd =3D thermal_of_zone_register(dev->of_node, sensor_id, data, ops); + if (IS_ERR(tzd)) { + devres_free(ptr); + return tzd; + } + + *ptr =3D tzd; + devres_add(dev, ptr); + + return tzd; +} +EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); + +/** + * devm_thermal_of_zone_unregister - Resource managed version of + * thermal_of_zone_unregister(). + * @dev: Device for which which resource was allocated. + * @tz: a pointer to struct thermal_zone where the sensor is registered. + * + * This function removes the sensor callbacks and private data from the + * thermal zone device registered with devm_thermal_zone_of_sensor_registe= r() + * API. It will also silent the zone by remove the .get_temp() and .get_tr= end() + * thermal zone device callbacks. + * Normally this function will not need to be called and the resource + * management code will ensure that the resource is freed. + */ +void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz) +{ + WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, + devm_thermal_of_zone_match, tz)); +} +EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); + /** * of_parse_thermal_zones - parse device tree thermal data * diff --git a/include/linux/thermal.h b/include/linux/thermal.h index fde4689a1755..eb1a16f038c5 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -327,6 +327,16 @@ struct thermal_zone_of_device_ops { =20 /* Function declarations */ #ifdef CONFIG_THERMAL_OF +struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, void *data, + const struct thermal_zone_device_ops *ops); + +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int id, void *data, + const struct thermal_zone_device_ops *ops); + +void thermal_of_zone_unregister(struct thermal_zone_device *tz); + +void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz); + int thermal_zone_of_get_sensor_id(struct device_node *tz_np, struct device_node *sensor_np, u32 *id); @@ -368,6 +378,14 @@ static inline struct thermal_zone_device *devm_thermal= _zone_of_sensor_register( return ERR_PTR(-ENODEV); } =20 +static inline void thermal_of_zone_unregister(struct thermal_zone_device *= tz) +{ +} + +static inline void devm_thermal_of_zone_unregister(struct device *dev, str= uct thermal_zone_device *tz) +{ +} + static inline void devm_thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz) --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 919FEC433EF for ; Mon, 25 Jul 2022 21:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237288AbiGYV1F (ORCPT ); Mon, 25 Jul 2022 17:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237070AbiGYV05 (ORCPT ); Mon, 25 Jul 2022 17:26:57 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B620240B5 for ; Mon, 25 Jul 2022 14:26:56 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id ay11-20020a05600c1e0b00b003a3013da120so10196185wmb.5 for ; Mon, 25 Jul 2022 14:26:56 -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=+fP/YW6lKk1YJJQWc/7vmVyoV6adpF0oqi8olxQPTOI=; b=0feYwnXx3S2BBot69kmOpOTZrOsVcBHsOOlpGhAPFhioWbRVeQHiw/hj/JuMtOW/LV DwFre0nCZhvE/hFn5q5PLOu9okhYPqsKOU6CAEhCih7dgJSPKU2Ue+mAR1lsqagakOkr d++OwpTy0W0iW2VfW7XeTLxJfwBFFTJK8dWPTBFo0Ldiag2euoH79Yyl4iLlgJYW3Gdp DZAbZkHp/WDhpQucou3zO6xIcpVuLglLDwr3Xuf3mVIvoMUvJDLkU0kLe8oH3eMArfJQ UqkC73BCw9tFAWNyU5DkrrDdIZQifHXyD/yf18HM6OUPLyAhLvJ0cBU8knK6aasVbEXI WQeQ== 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=+fP/YW6lKk1YJJQWc/7vmVyoV6adpF0oqi8olxQPTOI=; b=LrDUCRWvIGEO+p0SAyaoyzICFEBchP9J6mzwU7lZ1nxMfvxm9333Q2lvL/GnwIDHHq rrbalM0JAcPlm1cO43UrxSSkfFytgSxyJ5UiglIzR/EHdsf73PFfd1EoTftkLDXr5j0C u59Aw23XadPlQV8D17KsxKv5brRVFYEVcZKhdBXvUGYF4BVx1fOfpZpGIIRfEvE5ouQj kNbcueXotynH7dO61DHclo+0uA5Zt/PQMdWA8oi/uwJ868RSFhPbBCJlJ65q9XCY8jdv OrGW14oY1hjU7GcXwbW8sDvanwXzSzUeeVDt3TrWgTykdNK0FF0/tkXY8314w8s+c/5i /q3w== X-Gm-Message-State: AJIora/7qkApJhKRZ83wBo+ehdEqbbjtKdfEE/BI1sGJDDeE61adcbfY oc2NiKJC729sVQltNDsLz4AUpA== X-Google-Smtp-Source: AGRyM1vv+NfHkenD1U/kXF1SKD3HXOzTovyjxIVECBK7dlbN40kZjZRJ7zfmTEtYX0kW37/lnxex+g== X-Received: by 2002:a05:600c:1549:b0:3a3:2aa2:6f60 with SMTP id f9-20020a05600c154900b003a32aa26f60mr9660502wmg.57.1658784414975; Mon, 25 Jul 2022 14:26:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:26:54 -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 02/32] thermal/of: Make new code and old code co-exist Date: Mon, 25 Jul 2022 23:26:07 +0200 Message-Id: <20220725212637.2818207-3-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This transient change allows to use old and new OF together until all the drivers are converted to use the new OF API. This will go away when the old OF code will be removed. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 6 ------ drivers/thermal/thermal_of.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0d9e9b175f93..a4783ab7eabd 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1495,10 +1495,6 @@ static int __init thermal_init(void) if (result) goto unregister_governors; =20 - result =3D of_parse_thermal_zones(); - if (result) - goto unregister_class; - result =3D register_pm_notifier(&thermal_pm_nb); if (result) pr_warn("Thermal: Can not register suspend notifier, return %d\n", @@ -1506,8 +1502,6 @@ static int __init thermal_init(void) =20 return 0; =20 -unregister_class: - class_unregister(&thermal_class); unregister_governors: thermal_unregister_governors(); error: diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 7e7713c32e89..dbb450a9823c 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -485,6 +485,15 @@ thermal_zone_of_sensor_register(struct device *dev, in= t sensor_id, void *data, { struct device_node *np, *child, *sensor_np; struct thermal_zone_device *tzd =3D ERR_PTR(-ENODEV); + static int old_tz_initialized; + int ret; + + if (!old_tz_initialized) { + ret =3D of_parse_thermal_zones(); + if (ret) + return ERR_PTR(ret); + old_tz_initialized =3D 1; + } =20 np =3D of_find_node_by_name(NULL, "thermal-zones"); if (!np) @@ -1004,7 +1013,7 @@ __init *thermal_of_build_thermal_zone(struct device_n= ode *np) return ERR_PTR(ret); } =20 -static __init void of_thermal_free_zone(struct __thermal_zone *tz) +static void of_thermal_free_zone(struct __thermal_zone *tz) { struct __thermal_bind_params *tbp; int i, j; @@ -1517,7 +1526,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); * Return: 0 on success, proper error code otherwise * */ -int __init of_parse_thermal_zones(void) +int of_parse_thermal_zones(void) { struct device_node *np, *child; struct __thermal_zone *tz; --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 CE202C433EF for ; Mon, 25 Jul 2022 21:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237319AbiGYV1J (ORCPT ); Mon, 25 Jul 2022 17:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237279AbiGYV1B (ORCPT ); Mon, 25 Jul 2022 17:27:01 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B50CD240BE for ; Mon, 25 Jul 2022 14:26:58 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id d8so17620181wrp.6 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=L6LhNachJt3/EWXNfG5Ry10rLUd020qNO4mOe87+G8eW5BhBXV7Ri0CbnQsVjA4pLF GsqnWfGr4RNhEkKds8fRkAfxPU8tn2FXZwQcWivPvm8XmtXwyKYifPu0rmwRdsEyNQjI d0xlpI5Q4Ggl99vEtwaPo/juHVJULgjOgpA4NOCOs0K0dMyEWdPDBi+6nK89Cnfr7g4B kyFNdvDGbqPKRWDy3ufX5cHAYDVXY1+eeOXQSTSUYJo7wCIQDcLEiXy5ziGsrpNMrBZP fIfRsnoPgk5Ocw+cst4XPUtLYduvU8yVkI+34v+wKWvaOZkJIRZrJ2BnMaSM5Dng3EWm WF4w== X-Gm-Message-State: AJIora+Q8VYIXYsQh5UUwZqwheir5EFoy151vnsu1TcQbXO9FhvKkShp XFLsJVD8nQjcu6sVSsuSivPD96jI8DI6ZQ== 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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; } =20 -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 =3D _sensor; + struct rockchip_thermal_sensor *sensor =3D tz->devdata; struct rockchip_thermal_data *thermal =3D sensor->thermal; const struct rockchip_tsadc_chip *tsadc =3D thermal->chip; =20 @@ -1224,9 +1224,9 @@ static int rockchip_thermal_set_trips(void *_sensor, = int low, int high) sensor->id, thermal->regs, high); } =20 -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 =3D _sensor; + struct rockchip_thermal_sensor *sensor =3D tz->devdata; struct rockchip_thermal_data *thermal =3D sensor->thermal; const struct rockchip_tsadc_chip *tsadc =3D sensor->thermal->chip; int retval; @@ -1239,7 +1239,7 @@ static int rockchip_thermal_get_temp(void *_sensor, i= nt *out_temp) return retval; } =20 -static const struct thermal_zone_of_device_ops rockchip_of_thermal_ops =3D= { +static const struct thermal_zone_device_ops rockchip_of_thermal_ops =3D { .get_temp =3D rockchip_thermal_get_temp, .set_trips =3D rockchip_thermal_set_trips, }; @@ -1326,8 +1326,8 @@ rockchip_thermal_register_sensor(struct platform_devi= ce *pdev, =20 sensor->thermal =3D thermal; sensor->id =3D id; - sensor->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, id, - sensor, &rockchip_of_thermal_ops); + sensor->tzd =3D devm_thermal_of_zone_register(&pdev->dev, id, sensor, + &rockchip_of_thermal_ops); if (IS_ERR(sensor->tzd)) { error =3D PTR_ERR(sensor->tzd); dev_err(&pdev->dev, "failed to register sensor %d: %d\n", --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 915CAC43334 for ; Mon, 25 Jul 2022 21:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237330AbiGYV1L (ORCPT ); Mon, 25 Jul 2022 17:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237261AbiGYV1C (ORCPT ); Mon, 25 Jul 2022 17:27:02 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD68248CD for ; Mon, 25 Jul 2022 14:27:00 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id h8so17695930wrw.1 for ; Mon, 25 Jul 2022 14:27:00 -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=NVvhouf/ZsSYzyYoQ6bj2MFHWvALAEEXijoyeWSBKFg=; b=4A+rmH5FZdlInKT/IX846VUtAcg0whbHzdGUMh3sSe86/B1YPdQRtpISDXGnDjKA5A iEDwo0gN2W4HpW0UywK46TukdfyayePcb0aOuLa7dTqW2cFn/M5ZPAglWQMYjZcOcI2a 0WY6tPthSUe455uxDY0nXn0k934l/ir3s/PoEFq8oVnsfsBmzKbzFZsrsTCoMTKVBZdP ikGa5fkkOueujzOcly3zondACVTnIUtnipqKXG7HYH6OtYamjFgZxRjlqv6haVL3RicO 9VVXIW9lbt/ltgGuL+UiMAiNfhETPIyA3b2wPL4V70YN7DHCRyHPIZKjbR9WDKGRxav8 jWTg== 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=NVvhouf/ZsSYzyYoQ6bj2MFHWvALAEEXijoyeWSBKFg=; b=0J2HzSvLgwkTvbvr2D3sEsApQx9kxb27W9higm2pDZJ7cNIfpovj29g8cDJrJ4mKAx Hfq8KhvBAjfwH60k6AA5tKZqZVk5e7CnJZJMzQJDuE0BqSbGGjfUhAtFv3dLXDiZTLF/ Aad0MsPVDsW9vMuF8OGjx9P0fdjXtXSt+00X8RGFLdAK6aNhCFAnYxhKu+h7h2bYpG67 SoGpxYj/0eD77pRCbxsHBnlBUx8vDaSNzAR0ZKkQBCEsBJUurmqMnnIfWZCl2dW20OBl haLufR4N07zFLWXm3JG067yMbXvZi5guac+40vduzVrCSKr+ilapxtlm+qS0a6U2un6o Ay6w== X-Gm-Message-State: AJIora96pOwYyIOuv+r1B0PFV1IDsc+ni70QmOHdqUaf/+iQXLeHIrvd d3cnDshi0G+Mo4ZjlHkyu4Lvpg== X-Google-Smtp-Source: AGRyM1vUW151zyjWsaoIvJE7BR05pGeZN5me8jAFH/+l052fUdKUSaAu9hi8tNyIfy5CuOwaH6kQNw== X-Received: by 2002:a05:6000:719:b0:21e:4530:c558 with SMTP id bs25-20020a056000071900b0021e4530c558mr8323291wrb.243.1658784419294; Mon, 25 Jul 2022 14:26:59 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:26: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, Amit Kucheria , linux-arm-kernel@lists.infradead.org (moderated list:ARM/UNIPHIER ARCHITECTURE) Subject: [PATCH v2 04/32] thermal/drivers/uniphier: Switch to new of API Date: Mon, 25 Jul 2022 23:26:09 +0200 Message-Id: <20220725212637.2818207-5-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/uniphier_thermal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_= thermal.c index 4cae5561a2a3..4111d99ef50e 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -187,9 +187,9 @@ static void uniphier_tm_disable_sensor(struct uniphier_= tm_dev *tdev) usleep_range(1000, 2000); /* The spec note says at least 1ms */ } =20 -static int uniphier_tm_get_temp(void *data, int *out_temp) +static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_t= emp) { - struct uniphier_tm_dev *tdev =3D data; + struct uniphier_tm_dev *tdev =3D tz->devdata; struct regmap *map =3D tdev->regmap; int ret; u32 temp; @@ -204,7 +204,7 @@ static int uniphier_tm_get_temp(void *data, int *out_te= mp) return 0; } =20 -static const struct thermal_zone_of_device_ops uniphier_of_thermal_ops =3D= { +static const struct thermal_zone_device_ops uniphier_of_thermal_ops =3D { .get_temp =3D uniphier_tm_get_temp, }; =20 @@ -289,8 +289,8 @@ static int uniphier_tm_probe(struct platform_device *pd= ev) =20 platform_set_drvdata(pdev, tdev); =20 - tdev->tz_dev =3D devm_thermal_zone_of_sensor_register(dev, 0, tdev, - &uniphier_of_thermal_ops); + tdev->tz_dev =3D devm_thermal_of_zone_register(dev, 0, tdev, + &uniphier_of_thermal_ops); if (IS_ERR(tdev->tz_dev)) { dev_err(dev, "failed to register sensor device\n"); return PTR_ERR(tdev->tz_dev); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 2E542C43334 for ; Mon, 25 Jul 2022 21:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237341AbiGYV1S (ORCPT ); Mon, 25 Jul 2022 17:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237281AbiGYV1E (ORCPT ); Mon, 25 Jul 2022 17:27:04 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1C44240B8 for ; Mon, 25 Jul 2022 14:27:02 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id r1-20020a05600c35c100b003a326685e7cso101444wmq.1 for ; Mon, 25 Jul 2022 14:27:02 -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=0/7L9Lc2wRZZo52YCs91vi96h8X92jsylQFQZGCnX0s=; b=moWO8jivNU1cjTx+jhycpwp4j1NSrFXiBxnZLzWxkWOhd71+VNeuW0LevHrqNx+Y96 Xj6/35UpT0H8o2zYirADYTOclDWf3z9Dk5imPZNxkcVgB+NgGvhLIk7/cawOeh/rUTkr aDWM5oFzGzIQT7In16e0/Wst5qm/cmsrDeIWVqkXCBBd6hP/iXmwby5nnQxGcyt8rlIF YJIPGZg9AgWB3LHF6DKHFvNxPB1EwyzWRDnQ90gavwFHwqVVuqiYbpmulEYgmMD4Xryg XWvLDvcYCcW7JodGSsr5kFKGcqqde4xKh9nayjG3ro6hmdV0QwF1oRGIDmk3uLGDRjEl b0hQ== 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=0/7L9Lc2wRZZo52YCs91vi96h8X92jsylQFQZGCnX0s=; b=rt2X6et1e3xDNxIFbINgJ2r/Tv6e2snVGSzcSK0bFYduj2LiERohsIZ2spZ6TYQLxg Xv2OBHKKNu7C5oYJnJaGDHY8P6vHa+E+Lr1Wcid3yNklWhymCCA2y2SVnpDyEkz93VEO PEcjw7IjKipVFKN7COP7ur4feZ1fTsrvTZAnuaIv1qME2dZ3CAICiF2HSSWvRa36dAzW kmup/a48dpsUqBmB3c06QvNeQrt6DHmTGQUIsjsJsE3pxhpFOqDz0XVp0fqHx/xMjbOG It/kC2kiUgmo8GetUnh4XtHl9BwqqQhJmVjt/ou9lc5DWUcaZortHb+jzEHgOCPmZFq+ w7fw== X-Gm-Message-State: AJIora91fKPnAdLBf6AUshmSaZ9sm/u4cJ2ruYDpUZXOsQ4ew8ZHiRfJ 4mJsdoVT+5K99UXW/WgJqsWPxw== X-Google-Smtp-Source: AGRyM1vyKjPCEv+fbOJKMq+h7EeTbR0qwq3V9QbvaCMzbQZMAZEvkVpoRiQ0jzTYzF1x+kvB6/Inuw== X-Received: by 2002:a1c:2584:0:b0:3a1:9de1:f2cd with SMTP id l126-20020a1c2584000000b003a19de1f2cdmr9329750wml.182.1658784421392; Mon, 25 Jul 2022 14:27:01 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:01 -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 05/32] thermal/drivers/generic-adc: Switch to new of API Date: Mon, 25 Jul 2022 23:26:10 +0200 Message-Id: <20220725212637.2818207-6-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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-generic-adc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/therma= l-generic-adc.c index 73665c3ccfe0..323e273e3298 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -52,9 +52,9 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_i= nfo *gti, int val) return temp; } =20 -static int gadc_thermal_get_temp(void *data, int *temp) +static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct gadc_thermal_info *gti =3D data; + struct gadc_thermal_info *gti =3D tz->devdata; int val; int ret; =20 @@ -68,7 +68,7 @@ static int gadc_thermal_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops gadc_thermal_ops =3D { +static const struct thermal_zone_device_ops gadc_thermal_ops =3D { .get_temp =3D gadc_thermal_get_temp, }; =20 @@ -143,8 +143,8 @@ static int gadc_thermal_probe(struct platform_device *p= dev) gti->dev =3D &pdev->dev; platform_set_drvdata(pdev, gti); =20 - gti->tz_dev =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, gti, - &gadc_thermal_ops); + gti->tz_dev =3D devm_thermal_of_zone_register(&pdev->dev, 0, gti, + &gadc_thermal_ops); if (IS_ERR(gti->tz_dev)) { ret =3D PTR_ERR(gti->tz_dev); if (ret !=3D -EPROBE_DEFER) --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 1BEE1C433EF for ; Mon, 25 Jul 2022 21:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237369AbiGYV12 (ORCPT ); Mon, 25 Jul 2022 17:27:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237306AbiGYV1I (ORCPT ); Mon, 25 Jul 2022 17:27:08 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27B8F240B3 for ; Mon, 25 Jul 2022 14:27:05 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id v13so9936735wru.12 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=qEy2iQSSZTCwA6WaLp1tw/f+vnt5fMTvhr6JRxAzS8HV6E2J8j8zjB60dzK9HwrchU AYlqGZwWonWJ5PhmGOYw8OOS8xiq31rcNaEO385ifhXUo2aeL2tniU3B9eexRsfW10UH ZkgttqNqkVtmtjaLRo9gJe9PZn3YsINaD+YJsblPpiORZMGA8gHS2T55JyMGKUZh4Xkr 0mcLpQxv1HhCl7a3cG2GrfbttE+vq0ABGeHDOQskNAs6gp0XrAuX55rOMK3q7r/E4Zj+ eCAklZh4pJGVIP8Km0WsIFSmTgbDtD7cqLHrXMbZMpGLqLdInum5rghuKOpjyNuWakJ9 xeiA== X-Gm-Message-State: AJIora8bJn1yZtd93rQ7qoFd8fwX6fPcXFl+vAyrZ4LEd5AHVP5zYxtM U60Hb4cIzqaz9zf+TWKISEdljw== 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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); } =20 -static int thermal_mmio_get_temperature(void *private, int *temp) +static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, in= t *temp) { int t; - struct thermal_mmio *sensor =3D - (struct thermal_mmio *)private; + struct thermal_mmio *sensor =3D tz->devdata; =20 t =3D sensor->read_mmio(sensor->mmio_base) & sensor->mask; t *=3D sensor->factor; @@ -34,7 +33,7 @@ static int thermal_mmio_get_temperature(void *private, in= t *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops thermal_mmio_ops =3D { +static const struct thermal_zone_device_ops thermal_mmio_ops =3D { .get_temp =3D thermal_mmio_get_temperature, }; =20 @@ -68,10 +67,10 @@ static int thermal_mmio_probe(struct platform_device *p= dev) } } =20 - thermal_zone =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - 0, - sensor, - &thermal_mmio_ops); + thermal_zone =3D 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 *pde= v) return PTR_ERR(thermal_zone); } =20 - 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); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 68809C433EF for ; Mon, 25 Jul 2022 21:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236736AbiGYV1o (ORCPT ); Mon, 25 Jul 2022 17:27:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237015AbiGYV10 (ORCPT ); Mon, 25 Jul 2022 17:27:26 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5EF824950 for ; Mon, 25 Jul 2022 14:27:12 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id h9so17755595wrm.0 for ; Mon, 25 Jul 2022 14:27:12 -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=Pz2KjtXaMI0jScu1xq3EeaciLTNu3Oz8ilngbxKCnlM=; b=M7Iha6QwEF09+xRMyX8q0UnliZpGzYqt0v7SWMyDJ7qSxF2MkXQKSAivffZOws6tFI ViiJRyTGKIsqGaBjCB3GgWvG/PlscHlVmIEXrHsysc7mrktCCZjbsFX2I8xAEaIBcz0h 5E5tPcLoCKMpq6FVqNG8a0W20o9uQqGw/XwF800iJ8d/T6RShKaL4WOd1BmCyZk10DQd sLcfZUTMA7DGeczfvQepIAVMuDtcWwsHGpPb3lppUaAKcEXPC+xEhq+SvIVX3h1l6Zge JvL7pLHE4RoY6tdvdE1ZS8QZ1v2xp5FJiF8ZLUU1rj2hfSbuhbCv1QexucyzfIFJKNrZ eDGg== 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=Pz2KjtXaMI0jScu1xq3EeaciLTNu3Oz8ilngbxKCnlM=; b=pgzE7G0nuaWNdxhVZq7vz0xCSI9eyvAsKv4lHr0ToXxtWgnQVA6q2iZCPbBnSZTouJ WWCJHK1MYFfJE4a8swsTIuXfOtHycLnlWxPF4gonbgLwRgZSr37+Ze76vL+N0lNmkRxo QYk8EYs2O+iUpXrs2buKskYtY5uVjBNwBO1hwA/2viUpEsZA/0xzY2dK+DzvicSQnGXj TzgitZvRCMm2ltw/wfYqGMFw3UmfZWzyX+jE2l0PUOWhYmrGvXY4zaiR1teCDavM2Q4O +IC5V9+6qsK42lxL0T+8K6LwNH+STw959dPeWmMutD2m0RARRvxw3JXDiKcn/5+WOBbu imJg== X-Gm-Message-State: AJIora+UxslCo7CzLQMjIVS4WJXThW0eCUTKue2/Smt0zSzuVRi1ykLd 5fPfOaSJkfBDBY7rHanjlanKMQ== X-Google-Smtp-Source: AGRyM1toAQ74TcGjruMhvB1oCuhavIdBtppWfiae8QUX7e0lVbtXCtlYfuvOdU65IAVk/GJYSYgUAQ== X-Received: by 2002:adf:f747:0:b0:21e:8e2a:7cbc with SMTP id z7-20020adff747000000b0021e8e2a7cbcmr3189802wrp.342.1658784430948; Mon, 25 Jul 2022 14:27:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:10 -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 , Mikko Perttunen , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v2 07/32] thermal/drivers/tegra: Switch to new of API Date: Mon, 25 Jul 2022 23:26:12 +0200 Message-Id: <20220725212637.2818207-8-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/tegra/soctherm.c | 27 ++++++++++------------ drivers/thermal/tegra/tegra-bpmp-thermal.c | 19 +++++++++------ drivers/thermal/tegra/tegra30-tsensor.c | 12 +++++----- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/socth= erm.c index 210325f92559..52504b0097c4 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -421,9 +421,9 @@ static int translate_temp(u16 val) return t; } =20 -static int tegra_thermctl_get_temp(void *data, int *out_temp) +static int tegra_thermctl_get_temp(struct thermal_zone_device *tz, int *ou= t_temp) { - struct tegra_thermctl_zone *zone =3D data; + struct tegra_thermctl_zone *zone =3D tz->devdata; u32 val; =20 val =3D readl(zone->reg); @@ -582,10 +582,9 @@ static int tsensor_group_thermtrip_get(struct tegra_so= ctherm *ts, int id) return temp; } =20 -static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp) +static int tegra_thermctl_set_trip_temp(struct thermal_zone_device *tz, in= t trip, int temp) { - struct tegra_thermctl_zone *zone =3D data; - struct thermal_zone_device *tz =3D zone->tz; + struct tegra_thermctl_zone *zone =3D tz->devdata; struct tegra_soctherm *ts =3D zone->ts; const struct tegra_tsensor_group *sg =3D zone->sg; struct device *dev =3D zone->dev; @@ -633,17 +632,15 @@ static int tegra_thermctl_set_trip_temp(void *data, i= nt trip, int temp) return 0; } =20 -static int tegra_thermctl_get_trend(void *data, int trip, +static int tegra_thermctl_get_trend(struct thermal_zone_device *tz, int tr= ip, enum thermal_trend *trend) { - struct tegra_thermctl_zone *zone =3D data; - struct thermal_zone_device *tz =3D zone->tz; int trip_temp, temp, last_temp, ret; =20 if (!tz) return -EINVAL; =20 - ret =3D tz->ops->get_trip_temp(zone->tz, trip, &trip_temp); + ret =3D tz->ops->get_trip_temp(tz, trip, &trip_temp); if (ret) return ret; =20 @@ -688,9 +685,9 @@ static void thermal_irq_disable(struct tegra_thermctl_z= one *zn) mutex_unlock(&zn->ts->thermctl_lock); } =20 -static int tegra_thermctl_set_trips(void *data, int lo, int hi) +static int tegra_thermctl_set_trips(struct thermal_zone_device *tz, int lo= , int hi) { - struct tegra_thermctl_zone *zone =3D data; + struct tegra_thermctl_zone *zone =3D tz->devdata; u32 r; =20 thermal_irq_disable(zone); @@ -713,7 +710,7 @@ static int tegra_thermctl_set_trips(void *data, int lo,= int hi) return 0; } =20 -static const struct thermal_zone_of_device_ops tegra_of_thermal_ops =3D { +static const struct thermal_zone_device_ops tegra_of_thermal_ops =3D { .get_temp =3D tegra_thermctl_get_temp, .set_trip_temp =3D tegra_thermctl_set_trip_temp, .get_trend =3D tegra_thermctl_get_trend, @@ -2226,9 +2223,9 @@ static int tegra_soctherm_probe(struct platform_devic= e *pdev) zone->sg =3D soc->ttgs[i]; zone->ts =3D tegra; =20 - z =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - soc->ttgs[i]->id, zone, - &tegra_of_thermal_ops); + z =3D devm_thermal_of_zone_register(&pdev->dev, + soc->ttgs[i]->id, zone, + &tegra_of_thermal_ops); if (IS_ERR(z)) { err =3D PTR_ERR(z); dev_err(&pdev->dev, "failed to register sensor: %d\n", diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/t= egra/tegra-bpmp-thermal.c index 5affc3d196be..eb84f0b9dc7c 100644 --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c @@ -30,9 +30,9 @@ struct tegra_bpmp_thermal { struct tegra_bpmp_thermal_zone **zones; }; =20 -static int tegra_bpmp_thermal_get_temp(void *data, int *out_temp) +static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *z= one, + int *out_temp) { - struct tegra_bpmp_thermal_zone *zone =3D data; struct mrq_thermal_host_to_bpmp_request req; union mrq_thermal_bpmp_to_host_response reply; struct tegra_bpmp_message msg; @@ -60,9 +60,14 @@ static int tegra_bpmp_thermal_get_temp(void *data, int *= out_temp) return 0; } =20 -static int tegra_bpmp_thermal_set_trips(void *data, int low, int high) +static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int= *out_temp) { - struct tegra_bpmp_thermal_zone *zone =3D data; + return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp); +} + +static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, in= t low, int high) +{ + struct tegra_bpmp_thermal_zone *zone =3D tz->devdata; struct mrq_thermal_host_to_bpmp_request req; struct tegra_bpmp_message msg; int err; @@ -157,7 +162,7 @@ static int tegra_bpmp_thermal_get_num_zones(struct tegr= a_bpmp *bpmp, return 0; } =20 -static const struct thermal_zone_of_device_ops tegra_bpmp_of_thermal_ops = =3D { +static const struct thermal_zone_device_ops tegra_bpmp_of_thermal_ops =3D { .get_temp =3D tegra_bpmp_thermal_get_temp, .set_trips =3D tegra_bpmp_thermal_set_trips, }; @@ -200,13 +205,13 @@ static int tegra_bpmp_thermal_probe(struct platform_d= evice *pdev) zone->idx =3D i; zone->tegra =3D tegra; =20 - err =3D tegra_bpmp_thermal_get_temp(zone, &temp); + err =3D __tegra_bpmp_thermal_get_temp(zone, &temp); if (err < 0) { devm_kfree(&pdev->dev, zone); continue; } =20 - tzd =3D devm_thermal_zone_of_sensor_register( + tzd =3D devm_thermal_of_zone_register( &pdev->dev, i, zone, &tegra_bpmp_of_thermal_ops); if (IS_ERR(tzd)) { if (PTR_ERR(tzd) =3D=3D -EPROBE_DEFER) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index 05886684f429..c34501287e96 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -159,9 +159,9 @@ static void devm_tegra_tsensor_hw_disable(void *data) tegra_tsensor_hw_disable(ts); } =20 -static int tegra_tsensor_get_temp(void *data, int *temp) +static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *tem= p) { - const struct tegra_tsensor_channel *tsc =3D data; + const struct tegra_tsensor_channel *tsc =3D tz->devdata; const struct tegra_tsensor *ts =3D tsc->ts; int err, c1, c2, c3, c4, counter; u32 val; @@ -217,9 +217,9 @@ static int tegra_tsensor_temp_to_counter(const struct t= egra_tsensor *ts, int tem return DIV_ROUND_CLOSEST(c2 * 1000000 - ts->calib.b, ts->calib.a); } =20 -static int tegra_tsensor_set_trips(void *data, int low, int high) +static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low= , int high) { - const struct tegra_tsensor_channel *tsc =3D data; + const struct tegra_tsensor_channel *tsc =3D tz->devdata; const struct tegra_tsensor *ts =3D tsc->ts; u32 val; =20 @@ -240,7 +240,7 @@ static int tegra_tsensor_set_trips(void *data, int low,= int high) return 0; } =20 -static const struct thermal_zone_of_device_ops ops =3D { +static const struct thermal_zone_device_ops ops =3D { .get_temp =3D tegra_tsensor_get_temp, .set_trips =3D tegra_tsensor_set_trips, }; @@ -516,7 +516,7 @@ static int tegra_tsensor_register_channel(struct tegra_= tsensor *ts, tsc->id =3D id; tsc->regs =3D ts->regs + 0x40 * (hw_id + 1); =20 - tsc->tzd =3D devm_thermal_zone_of_sensor_register(ts->dev, id, tsc, &ops); + tsc->tzd =3D devm_thermal_of_zone_register(ts->dev, id, tsc, &ops); if (IS_ERR(tsc->tzd)) { if (PTR_ERR(tsc->tzd) !=3D -ENODEV) return dev_err_probe(ts->dev, PTR_ERR(tsc->tzd), --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 168AFC433EF for ; Mon, 25 Jul 2022 21:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236722AbiGYV1s (ORCPT ); Mon, 25 Jul 2022 17:27:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237345AbiGYV11 (ORCPT ); Mon, 25 Jul 2022 17:27:27 -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 C6D0A248E9 for ; Mon, 25 Jul 2022 14:27:13 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id b26so17729686wrc.2 for ; Mon, 25 Jul 2022 14:27:13 -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=6+IbCbjvww7/6MCT8FlO/AyuSJ2MYApVBUJpYGG38Fs=; b=fSrO/7vc7YdETGnbNnO4MEoFJhS6dOOpUs+z5Z4Q0CqwrIfzxANf5LlJa+hCQ7v27l 81lRhs5MjQ0RwMyOU1vngZmBC0e5WlCSypRzTh/imp8F2C1+GGzPkieklV32eFN2eqX9 2b3oxol1P3daqJxMXwf4AxNNCTUB+WzRIBt9g92q7jF/q5+OucyDzf9mbEvrFMBaGxfz CqAZFsBA51J9kXHUQafWLlFPmTmqUcZtH2Cdfe9nYyZJBzW5lG4pms2f0xN0wPiv5EE6 Ygn629fB7mPhzemvLau3tiqVBuPXCBBLBoh7CbwaV3G6d1ARVwrhfAc0OnXBq+JjYc7r uYRw== 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=6+IbCbjvww7/6MCT8FlO/AyuSJ2MYApVBUJpYGG38Fs=; b=b7pG2rK8yaA6llug5uKvO0pqiRDcerJ6JvxQz5VDJk3nSOXR0V4rMFL3zmqdRPqd+m vjXE9ssCtylUB7JUfTHLpgS+JWQxwkySTP1Sr0fyrLv1f1cgaNsqHGBUedPMSpZTtYoO BSALtLBMF83ocjHY801QvhD9IkbYEOMNOK/LbL2+I+Ee6EMWk9e6S2MrLFaBaziDN6JR Xz7g3hnssffjFYUs48gfYxyXb5hzejx4d/3E4OWRk7x0tdf8rmNXtAzpg+FTCyI4fHAT 091fGFXyZ9Bhp7CQzSUdwWV/rg9A6/rj0BhFqiPeccGW/OnsFuFZVPB8adHuYT4YQb/Z /25A== X-Gm-Message-State: AJIora8gMn4h4ZFmUJiqbIzZe9S8z7PCq0WbIhp8aU83Hvwp2sp+vbe+ kFpRryWfDBjulrjcn0PzBpinjg== X-Google-Smtp-Source: AGRyM1tPhZQxz2m/hgQzzipXQqvcy35d3jJ4+m1gu6vcvitjtr9rcjLcXjbfXhHboUlBS2gK8XX4ow== X-Received: by 2002:adf:f245:0:b0:21d:a39a:bed5 with SMTP id b5-20020adff245000000b0021da39abed5mr8265442wrp.508.1658784433206; Mon, 25 Jul 2022 14:27:13 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:12 -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 , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 08/32] thermal/drivers/sun8i: Switch to new of API Date: Mon, 25 Jul 2022 23:26:13 +0200 Message-Id: <20220725212637.2818207-9-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Vasily Khoruzhick --- drivers/thermal/sun8i_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_therma= l.c index d9cd23cbb671..2a4fa4068950 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -108,9 +108,9 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev, return -1590 * reg / 10 + 276000; } =20 -static int sun8i_ths_get_temp(void *data, int *temp) +static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsensor *s =3D data; + struct tsensor *s =3D tz->devdata; struct ths_device *tmdev =3D s->tmdev; int val =3D 0; =20 @@ -135,7 +135,7 @@ static int sun8i_ths_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops ths_ops =3D { +static const struct thermal_zone_device_ops ths_ops =3D { .get_temp =3D sun8i_ths_get_temp, }; =20 @@ -468,10 +468,10 @@ static int sun8i_ths_register(struct ths_device *tmde= v) tmdev->sensor[i].tmdev =3D tmdev; tmdev->sensor[i].id =3D i; tmdev->sensor[i].tzd =3D - devm_thermal_zone_of_sensor_register(tmdev->dev, - i, - &tmdev->sensor[i], - &ths_ops); + devm_thermal_of_zone_register(tmdev->dev, + i, + &tmdev->sensor[i], + &ths_ops); if (IS_ERR(tmdev->sensor[i].tzd)) return PTR_ERR(tmdev->sensor[i].tzd); =20 --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 49944C433EF for ; Mon, 25 Jul 2022 21:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237321AbiGYV2F (ORCPT ); Mon, 25 Jul 2022 17:28:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237340AbiGYV1g (ORCPT ); Mon, 25 Jul 2022 17:27:36 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB0B24978 for ; Mon, 25 Jul 2022 14:27:17 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id z13so17706450wro.13 for ; Mon, 25 Jul 2022 14:27:17 -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=3rC2SEgtKSVYrTT7ru1qnZcNbf0y/uFQwB+BT2UAJtk=; b=tTJaqnwqmawVByEqOMOm/Nv3cFkRkBv4F34hoQsNqeHfIYqK9b0w66zJ/b3DteSjE1 CHI6TILbelwqxEbn7yu8S84Wj83o7+k9RDgpf4OsPl/VhX2/NHgT9NHt30QJdHRJmU7P ASp0U3bFvVVapXQlJhLp0OES774M/RjK2gEt4JzEB+1jJ6BuJEm4pg5OgBVubA7S4X3g BLOZ+1ai2apSnYTD/xJ4aVpdZqmaScGkmZ3Gl9QlSB4s02WAnNrIQQqTKunMp3hqUSIi npcv7Xfdim52pzhuNJ7iGQKLvUmKVrLirrEoYvLetmViTgh9GNtuhNpyEf/uwj5fjep+ 6dTQ== 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=3rC2SEgtKSVYrTT7ru1qnZcNbf0y/uFQwB+BT2UAJtk=; b=0kTZrpnutz5rYqtzQT+K4HU36sxuJemcWow8V5RrsejNeAAJSW1WKxRL1YoLMHw/Wx 0C6DBSCNNK+qIZsoNoMaG2FAuwIXkQPTm4tzvENkgpMib7KCydpxni3FNRz7+VEG+pIQ l3eUV6M/LU9TWyhexeHoIVL78LqtqI4ux2TLawt8N7+QvD2WUEUPcN9JdOsTWDVJ9IN1 D6VinajZL40LK8qgAGwKsz2SSPZuxpgtEilcpnSUgqS1Q1P55at6F73HXEz6EK2XmKC9 PoaoGSQbvtqM6RQjVSSs5J+Xr/DZefGV/NaqFAvX2Xsi3zoeOm/7kEW2KPod/BPxIAzV dNDQ== X-Gm-Message-State: AJIora9oBUJnNPYW7EPWEn47D3dKZmlRydOALnuG2dzCEgSiYn4aR3WE LaS0EfPYNClukAM9UokXahFOIQ== X-Google-Smtp-Source: AGRyM1ttVeL1IJspkC7l7dkljVdsHkFLoAkcA2NnEFSotEZrsW61Y/M6NtQUvLW/0P5DpewP6i9a8A== X-Received: by 2002:adf:d084:0:b0:21e:5570:2b05 with SMTP id y4-20020adfd084000000b0021e55702b05mr8661442wrh.554.1658784435454; Mon, 25 Jul 2022 14:27:15 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:15 -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 , Orson Zhai , Chunyan Zhang Subject: [PATCH v2 09/32] thermal/drivers/sprd: Switch to new of API Date: Mon, 25 Jul 2022 23:26:14 +0200 Message-Id: <20220725212637.2818207-10-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/sprd_thermal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index fff80fc18002..ac884514f116 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -204,9 +204,9 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sp= rd_thermal_sensor *sen) return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); } =20 -static int sprd_thm_read_temp(void *devdata, int *temp) +static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) { - struct sprd_thermal_sensor *sen =3D devdata; + struct sprd_thermal_sensor *sen =3D tz->devdata; u32 data; =20 data =3D readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & @@ -217,7 +217,7 @@ static int sprd_thm_read_temp(void *devdata, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops sprd_thm_ops =3D { +static const struct thermal_zone_device_ops sprd_thm_ops =3D { .get_temp =3D sprd_thm_read_temp, }; =20 @@ -408,10 +408,10 @@ static int sprd_thm_probe(struct platform_device *pde= v) =20 sprd_thm_sensor_init(thm, sen); =20 - sen->tzd =3D devm_thermal_zone_of_sensor_register(sen->dev, - sen->id, - sen, - &sprd_thm_ops); + sen->tzd =3D devm_thermal_of_zone_register(sen->dev, + sen->id, + sen, + &sprd_thm_ops); if (IS_ERR(sen->tzd)) { dev_err(&pdev->dev, "register thermal zone failed %d\n", sen->id); @@ -523,8 +523,8 @@ static int sprd_thm_remove(struct platform_device *pdev) =20 for (i =3D 0; i < thm->nr_sensors; i++) { sprd_thm_toggle_sensor(thm->sensor[i], false); - devm_thermal_zone_of_sensor_unregister(&pdev->dev, - thm->sensor[i]->tzd); + devm_thermal_of_zone_unregister(&pdev->dev, + thm->sensor[i]->tzd); } =20 clk_disable_unprepare(thm->clk); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 D74DEC43334 for ; Mon, 25 Jul 2022 21:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236774AbiGYV2N (ORCPT ); Mon, 25 Jul 2022 17:28:13 -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 S236983AbiGYV1j (ORCPT ); Mon, 25 Jul 2022 17:27:39 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DAB024BDD for ; Mon, 25 Jul 2022 14:27:22 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id d13so10055350wrn.10 for ; Mon, 25 Jul 2022 14:27:22 -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=ApxyJvlL0EgkjxePD3esAQ9IvkzW++CVryyDi4r5gNo=; b=QTM80UlZEVlIMqYOokDPF8R5L8oC/ws6qivuyrx2062u+Gxq95COLZf9QDnTmjohHv jdhWaTRfG/YNwAnWDNNA+cqrrtQDjA1jeRS9vAbQzq0/4LfujFvGQW1mdrhtLBuQOCHy Uy7OvIwwFvJlBhPaeDZjXEhpvskdvqeuotFETckZwvDSvatHOtrsePO9A0DY+6CwBbmk W3oOjYl5z3jBFyvod9JITvNbaEvWkqBSgBWy18PebTsoOg+gYH1+HpKCSDjH7MhNr7sp C5Dn2NsKVuPQPJLdsr3xOXJ0axprIlHv2uBTqAq3XSUBYfRs2FDXXDGl7JHMzebhviEK WKrg== 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=ApxyJvlL0EgkjxePD3esAQ9IvkzW++CVryyDi4r5gNo=; b=2ffAJOZ0yzDOF9XaVmpAqXR1Ehp+OHLZx5Zb2LCCYplPWrcuOIV5qr0GmGpc6Q0KQn B7K/akT4FBmicXLLACyijddOyC1MaJ1MCTstBfQJ+2XiQeOt5D/PnONrMzxLAx/9OE8Y Xsxee1J9KgvqXfulm7EFwvseDe1vMKUWMHReC2W2YsnlkDrX+kGwieMYt/iUYpmKWYLh eFs3NhqSILSW70pcl1YHoQd4cW71aE6ko8RlTh0KtTPhLCShO/al+qsrfWVIXwCVxEK6 chc0Bv2uxP65rgN/m23zN5/T7t/XwRl+qsD+P/Z2/w9zc+09iN250eknVJ6HBNTy6SXd qvWQ== X-Gm-Message-State: AJIora+U1534h7iFAh1YElvbzhBSQg14hSkQ2r3FpwooZrJ9K3ih5l/7 XjbZ0zaa27dYRoWTsMKwDB1+CQ== X-Google-Smtp-Source: AGRyM1s3uYRhWPrUNnaJcvNKcMLy+yADF1JsPBXeRAR6KnjDOQjTyzAAOTYTxhJmAC/i12+29ohkog== X-Received: by 2002:a5d:4583:0:b0:21e:3b0e:2bc9 with SMTP id p3-20020a5d4583000000b0021e3b0e2bc9mr8736620wrq.649.1658784441846; Mon, 25 Jul 2022 14:27:21 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:21 -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 , Broadcom internal kernel review list , Ray Jui , Scott Branden , Markus Mayer , Stefan Wahren , Zheng Yongjun , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE) Subject: [PATCH v2 10/32] thermal/drivers/broadcom: Switch to new of API Date: Mon, 25 Jul 2022 23:26:15 +0200 Message-Id: <20220725212637.2818207-11-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Florian Fainelli Reviewed-by: Florian Fainelli --- drivers/thermal/broadcom/bcm2711_thermal.c | 14 +++--- drivers/thermal/broadcom/bcm2835_thermal.c | 14 +++--- drivers/thermal/broadcom/brcmstb_thermal.c | 20 ++++----- drivers/thermal/broadcom/ns-thermal.c | 50 +++++++++------------- drivers/thermal/broadcom/sr-thermal.c | 16 +++---- 5 files changed, 53 insertions(+), 61 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/b= roadcom/bcm2711_thermal.c index e9bef5c3414b..1f8651d15160 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -31,11 +31,11 @@ struct bcm2711_thermal_priv { struct thermal_zone_device *thermal; }; =20 -static int bcm2711_get_temp(void *data, int *temp) +static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2711_thermal_priv *priv =3D data; - int slope =3D thermal_zone_get_slope(priv->thermal); - int offset =3D thermal_zone_get_offset(priv->thermal); + struct bcm2711_thermal_priv *priv =3D tz->devdata; + int slope =3D thermal_zone_get_slope(tz); + int offset =3D thermal_zone_get_offset(tz); u32 val; int ret; =20 @@ -54,7 +54,7 @@ static int bcm2711_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops bcm2711_thermal_of_ops =3D { +static const struct thermal_zone_device_ops bcm2711_thermal_of_ops =3D { .get_temp =3D bcm2711_get_temp, }; =20 @@ -88,8 +88,8 @@ static int bcm2711_thermal_probe(struct platform_device *= pdev) } priv->regmap =3D regmap; =20 - thermal =3D devm_thermal_zone_of_sensor_register(dev, 0, priv, - &bcm2711_thermal_of_ops); + thermal =3D devm_thermal_of_zone_register(dev, 0, priv, + &bcm2711_thermal_of_ops); if (IS_ERR(thermal)) { ret =3D PTR_ERR(thermal); dev_err(dev, "could not register sensor: %d\n", ret); diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/b= roadcom/bcm2835_thermal.c index c8e4344d5a3d..2c67841a1115 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -88,9 +88,9 @@ static int bcm2835_thermal_temp2adc(int temp, int offset,= int slope) return temp; } =20 -static int bcm2835_thermal_get_temp(void *d, int *temp) +static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *t= emp) { - struct bcm2835_thermal_data *data =3D d; + struct bcm2835_thermal_data *data =3D tz->devdata; u32 val =3D readl(data->regs + BCM2835_TS_TSENSSTAT); =20 if (!(val & BCM2835_TS_TSENSSTAT_VALID)) @@ -135,7 +135,7 @@ static void bcm2835_thermal_debugfs(struct platform_dev= ice *pdev) debugfs_create_regset32("regset", 0444, data->debugfsdir, regset); } =20 -static const struct thermal_zone_of_device_ops bcm2835_thermal_ops =3D { +static const struct thermal_zone_device_ops bcm2835_thermal_ops =3D { .get_temp =3D bcm2835_thermal_get_temp, }; =20 @@ -206,8 +206,8 @@ static int bcm2835_thermal_probe(struct platform_device= *pdev) data->clk, rate); =20 /* register of thermal sensor and get info from DT */ - tz =3D thermal_zone_of_sensor_register(&pdev->dev, 0, data, - &bcm2835_thermal_ops); + tz =3D devm_thermal_of_zone_register(&pdev->dev, 0, data, + &bcm2835_thermal_ops); if (IS_ERR(tz)) { err =3D PTR_ERR(tz); dev_err(&pdev->dev, @@ -277,7 +277,7 @@ static int bcm2835_thermal_probe(struct platform_device= *pdev) =20 return 0; err_tz: - thermal_zone_of_sensor_unregister(&pdev->dev, tz); + thermal_of_zone_unregister(tz); err_clk: clk_disable_unprepare(data->clk); =20 @@ -290,7 +290,7 @@ static int bcm2835_thermal_remove(struct platform_devic= e *pdev) struct thermal_zone_device *tz =3D data->tz; =20 debugfs_remove_recursive(data->debugfsdir); - thermal_zone_of_sensor_unregister(&pdev->dev, tz); + thermal_of_zone_unregister(tz); clk_disable_unprepare(data->clk); =20 return 0; diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/b= roadcom/brcmstb_thermal.c index 0cedb8b4f00a..c79c6cfdd74d 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -105,7 +105,7 @@ static struct avs_tmon_trip avs_tmon_trips[] =3D { struct brcmstb_thermal_params { unsigned int offset; unsigned int mult; - const struct thermal_zone_of_device_ops *of_ops; + const struct thermal_zone_device_ops *of_ops; }; =20 struct brcmstb_thermal_priv { @@ -150,9 +150,9 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_= thermal_priv *priv, return (u32)((offset - temp) / mult); } =20 -static int brcmstb_get_temp(void *data, int *temp) +static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) { - struct brcmstb_thermal_priv *priv =3D data; + struct brcmstb_thermal_priv *priv =3D tz->devdata; u32 val; long t; =20 @@ -260,9 +260,9 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, voi= d *data) return IRQ_HANDLED; } =20 -static int brcmstb_set_trips(void *data, int low, int high) +static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int = high) { - struct brcmstb_thermal_priv *priv =3D data; + struct brcmstb_thermal_priv *priv =3D tz->devdata; =20 dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high); =20 @@ -288,7 +288,7 @@ static int brcmstb_set_trips(void *data, int low, int h= igh) return 0; } =20 -static const struct thermal_zone_of_device_ops brcmstb_16nm_of_ops =3D { +static const struct thermal_zone_device_ops brcmstb_16nm_of_ops =3D { .get_temp =3D brcmstb_get_temp, }; =20 @@ -298,7 +298,7 @@ static const struct brcmstb_thermal_params brcmstb_16nm= _params =3D { .of_ops =3D &brcmstb_16nm_of_ops, }; =20 -static const struct thermal_zone_of_device_ops brcmstb_28nm_of_ops =3D { +static const struct thermal_zone_device_ops brcmstb_28nm_of_ops =3D { .get_temp =3D brcmstb_get_temp, .set_trips =3D brcmstb_set_trips, }; @@ -318,7 +318,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table); =20 static int brcmstb_thermal_probe(struct platform_device *pdev) { - const struct thermal_zone_of_device_ops *of_ops; + const struct thermal_zone_device_ops *of_ops; struct thermal_zone_device *thermal; struct brcmstb_thermal_priv *priv; struct resource *res; @@ -341,8 +341,8 @@ static int brcmstb_thermal_probe(struct platform_device= *pdev) platform_set_drvdata(pdev, priv); of_ops =3D priv->temp_params->of_ops; =20 - thermal =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, - of_ops); + thermal =3D devm_thermal_of_zone_register(&pdev->dev, 0, priv, + of_ops); if (IS_ERR(thermal)) { ret =3D PTR_ERR(thermal); dev_err(&pdev->dev, "could not register sensor: %d\n", ret); diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadc= om/ns-thermal.c index c9468ba9d449..07a8a3f49bd0 100644 --- a/drivers/thermal/broadcom/ns-thermal.c +++ b/drivers/thermal/broadcom/ns-thermal.c @@ -14,19 +14,14 @@ #define PVTMON_CONTROL0_SEL_TEST_MODE 0x0000000e #define PVTMON_STATUS 0x08 =20 -struct ns_thermal { - struct thermal_zone_device *tz; - void __iomem *pvtmon; -}; - -static int ns_thermal_get_temp(void *data, int *temp) +static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct ns_thermal *ns_thermal =3D data; - int offset =3D thermal_zone_get_offset(ns_thermal->tz); - int slope =3D thermal_zone_get_slope(ns_thermal->tz); + void __iomem *pvtmon =3D tz->devdata; + int offset =3D thermal_zone_get_offset(tz); + int slope =3D thermal_zone_get_slope(tz); u32 val; =20 - val =3D readl(ns_thermal->pvtmon + PVTMON_CONTROL0); + val =3D readl(pvtmon + PVTMON_CONTROL0); if ((val & PVTMON_CONTROL0_SEL_MASK) !=3D PVTMON_CONTROL0_SEL_TEMP_MONITO= R) { /* Clear current mode selection */ val &=3D ~PVTMON_CONTROL0_SEL_MASK; @@ -34,50 +29,47 @@ static int ns_thermal_get_temp(void *data, int *temp) /* Set temp monitor mode (it's the default actually) */ val |=3D PVTMON_CONTROL0_SEL_TEMP_MONITOR; =20 - writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0); + writel(val, pvtmon + PVTMON_CONTROL0); } =20 - val =3D readl(ns_thermal->pvtmon + PVTMON_STATUS); + val =3D readl(pvtmon + PVTMON_STATUS); *temp =3D slope * val + offset; =20 return 0; } =20 -static const struct thermal_zone_of_device_ops ns_thermal_ops =3D { +static const struct thermal_zone_device_ops ns_thermal_ops =3D { .get_temp =3D ns_thermal_get_temp, }; =20 static int ns_thermal_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - struct ns_thermal *ns_thermal; - - ns_thermal =3D devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL); - if (!ns_thermal) - return -ENOMEM; + struct thermal_zone_device *tz; + void __iomem *pvtmon; =20 - ns_thermal->pvtmon =3D of_iomap(dev_of_node(dev), 0); - if (WARN_ON(!ns_thermal->pvtmon)) + pvtmon =3D of_iomap(dev_of_node(dev), 0); + if (WARN_ON(!pvtmon)) return -ENOENT; =20 - ns_thermal->tz =3D devm_thermal_zone_of_sensor_register(dev, 0, - ns_thermal, - &ns_thermal_ops); - if (IS_ERR(ns_thermal->tz)) { - iounmap(ns_thermal->pvtmon); - return PTR_ERR(ns_thermal->tz); + tz =3D devm_thermal_of_zone_register(dev, 0, + pvtmon, + &ns_thermal_ops); + if (IS_ERR(tz)) { + iounmap(pvtmon); + return PTR_ERR(tz); } =20 - platform_set_drvdata(pdev, ns_thermal); + platform_set_drvdata(pdev, pvtmon); =20 return 0; } =20 static int ns_thermal_remove(struct platform_device *pdev) { - struct ns_thermal *ns_thermal =3D platform_get_drvdata(pdev); + void __iomem *pvtmon =3D platform_get_drvdata(pdev); =20 - iounmap(ns_thermal->pvtmon); + iounmap(pvtmon); =20 return 0; } diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadc= om/sr-thermal.c index 85ab9edd580c..2b93502543ff 100644 --- a/drivers/thermal/broadcom/sr-thermal.c +++ b/drivers/thermal/broadcom/sr-thermal.c @@ -19,7 +19,6 @@ #define SR_TMON_MAX_LIST 6 =20 struct sr_tmon { - struct thermal_zone_device *tz; unsigned int crit_temp; unsigned int tmon_id; struct sr_thermal *priv; @@ -31,9 +30,9 @@ struct sr_thermal { struct sr_tmon tmon[SR_TMON_MAX_LIST]; }; =20 -static int sr_get_temp(void *data, int *temp) +static int sr_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sr_tmon *tmon =3D data; + struct sr_tmon *tmon =3D tz->devdata; struct sr_thermal *sr_thermal =3D tmon->priv; =20 *temp =3D readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id)); @@ -41,13 +40,14 @@ static int sr_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops sr_tz_ops =3D { +static const struct thermal_zone_device_ops sr_tz_ops =3D { .get_temp =3D sr_get_temp, }; =20 static int sr_thermal_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; + struct thermal_zone_device *tz; struct sr_thermal *sr_thermal; struct sr_tmon *tmon; struct resource *res; @@ -84,10 +84,10 @@ static int sr_thermal_probe(struct platform_device *pde= v) writel(0, sr_thermal->regs + SR_TMON_TEMP_BASE(i)); tmon->tmon_id =3D i; tmon->priv =3D sr_thermal; - tmon->tz =3D devm_thermal_zone_of_sensor_register(dev, i, tmon, - &sr_tz_ops); - if (IS_ERR(tmon->tz)) - return PTR_ERR(tmon->tz); + tz =3D devm_thermal_of_zone_register(dev, i, tmon, + &sr_tz_ops); + if (IS_ERR(tz)) + return PTR_ERR(tz); =20 dev_dbg(dev, "thermal sensor %d registered\n", i); } --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 AC28DC43334 for ; Mon, 25 Jul 2022 21:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237306AbiGYV2W (ORCPT ); Mon, 25 Jul 2022 17:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237440AbiGYV1o (ORCPT ); Mon, 25 Jul 2022 17:27:44 -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 09FD024F0D for ; Mon, 25 Jul 2022 14:27:25 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id h8so17696994wrw.1 for ; Mon, 25 Jul 2022 14:27:25 -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=JzvszfNQi5ejtAVUKzxFeqJKoKFcM2OL5I7wo6yOLUs=; b=30tz9RSnRYSbuuM1oeVf1s2lZN9N4F0FgqdOWOrdR7cPhuD2MR9UEt9RaXKjTPVUf1 2vS1HYTW7ESNwsM2aNSSqfFY65Ag93xVnanV7lmxzO1S7FMsTQzLA0v7FNd3HxY0b/Kp 5wP1ptbmzdCwSgp6o4NaD4wmCJApqE+98DHMks8hCMxcZa0vGv9O9sNQk5/9NSAXuhhw 3hYlDetbp4FKQogSBPdEcnGcJ7FhRH7dEkZaWYLgqe8l/rQWSsfm6AvcGlhZrts4wdzr COm5WvwxBPxGwXscqkQS9v3/AmlrDG7NO8o7i2xKLeaWNsuXUSU24dvlXzUDE4y7hiO/ mjXw== 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=JzvszfNQi5ejtAVUKzxFeqJKoKFcM2OL5I7wo6yOLUs=; b=nfYT3x1L6CwuujvyVavuxtg1pJS0ba2oZMdBPybo/6cx5idONgf7wMyHgDFAqfOW/Q D9oed2uDAect4AYFTiItKIMe5Q540JZ81ZXxpqBjqXhqOFKoTTRnYp7wUP34RUT7M8/2 0E69zevN/GKz+xpuvB2gosOjDIxZVX2wYVqGvU1/CKx/ccREU1kiZLkVNKhQ/x1o0ypK aLaK+ZIqpe0vTQZ3jguP47WH6F7wAsnhfp2F6fM6Wr8LOQOujqvu5yqviouZzLYhOJqn pygtgvm7rCzAJI1hdHpqLftuTLzWYLUg1sUNoAZ7z4+5I62XvnyRROwKvctMQdSHNYz3 ewgg== X-Gm-Message-State: AJIora/pwuzvDSuh6o/556bE39xjsHJjsjEyzin/nper7U0+hYeExABS BOpktXiw+yBxOlxe4hORDjbuGQ== X-Google-Smtp-Source: AGRyM1s9U02hra/VlDZWxvjRyNZFd/1Tk6FvV9bK+K+imuW0mbzylMH7L/c1GkdsuTGl4xbLLXpS1A== X-Received: by 2002:a5d:514e:0:b0:21e:4fe8:cbb2 with SMTP id u14-20020a5d514e000000b0021e4fe8cbb2mr8558182wrt.162.1658784444102; Mon, 25 Jul 2022 14:27:24 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:23 -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, Andy Gross , Amit Kucheria , Thara Gopinath , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH v2 11/32] thermal/drivers/qcom: Switch to new of API Date: Mon, 25 Jul 2022 23:26:16 +0200 Message-Id: <20220725212637.2818207-12-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/qcom/qcom-spmi-adc-tm5.c | 19 +++++++++---------- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 12 ++++++------ drivers/thermal/qcom/tsens.c | 20 ++++++++++---------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qco= m/qcom-spmi-adc-tm5.c index d9c9c975f931..8e23013a21cc 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -355,9 +355,9 @@ static irqreturn_t adc_tm5_gen2_isr(int irq, void *data) return IRQ_HANDLED; } =20 -static int adc_tm5_get_temp(void *data, int *temp) +static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp) { - struct adc_tm5_channel *channel =3D data; + struct adc_tm5_channel *channel =3D tz->devdata; int ret; =20 if (!channel || !channel->iio) @@ -637,9 +637,9 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channe= l *channel, int low, int return ret; } =20 -static int adc_tm5_set_trips(void *data, int low, int high) +static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int = high) { - struct adc_tm5_channel *channel =3D data; + struct adc_tm5_channel *channel =3D tz->devdata; struct adc_tm5_chip *chip; int ret; =20 @@ -658,7 +658,7 @@ static int adc_tm5_set_trips(void *data, int low, int h= igh) return ret; } =20 -static struct thermal_zone_of_device_ops adc_tm5_thermal_ops =3D { +static const struct thermal_zone_device_ops adc_tm5_thermal_ops =3D { .get_temp =3D adc_tm5_get_temp, .set_trips =3D adc_tm5_set_trips, }; @@ -670,11 +670,10 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *= adc_tm) =20 for (i =3D 0; i < adc_tm->nchannels; i++) { adc_tm->channels[i].chip =3D adc_tm; - - tzd =3D devm_thermal_zone_of_sensor_register(adc_tm->dev, - adc_tm->channels[i].channel, - &adc_tm->channels[i], - &adc_tm5_thermal_ops); + tzd =3D devm_thermal_of_zone_register(adc_tm->dev, + adc_tm->channels[i].channel, + &adc_tm->channels[i], + &adc_tm5_thermal_ops); if (IS_ERR(tzd)) { if (PTR_ERR(tzd) =3D=3D -ENODEV) { dev_warn(adc_tm->dev, "thermal sensor on channel %d is not used\n", diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/= qcom/qcom-spmi-temp-alarm.c index 7419e196dbb0..3d3ad0a27482 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -185,9 +185,9 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_ch= ip *chip) return 0; } =20 -static int qpnp_tm_get_temp(void *data, int *temp) +static int qpnp_tm_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qpnp_tm_chip *chip =3D data; + struct qpnp_tm_chip *chip =3D tz->devdata; int ret, mili_celsius; =20 if (!temp) @@ -262,9 +262,9 @@ static int qpnp_tm_update_critical_trip_temp(struct qpn= p_tm_chip *chip, return qpnp_tm_write(chip, QPNP_TM_REG_SHUTDOWN_CTRL1, reg); } =20 -static int qpnp_tm_set_trip_temp(void *data, int trip, int temp) +static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip,= int temp) { - struct qpnp_tm_chip *chip =3D data; + struct qpnp_tm_chip *chip =3D tz->devdata; const struct thermal_trip *trip_points; int ret; =20 @@ -282,7 +282,7 @@ static int qpnp_tm_set_trip_temp(void *data, int trip, = int temp) return ret; } =20 -static const struct thermal_zone_of_device_ops qpnp_tm_sensor_ops =3D { +static const struct thermal_zone_device_ops qpnp_tm_sensor_ops =3D { .get_temp =3D qpnp_tm_get_temp, .set_trip_temp =3D qpnp_tm_set_trip_temp, }; @@ -445,7 +445,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) * read the trip points. get_temp() returns the default temperature * before the hardware initialization is completed. */ - chip->tz_dev =3D devm_thermal_zone_of_sensor_register( + chip->tz_dev =3D devm_thermal_of_zone_register( &pdev->dev, 0, chip, &qpnp_tm_sensor_ops); if (IS_ERR(chip->tz_dev)) { dev_err(&pdev->dev, "failed to register sensor\n"); diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 7963ee33bf75..7238d6d50f4e 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -532,9 +532,9 @@ static irqreturn_t tsens_irq_thread(int irq, void *data) return IRQ_HANDLED; } =20 -static int tsens_set_trips(void *_sensor, int low, int high) +static int tsens_set_trips(struct thermal_zone_device *tz, int low, int hi= gh) { - struct tsens_sensor *s =3D _sensor; + struct tsens_sensor *s =3D tz->devdata; struct tsens_priv *priv =3D s->priv; struct device *dev =3D priv->dev; struct tsens_irq_data d; @@ -925,17 +925,17 @@ int __init init_common(struct tsens_priv *priv) return ret; } =20 -static int tsens_get_temp(void *data, int *temp) +static int tsens_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsens_sensor *s =3D data; + struct tsens_sensor *s =3D tz->devdata; struct tsens_priv *priv =3D s->priv; =20 return priv->ops->get_temp(s, temp); } =20 -static int tsens_get_trend(void *data, int trip, enum thermal_trend *trend) +static int tsens_get_trend(struct thermal_zone_device *tz, int trip, enum = thermal_trend *trend) { - struct tsens_sensor *s =3D data; + struct tsens_sensor *s =3D tz->devdata; struct tsens_priv *priv =3D s->priv; =20 if (priv->ops->get_trend) @@ -1002,7 +1002,7 @@ static const struct of_device_id tsens_table[] =3D { }; MODULE_DEVICE_TABLE(of, tsens_table); =20 -static const struct thermal_zone_of_device_ops tsens_of_ops =3D { +static const struct thermal_zone_device_ops tsens_of_ops =3D { .get_temp =3D tsens_get_temp, .get_trend =3D tsens_get_trend, .set_trips =3D tsens_set_trips, @@ -1056,9 +1056,9 @@ static int tsens_register(struct tsens_priv *priv) =20 for (i =3D 0; i < priv->num_sensors; i++) { priv->sensor[i].priv =3D priv; - tzd =3D devm_thermal_zone_of_sensor_register(priv->dev, priv->sensor[i].= hw_id, - &priv->sensor[i], - &tsens_of_ops); + tzd =3D devm_thermal_of_zone_register(priv->dev, priv->sensor[i].hw_id, + &priv->sensor[i], + &tsens_of_ops); if (IS_ERR(tzd)) continue; priv->sensor[i].tzd =3D tzd; --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 A20DCCCA48D for ; Mon, 25 Jul 2022 21:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236610AbiGYV22 (ORCPT ); Mon, 25 Jul 2022 17:28:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237334AbiGYV1q (ORCPT ); Mon, 25 Jul 2022 17:27:46 -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 3745F248DC for ; Mon, 25 Jul 2022 14:27:29 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id v13so9937699wru.12 for ; Mon, 25 Jul 2022 14:27:28 -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=Dxp2C7hOahM111jOQKxvW4vMPiwlgfAm7+eoRoP/H0c=; b=s0JsTCXNvt2WXkcPVxGiAIXsDZBIj5/AZesH2AAmCTyIEv16R//Vuw19MnW0bj3ZRG XuDTksIpw4MlrYs/cjNUee35Kgmoe3mzLas8SPOGTENfmGVbH62AekMDGcRqLfQfWx47 QHIJhEK+pvoQ3OsvU0bIKjNE0bSLJAMh1vWLYkZRZ1FM0BBm/fy51sDs8JmlHV2m1ZWk uGOZ46cC8LTcgJ2lt0ZmOzv5Is22R7LxCyO8G3Ly7NxpLMANhOBsRN4SMSvI3Ld25F+S /xlPKQnTOzN6Ag/mIT7OrSfged+na2T1jYMqAO/K8bndS3mUwyKaqU4VBTJR8Fqq3L01 eW7A== 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=Dxp2C7hOahM111jOQKxvW4vMPiwlgfAm7+eoRoP/H0c=; b=zMXG7Uo6/HXW/oW69ZH0iukagUT9RIxoRA0rG8oeTY0m4gvr9iWt81azKm+E7+vvlu uOKPX7j+0//UmHQe9LDWyRI+iS136vJotDn8egDqtLrbFGEzZdxV/wuPalsW5hM5aRDA ziB7Od/1YafLpsP+ipV1Nibf8GZ15iXsTF1CkFz/MTpZjeX/Iv/mrozRHqegsBZmkuHp Wgq1i8078wwUVWywI0fkiA2GGaak4iZg6VYA651UkUw3aBtyMLHNmseEihFShH3XJBwP rdWUFhijRV81z/rNIw/XGaWJFT2G8LLwWQLi1G+x/zKSxKfUzWYMCUJzjnJErOeg2mNb WryQ== X-Gm-Message-State: AJIora99jSR87rVoH8f35lOTxFcS/Lc4Kz6Wp75RAXamZviDPcqjW7fy G2OyxRtrzA/gVY7hbRmxROk3PQ== X-Google-Smtp-Source: AGRyM1tLUg/TxD3ibkRz8emLONGbMJ+9j8IhiFQVSF+CzEDj/RrI348CxZMU0187ugCaQfxFAjyrsQ== X-Received: by 2002:a05:6000:1a85:b0:21e:88f9:848d with SMTP id f5-20020a0560001a8500b0021e88f9848dmr4392788wry.82.1658784447240; Mon, 25 Jul 2022 14:27:27 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:26 -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 , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com (moderated list:ARM/STM32 ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:ARM/STM32 ARCHITECTURE) Subject: [PATCH v2 12/32] thermal/drivers/st: Switch to new of API Date: Mon, 25 Jul 2022 23:26:17 +0200 Message-Id: <20220725212637.2818207-13-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/st/stm_thermal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_ther= mal.c index 5fd3fb8912a6..e4ca0d504a4f 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -302,9 +302,9 @@ static int stm_disable_irq(struct stm_thermal_sensor *s= ensor) return 0; } =20 -static int stm_thermal_set_trips(void *data, int low, int high) +static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, = int high) { - struct stm_thermal_sensor *sensor =3D data; + struct stm_thermal_sensor *sensor =3D tz->devdata; u32 itr1, th; int ret; =20 @@ -350,9 +350,9 @@ static int stm_thermal_set_trips(void *data, int low, i= nt high) } =20 /* Callback to get temperature from HW */ -static int stm_thermal_get_temp(void *data, int *temp) +static int stm_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct stm_thermal_sensor *sensor =3D data; + struct stm_thermal_sensor *sensor =3D tz->devdata; u32 periods; int freqM, ret; =20 @@ -474,7 +474,7 @@ static int stm_thermal_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, stm_thermal_suspend, stm_thermal_resume); =20 -static const struct thermal_zone_of_device_ops stm_tz_ops =3D { +static const struct thermal_zone_device_ops stm_tz_ops =3D { .get_temp =3D stm_thermal_get_temp, .set_trips =3D stm_thermal_set_trips, }; @@ -539,9 +539,9 @@ static int stm_thermal_probe(struct platform_device *pd= ev) return ret; } =20 - sensor->th_dev =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, - sensor, - &stm_tz_ops); + sensor->th_dev =3D devm_thermal_of_zone_register(&pdev->dev, 0, + sensor, + &stm_tz_ops); =20 if (IS_ERR(sensor->th_dev)) { dev_err(&pdev->dev, "%s: thermal zone sensor registering KO\n", --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 110AEC433EF for ; Mon, 25 Jul 2022 21:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237378AbiGYV2c (ORCPT ); Mon, 25 Jul 2022 17:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237372AbiGYV1r (ORCPT ); Mon, 25 Jul 2022 17:27:47 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC74324F21 for ; Mon, 25 Jul 2022 14:27:31 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id h9so17756372wrm.0 for ; Mon, 25 Jul 2022 14:27:31 -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=YLbrdXUnmrQegHQ4ArILFVac507m4xUt/E4MiWL2p00=; b=5obZF+IG/xdPPKwvOIBUwn2Hf6xxT1MDTwIAwW4oZQErkW4sorJfIuG5NMjy/WfJe2 8ysob65cSqtWIe+CFNTlIrL7qJPGGVYorc1O3o5eg5pIA2OiZOP/hSyf/uQ10QVWsbSM /xd3zRQ5+d1hMbKpKVfKLTkbiU5olsoFIJBPV4FSsxX+Ov9xLAmbgQ+8vQBhk/ERbIAE qxnDSZZ+kpTZ7lDd+g/BlAyYHMT6PWdU1n7kjvqD/TCoHhfqrzv5xBI51YoVem3W9ofI 2cgL+YZVeGlk3Ra5VOtXvL4pGJFVDZjAIl16xBwN9vnJRNx4ojtv+4YRC5ZOMhDyDsTd PivQ== 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=YLbrdXUnmrQegHQ4ArILFVac507m4xUt/E4MiWL2p00=; b=s6bmDu/KOp5bz5uin4Jd4mD5nlD5gkC8pRXQJ1yumQGb03898Z8vl7iLPlYAVj7aZZ ozMkGMlnmhtgv51i8yNqFXSoZjA0ZXfcy1lzSX33XeLKTjiLYJxHfqH65nLf5WRQj5WG sCgJ+oVktvNu0EVQcnm1gTwCO6UwcpluQr7kxo4vmnTsAXutqTUlzOasoWlAwACRuIVa OwxocJTrvoOIZX9v/FUpHlAPpB7B1H7T2dceWcG6EAUvV3qHrfr6jG6Pd8/+Wt/trvkP 3nDAsbZlKo2aiKvlSpRq9GZwsot/GyI4Qi29p8H5h6Ngrj7c+7E/mMLVUVK+QqrZLMB1 EUDA== X-Gm-Message-State: AJIora8vx4bKM2N2Lm8cnTVFHx5b65yi1Y+ItqidA1R2hzxZ00ibTUsB Sn0g7ZibPMsRDU/SbGcyLxrqFw== X-Google-Smtp-Source: AGRyM1uqbR2UqwczcVNLDMmivmK8GC2b7p7ZjfknP1S0kTyDeKlT36aRIN75zYUuHNl1fngQZvICTw== X-Received: by 2002:adf:979b:0:b0:21d:868a:7f2f with SMTP id s27-20020adf979b000000b0021d868a7f2fmr8703664wrb.409.1658784449396; Mon, 25 Jul 2022 14:27:29 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:29 -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-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS) Subject: [PATCH v2 13/32] thermal/drivers/amlogic: Switch to new of API Date: Mon, 25 Jul 2022 23:26:18 +0200 Message-Id: <20220725212637.2818207-14-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/amlogic_thermal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_th= ermal.c index e61b91d14ad1..d30cb791e63c 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -179,12 +179,12 @@ static int amlogic_thermal_disable(struct amlogic_the= rmal *data) return 0; } =20 -static int amlogic_thermal_get_temp(void *data, int *temp) +static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *t= emp) { unsigned int tval; - struct amlogic_thermal *pdata =3D data; + struct amlogic_thermal *pdata =3D tz->devdata; =20 - if (!data) + if (!pdata) return -EINVAL; =20 regmap_read(pdata->regmap, TSENSOR_STAT0, &tval); @@ -195,7 +195,7 @@ static int amlogic_thermal_get_temp(void *data, int *te= mp) return 0; } =20 -static const struct thermal_zone_of_device_ops amlogic_thermal_ops =3D { +static const struct thermal_zone_device_ops amlogic_thermal_ops =3D { .get_temp =3D amlogic_thermal_get_temp, }; =20 @@ -276,10 +276,10 @@ static int amlogic_thermal_probe(struct platform_devi= ce *pdev) return PTR_ERR(pdata->sec_ao_map); } =20 - pdata->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - 0, - pdata, - &amlogic_thermal_ops); + pdata->tzd =3D devm_thermal_of_zone_register(&pdev->dev, + 0, + pdata, + &amlogic_thermal_ops); if (IS_ERR(pdata->tzd)) { ret =3D PTR_ERR(pdata->tzd); dev_err(dev, "Failed to register tsensor: %d\n", ret); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 ED00CC43334 for ; Mon, 25 Jul 2022 21:28:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235735AbiGYV2l (ORCPT ); Mon, 25 Jul 2022 17:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234254AbiGYV2E (ORCPT ); Mon, 25 Jul 2022 17:28:04 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A4A124F3F for ; Mon, 25 Jul 2022 14:27:35 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id m17so17425551wrw.7 for ; Mon, 25 Jul 2022 14:27:35 -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=3KXZ40ukCVssYokTyD4CFy6bR4TME8bIQCib4ndaUEM=; b=TrmbTyY+Jm2q3X/X6q1QtexNHvpBiAtomY5PyCgxik2uwmeaOGsOEuZemKSuqC97io Sk5axPQjpfDHpUFPl4ipa5f4cqQs9MVFPBDsO5t3w3MzZ39hrFXWdlt2VXIrcIASvktu TZISCuAMjEKCDjKiV2pWa1SkEreQbNQOu8mWIpovWrCB8o9zXvfjmfMekKdDhSGmlt/V tviRbaSiOAiiOy7W0YREjxbLjNFVkV4IefXYr6J+6/IAjMGPR6yb3r6ILhaXkCz/L2kp 1Vw76tVpM8nPiiUODJ9GLAFiE2TW1SQrC/T2WtCc9qg66L6byOzbALRM5EWxFyORY0Vp h58Q== 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=3KXZ40ukCVssYokTyD4CFy6bR4TME8bIQCib4ndaUEM=; b=0A38iUnu5L2aA/273LYr2EvbxiPMZNXczcseVHbwaNbIAB+7nrg0CNpX96MobxGqjT bThKKZIh25r70ocEx8Cx7bTJS2cOW7JedonQiCBOJF8bGKcEYlcTQfteSRUvd2ZofvgT 9tAjxmbZHK2kAICWp2TGGrsJqKMHVk5y0sVgCaavLU8UrEOg5Bws8GTr/T0ceGUnS/Xa 4giXQLFgbRYHWQ88nKSwMysY9FxV2eTStVwikAVEotqXqxflHmgEQlsNlH/bmRtYOA3d WPhAVNZo21yW2XjQrH4E8zWDNgoYl/FHyYDZILdEfaRq3f7Xh9JiguyLtlQfq2LSzpGI FbKw== X-Gm-Message-State: AJIora8RapDaZ+j0UTsEx2omYYJcyd3TP/OZiRWFF+4xrS+Llut/nZYH Y5w0LGh+CR0pmS2IqmkDLGuRBg== X-Google-Smtp-Source: AGRyM1umqWm+lULt+EkMxEKGIKTa0FZKFgM3T61QU8a0rBwxpmni/9bWC4Jmj8OwNZ9DmLN1TN8HMA== X-Received: by 2002:adf:fb83:0:b0:21d:649a:72d9 with SMTP id a3-20020adffb83000000b0021d649a72d9mr8412084wrr.688.1658784451499; Mon, 25 Jul 2022 14:27:31 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:31 -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 14/32] thermal/drivers/armada: Switch to new of API Date: Mon, 25 Jul 2022 23:26:19 +0200 Message-Id: <20220725212637.2818207-15-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/armada_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_ther= mal.c index c2ebfb5be4b3..52d63b3997fe 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -420,9 +420,9 @@ static struct thermal_zone_device_ops legacy_ops =3D { .get_temp =3D armada_get_temp_legacy, }; =20 -static int armada_get_temp(void *_sensor, int *temp) +static int armada_get_temp(struct thermal_zone_device *tz, int *temp) { - struct armada_thermal_sensor *sensor =3D _sensor; + struct armada_thermal_sensor *sensor =3D tz->devdata; struct armada_thermal_priv *priv =3D sensor->priv; int ret; =20 @@ -450,7 +450,7 @@ static int armada_get_temp(void *_sensor, int *temp) return ret; } =20 -static const struct thermal_zone_of_device_ops of_ops =3D { +static const struct thermal_zone_device_ops of_ops =3D { .get_temp =3D armada_get_temp, }; =20 @@ -928,9 +928,9 @@ static int armada_thermal_probe(struct platform_device = *pdev) /* Register the sensor */ sensor->priv =3D priv; sensor->id =3D sensor_id; - tz =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->id, sensor, - &of_ops); + tz =3D devm_thermal_of_zone_register(&pdev->dev, + sensor->id, sensor, + &of_ops); if (IS_ERR(tz)) { dev_info(&pdev->dev, "Thermal sensor %d unavailable\n", sensor_id); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 AC58DC43334 for ; Mon, 25 Jul 2022 21:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234387AbiGYV2p (ORCPT ); Mon, 25 Jul 2022 17:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237134AbiGYV2F (ORCPT ); Mon, 25 Jul 2022 17:28:05 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B16125281 for ; Mon, 25 Jul 2022 14:27:36 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id bn9so6832481wrb.9 for ; Mon, 25 Jul 2022 14:27:35 -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=c3dKZnAQZ0SIws+k1uhBHAMzUVp1fju47+AzixoTetw=; b=xCB8b9yxfHutieAo2I7Va3xYv0mtoYLkiW5s/GVWIh9uwWv3uDEtFciwSTI/u+XqTq GYUGN+hXxVN+UTPizFH+ucpPxf+DRrvGfWRXdYDHyx28B2o6v8oiyqrb0bP7J5CGbTD7 EX0sSXnmWrmA3nB37Umc2GNx4rR8uaxrlUhzn3eqJrC/H6DwLhHhexF99qCTVu3+nvj3 a9p537layJ1A0CPETRgwg7nMakZ+68pBNjx8HRRV6G/aYHp91U8O+Up/kro1lVgCE/km bUbv8O7mI5fX/5GAoVksjoRtXkSYfRTrvp2zQb1XyPQiyin68V64s34AVD6/OzbTDVio M+KA== 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=c3dKZnAQZ0SIws+k1uhBHAMzUVp1fju47+AzixoTetw=; b=sBBKrBsXIiIHI+tVpJnfDGNSvgVvecDlZ75Y4p8wUOJEA/v4h2tsvDn6psfAHJjscH 68lSX1c7K16wlCc7NbKPP4iVJMcdQkzKPXDgtH30Uez4jIT0PwFGg54NLsMze4TsPQzt oEDoWb8hdQQONrFGQ5tI48VRuyWPcOLss6f2dhz/GTchmOQvJUiaW0kf8MWmEWdS2KUw /DQVy8JG32sIpslg6osV2CXPzirJfwHHV2HySxaHbPVlRrJgdZaOCDCKPvtKz5biTi+M riU2i+ADM9Ll616ffvSd0cH4E6EVyA/wpxUaznVWWvez/OjKRWP6tcNjsodNUL6I+BHs 9Cyw== X-Gm-Message-State: AJIora/JtwKGMeDWkmZgRzFr4Lh9I9j/ZFeQs6yGzZia0by/S9lYrsd0 hxZVO165QruAn2BIu9FiMdMJSw== X-Google-Smtp-Source: AGRyM1vdEFmGCxZV6Bkcky9o/pVtDI2YiKOZH0ksVzR74izu9hBmSAcPes1btztsU+d0UM/QyrWRGw== X-Received: by 2002:adf:f492:0:b0:21d:89d5:9443 with SMTP id l18-20020adff492000000b0021d89d59443mr8483081wro.201.1658784453592; Mon, 25 Jul 2022 14:27:33 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:33 -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 15/32] thermal/drivers/db8500: Switch to new of API Date: Mon, 25 Jul 2022 23:26:20 +0200 Message-Id: <20220725212637.2818207-16-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/db8500_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_ther= mal.c index 21d4d6e6409a..4d1b31930209 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -59,9 +59,9 @@ struct db8500_thermal_zone { }; =20 /* Callback to get current temperature */ -static int db8500_thermal_get_temp(void *data, int *temp) +static int db8500_thermal_get_temp(struct thermal_zone_device *tz, int *te= mp) { - struct db8500_thermal_zone *th =3D data; + struct db8500_thermal_zone *th =3D tz->devdata; =20 /* * TODO: There is no PRCMU interface to get temperature data currently, @@ -74,16 +74,16 @@ static int db8500_thermal_get_temp(void *data, int *tem= p) } =20 /* Callback to get temperature changing trend */ -static int db8500_thermal_get_trend(void *data, int trip, enum thermal_tre= nd *trend) +static int db8500_thermal_get_trend(struct thermal_zone_device *tz, int tr= ip, enum thermal_trend *trend) { - struct db8500_thermal_zone *th =3D data; + struct db8500_thermal_zone *th =3D tz->devdata; =20 *trend =3D th->trend; =20 return 0; } =20 -static struct thermal_zone_of_device_ops thdev_ops =3D { +static const struct thermal_zone_device_ops thdev_ops =3D { .get_temp =3D db8500_thermal_get_temp, .get_trend =3D db8500_thermal_get_trend, }; @@ -202,7 +202,7 @@ static int db8500_thermal_probe(struct platform_device = *pdev) } =20 /* register of thermal sensor and get info from DT */ - th->tz =3D devm_thermal_zone_of_sensor_register(dev, 0, th, &thdev_ops); + th->tz =3D devm_thermal_of_zone_register(dev, 0, th, &thdev_ops); if (IS_ERR(th->tz)) { dev_err(dev, "register thermal zone sensor failed\n"); return PTR_ERR(th->tz); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 81150CCA48A for ; Mon, 25 Jul 2022 21:28:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237250AbiGYV2w (ORCPT ); Mon, 25 Jul 2022 17:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237299AbiGYV2P (ORCPT ); Mon, 25 Jul 2022 17:28:15 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965FF24948 for ; Mon, 25 Jul 2022 14:27:38 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id d8so17621743wrp.6 for ; Mon, 25 Jul 2022 14:27:38 -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=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=zjdR9E4eOlA7485Udy+F2VuliqkiFtNIb1Iy4w6TDM2S/95oYjkeZp+tds9IdXlTrN UKK8Gw6ragqY1xMt8eZfQHNwDqD68UnFmmUfzoLdJbUp4lMGXcN12f163r33Qk4Xd8Z8 XGs1McLdMgndqRB1i008YqqhJf92BvX8OwHMyVonsqJGKCK32FzXeAcmuD9HJmgs4Bqo /Ggn2UVy0G9Md/0qfkM/zSxb3AWAB2dZM75b+/EvLSCkCzLIJJ+ITFofgMgg9OEpQ5F5 cBe9uqk66HuS8yIjHXcNQKACIt97G6V6qWVcBBQnW47liQ/c5Hti0OYKiUNRxC0GYfOW UeGQ== 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=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=b4/DibQP6Gd0ztahtDygjklvGWXTALZmWmOJzuH5TXZNXjeA/ondfoDa4GcF2Q2Hch JmcnHhSYen1bVP3zFKsRyucuQ2fNuLgRwHdr8HiNeX+VyqHmAXnBll0AyKY3gqtKdX6U lNIyAm6+TCSRZuqjL4ZuI48aeJeSgPlbBMJgdzkcNNSBmB3GdE1ePxDIFDKMo+mm9Bqf pj6kCpQkoWEPlb014VrKuiStap6LBCBGMlH1dGm1qKzpviM0Gb2JCXPhhxxSq3ervwu7 c/EA83KgSDu5FQc1+W8vhsNOkbx/4F6HYH19ijicOX5JFSuxDzZfW4ji015BcVI5Luuy mucg== X-Gm-Message-State: AJIora8Idoq9ZsQ8CLIazxtA/hIev6tI8w55Uo8x7+J4mbOto5jUYrIa TtX5aaNcgEiYLCJlouO3XfX2cQ== X-Google-Smtp-Source: AGRyM1us+9EShmMg2IdStuWqW6GotveB0ReZJ6CFToeHn6HBdpQ5syMyeuCIZtxuWywyLn/TlD8REg== X-Received: by 2002:a5d:59a4:0:b0:21e:8704:ea35 with SMTP id p4-20020a5d59a4000000b0021e8704ea35mr4646344wrr.442.1658784455921; Mon, 25 Jul 2022 14:27:35 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:35 -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 , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v2 16/32] thermal/drivers/imx: Switch to new of API Date: Mon, 25 Jul 2022 23:26:21 +0200 Message-Id: <20220725212637.2818207-17-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/imx8mm_thermal.c | 14 +++++++------- drivers/thermal/imx_sc_thermal.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_ther= mal.c index af666bd9e8d4..e2c2673025a7 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -96,15 +96,15 @@ static int imx8mp_tmu_get_temp(void *data, int *temp) return 0; } =20 -static int tmu_get_temp(void *data, int *temp) +static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tmu_sensor *sensor =3D data; + struct tmu_sensor *sensor =3D tz->devdata; struct imx8mm_tmu *tmu =3D sensor->priv; =20 - return tmu->socdata->get_temp(data, temp); + return tmu->socdata->get_temp(sensor, temp); } =20 -static struct thermal_zone_of_device_ops tmu_tz_ops =3D { +static const struct thermal_zone_device_ops tmu_tz_ops =3D { .get_temp =3D tmu_get_temp, }; =20 @@ -165,9 +165,9 @@ static int imx8mm_tmu_probe(struct platform_device *pde= v) for (i =3D 0; i < data->num_sensors; i++) { tmu->sensors[i].priv =3D tmu; tmu->sensors[i].tzd =3D - devm_thermal_zone_of_sensor_register(&pdev->dev, i, - &tmu->sensors[i], - &tmu_tz_ops); + devm_thermal_of_zone_register(&pdev->dev, i, + &tmu->sensors[i], + &tmu_tz_ops); if (IS_ERR(tmu->sensors[i].tzd)) { ret =3D PTR_ERR(tmu->sensors[i].tzd); dev_err(&pdev->dev, diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_ther= mal.c index 331a241eb0ef..10bfa6507eb4 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -43,11 +43,11 @@ struct imx_sc_msg_misc_get_temp { } data; } __packed __aligned(4); =20 -static int imx_sc_thermal_get_temp(void *data, int *temp) +static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *te= mp) { struct imx_sc_msg_misc_get_temp msg; struct imx_sc_rpc_msg *hdr =3D &msg.hdr; - struct imx_sc_sensor *sensor =3D data; + struct imx_sc_sensor *sensor =3D tz->devdata; int ret; =20 msg.data.req.resource_id =3D sensor->resource_id; @@ -70,7 +70,7 @@ static int imx_sc_thermal_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops imx_sc_thermal_ops =3D { +static const struct thermal_zone_device_ops imx_sc_thermal_ops =3D { .get_temp =3D imx_sc_thermal_get_temp, }; =20 @@ -109,10 +109,10 @@ static int imx_sc_thermal_probe(struct platform_devic= e *pdev) break; } =20 - sensor->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->resource_id, - sensor, - &imx_sc_thermal_ops); + sensor->tzd =3D devm_thermal_of_zone_register(&pdev->dev, + sensor->resource_id, + sensor, + &imx_sc_thermal_ops); if (IS_ERR(sensor->tzd)) { dev_err(&pdev->dev, "failed to register thermal zone\n"); ret =3D PTR_ERR(sensor->tzd); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 259E5C43334 for ; Mon, 25 Jul 2022 21:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237382AbiGYV3E (ORCPT ); Mon, 25 Jul 2022 17:29:04 -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 S237166AbiGYV2V (ORCPT ); Mon, 25 Jul 2022 17:28:21 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488F8240B8 for ; Mon, 25 Jul 2022 14:27:42 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id d8so17621809wrp.6 for ; Mon, 25 Jul 2022 14:27:42 -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=eVR4CSPKsg/9FjgYXPjuWPfFNd2Yr4TVj6UpwGUj8uE=; b=lSGPGFMkmPAlpwMQja5l9hBjP3O81WxKw62XODPcgnj8vjPYpPP90o/4ior5lPAeVi U45U1jdgD0+KoWva6cyR9xKmjWg3jwi8opCLROL9ffzB9cfXfnKEy4iRR6y4P8NmeBkd SbHNPFOp3f8Sbgfuy6meLRPhhX4nTQQ+uWv+6r8jtEYLofFpotNTjl6z52hWvZ9bC9w6 MNvJazEAtXxcvkyCQgJLwuPbde3M9uWkhDyusd9XsOGw+RkpLI+NckkkD1bZj95RGFjx KUvIgnJ7LKcg2aWOBD8N+KxiAsfk0cnUZ4scJqcFtVTwn7Phu2aT/AFmsf4t84kvH0a9 NrCg== 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=eVR4CSPKsg/9FjgYXPjuWPfFNd2Yr4TVj6UpwGUj8uE=; b=N1oqSP738dIpxum6b+PGjBm9C7D+rVWF807tP7lKvakITcBBq8RV9idnYgoO3BYhbp 6OR3w+GUyuXkIDOzj7r3UjsKl7vKDZnWnbyGOuuyVQzamOGmCs9b2oNst85r5rV+gZ4X 0Ov4HE93+tbvDdv4NV5TVDg8NjADQyySozB1D6k4OKZNRmWBn8LAx0wftyMBeUS9frb3 dGevTRCc8UJSXJbJV1hnGr4qu6qp0bsZOOSnVCDR08mvKb8GSX0Gh/aEe6BtNcbDqfyK 9q1fRVeiBUd3EAQS49qxTskEoSz09wrAu00TDbaTnuMwXsvV4S5V15+bXloB+x+lqCtd EIIg== X-Gm-Message-State: AJIora9z3s90B2xv1AWsjr6j20/GgnX21HA1mm00VpMNWFrhMJS83kf4 9wwp1xfVLllcd4PYogVtQdUCHQ== X-Google-Smtp-Source: AGRyM1toJIpS6B2vwFnLOmbxdgOlSmoXmAesaTeSUvZwvhTc9mjbi4Hm8bc6bah53VhNaD0bNzAdPA== X-Received: by 2002:adf:e405:0:b0:21d:86b6:a286 with SMTP id g5-20020adfe405000000b0021d86b6a286mr8723875wrm.29.1658784458040; Mon, 25 Jul 2022 14:27:38 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:37 -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-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS) Subject: [PATCH v2 17/32] thermal/drivers/rcar: Switch to new of API Date: Mon, 25 Jul 2022 23:26:22 +0200 Message-Id: <20220725212637.2818207-18-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Niklas S=C3=B6derlund --- drivers/thermal/rcar_gen3_thermal.c | 16 ++++++++-------- drivers/thermal/rcar_thermal.c | 13 +++---------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen= 3_thermal.c index 43eb25b167bc..29946114a8f9 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -164,9 +164,9 @@ static int rcar_gen3_thermal_round(int temp) return result * RCAR3_THERMAL_GRAN; } =20 -static int rcar_gen3_thermal_get_temp(void *devdata, int *temp) +static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int = *temp) { - struct rcar_gen3_thermal_tsc *tsc =3D devdata; + struct rcar_gen3_thermal_tsc *tsc =3D tz->devdata; int mcelsius, val; int reg; =20 @@ -203,9 +203,9 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rc= ar_gen3_thermal_tsc *tsc, return INT_FIXPT(val); } =20 -static int rcar_gen3_thermal_set_trips(void *devdata, int low, int high) +static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int= low, int high) { - struct rcar_gen3_thermal_tsc *tsc =3D devdata; + struct rcar_gen3_thermal_tsc *tsc =3D tz->devdata; u32 irqmsk =3D 0; =20 if (low !=3D -INT_MAX) { @@ -225,7 +225,7 @@ static int rcar_gen3_thermal_set_trips(void *devdata, i= nt low, int high) return 0; } =20 -static struct thermal_zone_of_device_ops rcar_gen3_tz_of_ops =3D { +static struct thermal_zone_device_ops rcar_gen3_tz_of_ops =3D { .get_temp =3D rcar_gen3_thermal_get_temp, .set_trips =3D rcar_gen3_thermal_set_trips, }; @@ -504,8 +504,8 @@ static int rcar_gen3_thermal_probe(struct platform_devi= ce *pdev) for (i =3D 0; i < priv->num_tscs; i++) { struct rcar_gen3_thermal_tsc *tsc =3D priv->tscs[i]; =20 - zone =3D devm_thermal_zone_of_sensor_register(dev, i, tsc, - &rcar_gen3_tz_of_ops); + zone =3D devm_thermal_of_zone_register(dev, i, tsc, + &rcar_gen3_tz_of_ops); if (IS_ERR(zone)) { dev_err(dev, "Can't register thermal zone\n"); ret =3D PTR_ERR(zone); @@ -556,7 +556,7 @@ static int __maybe_unused rcar_gen3_thermal_resume(stru= ct device *dev) =20 priv->thermal_init(tsc); if (zone->ops->set_trips) - rcar_gen3_thermal_set_trips(tsc, zone->prev_low_trip, + rcar_gen3_thermal_set_trips(zone, zone->prev_low_trip, zone->prev_high_trip); } =20 diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 1d729ed4d685..4df42d70d867 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -271,13 +271,6 @@ static int rcar_thermal_get_current_temp(struct rcar_t= hermal_priv *priv, return 0; } =20 -static int rcar_thermal_of_get_temp(void *data, int *temp) -{ - struct rcar_thermal_priv *priv =3D data; - - return rcar_thermal_get_current_temp(priv, temp); -} - static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *te= mp) { struct rcar_thermal_priv *priv =3D rcar_zone_to_priv(zone); @@ -323,8 +316,8 @@ static int rcar_thermal_get_trip_temp(struct thermal_zo= ne_device *zone, return 0; } =20 -static const struct thermal_zone_of_device_ops rcar_thermal_zone_of_ops = =3D { - .get_temp =3D rcar_thermal_of_get_temp, +static struct thermal_zone_device_ops rcar_thermal_zone_of_ops =3D { + .get_temp =3D rcar_thermal_get_temp, }; =20 static struct thermal_zone_device_ops rcar_thermal_zone_ops =3D { @@ -534,7 +527,7 @@ static int rcar_thermal_probe(struct platform_device *p= dev) goto error_unregister; =20 if (chip->use_of_thermal) { - priv->zone =3D devm_thermal_zone_of_sensor_register( + priv->zone =3D devm_thermal_of_zone_register( dev, i, priv, &rcar_thermal_zone_of_ops); } else { --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 B8140CCA48D for ; Mon, 25 Jul 2022 21:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237442AbiGYV3K (ORCPT ); Mon, 25 Jul 2022 17:29:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237360AbiGYV2S (ORCPT ); Mon, 25 Jul 2022 17:28:18 -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 AD9802528E for ; Mon, 25 Jul 2022 14:27:40 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id h8so17697611wrw.1 for ; Mon, 25 Jul 2022 14:27:40 -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=AIkP5yEBR5GKJ3aUA9N+TAtTaSaKWh3Ceyc1uHZ1AFY=; b=zKLep7ZP4eQUE2OtQJy0AcAkUoBJ1gNOPxidZBMf41sAXrCfPPR+G890EhSHjDAZ2S OUoOG1Cp+aYpe50QOoRLEykFmbyk7h4EzowjtaWirRl9p04XknlmIbar33NEA0LemQcY owFAsyIenT0g3mA21NWs4H2bSAXPrlEYK6Q/A/7hWz/hZaCXQxvvyR3Qcrb1yFuwc9Dg nUuAJ9ZzZOGc3HnnSV5o5DhTvhOgHPXHmbu2a7u57TWBJNAW0x0hanzFzqAsCE+JI+0I unWOilFgalslP+48Qzq/YRPld1PDT6GqVt1ObqXctp3UIpKl2dqe7kwk04qH+Zxiiqa0 maAw== 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=AIkP5yEBR5GKJ3aUA9N+TAtTaSaKWh3Ceyc1uHZ1AFY=; b=Fhwl5ZkW8h4WfAiQPILs8XmIXVTqLnzraOIIOYx4g1skjazX7K74tlWFqRVdS3ETm7 wgDy+XF4XSBc5JoU62cZC9NZjIXx1kheLsh8tI8qhA3gMSWUCv5NkNvsy/XUsYtDeDTC u3yRaqjuT+HKvKdKtCmWJt0WalNDy+OxEVGRLGySAA98Lk0vAA992wCUy7WMAXl+jeAa F0VbvZHAoGVQmLyN3hhJz79pgYRwvyOjDVHDpj5nJ0itlrt8p7qhgaBbL2Eoj4c9eSLa XiAYYOum7k2zVmeDhLvUvjHm40I5vgQ9LVtoNywhnE6T9IKDMpRv1a5bjGtZQelg5Tpk G6Kg== X-Gm-Message-State: AJIora+IocOG52YcXlu1J6WQSvnuYlCv9PiFVbfH6d/+X798jEThtOHo /waCmvYamtwj8mH+Zy11jjdcpg== X-Google-Smtp-Source: AGRyM1tARCp7uSjffUfQKVUoW24wjazyAHV4sc+dIhjRlduqJetCsedMAajv81sq9LCv7v9b5urcgw== X-Received: by 2002:a5d:4ece:0:b0:21e:7ed1:f195 with SMTP id s14-20020a5d4ece000000b0021e7ed1f195mr6434201wrv.662.1658784460116; Mon, 25 Jul 2022 14:27:40 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:39 -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 18/32] thermal/drivers/rzg2l: Switch to new of API Date: Mon, 25 Jul 2022 23:26:23 +0200 Message-Id: <20220725212637.2818207-19-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/rzg2l_thermal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_therma= l.c index be07e04c6926..0db784f7d5ed 100644 --- a/drivers/thermal/rzg2l_thermal.c +++ b/drivers/thermal/rzg2l_thermal.c @@ -73,9 +73,9 @@ static inline void rzg2l_thermal_write(struct rzg2l_therm= al_priv *priv, u32 reg, iowrite32(data, priv->base + reg); } =20 -static int rzg2l_thermal_get_temp(void *devdata, int *temp) +static int rzg2l_thermal_get_temp(struct thermal_zone_device *tz, int *tem= p) { - struct rzg2l_thermal_priv *priv =3D devdata; + struct rzg2l_thermal_priv *priv =3D tz->devdata; u32 result =3D 0, dsensor, ts_code_ave; int val, i; =20 @@ -111,7 +111,7 @@ static int rzg2l_thermal_get_temp(void *devdata, int *t= emp) return 0; } =20 -static const struct thermal_zone_of_device_ops rzg2l_tz_of_ops =3D { +static const struct thermal_zone_device_ops rzg2l_tz_of_ops =3D { .get_temp =3D rzg2l_thermal_get_temp, }; =20 @@ -203,8 +203,8 @@ static int rzg2l_thermal_probe(struct platform_device *= pdev) goto err; } =20 - zone =3D devm_thermal_zone_of_sensor_register(dev, 0, priv, - &rzg2l_tz_of_ops); + zone =3D devm_thermal_of_zone_register(dev, 0, priv, + &rzg2l_tz_of_ops); if (IS_ERR(zone)) { dev_err(dev, "Can't register thermal zone"); ret =3D PTR_ERR(zone); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 D503DCCA48A for ; Mon, 25 Jul 2022 21:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233302AbiGYV3W (ORCPT ); Mon, 25 Jul 2022 17:29:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237397AbiGYV20 (ORCPT ); Mon, 25 Jul 2022 17:28:26 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F9E24973 for ; Mon, 25 Jul 2022 14:27:45 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id h9so17756904wrm.0 for ; Mon, 25 Jul 2022 14:27:45 -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=CsU6ca+7WX/xVGECcsjSjS8CnQ/NXZV7RYxDyAjfgbo=; b=tjmiNYVqtsTChO02vhbkBNOAETx1giolsKbKa9UIaimnQiiS1T6pdHQp0b5G/IunYK xYlWtgk/sixvp/pvh3PSYS8QQDTV3rxGukQvo1qpLvjT6b/h2SXdvKOTlRIKn9RF/GQ8 lIRDVIO5fM64Dlk9BI3eBeyCvtIE37+5ozjxGRB/54yGknNnvclr/jdlBVkugB2xfw5u qq0oRa2ucA2+e9wifU4KUR3apoWjg4BcuV/GF437Rs7imkr+Fhl69Sdx41NbAf3LdBlk bZkmCwyY3L5Tgay0v5/P0MB+3iyDYpx9SXhXIqD7xRpzWAm+tF9fEnMP9dtYGVNp0MC+ iNQg== 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=CsU6ca+7WX/xVGECcsjSjS8CnQ/NXZV7RYxDyAjfgbo=; b=h1XkDH7yNMnkNmBVEXmJ6gSXS44WdqH6zeRwEnkqqdZ5q+VVIopzZa9632YKoc+CFe Wjjq0/mBPfYrnI91g+8lTOmZTNChZIU2LlbPFO/jg+eSfhRYcPIhrudugjbtCoe46ob6 A1XzivgblHd/aN29uB5CU2GbsuwQNw+MBCFzrtQR07K5A3yRDYZEix+eB5VX+nMQ/Omh bXCfW+sS3Q3hIKotiovkdx/OGGrLlZF++Heq77aGciC0P2msMzM14Nm5ua309hvyz0mU ixSRkCndbf0owwtfGsDsOMDd4QpGyNDT+SSZWWZGVmM7CBfxI5mdfC1BurKcy8MNV2Zi jUvQ== X-Gm-Message-State: AJIora8C0iw1TqdLvyeM4pKbycupKaF58Lc0KyslZmsekqaNlxmcHxPS ufnv5RG6Xzt8/cVZMlHFKXQMhw== X-Google-Smtp-Source: AGRyM1teSkYLdenuX2lRH71M/Hp1fJAVMWkEgZoTwY5yNri+eBJzdSNalR/lu2zwYWU5jGhKft4GGA== X-Received: by 2002:adf:f747:0:b0:21e:8e2a:7cbc with SMTP id z7-20020adff747000000b0021e8e2a7cbcmr3190615wrp.342.1658784462157; Mon, 25 Jul 2022 14:27:42 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:41 -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 19/32] thermal/drivers/qoriq: Switch to new of API Date: Mon, 25 Jul 2022 23:26:24 +0200 Message-Id: <20220725212637.2818207-20-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/qoriq_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_therma= l.c index 73049f9bea25..d111e218f362 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -82,9 +82,9 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct= qoriq_sensor *s) return container_of(s, struct qoriq_tmu_data, sensor[s->id]); } =20 -static int tmu_get_temp(void *p, int *temp) +static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qoriq_sensor *qsensor =3D p; + struct qoriq_sensor *qsensor =3D tz->devdata; struct qoriq_tmu_data *qdata =3D qoriq_sensor_to_data(qsensor); u32 val; /* @@ -122,7 +122,7 @@ static int tmu_get_temp(void *p, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops tmu_tz_ops =3D { +static const struct thermal_zone_device_ops tmu_tz_ops =3D { .get_temp =3D tmu_get_temp, }; =20 @@ -146,9 +146,9 @@ static int qoriq_tmu_register_tmu_zone(struct device *d= ev, =20 sensor->id =3D id; =20 - tzd =3D devm_thermal_zone_of_sensor_register(dev, id, - sensor, - &tmu_tz_ops); + tzd =3D devm_thermal_of_zone_register(dev, id, + sensor, + &tmu_tz_ops); ret =3D PTR_ERR_OR_ZERO(tzd); if (ret) { if (ret =3D=3D -ENODEV) --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 D154BC433EF for ; Mon, 25 Jul 2022 21:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235958AbiGYV32 (ORCPT ); Mon, 25 Jul 2022 17:29:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237409AbiGYV2a (ORCPT ); Mon, 25 Jul 2022 17:28:30 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1499F24979 for ; Mon, 25 Jul 2022 14:27:45 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id u5so17717455wrm.4 for ; Mon, 25 Jul 2022 14:27:45 -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=Y+4pPbHoJuz+mVWdzAPQM0rRrJIgIdixEMQHV/ZC2Bo=; b=ybgq1bQw5JTchd8a23+QTuXwRK92Wz4uj6aBKpdF2CjDPZvoPh1AhpM07Vfmh4dMc9 +tRqx6rBEv16XPq5nh6iX8HC3JyYRshmsE60ihz2r8O+CqI2ol93GArWwQMNrkBH6W+m 2ePcLAhTwaIumi7L06v3eb9pOqxjmey+jBW6XddLcAyz3j1KwRL6ZLYq2v8dxPzpTfc7 2SrtgSPNtG+T7It9Vdb/E/KOZ8crbZVMl4ov7bkEYTqNmaOC1/8h6KRfIwCF46QQfN6j hVXA8WON6RQn+Mu82nrUm4XVYx6Xkl52eomujzkl6kaagqE8VBZZaKKKuf065ykyWQEB NVyQ== 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=Y+4pPbHoJuz+mVWdzAPQM0rRrJIgIdixEMQHV/ZC2Bo=; b=5kUpXaWtqnVDLb6J4gchNxENr8MGLyexL4cAxGJuFfVxgM4x8JIu/14a9NbR0RGVxj xBDR63Ft6janYxgjoT29WTofPfWP4eeIKA6AWD4lY32LAQYuAYPPObgCv++pW1sMaAUo TZ1m/w8GMm4R8NIYALuko7DPgVrLk3SF/7zdNEvJaxEdLmwuZzV1Riy0QOJxpS5/opBh TTJ+48nOhMl30yQzoRp+RboryDf19lKM3SFQWXmipbgubDwwV1mYZ0M2GiHOggWYEA1x YIwnBtwrTtg6ZKEQIWurcUSsDkiL3wokTb4orCJ+HXBQ6wT3/H8j6ijtb3VXAck9raOi t8Cw== X-Gm-Message-State: AJIora/I7QKlfVsFJ16I4oXwy0VlOdKypDkFsZ2tjBi/j31A8oC1xX9k uj0vivWVvuxaA7BOJDqpdk1DzQ== X-Google-Smtp-Source: AGRyM1tVVTPgbv6m/PfwEAw+Q3+sp9/OXWPj7BXkkTzeL9SI/ci+YdWF7OjntDndJ+hlHcYZWICbpA== X-Received: by 2002:a5d:604a:0:b0:21e:6b84:a4d8 with SMTP id j10-20020a5d604a000000b0021e6b84a4d8mr8479548wrt.187.1658784464351; Mon, 25 Jul 2022 14:27:44 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:44 -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/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v2 20/32] thermal/drivers/mtk: Switch to new of API Date: Mon, 25 Jul 2022 23:26:25 +0200 Message-Id: <20220725212637.2818207-21-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: AngeloGioacchino Del Regno --- drivers/thermal/mtk_thermal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index ede94eadddda..8440692e3890 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -679,9 +679,9 @@ static int mtk_thermal_bank_temperature(struct mtk_ther= mal_bank *bank) return max; } =20 -static int mtk_read_temp(void *data, int *temperature) +static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) { - struct mtk_thermal *mt =3D data; + struct mtk_thermal *mt =3D tz->devdata; int i; int tempmax =3D INT_MIN; =20 @@ -700,7 +700,7 @@ static int mtk_read_temp(void *data, int *temperature) return 0; } =20 -static const struct thermal_zone_of_device_ops mtk_thermal_ops =3D { +static const struct thermal_zone_device_ops mtk_thermal_ops =3D { .get_temp =3D mtk_read_temp, }; =20 @@ -1082,8 +1082,8 @@ static int mtk_thermal_probe(struct platform_device *= pdev) =20 platform_set_drvdata(pdev, mt); =20 - tzdev =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, - &mtk_thermal_ops); + tzdev =3D devm_thermal_of_zone_register(&pdev->dev, 0, mt, + &mtk_thermal_ops); if (IS_ERR(tzdev)) { ret =3D PTR_ERR(tzdev); goto err_disable_clk_peri_therm; --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 708E3C433EF for ; Mon, 25 Jul 2022 21:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236807AbiGYV3h (ORCPT ); Mon, 25 Jul 2022 17:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236822AbiGYV2m (ORCPT ); Mon, 25 Jul 2022 17:28:42 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 668E424BCF for ; Mon, 25 Jul 2022 14:27:48 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id v67-20020a1cac46000000b003a1888b9d36so10218900wme.0 for ; Mon, 25 Jul 2022 14:27:48 -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=WcT26bxdghVckoFOQydcurz7wa7nyvcLqA4Sho5B2kU=; b=UnTy2ZqQ54nkBEnZa4nFUdJocliUWkBqUlDnt9qVb6o3YPfRiTMHb+MgP/nV0mQXyt rIkK02FnPj1VlMbJVqtfPeSgvt9dPSuhwclqlGO7F1UnXE5ODJZCOy4oodvNR+07j6wV 32oNuB0OQHApiKdag892W8xdHQslcluY5NC/cjAFLBlenRFygcqIyjDOOh/QXOqCVT/X 68SbYRs4nvupamaL4cGLWCg3HdzyXhsycsKHg8oZTsqsC5fluUWzP/0GSkRocb6cA7Rm +mdi/pNTxQPCTtYaFAwioloPK1X1vGUX8vY4Udc13r//1kH/atQlPRMVmMKYT+JYbfq/ Z4hg== 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=WcT26bxdghVckoFOQydcurz7wa7nyvcLqA4Sho5B2kU=; b=pZgUNR8pwSomS+JNzlhbNB3sDux+eOY8bwpbNeI3JV6jvND1eb123m5BievFN09Z+r O4CuvX3ZHZGexzpJz11+RvDBApxghTmAZ6U/WWCdqzih3jgTFn0vebPhWa12meb0WuyG XqAmjSSy+MyPNeHHINEu7eqVp2XVPMO2FZ7IoImRLlhJPdMTtWkOlTU2CFUiD/gB1jiu 20v0ym4a8Mn5PYXqYwu+JNyZxwzaMUIws/9Et6anfmlHxWWDiCkTFd6SRczAdrFnv+Os +GxQAMFMP67bQm5S4TVIxaK39OvD4zd9/BXQ9/TGsqxT/ZMZ5Sg8nBtFNIn6IQj7JmxH 7cWQ== X-Gm-Message-State: AJIora/d1MGUQPEam+7Hif/OIgA3qdWTcgZTZRN/dt9Kmbo6Cuu4Z0EQ WUeB3WbBeMIEkFhFLhgUpc6k4A== X-Google-Smtp-Source: AGRyM1vMi0ueT0EJYTNdrfHJ6Wa+Z++OF580oDIsW+JHEkXKe96kyAEMbzmtoxaLPXG+no13VsU3nA== X-Received: by 2002:a05:600c:34c2:b0:3a3:62d3:de5 with SMTP id d2-20020a05600c34c200b003a362d30de5mr3737807wmq.29.1658784466492; Mon, 25 Jul 2022 14:27:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:46 -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 21/32] thermal/drivers/banggap: Switch to new of API Date: Mon, 25 Jul 2022 23:26:26 +0200 Message-Id: <20220725212637.2818207-22-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/k3_bandgap.c | 12 ++++++------ drivers/thermal/k3_j72xx_bandgap.c | 12 +++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 5d0b3ffc6f46..22c9bcb899c3 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -139,9 +139,9 @@ static int k3_bgp_read_temp(struct k3_thermal_data *dev= data, return 0; } =20 -static int k3_thermal_get_temp(void *devdata, int *temp) +static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct k3_thermal_data *data =3D devdata; + struct k3_thermal_data *data =3D tz->devdata; int ret =3D 0; =20 ret =3D k3_bgp_read_temp(data, temp); @@ -151,7 +151,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp) return ret; } =20 -static const struct thermal_zone_of_device_ops k3_of_thermal_ops =3D { +static const struct thermal_zone_device_ops k3_of_thermal_ops =3D { .get_temp =3D k3_thermal_get_temp, }; =20 @@ -213,9 +213,9 @@ static int k3_bandgap_probe(struct platform_device *pde= v) writel(val, data[id].bgp->base + data[id].ctrl_offset); =20 data[id].tzd =3D - devm_thermal_zone_of_sensor_register(dev, id, - &data[id], - &k3_of_thermal_ops); + devm_thermal_of_zone_register(dev, id, + &data[id], + &k3_of_thermal_ops); if (IS_ERR(data[id].tzd)) { dev_err(dev, "thermal zone device is NULL\n"); ret =3D PTR_ERR(data[id].tzd); diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_= bandgap.c index 64e323158952..38362d3aea99 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -249,9 +249,9 @@ static inline int k3_bgp_read_temp(struct k3_thermal_da= ta *devdata, } =20 /* Get temperature callback function for thermal zone */ -static int k3_thermal_get_temp(void *devdata, int *temp) +static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct k3_thermal_data *data =3D devdata; + struct k3_thermal_data *data =3D tz->devdata; int ret =3D 0; =20 ret =3D k3_bgp_read_temp(data, temp); @@ -261,7 +261,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp) return ret; } =20 -static const struct thermal_zone_of_device_ops k3_of_thermal_ops =3D { +static const struct thermal_zone_device_ops k3_of_thermal_ops =3D { .get_temp =3D k3_thermal_get_temp, }; =20 @@ -476,10 +476,8 @@ static int k3_j72xx_bandgap_probe(struct platform_devi= ce *pdev) writel(val, data[id].bgp->cfg2_base + data[id].ctrl_offset); =20 bgp->ts_data[id] =3D &data[id]; - ti_thermal =3D - devm_thermal_zone_of_sensor_register(bgp->dev, id, - &data[id], - &k3_of_thermal_ops); + ti_thermal =3D devm_thermal_of_zone_register(bgp->dev, id, &data[id], + &k3_of_thermal_ops); if (IS_ERR(ti_thermal)) { dev_err(bgp->dev, "thermal zone device is NULL\n"); ret =3D PTR_ERR(ti_thermal); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 4B58AC433EF for ; Mon, 25 Jul 2022 21:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237438AbiGYVbL (ORCPT ); Mon, 25 Jul 2022 17:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237285AbiGYV2o (ORCPT ); Mon, 25 Jul 2022 17:28:44 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F4B25286 for ; Mon, 25 Jul 2022 14:27:50 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id b6so7613860wmq.5 for ; Mon, 25 Jul 2022 14:27:50 -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=5vPTvuI94uga8nmWiqOTMlhssMKMlt7Rbmmokv8UyAg=; b=b2VZ8Ju8IwtY6a6J6GJwWN+9At19kwozRPe13f2CTVnLgb2W4A989u3Y0aiRzpqCeF 1J0NpYYL7WbpTE0kPHlR1AELCW/7ceZKgc7wyI5T6s/3pmekxppjBcqa8SdH4V9A8Yr0 DWNNEM8c1OTx+dCyNJBHhk6uWGwbS8p1ApOslg3Pand4UdhH18E1sQMHy7wO1L27Em8L ndaCXDKohkiM2dwvJtx369LeryzzZKJ9E5ee1pYKZM7N62r+g6GaJAI+tZLe93ERpB5J OTWGCj47lzDyNfimDx+AEN0VSLghbaJsbdWVWo2dKQM39c5o0XYWZKCTLHe0xaEv7hmP zk/g== 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=5vPTvuI94uga8nmWiqOTMlhssMKMlt7Rbmmokv8UyAg=; b=fOsgdPg6wImODH+cja/kKrNGDbQsAooDF2oO0x0doKtajptNaK3DbpvIZY6PFgHi+b TnMwS9/EikwvIWKAepo38HQzlr1yTZ26MUO7VmW6Uwj8ydb2YlzjW3INmsbqVwj1MLLS 0VGSCXuYu6VK0ONyLD7sQlS4aMpFVxqbRhgnKNL4YCd3codcWGhLt68nup/NHu3KobL2 ZaLP9oDE3Z4n+rnA9XqmFa5E5X0DU1aAP1FaZ6FbDA7ycydCGg4TRsE2WUmq2wo57yq1 wgkwql4rR2HNOd9n9l0foS5g7Ek4hF4soq0gj6RLfZftx6XZzw5BhM3o780/+Ks+SRmR plag== X-Gm-Message-State: AJIora/SajhZcsW0GTsxHkAvlCe6/3najG0caYFaNnyjCoou2Y2ZsDQg QbnuMKcDZEIHUeM2/OZy8tpNMg== X-Google-Smtp-Source: AGRyM1tBn+lVCslS7l3C/D2sAss3SonsfMDvDGzZGhRSizto3CJv3y8B58GZuJKhGdD8qSOwrYh+IQ== X-Received: by 2002:a1c:4c0f:0:b0:3a3:1401:7660 with SMTP id z15-20020a1c4c0f000000b003a314017660mr22597468wmf.8.1658784468598; Mon, 25 Jul 2022 14:27:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:48 -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 22/32] thermal/drivers/maxim: Switch to new of API Date: Mon, 25 Jul 2022 23:26:27 +0200 Message-Id: <20220725212637.2818207-23-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/max77620_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_= thermal.c index 82d06c7411eb..6451a55eb582 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -44,9 +44,9 @@ struct max77620_therm_info { * Return 0 on success otherwise error number to show reason of failure. */ =20 -static int max77620_thermal_read_temp(void *data, int *temp) +static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int = *temp) { - struct max77620_therm_info *mtherm =3D data; + struct max77620_therm_info *mtherm =3D tz->devdata; unsigned int val; int ret; =20 @@ -66,7 +66,7 @@ static int max77620_thermal_read_temp(void *data, int *te= mp) return 0; } =20 -static const struct thermal_zone_of_device_ops max77620_thermal_ops =3D { +static const struct thermal_zone_device_ops max77620_thermal_ops =3D { .get_temp =3D max77620_thermal_read_temp, }; =20 @@ -114,7 +114,7 @@ static int max77620_thermal_probe(struct platform_devic= e *pdev) */ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); =20 - mtherm->tz_device =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, + mtherm->tz_device =3D devm_thermal_of_zone_register(&pdev->dev, 0, mtherm, &max77620_thermal_ops); if (IS_ERR(mtherm->tz_device)) { ret =3D PTR_ERR(mtherm->tz_device); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 41AEBC433EF for ; Mon, 25 Jul 2022 21:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237455AbiGYVbQ (ORCPT ); Mon, 25 Jul 2022 17:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235512AbiGYV2s (ORCPT ); Mon, 25 Jul 2022 17:28:48 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3569C25296 for ; Mon, 25 Jul 2022 14:27:51 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id g2so9659817wru.3 for ; Mon, 25 Jul 2022 14:27:51 -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=dtIC8RNPtrIhefVP3qkzn/ojto5ZENqxzOLIoU7Obsk=; b=fpGNc8n1xXJ0imA/RGA543TJhgsAaJo9AZK6Lbnx9rKmV/f4ipl9YuG4iyqU1Pn+HK DWc6xfs4lcvmwoejpmcgy2XzCrnJHfp6HwZ8Jiky/3RVh1f1l59Hd/amLfHg2Y9SfiTG 4x8uBz8cwG/3nLpf9sXeO+ZJmOBET2cLqsaRGNPOelXNBEQizf5w6T7qX8+skV1dvZQA sICPw4uNgIU0Nul5Pz25KafqkTB2Ta3xShV6Og2pH2/NK63YTo9ichfn6UBguYYRa5a5 5p3ujwgdzN0+e3NFNffrZxxCHrThrJCeLd6yOUGVsaZwsL0qtwaxwg6Gii+lwqemHQOk ib+A== 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=dtIC8RNPtrIhefVP3qkzn/ojto5ZENqxzOLIoU7Obsk=; b=iYKnynXRhJ/aAZJMgVQJv1sGi62FelnMHFUmQnCxqV1C7AlRvDpAPqlKR9KBek9W5s mu00SD8ETrnGaqV7+Aq7peZvgbCfiwlpTfNswRA5ZEK3ILuxtlMTJsMJEDoOnvoF9L5A nbaXTPEReTdEwSevi8oaqyi1rEj88Y9ZNRIHV44RKAgR44zUBDhlxyoVX6Ic3eTY0IIG x8CIszqJLeZ/r2bW8zlYRZ5DiI8kmEphgpk3xcRF2xTaKYf3LItLlivd9dk5OubYi/ez F3wkreG+e5nN9wE8Yvk6WBl6zouFlRsv4yuTANh5mwAcUHf2Ic6AAlPRE9fUb5Srq6ca fj1g== X-Gm-Message-State: AJIora9ligT9uanmyahx4udg9G/qdIWPYstkRVfSm7ncxT0RgCNCmCVi DvlBHHLoBhILWUMXn2hF8NHLDQ== X-Google-Smtp-Source: AGRyM1uPbLXiSnUUCqzUagWvav4f7h6KELyLpVVBzYURiv4OmSHpWYSoTI1UWdB3mM3+TprKDaKLPA== X-Received: by 2002:adf:f245:0:b0:21d:a39a:bed5 with SMTP id b5-20020adff245000000b0021da39abed5mr8266370wrp.508.1658784470723; Mon, 25 Jul 2022 14:27:50 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:50 -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 23/32] thermal/drivers/hisilicon: Switch to new of API Date: Mon, 25 Jul 2022 23:26:28 +0200 Message-Id: <20220725212637.2818207-24-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/hisi_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index b29ab09040d5..cc5da71b6f55 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -442,9 +442,9 @@ static int hi3660_thermal_probe(struct hisi_thermal_dat= a *data) return 0; } =20 -static int hisi_thermal_get_temp(void *__data, int *temp) +static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hisi_thermal_sensor *sensor =3D __data; + struct hisi_thermal_sensor *sensor =3D tz->devdata; struct hisi_thermal_data *data =3D sensor->data; =20 *temp =3D data->ops->get_temp(sensor); @@ -455,7 +455,7 @@ static int hisi_thermal_get_temp(void *__data, int *tem= p) return 0; } =20 -static const struct thermal_zone_of_device_ops hisi_of_thermal_ops =3D { +static const struct thermal_zone_device_ops hisi_of_thermal_ops =3D { .get_temp =3D hisi_thermal_get_temp, }; =20 @@ -467,7 +467,7 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int ir= q, void *dev) =20 data->ops->irq_handler(sensor); =20 - hisi_thermal_get_temp(sensor, &temp); + temp =3D data->ops->get_temp(sensor); =20 if (temp >=3D sensor->thres_temp) { dev_crit(&data->pdev->dev, @@ -492,9 +492,9 @@ static int hisi_thermal_register_sensor(struct platform= _device *pdev, int ret, i; const struct thermal_trip *trip; =20 - sensor->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->id, sensor, - &hisi_of_thermal_ops); + sensor->tzd =3D devm_thermal_of_zone_register(&pdev->dev, + sensor->id, sensor, + &hisi_of_thermal_ops); if (IS_ERR(sensor->tzd)) { ret =3D PTR_ERR(sensor->tzd); sensor->tzd =3D NULL; --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 AB188C433EF for ; Mon, 25 Jul 2022 21:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236915AbiGYV3k (ORCPT ); Mon, 25 Jul 2022 17:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236912AbiGYV2w (ORCPT ); Mon, 25 Jul 2022 17:28:52 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C1B9252B4 for ; Mon, 25 Jul 2022 14:27:55 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id w8-20020a05600c014800b003a32e89bc4eso7087354wmm.5 for ; Mon, 25 Jul 2022 14:27:55 -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=fQwrODMneSzL3hNZushZmArM7t54Sdd+4j1p+OO3JS8=; b=wAqIxUamNgGfpXlAtv5dRL3vUzGyBJmyD2ekYHrdDe8vQTZ/ycyXgh882FiO+8X5xh 9rfkhRLXg0mb7GqSGcNY1W7GdCLS8uNloydV6P0oUp0sjyxtYJTlAYkEHNKQIuAsB+He 8lF3OcbuLRLQHqPRgZ7gADkIOAPHmuDuPARzJSylftVm7ZM1IgS74UB+Un5KRHhZ3v0V cB1xOICwt+Vvwy1ZXGUBw2fxXy0xr/qT+m2pc3f5nhPtT3suqe2PVfOtCng/j7YSTtqs Y28PjSzufx88vVPjnchNtaso0n2S5pcXwxlyjwrwX4K3n1123qPqLkUmTYrmGMfBqmJG bgQw== 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=fQwrODMneSzL3hNZushZmArM7t54Sdd+4j1p+OO3JS8=; b=dm49wYF3+0IxxCENQBqQ24PGvHXDmaa7oLkw3xrc/y/xwDIpiOWxlTwtFi7Qi9ox/V vWoxr0Xt60EJ55sQLRz9IdCAbXdPQ4Hbj2jEAFwLNcGg5ZNcezM3iGkVr+0y8kJuwr9Y 8sf+r7JgrPQeCD06s/WA0j/DWuCvXCGUA/YX34rD7hXzSxKGqRwD3WEUdYMqXFGWipAm dLguRMnWqvkizZtI0D1WmKScoRgT8AZUQ0eV9Ndibi8v8vTam3f5yuTRQXgNNRmiZZgp 8yRDbHV8GoqVip/lDs1uEpFxp0bSsonaoXefeQFjPnwvT8ZF7p8UMTmq/wcf8MLHCFdb aRjw== X-Gm-Message-State: AJIora8oAwqBhDRP9Oc52Nz4AY8m3iyYBhbkpibnzae3DFqnK5MYirw/ z8YZHPBgnLWYynHBgspGk3F6sA== X-Google-Smtp-Source: AGRyM1tbvETSoIRv7uuZ9n4quQqOkazqYwKqHrQODDUEp+EUyJvLC5o19BvGxgtpTnCBj1LhJX76jg== X-Received: by 2002:a05:600c:1552:b0:3a3:2e4c:bd0a with SMTP id f18-20020a05600c155200b003a32e4cbd0amr18447864wmg.82.1658784472932; Mon, 25 Jul 2022 14:27:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:52 -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, Eduardo Valentin , Amit Kucheria , linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER) Subject: [PATCH v2 24/32] thermal/drivers/ti-soc: Switch to new of API Date: Mon, 25 Jul 2022 23:26:29 +0200 Message-Id: <20220725212637.2818207-25-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- .../thermal/ti-soc-thermal/ti-thermal-common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 703039d8b937..8a9055bd376e 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -65,10 +65,10 @@ static inline int ti_thermal_hotspot_temperature(int t,= int s, int c) =20 /* thermal zone ops */ /* Get temperature callback function for thermal zone */ -static inline int __ti_thermal_get_temp(void *devdata, int *temp) +static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, in= t *temp) { struct thermal_zone_device *pcb_tz =3D NULL; - struct ti_thermal_data *data =3D devdata; + struct ti_thermal_data *data =3D tz->devdata; struct ti_bandgap *bgp; const struct ti_temp_sensor *s; int ret, tmp, slope, constant; @@ -85,8 +85,8 @@ static inline int __ti_thermal_get_temp(void *devdata, in= t *temp) return ret; =20 /* Default constants */ - slope =3D thermal_zone_get_slope(data->ti_thermal); - constant =3D thermal_zone_get_offset(data->ti_thermal); + slope =3D thermal_zone_get_slope(tz); + constant =3D thermal_zone_get_offset(tz); =20 pcb_tz =3D data->pcb_tz; /* In case pcb zone is available, use the extrapolation rule with it */ @@ -107,9 +107,9 @@ static inline int __ti_thermal_get_temp(void *devdata, = int *temp) return ret; } =20 -static int __ti_thermal_get_trend(void *p, int trip, enum thermal_trend *t= rend) +static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip= , enum thermal_trend *trend) { - struct ti_thermal_data *data =3D p; + struct ti_thermal_data *data =3D tz->devdata; struct ti_bandgap *bgp; int id, tr, ret =3D 0; =20 @@ -130,7 +130,7 @@ static int __ti_thermal_get_trend(void *p, int trip, en= um thermal_trend *trend) return 0; } =20 -static const struct thermal_zone_of_device_ops ti_of_thermal_ops =3D { +static const struct thermal_zone_device_ops ti_of_thermal_ops =3D { .get_temp =3D __ti_thermal_get_temp, .get_trend =3D __ti_thermal_get_trend, }; @@ -170,7 +170,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, in= t id, return -EINVAL; =20 /* in case this is specified by DT */ - data->ti_thermal =3D devm_thermal_zone_of_sensor_register(bgp->dev, id, + data->ti_thermal =3D devm_thermal_of_zone_register(bgp->dev, id, data, &ti_of_thermal_ops); if (IS_ERR(data->ti_thermal)) { dev_err(bgp->dev, "thermal zone device is NULL\n"); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 C8F20C433EF for ; Mon, 25 Jul 2022 21:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237120AbiGYV3o (ORCPT ); Mon, 25 Jul 2022 17:29:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237101AbiGYV2w (ORCPT ); Mon, 25 Jul 2022 17:28:52 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C027252B2 for ; Mon, 25 Jul 2022 14:27:55 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id g2so9659986wru.3 for ; Mon, 25 Jul 2022 14:27:55 -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=GCM3yQVLWF86sbYiyvudiotSwDPj8nChQ6qnbaMqhHs=; b=vDf+UJQ90Y1OWcD9jAnPyUDj6PkXAIzUZs8Stl2T8Wwp2Ny/rUiqSVophvD3G96yuQ lESLHGbb59gI+rUi0Hcjr6568aF+hmWk0pf4X7Ix7akWPPeBUYA/2MoqKJ8BPp9tHw/c n/u7RiY1/D7LNPLFE07I49c5y1wM6T5stX3lsJAM54XHJ73/SS6PoNp7Do2wrqbjKfcJ Af04ZoPkKxUoECcmKBsZpL4vMk9H3L2qnaiG2l4o5MepqTlXXhnZ2s4eOWJpUp/zYETY ke945GH7Dk3mEnAD/zhFbqCnIJzUWsPLq9gsZJw2I+YA8eHItz2G43rEI/AIxfsdVwnm PZyA== 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=GCM3yQVLWF86sbYiyvudiotSwDPj8nChQ6qnbaMqhHs=; b=YErEx+JJrFn5RUX6ZOY7qKCGMCLjrTAeMNCJ+Vj0uR8Nq7TZ0hD52INywlsyKKkN2+ eKtCyOnEubgMiD/Dc/1mIXKRD4D+7SEd9ab/WVKf9SCoChIqhalWlJ5vp2Ypr1vfVHL8 h4SmhGL2laUolS9hQW2j4PB1bpTQqDH2L9/vuE4yu1z1m05SZeNOrg0s6SYp2dECqI5Z 5cQNLnHRhwL/48ztbdnfUUklpOOLFG/zDaEmJDmUnjyw64S21ZQSC/rErbtK1P4p4+Mf cdRyCS4qkZEYr7We/j6uLodCJ9yTlPM8NEf6cIimEHcg5VmnISEZGaQNR7UNs+GNnBju w3EQ== X-Gm-Message-State: AJIora/w0Xc+zxloqBFiGCfzXgz6bAGCswF34NMBlAGP9RNefAJ0LCiZ vx58DL7/Plivx/RsjM+7LQZfDA== X-Google-Smtp-Source: AGRyM1uxSmqjc+KicVfEox4C6+Jx/zNXBWMGNOe4hpzsYpYRTzP2OOFmX4pTibti8j4IRFLYXUoFzA== X-Received: by 2002:a05:6000:2ab:b0:21e:2e68:52f4 with SMTP id l11-20020a05600002ab00b0021e2e6852f4mr8435661wry.236.1658784475211; Mon, 25 Jul 2022 14:27:55 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:54 -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, Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v2 25/32] ata/drivers/ahci_imx: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:30 +0200 Message-Id: <20220725212637.2818207-26-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. sata_ahci_read_temperature() is used by sata_ahci_show_temp() also. So in order to change the function prototype for the get_temp ops which does not take a void* but a thermal_zone_device* structure, this function wraps the call. Signed-off-by: Daniel Lezcano Acked-by: Damien Le Moal --- drivers/ata/ahci_imx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 79aa9f285312..b734e069034d 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, v= oid __iomem * mmio) } =20 /* SATA AHCI temperature monitor */ -static int sata_ahci_read_temperature(void *dev, int *temp) +static int __sata_ahci_read_temperature(void *dev, int *temp) { u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum; u32 str1, str2, str3, str4; @@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *= temp) return 0; } =20 +static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int = *temp) +{ + return __sata_ahci_read_temperature(tz->devdata, temp); +} + static ssize_t sata_ahci_show_temp(struct device *dev, struct device_attribute *da, char *buf) @@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev, unsigned int temp =3D 0; int err; =20 - err =3D sata_ahci_read_temperature(dev, &temp); + err =3D __sata_ahci_read_temperature(dev, &temp); if (err < 0) return err; =20 return sprintf(buf, "%u\n", temp); } =20 -static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_op= s =3D { +static const struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = =3D { .get_temp =3D sata_ahci_read_temperature, }; =20 @@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pde= v) ret =3D PTR_ERR(hwmon_dev); goto disable_clk; } - devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, - &fsl_sata_ahci_of_thermal_ops); + devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev, + &fsl_sata_ahci_of_thermal_ops); dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev)); } =20 --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 BAB1AC43334 for ; Mon, 25 Jul 2022 21:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237386AbiGYV3z (ORCPT ); Mon, 25 Jul 2022 17:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237441AbiGYV3K (ORCPT ); Mon, 25 Jul 2022 17:29:10 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E67C525587 for ; Mon, 25 Jul 2022 14:27:58 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id q18so7286786wrx.8 for ; Mon, 25 Jul 2022 14:27: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=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=BQIqkYJOdrThCxqkoN0HqoiKd85QmoVrcMCeEAfCF97dAZeTMKwFToOFD2I0wIbXXG E7+z9C8S7ptwm+42X+RVUmfrLEBrQdbACHcRxdo+Xc1rvOnSINpFnqXU5arazqHAOp2f QRdjyjQz6PVozo1s++7CkfrVavslndrnfXQLTmlBQPJYgZr/lk8YTr/fpxjYGrci+5Fw GcekwKrVWKcH7o5gU9yWmjDG6EPdkBLJxhvrxQwnXzkSCIChWkh+T0fe3bHMwQ37KPyt 1+GGtUQ7fDSMs4/pJ2yg/4YRmMuyRHdCe/NG3UbxY4ktVuuqqJ5PYqmlV86Ls5vS9hAZ oudA== 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=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=DX8l9Kjs3KuL+wNtuI2yWHjXsvzEdNwyNKdKwJ2YUIlakunfbFIWOeMyMoNE8LmG/I pSfNd4MgjvLrM7utpnbR/d/YzYiCA73JqU6BNHgvMNamB6V5QOWe26peCjbdw8UQzZLh UtB7hWpKG3a5lndoiYkZKSMQzgUvobUJYDBJnOY+XZTw2cFDfM/hSkFCKNHP/IT9E6M5 pyukTlc1E3P7OUhJb++HoL7SxliYJi9NL8H4/dDuM9ejfUmneg1sBNdx6SrG+Nn1IGRb dAnqYl/C/jIBnkK5GDX5tv7MDFXXojTXzw7h+D8QdpM5qJ/QnXHkscUebcng61ufe7PK al1Q== X-Gm-Message-State: AJIora9cBiPS6h0R8X+BaCKSeDEPpFgh8UY+ax3w4gAgipg5S2UUtSxA KJX9CorJpUJ6D/I3TP4oD4QxvFip3+mGRQ== X-Google-Smtp-Source: AGRyM1s4RXnKN/31+ASOZIAuvhqyeGVGD+/fZgIsKbHxSIuMv4zbFJClRu/iEZv9Jzyjlxt8zSox5A== X-Received: by 2002:adf:d084:0:b0:21e:5570:2b05 with SMTP id y4-20020adfd084000000b0021e55702b05mr8662517wrh.554.1658784477438; Mon, 25 Jul 2022 14:27: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.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:27:57 -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 v2 26/32] hwmon/drivers: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:31 +0200 Message-Id: <20220725212637.2818207-27-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 *tem= p) { - struct hwmon_thermal_data *tdata =3D data; + struct hwmon_thermal_data *tdata =3D tz->devdata; struct hwmon_device *hwdev =3D 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; } =20 -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 =3D data; + struct hwmon_thermal_data *tdata =3D tz->devdata; struct hwmon_device *hwdev =3D to_hwmon_device(tdata->dev); const struct hwmon_chip_info *chip =3D hwdev->chip; const struct hwmon_channel_info **info =3D chip->info; @@ -203,7 +203,7 @@ static int hwmon_thermal_set_trips(void *data, int low,= int high) return 0; } =20 -static const struct thermal_zone_of_device_ops hwmon_thermal_ops =3D { +static const struct thermal_zone_device_ops hwmon_thermal_ops =3D { .get_temp =3D hwmon_thermal_get_temp, .set_trips =3D hwmon_thermal_set_trips, }; @@ -227,8 +227,8 @@ static int hwmon_thermal_add_sensor(struct device *dev,= int index) tdata->dev =3D dev; tdata->index =3D index; =20 - tzd =3D devm_thermal_zone_of_sensor_register(dev, index, tdata, - &hwmon_thermal_ops); + tzd =3D devm_thermal_of_zone_register(dev, index, tdata, + &hwmon_thermal_ops); if (IS_ERR(tzd)) { if (PTR_ERR(tzd) !=3D -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) } } =20 -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 =3D dev; + struct scpi_thermal_zone *zone =3D tz->devdata; struct scpi_sensors *scpi_sensors =3D zone->scpi_sensors; struct scpi_ops *scpi_ops =3D scpi_sensors->scpi_ops; struct sensor_data *sensor =3D &scpi_sensors->data[zone->sensor_id]; @@ -121,7 +121,7 @@ scpi_show_label(struct device *dev, struct device_attri= bute *attr, char *buf) return sprintf(buf, "%s\n", sensor->info.name); } =20 -static const struct thermal_zone_of_device_ops scpi_sensor_ops =3D { +static const struct thermal_zone_device_ops scpi_sensor_ops =3D { .get_temp =3D scpi_read_temp, }; =20 @@ -275,10 +275,10 @@ static int scpi_hwmon_probe(struct platform_device *p= dev) =20 zone->sensor_id =3D i; zone->scpi_sensors =3D scpi_sensors; - z =3D devm_thermal_zone_of_sensor_register(dev, - sensor->info.sensor_id, - zone, - &scpi_sensor_ops); + z =3D 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 --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 05752CCA48A for ; Mon, 25 Jul 2022 21:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237431AbiGYV36 (ORCPT ); Mon, 25 Jul 2022 17:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237469AbiGYV3N (ORCPT ); Mon, 25 Jul 2022 17:29:13 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B8F624BE9 for ; Mon, 25 Jul 2022 14:28:02 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id h9so17757644wrm.0 for ; Mon, 25 Jul 2022 14:28:02 -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=hWFZXwysMvsN10lXDK6sChpf4X2qhnFs4AeSH8mvwTs=; b=V7mOn4CmTbqh6bMglDam17dQJNZ1uZrNkVGQ9enufVzer/0mK6rPnBa9tF2CYQq5cg vaNSspxKpPyqo32kEpyyS60GvsAsJWRR63UZwIyE/ZsQYTKhNDDJeYh/7BukklPce9nj PGeuq+xjSewtJiwagQ+ykjt7JcfqbcEpWEjmtFqX63+C+7ZHBBIApfDFjJUSg08iNFL+ WMunOtTVpalGGXY+2NCGXOGoVwtIx7k67mk+Hgz6tL3ONvrQNdPzimxNLZdJ9A0zBcDU c4Tx1rEyKbqKRyH/VNBC6tDn3pUuPvQQkTcLEr0zeOECp+W8KVMi/sFUeokpdyPMEj7Q T+gA== 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=hWFZXwysMvsN10lXDK6sChpf4X2qhnFs4AeSH8mvwTs=; b=5AX6LQeBC2FoOPiDm2bkf7AIAOmOUDZN5De/9L+BF4Wo+XptQr7u+PJ2HsLX1QfAvq HoYWwtfQedgwUBabTotA+iQ34vTCjWwWotI8FVY+9e5TWZDfNBost1uvchQcoFmgkzZv 8svdiQ35WBep3meOsygzs8IMX4/tSxGNF8NS8aTmiZmL1c0fIhUkU2fkN+tMWjaqMO6R H2wjhv6eHqFxVAuqURPtbNidLi/Irs7NknPcpWPNSjxjW58iaYOWA6cSbI6FPXGz3YfV N5x48bCgxMmAeGiVAFcB2UhBSw0WLZS/RFnsPiET4hU2npZPOYhUfVFXa5jidK+5NYSc lvZA== X-Gm-Message-State: AJIora+T+M5+ogM/jWZEe7jwebV5pwMobblpTdVlQqzGJq1Kp8sHcKkA ZQvvLpcdw8J4WHTrHyqfPPL7Aw== X-Google-Smtp-Source: AGRyM1sKKjruioCvoZ3EI2JZMo3qqzjeRP7j12dQmi1UnueZHyDTnJl5KV6/Y//5r/xXSnueikdBQg== X-Received: by 2002:adf:e193:0:b0:21e:626c:d082 with SMTP id az19-20020adfe193000000b0021e626cd082mr8548154wrb.159.1658784480791; Mon, 25 Jul 2022 14:28:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28:00 -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, Jonathan Cameron , Lars-Peter Clausen , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 27/32] iio/drivers/sun4i_gpadc: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:32 +0200 Message-Id: <20220725212637.2818207-28-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/iio/adc/sun4i-gpadc-iio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpad= c-iio.c index 2d393a4dfff6..13d1e937357c 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -412,9 +412,9 @@ static int sun4i_gpadc_runtime_resume(struct device *de= v) return 0; } =20 -static int sun4i_gpadc_get_temp(void *data, int *temp) +static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sun4i_gpadc_iio *info =3D data; + struct sun4i_gpadc_iio *info =3D tz->devdata; int val, scale, offset; =20 if (sun4i_gpadc_temp_read(info->indio_dev, &val)) @@ -428,7 +428,7 @@ static int sun4i_gpadc_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops =3D { +static const struct thermal_zone_device_ops sun4i_ts_tz_ops =3D { .get_temp =3D &sun4i_gpadc_get_temp, }; =20 @@ -637,9 +637,9 @@ static int sun4i_gpadc_probe(struct platform_device *pd= ev) pm_runtime_enable(&pdev->dev); =20 if (IS_ENABLED(CONFIG_THERMAL_OF)) { - info->tzd =3D thermal_zone_of_sensor_register(info->sensor_device, - 0, info, - &sun4i_ts_tz_ops); + info->tzd =3D thermal_of_zone_register(info->sensor_device, + 0, info, + &sun4i_ts_tz_ops); /* * Do not fail driver probing when failing to register in * thermal because no thermal DT node is found. --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 30180C433EF for ; Mon, 25 Jul 2022 21:30:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237465AbiGYVaH (ORCPT ); Mon, 25 Jul 2022 17:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237489AbiGYV3P (ORCPT ); Mon, 25 Jul 2022 17:29:15 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D1C252B7 for ; Mon, 25 Jul 2022 14:28:05 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id b26so17731743wrc.2 for ; Mon, 25 Jul 2022 14:28: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=kpAJvHnsGVgVYdV6CGwRXamKol+XLg/BJyowOdExSUs=; b=uisaYlWHlc1RSvh90hpzc7AOFByO6SZOCyDzOMnogH0ZogazNwnYVkQ9oEHpT9V+JG dHyb/dlixsReklVEcEGk1t6k+jnAlhFtWhmjsD+3vhap9Y7sdPNYwZ7n6GaWxIPg8VIr M5BrqdaX1YGUbos8NzxD1/HbBDMNiMxwh9Ej/3ahYypsbH2QRpvXUNFFpO122LDxygZ2 yflNbmzyx/yfw4bJe7B+sh2esm9/YIr8r737zy8yHkSXxoJ9HTZd8sl7aRrYVW3GmYS0 2Q2weVTqUyHsNYiQeuy4csaFK93xldDCTSdJ58OnQxYjMCQCfveEwsJ8VgVSkkaJoMe6 yFzg== 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=kpAJvHnsGVgVYdV6CGwRXamKol+XLg/BJyowOdExSUs=; b=0HO9cb6UBPvKyYMA9EA7lgCItcz+kCAM20o38NIbqMbmtnDhU8n2G+iRqg1c456D08 2rb+w2xrYbuH6Dilwozr7bmoGNZ3xl6uAu4jc1magBD4DBeuZfFu/ujT75+BXoVgi+Bv FdSlW68Z3OCQJ0FoEPVHPRvVXkhQfeeNaTw/O5MiT1wL9VL6xB2n0jfjAu/2p3jqwme4 eoKVeGOkmY3Fel/c49hhIzBq+pYH9/nDN2Y212OryyNIW9G5zn/KguOCzrnCBKhqc75s bW+V7ZJIHH9WtdYV7lk4kRqriK02sZKU32OvWSeJdQRxDgcA6io+JAp3urnxs4ut/Jpb 11UQ== X-Gm-Message-State: AJIora9QO1yE8JdnYCH5m7zDl+XTUsQHtsF6NadTaMDicILxg81pbM5E btcjs78BdzxzkIT99UcRRrLPDA== X-Google-Smtp-Source: AGRyM1uI3wfXx2DOxmMhE1F+VbGqV3pN/W/4oQOzQ/VR/RxyuEoMWtDqsQfUPTNSt3/kwY1RVdJN+Q== X-Received: by 2002:a5d:4811:0:b0:21e:3d86:a2df with SMTP id l17-20020a5d4811000000b0021e3d86a2dfmr9104284wrq.633.1658784483998; Mon, 25 Jul 2022 14:28: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.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28: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, Dmitry Torokhov , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK , TOUCHSCREEN)...), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 28/32] Input: sun4i-ts - switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:33 +0200 Message-Id: <20220725212637.2818207-29-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Dmitry Torokhov --- drivers/input/touchscreen/sun4i-ts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscre= en/sun4i-ts.c index 742a7e96c1b5..73eb8f80be6e 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -192,12 +192,12 @@ static int sun4i_get_temp(const struct sun4i_ts_data = *ts, int *temp) return 0; } =20 -static int sun4i_get_tz_temp(void *data, int *temp) +static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp) { - return sun4i_get_temp(data, temp); + return sun4i_get_temp(tz->devdata, temp); } =20 -static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops =3D { +static const struct thermal_zone_device_ops sun4i_ts_tz_ops =3D { .get_temp =3D sun4i_get_tz_temp, }; =20 @@ -356,8 +356,8 @@ static int sun4i_ts_probe(struct platform_device *pdev) if (IS_ERR(hwmon)) return PTR_ERR(hwmon); =20 - thermal =3D devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, - &sun4i_ts_tz_ops); + thermal =3D devm_thermal_of_zone_register(ts->dev, 0, ts, + &sun4i_ts_tz_ops); if (IS_ERR(thermal)) return PTR_ERR(thermal); =20 --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 3240AC43334 for ; Mon, 25 Jul 2022 21:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237482AbiGYVaL (ORCPT ); Mon, 25 Jul 2022 17:30:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237510AbiGYV3Q (ORCPT ); Mon, 25 Jul 2022 17:29:16 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B01A42559D for ; Mon, 25 Jul 2022 14:28:07 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id a11so7610618wmq.3 for ; Mon, 25 Jul 2022 14:28:07 -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=VtrE+xA1tF8iSNMdDW1P/DphWtZyHaO/Zoz/qfhB2UA=; b=HKPwXjA8ROF4qVeYNByZtE4ZdLmoeJu41nyUu7JJtc+7zJcOMsCzrXRof/Q6cG1F6X lpKOyBZ/8TZ/QkZjMkZCl8MFkCMXp9YwcetgnwN7SMuhb5noq/Lh0oL/sZ4QoC1W1eCS 1LL7+lpCSiFjLA5e/Y4Mup78A2ioqqfE180R+WVssnd0UiDoZUZXZT9ugcDSMuZqf28x v6aKpdcMVtTpM21uSrPAjH6fAjVV0YiYt2N+GziuGCoYXaHMjF+awLcKrsC+kpJR/4p5 KSpMVDxMH4x2mN9AW9YyXiqPiW7mXx2Aj1FNhVl/wzoVVBTuGRcAIqT8WNrO8yp0hgpG 3z+A== 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=VtrE+xA1tF8iSNMdDW1P/DphWtZyHaO/Zoz/qfhB2UA=; b=OXWWDPcbi7SA04l+Y9Y0zVmXsFWn5+J1kz5swnXATza31vv4YRHaBQkCs5g5r0yJj9 +SuKoUPh3qZaL6eqQ98/cp40+ynq3+j959wpSVc5OxK0ur5w6eC6V92Mzawa8GYG7Gpo lPtT6lRdYvL3Hprs/UX3iEjc7DI5XqPoZGXwmxST62K7ioWe4SkehLFgrrs/6kFlf6b5 8an1cMov3PY8A4bw6W4xb2VsPxr9CIIQpkmYXYKeDNI9jiM2ju/0g3QAA5QleldUVKcS WrTGTNWb0HAqR5etCv+zApW7yTEUgulHuBQfZ0hsrMNLlGcpjG7/Ti3ILzfSNiRt8rzy W/Uw== X-Gm-Message-State: AJIora/05q9j+jsKtD3RmA5lVfIw/wOWuWF1kFFJ5iNIMrI7zjfXOZ2X fUSz8oPQzUD/JXirYrzefjYTJg== X-Google-Smtp-Source: AGRyM1uEfAwk0NQYCGneudL04IHnOpSVAjtNyZP1DD+jte3hquc7uQnE+4RAK4airXbZOhke68+Tdg== X-Received: by 2002:a7b:c8da:0:b0:3a3:19e:4a3a with SMTP id f26-20020a7bc8da000000b003a3019e4a3amr22833840wml.201.1658784486125; Mon, 25 Jul 2022 14:28:06 -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.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28:05 -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, Liam Girdwood Subject: [PATCH v2 29/32] regulator/drivers/max8976: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:34 +0200 Message-Id: <20220725212637.2818207-30-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Mark Brown --- drivers/regulator/max8973-regulator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8= 973-regulator.c index cb7e50003f70..61211c462b1a 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -447,9 +447,9 @@ static int max8973_init_dcdc(struct max8973_chip *max, return ret; } =20 -static int max8973_thermal_read_temp(void *data, int *temp) +static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *= temp) { - struct max8973_chip *mchip =3D data; + struct max8973_chip *mchip =3D tz->devdata; unsigned int val; int ret; =20 @@ -478,7 +478,7 @@ static irqreturn_t max8973_thermal_irq(int irq, void *d= ata) return IRQ_HANDLED; } =20 -static const struct thermal_zone_of_device_ops max77621_tz_ops =3D { +static const struct thermal_zone_device_ops max77621_tz_ops =3D { .get_temp =3D max8973_thermal_read_temp, }; =20 @@ -492,8 +492,8 @@ static int max8973_thermal_init(struct max8973_chip *mc= hip) if (mchip->id !=3D MAX77621) return 0; =20 - tzd =3D devm_thermal_zone_of_sensor_register(mchip->dev, 0, mchip, - &max77621_tz_ops); + tzd =3D devm_thermal_of_zone_register(mchip->dev, 0, mchip, + &max77621_tz_ops); if (IS_ERR(tzd)) { ret =3D PTR_ERR(tzd); dev_err(mchip->dev, "Failed to register thermal sensor: %d\n", --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 5EE95CCA48D for ; Mon, 25 Jul 2022 21:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236236AbiGYVaU (ORCPT ); Mon, 25 Jul 2022 17:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237360AbiGYV3T (ORCPT ); Mon, 25 Jul 2022 17:29:19 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 031FE255AA for ; Mon, 25 Jul 2022 14:28:10 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id f24-20020a1cc918000000b003a30178c022so10200844wmb.3 for ; Mon, 25 Jul 2022 14:28:09 -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=5ySF+b0toG9yTVS3ACVkkX+IpUHvtJQ/EOrRyNhrRXg=; b=s6z7yoSV0rekPzE4RDgRa5y5JvTAMcHuEGlvc5yE01gfsHE/h+bkbXvzMdz4cv830a Yfd8XaLjC5vFDocgKRQ2ft27kY3GJj0TmnODwt2nEtVTEnAvOT5B9NDyjXG+U9wBTsEQ xYyNbPfWhrJlsQo2v9XeM3TZggY9EjSovtTF9kKqARweT1hvK4gU7f0Za9ZD5hFJ1qzP knYiTCcn+JyO8aHU/I2WFS7vDmh3GlpIWRMrYnz8rwouDDnAdwEYTEZs+hBFTOX+jjHP cn2MHZn5jEZ34FBOmrQh0LS7uARU/9FuQj0tN3Yd5TEMCIXkzZv8McogKvYj7dH/TShu Dg0w== 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=5ySF+b0toG9yTVS3ACVkkX+IpUHvtJQ/EOrRyNhrRXg=; b=6R5TxT5Jx2VJb1FZ2Cs0gwqoZlnQ2glJjo7N6gw4CGTUprhLcwf7b6vSijJ1sx5U8+ CVQvwQ4UvaZsUVa8d/vnc9ePrGfVkQ7oSOGFrNpI7p4ALY55UygZtgW7u3gQ5A4FPU1x HVhkrP9GoqHrMVdlNX6kzFY/CFlEP9IM+UdNHt2NO8S/CCOqYThPJKJHjExmWCWwUXrZ 4yIQIUyVXbPLblrdWLFw45XcxF8O9a4YdD3AN8wE4eJs4S8qmNYMQ3B8TM5RN9cB1hZ/ HsQGXpSrUAmWR0HawRpkuRG2MK6R7Yhrzicu4JW1f4b3yOT0a2Gx3P/kmygF9Wypzezs +j1A== X-Gm-Message-State: AJIora8g8kNG0yvFEU4hwvh4oyAuVuO6HeWyosYWNQmC0LG2GX746jfW aLqszbSaoaueZmSqDjQSCg7iCQ== X-Google-Smtp-Source: AGRyM1t7vq2vDZZFgYRcdteW9NvkgZMxCdv/oe6Ppug+VrhMCGytQcJClM5w0E1gbcjuWx6jpaQxEw== X-Received: by 2002:a1c:2783:0:b0:3a2:fd82:bf46 with SMTP id n125-20020a1c2783000000b003a2fd82bf46mr22261412wmn.29.1658784488465; Mon, 25 Jul 2022 14:28:08 -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.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28:08 -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, Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Amit Kucheria , Alim Akhtar , linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES) Subject: [PATCH v2 30/32] thermal/drivers/samsung: Switch to new of thermal API Date: Mon, 25 Jul 2022 23:26:35 +0200 Message-Id: <20220725212637.2818207-31-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung= /exynos_tmu.c index f4ab4c5b4b62..5b1a8a1e193d 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -650,9 +650,9 @@ static void exynos7_tmu_control(struct platform_device = *pdev, bool on) writel(con, data->base + EXYNOS_TMU_REG_CONTROL); } =20 -static int exynos_get_temp(void *p, int *temp) +static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) { - struct exynos_tmu_data *data =3D p; + struct exynos_tmu_data *data =3D tz->devdata; int value, ret =3D 0; =20 if (!data || !data->tmu_read) @@ -728,9 +728,9 @@ static void exynos4412_tmu_set_emulation(struct exynos_= tmu_data *data, writel(val, data->base + emul_con); } =20 -static int exynos_tmu_set_emulation(void *drv_data, int temp) +static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int te= mp) { - struct exynos_tmu_data *data =3D drv_data; + struct exynos_tmu_data *data =3D tz->devdata; int ret =3D -EINVAL; =20 if (data->soc =3D=3D SOC_ARCH_EXYNOS4210) @@ -750,7 +750,7 @@ static int exynos_tmu_set_emulation(void *drv_data, int= temp) } #else #define exynos4412_tmu_set_emulation NULL -static int exynos_tmu_set_emulation(void *drv_data, int temp) +static int exynos_tmu_set_emulation(struct thermal_zone *tz, int temp) { return -EINVAL; } #endif /* CONFIG_THERMAL_EMULATION */ =20 @@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *p= dev) return 0; } =20 -static const struct thermal_zone_of_device_ops exynos_sensor_ops =3D { +static const struct thermal_zone_device_ops exynos_sensor_ops =3D { .get_temp =3D exynos_get_temp, .set_emul_temp =3D exynos_tmu_set_emulation, }; @@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *p= dev) * data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd =3D thermal_zone_of_sensor_register(&pdev->dev, 0, data, - &exynos_sensor_ops); + data->tzd =3D devm_thermal_of_zone_register(&pdev->dev, 0, data, + &exynos_sensor_ops); if (IS_ERR(data->tzd)) { ret =3D PTR_ERR(data->tzd); if (ret !=3D -EPROBE_DEFER) @@ -1104,21 +1104,19 @@ static int exynos_tmu_probe(struct platform_device = *pdev) ret =3D exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_thermal; + goto err_sclk; } =20 ret =3D devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - goto err_thermal; + goto err_sclk; } =20 exynos_tmu_control(pdev, true); return 0; =20 -err_thermal: - thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); err_sclk: clk_disable_unprepare(data->sclk); err_clk: @@ -1136,9 +1134,7 @@ static int exynos_tmu_probe(struct platform_device *p= dev) static int exynos_tmu_remove(struct platform_device *pdev) { struct exynos_tmu_data *data =3D platform_get_drvdata(pdev); - struct thermal_zone_device *tzd =3D data->tzd; =20 - thermal_zone_of_sensor_unregister(&pdev->dev, tzd); exynos_tmu_control(pdev, false); =20 clk_disable_unprepare(data->sclk); --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 3E7DFC433EF for ; Mon, 25 Jul 2022 21:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237300AbiGYVa2 (ORCPT ); Mon, 25 Jul 2022 17:30:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236996AbiGYV3T (ORCPT ); Mon, 25 Jul 2022 17:29:19 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1079E255AB for ; Mon, 25 Jul 2022 14:28:12 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id v67-20020a1cac46000000b003a1888b9d36so10219379wme.0 for ; Mon, 25 Jul 2022 14:28: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=JuGNOlhxehBBwi2MK8Fh7ISvjbM/JkRb1FziqBsU70Y=; b=6GQ+E8elxfE4MzPZK59czfj18rZwiW9YGKN0RvLHawL1j5NftSlP90dbquqKY0Ue13 CgyraxPfRpFoXyQYgLeMwUDDW+E0f6Ja7YQ5SU4rRuZFS73pKwfVBXnWUuNaKCBqs7C/ YdRFUNzAQPPcyFBgrQ5XjsTy2bKp1ACEXa3Ry0L66la/hUud6toAMR27Hzuv3uDRMBT4 fob5UmSisNW/aFN3plnVfD0lt2pqUvcJq8Y/Cc9DKLsPP79qy3iUoA6ZMFDY/6bWVESu UWvdrMFeT6NgfPJFt0bOL6/MrxMVAhQs/ybLZ8SkVlWEKZ3cmPm3548ojHKxTWKd6Xiw +1Aw== 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=JuGNOlhxehBBwi2MK8Fh7ISvjbM/JkRb1FziqBsU70Y=; b=k5n+raNnl8NR/S4Q27YzC4NQua5qNBW/GiYuvocstOpq3sxf+lRhjExxwqi0g75sfz 7AeljM3cYwcPHApNFvQ7rM4bQ+kbow3/UOJROlPfHohyv7eabVDZRIhlZ/IY4B0GyqDh jjBBIEUPc8Rt9TgQu98DvvyOvicp+9Y+UmtDX3Ubp0urNCAYTkII/b7WT9r38eA6J8PS ZEySmIFNt1+RM+AglMTgmMwL/2BBwsjx4o60I6Rhi/g+T9RfmzQFzxE9m0YgG04Ng1cr 166onL50n36HAUHPJdFkjF3USblCqGHR1+KTDLx90QjnKmhbI4IhjXuqSQbgwlOxOcP8 Ir8A== X-Gm-Message-State: AJIora8xczbcbZCSp95ZhIQsYNNRhnRZvUjHDVf6PCqgNS++OsWV6lCc esZ2RgM/X2f2eF9CHGVQZUz8IQ== X-Google-Smtp-Source: AGRyM1v3Zxeg9nAMbSG/6KtM1U5vZi1hSauIM0jGwiJrdyQ1oZWJCkTpkigA35o5Xcxxy6txnWpqdg== X-Received: by 2002:a7b:ca4a:0:b0:3a3:651f:51d8 with SMTP id m10-20020a7bca4a000000b003a3651f51d8mr3353170wml.102.1658784490592; Mon, 25 Jul 2022 14:28:10 -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.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28:10 -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 31/32] thermal/core: Move set_trip_temp ops to the sysfs code Date: Mon, 25 Jul 2022 23:26:36 +0200 Message-Id: <20220725212637.2818207-32-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Given the trip points can be set in the thermal zone structure, there is no need of a specific OF function to do that. Move the code in the place where it is generic, in the sysfs set_trip_temp storing function. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_of.c | 23 ----------------------- drivers/thermal/thermal_sysfs.c | 5 ++++- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index dbb450a9823c..988470d44fb6 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -288,28 +288,6 @@ static int of_thermal_get_trip_temp(struct thermal_zon= e_device *tz, int trip, return 0; } =20 -static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int tr= ip, - int temp) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (trip >=3D tz->num_trips || trip < 0) - return -EDOM; - - if (data->ops && data->ops->set_trip_temp) { - int ret; - - ret =3D data->ops->set_trip_temp(data->sensor_data, trip, temp); - if (ret) - return ret; - } - - /* thermal framework should take care of data->mask & (1 << trip) */ - tz->trips[trip].temperature =3D temp; - - return 0; -} - static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int tr= ip, int *hyst) { @@ -350,7 +328,6 @@ static int of_thermal_get_crit_temp(struct thermal_zone= _device *tz, static struct thermal_zone_device_ops of_thermal_ops =3D { .get_trip_type =3D of_thermal_get_trip_type, .get_trip_temp =3D of_thermal_get_trip_temp, - .set_trip_temp =3D of_thermal_set_trip_temp, .get_trip_hyst =3D of_thermal_get_trip_hyst, .set_trip_hyst =3D of_thermal_set_trip_hyst, .get_crit_temp =3D of_thermal_get_crit_temp, diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysf= s.c index 5018459e8dd9..3c513561d346 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -115,7 +115,7 @@ trip_point_temp_store(struct device *dev, struct device= _attribute *attr, int temperature, hyst =3D 0; enum thermal_trip_type type; =20 - if (!tz->ops->set_trip_temp) + if (!tz->ops->set_trip_temp && !tz->trips) return -EPERM; =20 if (sscanf(attr->attr.name, "trip_point_%d_temp", &trip) !=3D 1) @@ -128,6 +128,9 @@ trip_point_temp_store(struct device *dev, struct device= _attribute *attr, if (ret) return ret; =20 + if (tz->trips) + tz->trips[trip].temperature =3D temperature; + if (tz->ops->get_trip_hyst) { ret =3D tz->ops->get_trip_hyst(tz, trip, &hyst); if (ret) --=20 2.25.1 From nobody Wed Apr 15 05:38:31 2026 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 49921C43334 for ; Mon, 25 Jul 2022 21:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237521AbiGYVae (ORCPT ); Mon, 25 Jul 2022 17:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237175AbiGYV3v (ORCPT ); Mon, 25 Jul 2022 17:29:51 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5EC24BF5 for ; Mon, 25 Jul 2022 14:28:14 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id i205-20020a1c3bd6000000b003a2fa488efdso4430720wma.4 for ; Mon, 25 Jul 2022 14:28:14 -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=xX3SYFJR4mHf53n4Vr/aR0/yh4w8JyaFawqhxn05BL8=; b=Ij4HLpscxBF9TaBrmvC4jgjWX3nCj9PE4cjntfxI+kjCwEjGjE0jASpWEiIe0JyjMw 68GFDgQyFcEAVuIcHCD3vIAJAQiL3s07sT/UgRTzH3YpiTDpc5jqjdG+s5ytQzya3hsh /JOTwfVIReRW5WuL4HrWAf8rlAUodd6gkEuFdakB7XkeFPIPvKWYOoVzNynTlcBfXo5i T9kqnVDMIpj8HemQAVKP1qlfb4cMRFHFG+oFIY+bnn2UVVZNn1m8hM6KlKslLiEf5bq2 7P8joIMVHOFojnuxU2/nKnnXOwC72hbXIMMg0sg0+JEHqLIXoZAI6aUWI7ldieAKu9NL mLGg== 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=xX3SYFJR4mHf53n4Vr/aR0/yh4w8JyaFawqhxn05BL8=; b=ws7E5c7Gn1V2lZJnCO06Sr9J3z+cIcOeSGwK2wCcw2W7NQh3Qoz/DmQ29H5X7eHQSi mf+MNbmmUCjni0N3OZRbOMXDdsNm+KcyvE7VC4PF8sZpGupnHViG0RYzRRYnCBpb8Ekq QpPkWcGPpragsab4nlM7fHXH4m+7Z7roJpu1zWW63o9b1wmrOKbeLvTLN5uREbbQ5ovR QJiLlPwZH5GJrPRBXwMFQ2u+hJREn9rzVBtgvSn9M8q/2iJ4KbuEp80m2FXKo/YrCX3y RLeotgvEeykfVG6avV4orRDx4CTbA52+N2nBCCAddi+tvxIpKnfFzGEEimvxJ6KdxV3q ZA5g== X-Gm-Message-State: AJIora+nBbRmbBCdGxzOcp8OMc+yLZ1fcIvia+kjDkwTnSjhDd6UICRU L+S1wQo1uPpGP8P02NX59l2y+w== X-Google-Smtp-Source: AGRyM1srmjZFMbbbTxNh4Hul6RThQDeLZ4SGw+sxbQuZTUWUwSNyWuis7XllbaW+eW244KBoWS7ykA== X-Received: by 2002:a05:600c:1549:b0:3a3:2aa2:6f60 with SMTP id f9-20020a05600c154900b003a32aa26f60mr9662642wmg.57.1658784492943; Mon, 25 Jul 2022 14:28:12 -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.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:28:12 -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 32/32] thermal/of: Remove old OF code Date: Mon, 25 Jul 2022 23:26:37 +0200 Message-Id: <20220725212637.2818207-33-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" All the drivers are converted to the new OF API, remove the old OF code. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 2 - drivers/thermal/thermal_of.c | 810 +-------------------------------- include/linux/thermal.h | 75 +-- 3 files changed, 19 insertions(+), 868 deletions(-) diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index c991bb290512..2241d2dce017 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -135,13 +135,11 @@ thermal_cooling_device_stats_update(struct thermal_co= oling_device *cdev, =20 /* device tree support */ #ifdef CONFIG_THERMAL_OF -int of_parse_thermal_zones(void); int of_thermal_get_ntrips(struct thermal_zone_device *); bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); const struct thermal_trip * of_thermal_get_trip_points(struct thermal_zone_device *); #else -static inline int of_parse_thermal_zones(void) { return 0; } static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) { return 0; diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 988470d44fb6..12dbf0a415c4 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -19,93 +19,6 @@ =20 #include "thermal_core.h" =20 -/*** Private data structures to represent thermal device tree data ***/ - -/** - * struct __thermal_cooling_bind_param - a cooling device for a trip point - * @cooling_device: a pointer to identify the referred cooling device - * @min: minimum cooling state used at this trip point - * @max: maximum cooling state used at this trip point - */ - -struct __thermal_cooling_bind_param { - struct device_node *cooling_device; - unsigned long min; - unsigned long max; -}; - -/** - * struct __thermal_bind_params - a match between trip and cooling device - * @tcbp: a pointer to an array of cooling devices - * @count: number of elements in array - * @trip_id: the trip point index - * @usage: the percentage (from 0 to 100) of cooling contribution - */ - -struct __thermal_bind_params { - struct __thermal_cooling_bind_param *tcbp; - unsigned int count; - unsigned int trip_id; - unsigned int usage; -}; - -/** - * struct __thermal_zone - internal representation of a thermal zone - * @passive_delay: polling interval while passive cooling is activated - * @polling_delay: zone polling interval - * @slope: slope of the temperature adjustment curve - * @offset: offset of the temperature adjustment curve - * @ntrips: number of trip points - * @trips: an array of trip points (0..ntrips - 1) - * @num_tbps: number of thermal bind params - * @tbps: an array of thermal bind params (0..num_tbps - 1) - * @sensor_data: sensor private data used while reading temperature and tr= end - * @ops: set of callbacks to handle the thermal zone based on DT - */ - -struct __thermal_zone { - int passive_delay; - int polling_delay; - int slope; - int offset; - - /* trip data */ - int ntrips; - struct thermal_trip *trips; - - /* cooling binding data */ - int num_tbps; - struct __thermal_bind_params *tbps; - - /* sensor interface */ - void *sensor_data; - const struct thermal_zone_of_device_ops *ops; -}; - -/*** DT thermal zone device callbacks ***/ - -static int of_thermal_get_temp(struct thermal_zone_device *tz, - int *temp) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->get_temp) - return -EINVAL; - - return data->ops->get_temp(data->sensor_data, temp); -} - -static int of_thermal_set_trips(struct thermal_zone_device *tz, - int low, int high) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->set_trips) - return -EINVAL; - - return data->ops->set_trips(data->sensor_data, low, high); -} - /** * of_thermal_get_ntrips - function to export number of available trip * points. @@ -158,114 +71,6 @@ of_thermal_get_trip_points(struct thermal_zone_device = *tz) } EXPORT_SYMBOL_GPL(of_thermal_get_trip_points); =20 -/** - * of_thermal_set_emul_temp - function to set emulated temperature - * - * @tz: pointer to a thermal zone - * @temp: temperature to set - * - * This function gives the ability to set emulated value of temperature, - * which is handy for debugging - * - * Return: zero on success, error code otherwise - */ -static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, - int temp) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->set_emul_temp) - return -EINVAL; - - return data->ops->set_emul_temp(data->sensor_data, temp); -} - -static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, - enum thermal_trend *trend) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->get_trend) - return -EINVAL; - - return data->ops->get_trend(data->sensor_data, trip, trend); -} - -static int of_thermal_change_mode(struct thermal_zone_device *tz, - enum thermal_device_mode mode) -{ - struct __thermal_zone *data =3D tz->devdata; - - return data->ops->change_mode(data->sensor_data, mode); -} - -static int of_thermal_bind(struct thermal_zone_device *thermal, - struct thermal_cooling_device *cdev) -{ - struct __thermal_zone *data =3D thermal->devdata; - struct __thermal_bind_params *tbp; - struct __thermal_cooling_bind_param *tcbp; - int i, j; - - if (!data || IS_ERR(data)) - return -ENODEV; - - /* find where to bind */ - for (i =3D 0; i < data->num_tbps; i++) { - tbp =3D data->tbps + i; - - for (j =3D 0; j < tbp->count; j++) { - tcbp =3D tbp->tcbp + j; - - if (tcbp->cooling_device =3D=3D cdev->np) { - int ret; - - ret =3D thermal_zone_bind_cooling_device(thermal, - tbp->trip_id, cdev, - tcbp->max, - tcbp->min, - tbp->usage); - if (ret) - return ret; - } - } - } - - return 0; -} - -static int of_thermal_unbind(struct thermal_zone_device *thermal, - struct thermal_cooling_device *cdev) -{ - struct __thermal_zone *data =3D thermal->devdata; - struct __thermal_bind_params *tbp; - struct __thermal_cooling_bind_param *tcbp; - int i, j; - - if (!data || IS_ERR(data)) - return -ENODEV; - - /* find where to unbind */ - for (i =3D 0; i < data->num_tbps; i++) { - tbp =3D data->tbps + i; - - for (j =3D 0; j < tbp->count; j++) { - tcbp =3D tbp->tcbp + j; - - if (tcbp->cooling_device =3D=3D cdev->np) { - int ret; - - ret =3D thermal_zone_unbind_cooling_device(thermal, - tbp->trip_id, cdev); - if (ret) - return ret; - } - } - } - - return 0; -} - static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int tr= ip, enum thermal_trip_type *type) { @@ -325,61 +130,6 @@ static int of_thermal_get_crit_temp(struct thermal_zon= e_device *tz, return -EINVAL; } =20 -static struct thermal_zone_device_ops of_thermal_ops =3D { - .get_trip_type =3D of_thermal_get_trip_type, - .get_trip_temp =3D of_thermal_get_trip_temp, - .get_trip_hyst =3D of_thermal_get_trip_hyst, - .set_trip_hyst =3D of_thermal_set_trip_hyst, - .get_crit_temp =3D of_thermal_get_crit_temp, - - .bind =3D of_thermal_bind, - .unbind =3D of_thermal_unbind, -}; - -/*** sensor API ***/ - -static struct thermal_zone_device * -thermal_zone_of_add_sensor(struct device_node *zone, - struct device_node *sensor, void *data, - const struct thermal_zone_of_device_ops *ops) -{ - struct thermal_zone_device *tzd; - struct __thermal_zone *tz; - - tzd =3D thermal_zone_get_zone_by_name(zone->name); - if (IS_ERR(tzd)) - return ERR_PTR(-EPROBE_DEFER); - - tz =3D tzd->devdata; - - if (!ops) - return ERR_PTR(-EINVAL); - - mutex_lock(&tzd->lock); - tz->ops =3D ops; - tz->sensor_data =3D data; - - tzd->ops->get_temp =3D of_thermal_get_temp; - tzd->ops->get_trend =3D of_thermal_get_trend; - - /* - * The thermal zone core will calculate the window if they have set the - * optional set_trips pointer. - */ - if (ops->set_trips) - tzd->ops->set_trips =3D of_thermal_set_trips; - - if (ops->set_emul_temp) - tzd->ops->set_emul_temp =3D of_thermal_set_emul_temp; - - if (ops->change_mode) - tzd->ops->change_mode =3D of_thermal_change_mode; - - mutex_unlock(&tzd->lock); - - return tzd; -} - /** * thermal_zone_of_get_sensor_id - get sensor ID from a DT thermal zone * @tz_np: a valid thermal zone device node. @@ -424,216 +174,6 @@ int thermal_zone_of_get_sensor_id(struct device_node = *tz_np, } EXPORT_SYMBOL_GPL(thermal_zone_of_get_sensor_id); =20 -/** - * thermal_zone_of_sensor_register - registers a sensor to a DT thermal zo= ne - * @dev: a valid struct device pointer of a sensor device. Must contain - * a valid .of_node, for the sensor node. - * @sensor_id: a sensor identifier, in case the sensor IP has more - * than one sensors - * @data: a private pointer (owned by the caller) that will be passed - * back, when a temperature reading is needed. - * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_t= emp. - * - * This function will search the list of thermal zones described in device - * tree and look for the zone that refer to the sensor device pointed by - * @dev->of_node as temperature providers. For the zone pointing to the - * sensor node, the sensor will be added to the DT thermal zone device. - * - * The thermal zone temperature is provided by the @get_temp function - * pointer. When called, it will have the private pointer @data back. - * - * The thermal zone temperature trend is provided by the @get_trend functi= on - * pointer. When called, it will have the private pointer @data back. - * - * TODO: - * 01 - This function must enqueue the new sensor instead of using - * it as the only source of temperature values. - * - * 02 - There must be a way to match the sensor with all thermal zones - * that refer to it. - * - * Return: On success returns a valid struct thermal_zone_device, - * otherwise, it returns a corresponding ERR_PTR(). Caller must - * check the return value with help of IS_ERR() helper. - */ -struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *d= ata, - const struct thermal_zone_of_device_ops *ops) -{ - struct device_node *np, *child, *sensor_np; - struct thermal_zone_device *tzd =3D ERR_PTR(-ENODEV); - static int old_tz_initialized; - int ret; - - if (!old_tz_initialized) { - ret =3D of_parse_thermal_zones(); - if (ret) - return ERR_PTR(ret); - old_tz_initialized =3D 1; - } - - np =3D of_find_node_by_name(NULL, "thermal-zones"); - if (!np) - return ERR_PTR(-ENODEV); - - if (!dev || !dev->of_node) { - of_node_put(np); - return ERR_PTR(-ENODEV); - } - - sensor_np =3D of_node_get(dev->of_node); - - for_each_available_child_of_node(np, child) { - int ret, id; - - /* For now, thermal framework supports only 1 sensor per zone */ - ret =3D thermal_zone_of_get_sensor_id(child, sensor_np, &id); - if (ret) - continue; - - if (id =3D=3D sensor_id) { - tzd =3D thermal_zone_of_add_sensor(child, sensor_np, - data, ops); - if (!IS_ERR(tzd)) - thermal_zone_device_enable(tzd); - - of_node_put(child); - goto exit; - } - } -exit: - of_node_put(sensor_np); - of_node_put(np); - - return tzd; -} -EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register); - -/** - * thermal_zone_of_sensor_unregister - unregisters a sensor from a DT ther= mal zone - * @dev: a valid struct device pointer of a sensor device. Must contain - * a valid .of_node, for the sensor node. - * @tzd: a pointer to struct thermal_zone_device where the sensor is regis= tered. - * - * This function removes the sensor callbacks and private data from the - * thermal zone device registered with thermal_zone_of_sensor_register() - * API. It will also silent the zone by remove the .get_temp() and .get_tr= end() - * thermal zone device callbacks. - * - * TODO: When the support to several sensors per zone is added, this - * function must search the sensor list based on @dev parameter. - * - */ -void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tzd) -{ - struct __thermal_zone *tz; - - if (!dev || !tzd || !tzd->devdata) - return; - - tz =3D tzd->devdata; - - /* no __thermal_zone, nothing to be done */ - if (!tz) - return; - - /* stop temperature polling */ - thermal_zone_device_disable(tzd); - - mutex_lock(&tzd->lock); - tzd->ops->get_temp =3D NULL; - tzd->ops->get_trend =3D NULL; - tzd->ops->set_emul_temp =3D NULL; - tzd->ops->change_mode =3D NULL; - - tz->ops =3D NULL; - tz->sensor_data =3D NULL; - mutex_unlock(&tzd->lock); -} -EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_unregister); - -static void devm_thermal_zone_of_sensor_release(struct device *dev, void *= res) -{ - thermal_zone_of_sensor_unregister(dev, - *(struct thermal_zone_device **)res); -} - -static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, - void *data) -{ - struct thermal_zone_device **r =3D res; - - if (WARN_ON(!r || !*r)) - return 0; - - return *r =3D=3D data; -} - -/** - * devm_thermal_zone_of_sensor_register - Resource managed version of - * thermal_zone_of_sensor_register() - * @dev: a valid struct device pointer of a sensor device. Must contain - * a valid .of_node, for the sensor node. - * @sensor_id: a sensor identifier, in case the sensor IP has more - * than one sensors - * @data: a private pointer (owned by the caller) that will be passed - * back, when a temperature reading is needed. - * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_t= emp. - * - * Refer thermal_zone_of_sensor_register() for more details. - * - * Return: On success returns a valid struct thermal_zone_device, - * otherwise, it returns a corresponding ERR_PTR(). Caller must - * check the return value with help of IS_ERR() helper. - * Registered thermal_zone_device device will automatically be - * released when device is unbounded. - */ -struct thermal_zone_device *devm_thermal_zone_of_sensor_register( - struct device *dev, int sensor_id, - void *data, const struct thermal_zone_of_device_ops *ops) -{ - struct thermal_zone_device **ptr, *tzd; - - ptr =3D devres_alloc(devm_thermal_zone_of_sensor_release, sizeof(*ptr), - GFP_KERNEL); - if (!ptr) - return ERR_PTR(-ENOMEM); - - tzd =3D thermal_zone_of_sensor_register(dev, sensor_id, data, ops); - if (IS_ERR(tzd)) { - devres_free(ptr); - return tzd; - } - - *ptr =3D tzd; - devres_add(dev, ptr); - - return tzd; -} -EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register); - -/** - * devm_thermal_zone_of_sensor_unregister - Resource managed version of - * thermal_zone_of_sensor_unregister(). - * @dev: Device for which which resource was allocated. - * @tzd: a pointer to struct thermal_zone_device where the sensor is regis= tered. - * - * This function removes the sensor callbacks and private data from the - * thermal zone device registered with devm_thermal_zone_of_sensor_registe= r() - * API. It will also silent the zone by remove the .get_temp() and .get_tr= end() - * thermal zone device callbacks. - * Normally this function will not need to be called and the resource - * management code will ensure that the resource is freed. - */ -void devm_thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tzd) -{ - WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, - devm_thermal_zone_of_sensor_match, tzd)); -} -EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_unregister); - /*** functions parsing device tree nodes ***/ =20 static int of_find_trip_id(struct device_node *np, struct device_node *tri= p) @@ -665,98 +205,6 @@ static int of_find_trip_id(struct device_node *np, str= uct device_node *trip) return i; } =20 -/** - * thermal_of_populate_bind_params - parse and fill cooling map data - * @np: DT node containing a cooling-map node - * @__tbp: data structure to be filled with cooling map info - * @trips: array of thermal zone trip points - * @ntrips: number of trip points inside trips. - * - * This function parses a cooling-map type of node represented by - * @np parameter and fills the read data into @__tbp data structure. - * It needs the already parsed array of trip points of the thermal zone - * in consideration. - * - * Return: 0 on success, proper error code otherwise - */ -static int thermal_of_populate_bind_params(struct device_node *tz_np, - struct device_node *np, - struct __thermal_bind_params *__tbp) -{ - struct of_phandle_args cooling_spec; - struct __thermal_cooling_bind_param *__tcbp; - struct device_node *trip; - int ret, i, count; - int trip_id; - u32 prop; - - /* Default weight. Usage is optional */ - __tbp->usage =3D THERMAL_WEIGHT_DEFAULT; - ret =3D of_property_read_u32(np, "contribution", &prop); - if (ret =3D=3D 0) - __tbp->usage =3D prop; - - trip =3D of_parse_phandle(np, "trip", 0); - if (!trip) { - pr_err("missing trip property\n"); - return -ENODEV; - } - - trip_id =3D of_find_trip_id(tz_np, trip); - if (trip_id < 0) { - ret =3D trip_id; - goto end; - } - - __tbp->trip_id =3D trip_id; -=09 - count =3D of_count_phandle_with_args(np, "cooling-device", - "#cooling-cells"); - if (count <=3D 0) { - pr_err("Add a cooling_device property with at least one device\n"); - ret =3D -ENOENT; - goto end; - } - - __tcbp =3D kcalloc(count, sizeof(*__tcbp), GFP_KERNEL); - if (!__tcbp) { - ret =3D -ENOMEM; - goto end; - } - - for (i =3D 0; i < count; i++) { - ret =3D of_parse_phandle_with_args(np, "cooling-device", - "#cooling-cells", i, &cooling_spec); - if (ret < 0) { - pr_err("Invalid cooling-device entry\n"); - goto free_tcbp; - } - - __tcbp[i].cooling_device =3D cooling_spec.np; - - if (cooling_spec.args_count >=3D 2) { /* at least min and max */ - __tcbp[i].min =3D cooling_spec.args[0]; - __tcbp[i].max =3D cooling_spec.args[1]; - } else { - pr_err("wrong reference to cooling device, missing limits\n"); - } - } - - __tbp->tcbp =3D __tcbp; - __tbp->count =3D count; - - goto end; - -free_tcbp: - for (i =3D i - 1; i >=3D 0; i--) - of_node_put(__tcbp[i].cooling_device); - kfree(__tcbp); -end: - of_node_put(trip); - - return ret; -} - /* * It maps 'enum thermal_trip_type' found in include/linux/thermal.h * into the device tree binding of 'trip', property type. @@ -873,174 +321,6 @@ static struct thermal_trip *thermal_of_trips_init(str= uct device_node *np, int *n return ERR_PTR(ret); } =20 -/** - * thermal_of_build_thermal_zone - parse and fill one thermal zone data - * @np: DT node containing a thermal zone node - * - * This function parses a thermal zone type of node represented by - * @np parameter and fills the read data into a __thermal_zone data struct= ure - * and return this pointer. - * - * TODO: Missing properties to parse: thermal-sensor-names - * - * Return: On success returns a valid struct __thermal_zone, - * otherwise, it returns a corresponding ERR_PTR(). Caller must - * check the return value with help of IS_ERR() helper. - */ -static struct __thermal_zone -__init *thermal_of_build_thermal_zone(struct device_node *np) -{ - struct device_node *child =3D NULL, *gchild; - struct __thermal_zone *tz; - int ret, i; - u32 prop, coef[2]; - - if (!np) { - pr_err("no thermal zone np\n"); - return ERR_PTR(-EINVAL); - } - - tz =3D kzalloc(sizeof(*tz), GFP_KERNEL); - if (!tz) - return ERR_PTR(-ENOMEM); - - ret =3D of_property_read_u32(np, "polling-delay-passive", &prop); - if (ret < 0) { - pr_err("%pOFn: missing polling-delay-passive property\n", np); - goto free_tz; - } - tz->passive_delay =3D prop; - - ret =3D of_property_read_u32(np, "polling-delay", &prop); - if (ret < 0) { - pr_err("%pOFn: missing polling-delay property\n", np); - goto free_tz; - } - tz->polling_delay =3D prop; - - /* - * REVIST: for now, the thermal framework supports only - * one sensor per thermal zone. Thus, we are considering - * only the first two values as slope and offset. - */ - ret =3D of_property_read_u32_array(np, "coefficients", coef, 2); - if (ret =3D=3D 0) { - tz->slope =3D coef[0]; - tz->offset =3D coef[1]; - } else { - tz->slope =3D 1; - tz->offset =3D 0; - } - - tz->trips =3D thermal_of_trips_init(np, &tz->ntrips); - if (IS_ERR(tz->trips)) { - ret =3D PTR_ERR(tz->trips); - goto finish; - } - - /* cooling-maps */ - child =3D of_get_child_by_name(np, "cooling-maps"); - - /* cooling-maps not provided */ - if (!child) - goto finish; - - tz->num_tbps =3D of_get_child_count(child); - if (tz->num_tbps =3D=3D 0) - goto finish; - - tz->tbps =3D kcalloc(tz->num_tbps, sizeof(*tz->tbps), GFP_KERNEL); - if (!tz->tbps) { - ret =3D -ENOMEM; - goto free_trips; - } - - i =3D 0; - for_each_child_of_node(child, gchild) { - ret =3D thermal_of_populate_bind_params(np, gchild, &tz->tbps[i++]); - if (ret) { - of_node_put(gchild); - goto free_tbps; - } - } - -finish: - of_node_put(child); - - return tz; - -free_tbps: - for (i =3D i - 1; i >=3D 0; i--) { - struct __thermal_bind_params *tbp =3D tz->tbps + i; - int j; - - for (j =3D 0; j < tbp->count; j++) - of_node_put(tbp->tcbp[j].cooling_device); - - kfree(tbp->tcbp); - } - - kfree(tz->tbps); -free_trips: - kfree(tz->trips); -free_tz: - kfree(tz); - of_node_put(child); - - return ERR_PTR(ret); -} - -static void of_thermal_free_zone(struct __thermal_zone *tz) -{ - struct __thermal_bind_params *tbp; - int i, j; - - for (i =3D 0; i < tz->num_tbps; i++) { - tbp =3D tz->tbps + i; - - for (j =3D 0; j < tbp->count; j++) - of_node_put(tbp->tcbp[j].cooling_device); - - kfree(tbp->tcbp); - } - - kfree(tz->tbps); - kfree(tz->trips); - kfree(tz); -} - -/** - * of_thermal_destroy_zones - remove all zones parsed and allocated resour= ces - * - * Finds all zones parsed and added to the thermal framework and remove th= em - * from the system, together with their resources. - * - */ -static __init void of_thermal_destroy_zones(void) -{ - struct device_node *np, *child; - - np =3D of_find_node_by_name(NULL, "thermal-zones"); - if (!np) { - pr_debug("unable to find thermal zones\n"); - return; - } - - for_each_available_child_of_node(np, child) { - struct thermal_zone_device *zone; - - zone =3D thermal_zone_get_zone_by_name(child->name); - if (IS_ERR(zone)) - continue; - - thermal_zone_device_unregister(zone); - kfree(zone->tzp); - kfree(zone->ops); - of_thermal_free_zone(zone->devdata); - } - of_node_put(np); -} - static struct device_node *of_thermal_zone_find(struct device_node *sensor= , int id) { struct device_node *np, *tz; @@ -1486,95 +766,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); */ void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz) { - WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, + WARN_ON(devres_release(dev, devm_thermal_of_zone_release, devm_thermal_of_zone_match, tz)); } EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); - -/** - * of_parse_thermal_zones - parse device tree thermal data - * - * Initialization function that can be called by machine initialization - * code to parse thermal data and populate the thermal framework - * with hardware thermal zones info. This function only parses thermal zon= es. - * Cooling devices and sensor devices nodes are supposed to be parsed - * by their respective drivers. - * - * Return: 0 on success, proper error code otherwise - * - */ -int of_parse_thermal_zones(void) -{ - struct device_node *np, *child; - struct __thermal_zone *tz; - struct thermal_zone_device_ops *ops; - - np =3D of_find_node_by_name(NULL, "thermal-zones"); - if (!np) { - pr_debug("unable to find thermal zones\n"); - return 0; /* Run successfully on systems without thermal DT */ - } - - for_each_available_child_of_node(np, child) { - struct thermal_zone_device *zone; - struct thermal_zone_params *tzp; - int i, mask =3D 0; - u32 prop; - - tz =3D thermal_of_build_thermal_zone(child); - if (IS_ERR(tz)) { - pr_err("failed to build thermal zone %pOFn: %ld\n", - child, - PTR_ERR(tz)); - continue; - } - - ops =3D kmemdup(&of_thermal_ops, sizeof(*ops), GFP_KERNEL); - if (!ops) - goto exit_free; - - tzp =3D kzalloc(sizeof(*tzp), GFP_KERNEL); - if (!tzp) { - kfree(ops); - goto exit_free; - } - - /* No hwmon because there might be hwmon drivers registering */ - tzp->no_hwmon =3D true; - - if (!of_property_read_u32(child, "sustainable-power", &prop)) - tzp->sustainable_power =3D prop; - - for (i =3D 0; i < tz->ntrips; i++) - mask |=3D 1 << i; - - /* these two are left for temperature drivers to use */ - tzp->slope =3D tz->slope; - tzp->offset =3D tz->offset; - - zone =3D thermal_zone_device_register_with_trips(child->name, tz->trips,= tz->ntrips, - mask, tz, ops, tzp, tz->passive_delay, - tz->polling_delay); - if (IS_ERR(zone)) { - pr_err("Failed to build %pOFn zone %ld\n", child, - PTR_ERR(zone)); - kfree(tzp); - kfree(ops); - of_thermal_free_zone(tz); - /* attempting to build remaining zones still */ - } - } - of_node_put(np); - - return 0; - -exit_free: - of_node_put(child); - of_node_put(np); - of_thermal_free_zone(tz); - - /* no memory available, so free what we have built */ - of_thermal_destroy_zones(); - - return -ENOMEM; -} diff --git a/include/linux/thermal.h b/include/linux/thermal.h index eb1a16f038c5..0c7a64b31821 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -298,33 +298,6 @@ struct thermal_zone_params { int offset; }; =20 -/** - * struct thermal_zone_of_device_ops - callbacks for handling DT based zon= es - * - * Mandatory: - * @get_temp: a pointer to a function that reads the sensor temperature. - * - * Optional: - * @get_trend: a pointer to a function that reads the sensor temperature t= rend. - * @set_trips: a pointer to a function that sets a temperature window. When - * this window is left the driver must inform the thermal core via - * thermal_zone_device_update. - * @set_emul_temp: a pointer to a function that sets sensor emulated - * temperature. - * @set_trip_temp: a pointer to a function that sets the trip temperature = on - * hardware. - * @change_mode: a pointer to a function that notifies the thermal zone - * mode change. - */ -struct thermal_zone_of_device_ops { - int (*get_temp)(void *, int *); - int (*get_trend)(void *, int, enum thermal_trend *); - int (*set_trips)(void *, int, int); - int (*set_emul_temp)(void *, int); - int (*set_trip_temp)(void *, int, int); - int (*change_mode) (void *, enum thermal_device_mode); -}; - /* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, void *data, @@ -337,45 +310,28 @@ void thermal_of_zone_unregister(struct thermal_zone_d= evice *tz); =20 void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz); =20 +void thermal_of_zone_unregister(struct thermal_zone_device *tz); + int thermal_zone_of_get_sensor_id(struct device_node *tz_np, struct device_node *sensor_np, u32 *id); -struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops); -void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz); -struct thermal_zone_device *devm_thermal_zone_of_sensor_register( - struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops); -void devm_thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz); #else - -static inline int thermal_zone_of_get_sensor_id(struct device_node *tz_np, - struct device_node *sensor_np, - u32 *id) -{ - return -ENOENT; -} -static inline struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops) +static inline +struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, + void *data, struct thermal_sensor_ops *ops) { - return ERR_PTR(-ENODEV); + return ERR_PTR(-ENOTSUPP); } =20 static inline -void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz) +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int id, + void *data, struct thermal_sensor_ops *ops) { + return ERR_PTR(-ENOTSUPP); } =20 -static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_regi= ster( - struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops) +static inline void thermal_of_zone_unregister(struct thermal_zone_device *= tz) { - return ERR_PTR(-ENODEV); } =20 static inline void thermal_of_zone_unregister(struct thermal_zone_device *= tz) @@ -386,12 +342,17 @@ static inline void devm_thermal_of_zone_unregister(st= ruct device *dev, struct th { } =20 -static inline -void devm_thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz) +static inline void devm_thermal_of_zone_unregister(struct device *dev, + struct thermal_zone_device *tz) { } =20 +static inline int thermal_zone_of_get_sensor_id(struct device_node *tz_np, + struct device_node *sensor_np, + u32 *id) +{ + return -ENOENT; +} #endif =20 #ifdef CONFIG_THERMAL --=20 2.25.1