From nobody Sat Apr 18 21:01:24 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 15853CCA482 for ; Sun, 10 Jul 2022 21:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbiGJVYn (ORCPT ); Sun, 10 Jul 2022 17:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiGJVYj (ORCPT ); Sun, 10 Jul 2022 17:24:39 -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 208C3EE1C for ; Sun, 10 Jul 2022 14:24:38 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id f2so4761130wrr.6 for ; Sun, 10 Jul 2022 14:24: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=Pt+F4UPJfX76BAar3Kq5kOUJASYi8LQ2o9UqHnwVMWk=; b=3Ipcvq1ziRYv0MzuHoPTbkXA/b72kz/ZPIDIKL9d8nZzLcM3B3ax4GOYnYWDonmThF oaskfqdr83X5Ni/bFLUHVk5JdHnVQWLFf3Iha+/2V1woNdpxm48PO64/WBc/GTiACS4j 0NrJfp+rcplqXlAWdh1vY0UEZSIfMpkY2GpTe5DMshvxcU1ElGzu5ASzNmbQ0acnns50 gJg2XK38RttM0viGCwjL1aVv7a6kz62Fz4qa+aPPyU7yB3QiwlB7hKzTehJiaEG+KPGw 7isJPqV4ZcRCNUO5s2wATihWKm2wrvD0k+7j472IByASALDgxbfUlvm1fsRKGzwFiVv/ INFw== 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=Pt+F4UPJfX76BAar3Kq5kOUJASYi8LQ2o9UqHnwVMWk=; b=5x4VZXhmUwGZ+kt7TAsHSChHsIlGtlfHC+NJ7AgSnl2qpiJOqCiRr5oPs05oykbHQE cVxmaCsWT0Afttnum3EEKBeW/Q5sOIZXYBe5hqZSMig7k+5s/uga7NXM+ohMLkTOokRs m/l9ghcvNdOco3NUwt4bGb785OVldE9RVytFdoUKA3j0Fq0sKqhUPjB1pNAhnOk5p7V8 ZdvhsKVBe5+8kLmxw26dWt5DPKxxvHJHqQJVeqibI3euFwzBmGOhjAn7s5VUwHTdGpws abiuUYzXX2+a+X/4rLx+Ta2MLwqtAxUkjL09PykUXqtbGOwS+1jp9QIgt8rnU1/8kG30 VTfw== X-Gm-Message-State: AJIora9kU/7cYDO31D6hz9E4rCzM7r7nF0E2J+h7LmlBitoVTTYtZ5Y2 RYun1GDnXDRl8E/jzHOYyhGXrA== X-Google-Smtp-Source: AGRyM1uMQbRo8e92o4VNM0NNWEmVhWFPU5ARLUAsfE8uL+cGP6Q+b/uHzXvsXJSm9nTVbxgT/htR4Q== X-Received: by 2002:a05:6000:702:b0:21d:7f65:f1b5 with SMTP id bs2-20020a056000070200b0021d7f65f1b5mr14008191wrb.555.1657488276621; Sun, 10 Jul 2022 14:24:36 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:36 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 01/33] thermal/of: Rework the thermal device tree initialization Date: Sun, 10 Jul 2022 23:23:51 +0200 Message-Id: <20220710212423.681301-2-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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 | 452 ++++++++++++++++++++++++++++++++++- include/linux/thermal.h | 18 ++ 2 files changed, 460 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 0693edc00f60..59e6411fcc23 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,448 @@ 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; + =09 + 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_info("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]; +=09 + 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; + } +=09 + /* + * 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; + } +=09 + of_node_put(cm_np); +out: + of_node_put(tz_np); +=09 + 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); + + mutex_lock(&tz->lock); + kfree(tz->trips); + kfree(tz->tzp); + tz->trips =3D NULL; + tz->tzp =3D NULL; + mutex_unlock(&tz->lock); + + thermal_zone_device_unregister(tz); +} +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, + struct thermal_zone_device_ops *ops) +{ + struct thermal_zone_device *tz; + struct thermal_trip *trips; + struct thermal_zone_params *tzp; + struct device_node *np; + int delay, pdelay; + int ntrips, mask; + int ret; + + 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); + } +=09 + 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; + } + + ops->get_trip_type =3D ops->get_trip_type ? : of_thermal_get_trip_type; + ops->get_trip_temp =3D ops->get_trip_temp ? : of_thermal_get_trip_temp; + ops->get_trip_hyst =3D ops->get_trip_hyst ? : of_thermal_get_trip_hyst; + ops->set_trip_hyst =3D ops->set_trip_hyst ? : of_thermal_set_trip_hyst; + ops->get_crit_temp =3D ops->get_crit_temp ? : of_thermal_get_crit_temp; + ops->bind =3D thermal_of_bind; + ops->unbind =3D thermal_of_unbind; + + mask =3D GENMASK_ULL((ntrips) - 1, 0); +=09 + tz =3D thermal_zone_device_register_with_trips(np->name, trips, ntrips, + mask, data, 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; + } + + 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, + 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..0335aeec56ce 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, + struct thermal_zone_device_ops *ops); + +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int id, void *data, + struct thermal_zone_device_ops *ops); + +void thermal_of_zone_unregister(struct thermal_zone_device *tz); +=09 +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 Sat Apr 18 21:01:24 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 1B649C43334 for ; Sun, 10 Jul 2022 21:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbiGJVYr (ORCPT ); Sun, 10 Jul 2022 17:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiGJVYl (ORCPT ); Sun, 10 Jul 2022 17:24:41 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266C510548 for ; Sun, 10 Jul 2022 14:24:39 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so2015967wmb.5 for ; Sun, 10 Jul 2022 14:24:39 -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=wPnJAfFnd3wDunU75N6r1WtNSew2hFlVfY0tCu19E2Y=; b=LFO9AXb6O5BtHxx4B3bZybckQXVj5Fblc/z1eM9tpN7ttE/Y+4NZ36rPu1yvix+aPF Zrff5O8wBjJmNQ2EXX51I/HONyOa1uxQTv5lcO3MqOPZq4yBic4lCmRrJP2RQUbiHkRL DwjFUj+HDeV8T0fPxF/OEJRWEV/+Nn94dmTq2FsxnHaxYJvKWqg5yeqDMjmjKZmFXluS 7fRh6pAeI14jytiRpXCtoUcMxHPS48DCg1GtVMXBzUrD20YIXwCMMum03BnbCiWjl9cS TrsZe5QFhZipuyooth+/1s70iT4WZHhsbEaDi/IF7JxTxGY2MyQGMTzAetukdzJoi6AK VrAg== 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=wPnJAfFnd3wDunU75N6r1WtNSew2hFlVfY0tCu19E2Y=; b=koRSm/qW1xOjn8wKVeHI0jKrYcsr+91fy6S64SLFQ9DD3kn0OGfhLuAsXIZiRE3M0M tj+qtR43FH8qmO6TP1/f5DllViDyaZQA2F2OjoSyLv5ykGpoInqeIt0GclYiws3OufYu yzoS0GmNUKxV7k7j829ptKB4BxmjlSxvaMgchal7IB1iBAzNkUaDR+qsYYAxdMKEjGsf wYUNcStkXX9tSSsO6huB4tpVOnrih+S9+kXoGKD4brIAd7QmkhnoqmHGdWcjWjlkK6jd LSVLFdMgCF3c9Dz96DGKEayKE9l/j9xpJx+71rRd2LT6WqT8qoRa+6CAyL7GYN0uISC2 Glxg== X-Gm-Message-State: AJIora838PssEdChy6pCxtqGF+NMKH19xOi/T9pDvBBcdCmU4gbOZGrf A1rgsCtT/JK9aav9uko1og2zsQ== X-Google-Smtp-Source: AGRyM1sZxx/vOercXS7JTdWs/lCHIF5gSfc0XtT2aGm8suodLBhBAdSvm+l37u5v38pqT+H2FUkDNQ== X-Received: by 2002:a1c:f317:0:b0:3a2:df38:9877 with SMTP id q23-20020a1cf317000000b003a2df389877mr11628713wmq.124.1657488277767; Sun, 10 Jul 2022 14:24:37 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:37 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 02/33] thermal/of: Make new code and old code co-exist Date: Sun, 10 Jul 2022 23:23:52 +0200 Message-Id: <20220710212423.681301-3-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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 59e6411fcc23..60ce270f2add 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -485,7 +485,16 @@ 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; =20 + if (!old_tz_initialized) { + ret =3D of_parse_thermal_zones(); + if (ret) + return ERR_PTR(ret); + old_tz_initialized =3D 1; + } +=09 np =3D of_find_node_by_name(NULL, "thermal-zones"); if (!np) return ERR_PTR(-ENODEV); @@ -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; @@ -1509,7 +1518,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 Sat Apr 18 21:01:24 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 14999C43334 for ; Sun, 10 Jul 2022 21:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbiGJVYu (ORCPT ); Sun, 10 Jul 2022 17:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbiGJVYl (ORCPT ); Sun, 10 Jul 2022 17:24:41 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A9110FFB for ; Sun, 10 Jul 2022 14:24:40 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id l42so1989344wms.5 for ; Sun, 10 Jul 2022 14:24: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=HjRFmpGybbr7CcVNDUXcigDJ5VrNfuY+c1EB/6AHNWI=; b=OxjhRHGwv3JxchWDTPUu1T+zywciRVphtTvXEmU6mUP2Q9Of5MXMuHJY5jKgJ6vOj5 0FkeqDfjT/IT/xDaqYBzID/YeazVI30mFF4P5pEUJxCKFt1lqN5GhLAyfDCgXZZJaV2K dDfhBRDUjsb+PsEVfJszUYZM3197zydiypebSIPcqBt4cUhP+JV+xuPrRncSvDMKWF2/ p/dTWys6Fe4NJQKArT17uycj3ES1nZJi8EO6o2/Jg5QJMl33K1QqSOkETVJK6m6IT0GL PtBaI7T9ekSbYG++sokQO3C4N5hDmtfflXY+DWamHH+PQP+iaua08bc9WYB0yvJY8Tec OFKw== 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=HjRFmpGybbr7CcVNDUXcigDJ5VrNfuY+c1EB/6AHNWI=; b=4l4Jmthm+2t2ERIRRDJpKSWGqj8nnWHlkdKycr5wi8jnGrgFEUtbOoWoRVMKRIIrHC rwcE9a2CEC38uKGkCumu3UaXmeBEaUb7Mdi+rFfJUYUSyNqP+7LABP82fe2BObBxb/is IaMlBfzS9s8l5qwqNAd1saGhGUxnnVClC7RShZzosksanNaYt26zwpSlhIZTXxQIkiJC qa4AiXUMTAh119uqr4zx1ng74Wlc6ghzmxgqyH2ZKtlaTbcaojbvL9wi+Wq61EB/t450 IKqtBQjM5DBdSiz6Kv4/O/WSiUOFROrKpv4iNU4BDhR/LwWjy+PPRuqWN0iVEcZDi9rn EG/Q== X-Gm-Message-State: AJIora8yI9YmsPK0WvZBVHAza/PcUU8sXp+oW9R0GHCSQn+LXPISDM0a 1aigkrqPB/DLyfFuGes6E7Kbmw== X-Google-Smtp-Source: AGRyM1usBJbr5Lkiq7/hO35XDewZS0GFLE3KDQw4iUzv5twxxD1w/8r2ebUW/ye7FMkxIGG534Tm/Q== X-Received: by 2002:a05:600c:1c93:b0:3a0:579e:9f44 with SMTP id k19-20020a05600c1c9300b003a0579e9f44mr12373763wms.82.1657488278918; Sun, 10 Jul 2022 14:24:38 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:38 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Heiko Stuebner , 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 v1 03/33] thermal/drivers/rockchip: Switch to new of API Date: Sun, 10 Jul 2022 23:23:53 +0200 Message-Id: <20220710212423.681301-4-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..ea3abfb8e6c8 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 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 Sat Apr 18 21:01:24 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 39D61C433EF for ; Sun, 10 Jul 2022 21:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbiGJVYx (ORCPT ); Sun, 10 Jul 2022 17:24:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbiGJVYm (ORCPT ); Sun, 10 Jul 2022 17:24:42 -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 86D1FEE1D for ; Sun, 10 Jul 2022 14:24:41 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id d13-20020a05600c34cd00b003a2dc1cf0b4so2016143wmq.4 for ; Sun, 10 Jul 2022 14:24:41 -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=PQqkCzGs0TNscL3Fp51/xfhe1kt8vg2MHxpQZiBNFPs=; b=4aJZt2aQ31ms4fI64NW66+/kEAOAtdLX3E9HzQVb1yM90MfiW3C/yVvHPEqGA+VA8Y VDNjVVwCkNDR9PJ++2YyQyAR8kgPrlSiM7fW1fnHz61BdP2sEE3ZHuzaR9Ijh3sDmhyH XZWPNovQs/YInhp4N7AChczwTTawfe/MCmdWkGUhugxS3CJZlAgyRKqt0cwQq5YwUvtV dwduRJ5Uuz9SAbCr6M664XpWqnJnGA/Kl697gxXhfn5KF9cEe5iSOaR4BFHrX8No6SzS waB2UA8u5IdKO5Nsg+EdvVp2PRdB2yhW3d+otTRlS6yVebsAyCRij3BS0YAigualSreJ pXQw== 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=PQqkCzGs0TNscL3Fp51/xfhe1kt8vg2MHxpQZiBNFPs=; b=QGD231LA5aaJZmFuHv6gAGMeENpzLEL6Ksev6Uf67eswXWupVd5sjXbCO9d6imiiXO 8Iq9g4Xx4PJlM3i9Z/mn9ToqaPHgqa22CXcYJzgPGQAMMF2RARXB6E5gsn6y1Cdj7Sks kfwAJzJtWfmdoch3+6tSEf4Fv6NiUPgWgHdEEkpkbBqwqicPIAgusdPgtFZlMHmuBGU0 e+kVQDYsBWnSh75pCEdCciUTp7+lcbxGzZ+OFKcF/GPG1KiYEMV/VtVObZ7eZXC1efez C/VCiIbjFokfghdUluAzpvoFIaLcb7Mp5/9GTOtUH//7cqQrcz3ryjOT6GR2eSBGNQJi TOqg== X-Gm-Message-State: AJIora90cuLvbvwcFQdhkohAa0Z+m7ITCV/21+x9VChU03j5RHUfCZbZ zvHm8g2RNblv+LpFt8StBLKsvQ== X-Google-Smtp-Source: AGRyM1vehfk2uVwMBSPqXeTnml3BqmcbapAlnZRFWFrq89E2gid0IDjS6WDq8q4pULjlwDqg4AtKiQ== X-Received: by 2002:a1c:ed14:0:b0:3a2:b91b:dce4 with SMTP id l20-20020a1ced14000000b003a2b91bdce4mr12459265wmh.22.1657488280129; Sun, 10 Jul 2022 14:24:40 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:39 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Kunihiko Hayashi , Masami Hiramatsu , linux-arm-kernel@lists.infradead.org (moderated list:ARM/UNIPHIER ARCHITECTURE) Subject: [PATCH v1 04/33] thermal/drivers/uniphier: Switch to new of API Date: Sun, 10 Jul 2022 23:23:54 +0200 Message-Id: <20220710212423.681301-5-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..2405e72fb5f9 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 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 Sat Apr 18 21:01:24 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 1F309C43334 for ; Sun, 10 Jul 2022 21:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229601AbiGJVY5 (ORCPT ); Sun, 10 Jul 2022 17:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiGJVYm (ORCPT ); Sun, 10 Jul 2022 17:24:42 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8843110549 for ; Sun, 10 Jul 2022 14:24:41 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so2016017wmb.5 for ; Sun, 10 Jul 2022 14:24:41 -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=e6UpZxMs6Mqjfm9lFZkQvs2oPZ3BpcuARfv2WvsRFc8=; b=7eP5i1cApoeADUl1qvPMI05On/4n8rzqej9f1ynk/X8gS+0GIfns9KyuaR9ADGkkUb +dat/V+CoEk/6CbkBlcrJlzSL03Kg7GZRCu7kM9EoM4d++BB7HeIsFix4d2lAPhjCjVT FchZH52kyTSDBFlmKgkzTD98mntb8CAX2Q8NLgySEUOUYNQPfwyk/buvD8im8xDMIP7B fWUBkRzDD/8vCnY0OKG7BmZSo7+i4WJRXhKcDccZaMmQxdKYDQv5VFqMMUf8G8ceGxti qAXMQ/qzhTfXL15q/fcXOHQK9LTdXPvAArgxYDwuISkeqYQU6MmjZqE/P453FlyTj/x7 Y5NA== 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=e6UpZxMs6Mqjfm9lFZkQvs2oPZ3BpcuARfv2WvsRFc8=; b=Dtordzc5xJ85Yg1IjReUMNlhRuu3+fhDx3fRWVAPDUcMvvj2fEsQ4ToXkPoTvenBO/ e8fBFLCDFKmWaJclif/jqevvKMdgLPrIxTYK/lSbyTKnjqOc81rybtPc77C917Cqhn8i 03yldB7xrgIwcpdnnEelFRND56rxifQcCLZ+tkMJEU0lLmA5lAkmD3RHdGv7ffcTjCnG N4E/Np/jqsQf8D/Tsjhxc2ktGD+lRalrdiqwccVGMrM1woJzKpdZUSLg0JrywOzFTXPz Ql9RtVUJGrRO8R6T4EBsPwlUDqpqNBhA+6MNgEw0WhGeg+kJtFxzLubXwkIYEmv+wD5q tJPQ== X-Gm-Message-State: AJIora+PUjjnYqTFwhmdNbOurukDbjNWr6kDCH9q02cpZyqPhaSN5Lej 1KIoKnXN/1BS3loYa9Jwwu6oFg== X-Google-Smtp-Source: AGRyM1sU6krUfi9DTkwT2d3dqHGaGczAfeCTxsiKOGMOsQMqzxz5m+5MnRgSOE6BbF1G8zXvDRCSMQ== X-Received: by 2002:a05:600c:224b:b0:3a2:e86a:988a with SMTP id a11-20020a05600c224b00b003a2e86a988amr1241607wmm.135.1657488281194; Sun, 10 Jul 2022 14:24:41 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:40 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 05/33] thermal/drivers/generic-adc: Switch to new of API Date: Sun, 10 Jul 2022 23:23:55 +0200 Message-Id: <20220710212423.681301-6-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..5d58ba904298 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 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 Sat Apr 18 21:01:24 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 8E49EC43334 for ; Sun, 10 Jul 2022 21:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229624AbiGJVZB (ORCPT ); Sun, 10 Jul 2022 17:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbiGJVYq (ORCPT ); Sun, 10 Jul 2022 17:24:46 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B871311152 for ; Sun, 10 Jul 2022 14:24:43 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id bk26so4740164wrb.11 for ; Sun, 10 Jul 2022 14:24:43 -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=Xk6A/pNWCl/Nzs7Qg1vyN7A/ewbkmH3NrwD0SYWTSzQ=; b=bY0fExwP3MURnYRBx4omWr6dHDeloNf3GtuXmB5SJTGKaGli9DPxOPVtnSXfYy/IZj euH+0zIKdnC7syngU7AO3tFLPLy4YJ7YE3aSQJW879SKowor/hPmNwimCZyTBGh5Fokw pN9r62L2aLDdSE5mQlVIK31j3WZHW3y+JADNgy7szDmqsrXMtZDNu9XGKvArcYSW2SHK ZHv1RnXiGJEiqlVDqMmrkZgXzjw4/kKAAaHxZEN+0umle7/d+QLJLXzJVYqYnmYmZfa0 KetYEco7njc8yITUk7gDVNEXgnqAMDxUMyamEjaaT7qUP84VbJM1RZM3jkM/Ssdx3lA0 VlZg== 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=Xk6A/pNWCl/Nzs7Qg1vyN7A/ewbkmH3NrwD0SYWTSzQ=; b=OYDeE28S3FXg1ImpozTov0CUseU+XPfgws2OGt/x9vWibgY5097YDmOMn1ncoqB5NZ +M32NzMSxjHuwpkNgLYJlVVd7CoWVvMFULo/o3o6YrwFDX/EJSZGy0BTIleAst+1AIBU KrEtf6YZUoT1J15R+qedkG7ULA6LdhTm9SMtJAToSq2+v6q2mdtfs1+V1Ozh8pc5/7RJ XLi9tGt4HCtwwuC5On7IFxWd6tGVDejsByND3pO8V16fY1jR9I3hg+6AWeR3CmkotE3T ahjPJEvQJwBsZ7SXYAuPjWBMJugt0dA6BwQEVRJmAaL3BMAzqbdk4cb7feGSRIBFX9En JsWA== X-Gm-Message-State: AJIora/snw9sNkmOkovoh3znIODBOcIk9iiE98PHk3rPJv/o10sM8kw4 bD8EA1p9gTP4EnGq0IVg0vo9Vw== X-Google-Smtp-Source: AGRyM1vKS9doHkKgEmjxJC9SU75lHuuqhQ6vkhBSE+BJuwsds520dkzYONMvXdKg3SpePQIjpLJppQ== X-Received: by 2002:a05:6000:1446:b0:21d:27ea:5a01 with SMTP id v6-20020a056000144600b0021d27ea5a01mr13953400wrx.314.1657488282307; Sun, 10 Jul 2022 14:24:42 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:42 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Talel Shenhar Subject: [PATCH v1 06/33] thermal/drivers/mmio: Switch to new of API Date: Sun, 10 Jul 2022 23:23:56 +0200 Message-Id: <20220710212423.681301-7-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..fecf537bb470 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 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 Sat Apr 18 21:01:24 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 CE66DC43334 for ; Sun, 10 Jul 2022 21:25:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229463AbiGJVZK (ORCPT ); Sun, 10 Jul 2022 17:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiGJVZB (ORCPT ); Sun, 10 Jul 2022 17:25:01 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A2D413E38 for ; Sun, 10 Jul 2022 14:24:50 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id bk26so4740376wrb.11 for ; Sun, 10 Jul 2022 14:24: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=SyxSecaxyfXq67qrGJ11K0Y7p/mmLBDlC9uSFmHhUoU=; b=qiIGEGFDy9aVU7pT3HL3df9gb2BMR/O6+I0Hah7kXPmN2zCL5LMjVP1MdyUjRgtfTW +z2Drc6Iyyukl4YtezkIzoGzgIuGDS/aCh/HJc8vflrq8Qlni0u1GMxR8Z7KRfgBnJPz 7i1uWMFtA+OWR8IwwQUyFGJzSBM+5o7QAefem17GgGffu/Q/zCidXvMeUKwnr0zyt4hG m75u8kelrd3/Fy4vF43DaWxeE+aVO/dVwqX+bLazcbCbnS9akrQDWVTbR6xfayQzxoJq gHmlQvr5umn+ZPh4QCE5daEgJRpk7Vzu+kIolrXiJ+/1l7032owCdV4TEIPdT++/GfmU YwzQ== 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=SyxSecaxyfXq67qrGJ11K0Y7p/mmLBDlC9uSFmHhUoU=; b=yz/xT6Hzoaqh3HpIp6Zde1Iw835Cx1FcBK+jMisPMTAPyE9TX3yqiHuWqRrXuj7zfS pFk7va5muUcx9NwiFbvtojML2yxWfe91lm/s8BVN/u0OELGQGTYygKU4N5egmNAm2qaW rxuu3TsxRJS6zQyyURfzpVlyQ+GrVb+juw2M+X7pU2zULI0PPRER2YldF2g0LmIomGl5 xRXHL/3IOETARPnyqhoh/0Zdeg4NsToUJyPWSitjfQlO1mOXDYsPkiI6t0G7A5d5Kifz m3xt8CAAe/trrShnIgXTkv7Yn4we+uNM/oeBpNrJrEI5FE7xAno11AzkrdYN498NhKoR B4lQ== X-Gm-Message-State: AJIora8FeKOo5RUX8JkoSxu5CmzArcxH3q2KEW4IArkacBP4tE2Jj7ZH sX5Q9a421NKYAbcRg5A7hBBqfdwFWivz3w== X-Google-Smtp-Source: AGRyM1vhe7RfcxS8aO85F2LLfcWjkn1lLG61No+kHWIvhrtj2bwrow/v9AyZ18K4n7RWPttGImWAQw== X-Received: by 2002:a05:6000:1d1:b0:21d:6673:9894 with SMTP id t17-20020a05600001d100b0021d66739894mr13925586wrx.640.1657488290010; Sun, 10 Jul 2022 14:24:50 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:49 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Thierry Reding , Jonathan Hunter , Dmitry Osipenko , Mikko Perttunen , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v1 07/33] thermal/drivers/tegra: Switch to new of API Date: Sun, 10 Jul 2022 23:23:57 +0200 Message-Id: <20220710212423.681301-8-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..ae53bfc9e50b 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 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..a88d292a063a 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; @@ -59,10 +59,15 @@ static int tegra_bpmp_thermal_get_temp(void *data, int = *out_temp) =20 return 0; } +=09 +static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int= *out_temp) +{ + return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp); +} =20 -static int tegra_bpmp_thermal_set_trips(void *data, int low, int high) +static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, in= t low, int high) { - struct tegra_bpmp_thermal_zone *zone =3D data; + 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 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..8384980be9e3 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 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 Sat Apr 18 21:01:24 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 BB115CCA479 for ; Sun, 10 Jul 2022 21:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbiGJVZP (ORCPT ); Sun, 10 Jul 2022 17:25:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbiGJVZH (ORCPT ); Sun, 10 Jul 2022 17:25:07 -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 48EDA1570C for ; Sun, 10 Jul 2022 14:24:51 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id f2so4761460wrr.6 for ; Sun, 10 Jul 2022 14:24: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=XKrmrf+cSxdde7+ZUymVasY3n7CrcY/HjZWqjqekd2E=; b=Q6/0d8VjALBuFP6Yp6/DDTv9I6sAEW6VuNJ0HRWOdbHFQXEGVkKwEqGlyKySV7oKc0 zl9TgSS9dbQcAYqB5k9Qdc/MfOMbMV2wwJ6QehNTZv3ldzlg8dXldph6QRO0zqz9aAfu i8chWAUnWBSdBF8uVesQPWD8uDEJ4LcwFTxGHxBIZto03XxX6YqBUeS3SudWdspoFqOg gUMVqKEiza42aro7/7QSsT/ptwxZHZuNoP2d14R7J+6o4zaIrW4b5XGzJZ8vj6W0nvYu rw2FZyhy0mR8MvGud5WQVAUr5yrl1lXYKHyfitjIe4v2vcC6z0utO16kLSHFagt31w1H PZGw== 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=XKrmrf+cSxdde7+ZUymVasY3n7CrcY/HjZWqjqekd2E=; b=Hg/w1n/0WTF7sE9tsrirlKt1XH8NQDERNIkEeIxgfgjQrXm6zBmq6At4NC4tbrwJoa Lmsob9vJpc2/35rI0XIDjk7H2Y/MiCFX+KGYSuPlkaWmiGsJV6cSi5HQp3XT74OsF3JR sV02j6XJ000d3lXxloHE5N2CD3BKAH1drfEhEfFP2dGMhOwKGBpP7yuYhDJwNcB+4XQF qONC1coxnOQKSoJwrPhWbPC3DklxkoSpUMOpqU2cLRuklisaVq9R4I4+Xwe0k9A7wq/v o5A/ernpJb2ZYLA5gO6x84sltAAeMkWX0qh2BfW3PTqFzDE7iAkUuDgrmIuCIWL0orpP /yDQ== X-Gm-Message-State: AJIora/FH5o3qoYQHSq3gH4iAAvjXU648TW9m0JiOiMgzPOtJ/XDM++j nEOBzH+Gu2tgOsAOk8v9clf9Sw== X-Google-Smtp-Source: AGRyM1u2vq7qmaJGmyL9yhX5LXCLt9CoVTxexTX9SfZep/w9D5UJPtU+1Xzot74ix+2oUD+2qtF+9w== X-Received: by 2002:adf:d4c4:0:b0:21d:6c8f:4da3 with SMTP id w4-20020adfd4c4000000b0021d6c8f4da3mr14085345wrk.325.1657488291458; Sun, 10 Jul 2022 14:24:51 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:51 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vasily Khoruzhick , Yangtao Li , 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 v1 08/33] thermal/drivers/sun8i: Switch to new of API Date: Sun, 10 Jul 2022 23:23:58 +0200 Message-Id: <20220710212423.681301-9-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano --- 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..d4e04c2c5135 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 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 Sat Apr 18 21:01:24 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 0EB62C433EF for ; Sun, 10 Jul 2022 21:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbiGJVZX (ORCPT ); Sun, 10 Jul 2022 17:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbiGJVZI (ORCPT ); Sun, 10 Jul 2022 17:25:08 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BBDE1582F for ; Sun, 10 Jul 2022 14:24:54 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id y22-20020a7bcd96000000b003a2e2725e89so1708550wmj.0 for ; Sun, 10 Jul 2022 14:24: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=INk34QU48g4ONn4Ji/Nf4w3CB/6PWddAsr1wHbZyEGU=; b=hTG0EibU+AjAgaWN80FIO0I3IVp0EqRZiQeOLztiHW687LIvFERwOYArVxQx6yIdvH IBSLg7xFclb6BAPkFUmQmrep2j0NLrISGeM4OsRJCLKvaq6Gs153E2cK29CcexeLeeUK 5ushi7w0iA1Wz+XBkDDD2tk78+muhAJzz3YK/0zagBbVLcFY4x52cNk+WmMzgDYJ0dsI A+ECYcPqFvCAol/MuZEl3tH+J/M+t1fgUZpZiik6+13Pqy9eGbO8YKgYp8TkaYOn0ePY QQ9+e01uR/hRePCfGNMcWreOR0b7SuG7DwG2O/CQSuzihmQkee8AjvkoLR5nY90riTbb e3zA== 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=INk34QU48g4ONn4Ji/Nf4w3CB/6PWddAsr1wHbZyEGU=; b=mvgkioC3BcILViofzJj+xab0zdh5ZJlr1GWSJMZ8+Qhg7VbO0kYwhm0UXF1vG1Mytz wrjHD2Q7xn81RrFR0fROyd/IVT3ZqlCqmCzLdCj8VzqbP9PirL0bMkZI35M2p/056jza C2c7ju8zgXG1DLyZ5JOxXpruwc5Ve40qbrvBT3GylQV6ALkyPCzi6viX5uw8DgQB4jrC 8dztaRIZTsFJWXQd/Q4DRg4Y+zF+Ffv9QmeK+tygGAxT/A2DbvxoIr+AHGLeVjAB9mjJ ddNGTDvoltc9b0Pb8AolHCX6maIOcVUCPF/XJKyO0VyBEB/4GmUxmwm7N18xQb0mUwXH qx2A== X-Gm-Message-State: AJIora/MPY+xzrjLS3IvCazy2yAsMIwk4CuhJxxZRIt/l3K/yKlvNCyY weT8Bkn4RNfcxZqDXsc86+WSNQ== X-Google-Smtp-Source: AGRyM1tutHCkZnBe34Cn17VJl2lwBf5jyvPNpL13mRwcRo7v9pt2JinnXDpYMMSfQW+6kiTCa9Rr2Q== X-Received: by 2002:a05:600c:5023:b0:3a2:d6c1:4b52 with SMTP id n35-20020a05600c502300b003a2d6c14b52mr11901565wmr.13.1657488292613; Sun, 10 Jul 2022 14:24:52 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:52 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Orson Zhai , Baolin Wang , Chunyan Zhang Subject: [PATCH v1 09/33] thermal/drivers/sprd: Switch to new of API Date: Sun, 10 Jul 2022 23:23:59 +0200 Message-Id: <20220710212423.681301-10-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..eb8e6bc0fc28 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 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 Sat Apr 18 21:01:24 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 15B5FC433EF for ; Sun, 10 Jul 2022 21:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiGJVZv (ORCPT ); Sun, 10 Jul 2022 17:25:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbiGJVZV (ORCPT ); Sun, 10 Jul 2022 17:25:21 -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 55DA716581 for ; Sun, 10 Jul 2022 14:25:03 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id q9so4752605wrd.8 for ; Sun, 10 Jul 2022 14:25:03 -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=ZdZqryGNMWnNyZeLlzRFuZV+IRU5vvwot+uqXNMaBz0=; b=8VaLIjdOhEoVsAbT2Fb30QXZPvqhkTqOiH/7Yw89gQXa2vBo5MldCLFNshwnSo/oyU ElVRrJCOiOA8pw28W5jtxJPAR29EWzXKxNQtta3+jmBRKGLZraM+g9mIRwg+Rda/1k53 HGFka7VM97xC5qjLi6En3eoCAjZXd7nSejVNXUh3feC50vjzTQk4xFSS7RZRXdPLpjhO wd3+9gGlUti5JQoICH1s9DMwwh+BLJ9TgUqgcst1TKU1tPcF4dTSwZ0dHjwcWvKsVnpN s7DqFvik7QtpGwJiKEUFoNyM56pad1UbIHZx9XUjz3UiuPlQUSvAHeXNPPvgEA6Ylvnv BlQQ== 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=ZdZqryGNMWnNyZeLlzRFuZV+IRU5vvwot+uqXNMaBz0=; b=KLMf0sRfv3dCMwtu7N1YODliOJD0dRRc738UiFgDDryrGKQ9+cIl9CZCSVPnI3jr2R VuVMiNeebqm8kXENHb/U64csqAq1PdLLk8QU7s2V9Q/cI9ua2fipPOp7j1pM335qfBoR wvD7rf5X5B6gpua6JQ0KJUP3k0TQFw56PgqMT7EE8hv/ZzaUrvdekqM90W+7a4T/McY4 JWFWuw9mUcszFVFl+z2Ijtn1hDxvOK0n9DdUe3y1MmgXqZOUaEuW31OiVsTo0ukEkseh aKyz4Ka4wFBMYlC+quibR1Xiv7h5ydGG+BrYUGKIhSZasNEhbmY31a2vtCkOsYnvirrZ ztiQ== X-Gm-Message-State: AJIora/BUnsKqCNhLJ+Rdl8bm35CKWXz4ZWz/UoGGk6TaPOI/MuxmiYg vacZsoIn2WwGlS8drLBtRWMBJQ== X-Google-Smtp-Source: AGRyM1trqFFqRWuC5BLpUAz8LI9O0XAgo8gykf7SBfBfpcZpdqcmj8kby/aaNgwsArwywzm9oD/vrA== X-Received: by 2002:a5d:5903:0:b0:21d:6dd5:d9c3 with SMTP id v3-20020a5d5903000000b0021d6dd5d9c3mr13835071wrd.85.1657488297073; Sun, 10 Jul 2022 14:24:57 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:56 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Florian Fainelli , Broadcom internal kernel review list , 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 v1 10/33] thermal/drivers/broadcom: Switch to new of API Date: Sun, 10 Jul 2022 23:24:00 +0200 Message-Id: <20220710212423.681301-11-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli --- drivers/thermal/broadcom/bcm2711_thermal.c | 14 +++--- drivers/thermal/broadcom/brcmstb_thermal.c | 20 ++++----- drivers/thermal/broadcom/ns-thermal.c | 50 +++++++++------------- drivers/thermal/broadcom/sr-thermal.c | 16 +++---- 4 files changed, 46 insertions(+), 54 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/b= roadcom/bcm2711_thermal.c index e9bef5c3414b..64d75593e760 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 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/brcmstb_thermal.c b/drivers/thermal/b= roadcom/brcmstb_thermal.c index 0cedb8b4f00a..c459d14df3b5 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; + 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 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 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; + 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..b9c3f2306bf5 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 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..7c58eff407b3 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 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 Sat Apr 18 21:01:24 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 D4900C43334 for ; Sun, 10 Jul 2022 21:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229755AbiGJVZi (ORCPT ); Sun, 10 Jul 2022 17:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbiGJVZM (ORCPT ); Sun, 10 Jul 2022 17:25:12 -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 11CFC15FDA for ; Sun, 10 Jul 2022 14:24:58 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id r14so4782190wrg.1 for ; Sun, 10 Jul 2022 14:24: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=6nqlS4HJEPRuqGXDCJhKcOM7h4FYHZtSlqnLPCfi0Dk=; b=ZrAOZwErE5/4X6q2IFyHuCtdYe0LUbpXz71u3/j2ONeWEKZfTyIoVIGYwAsZhnrG3Q IoN7BR+eGyF9dQRLKhR/py5VHYAfJtAmBtDYlDqwghZer/XXzMs9dL/eLbbd/hS2QgaT w/rioF7n98gh9q6X8HfgD0bEugz9KDGOhBfAVOLbKOd2ohLod1fQcOnugOjm53ZPKxxc mzhHGB/dqDWcVjYFTFb7sI8aGUG9MUt3o2AaamlpipS6QnvLCc4OjF7DS8YbMQ8cGRYM c+5KcVTgeHv2L98HktAcgnyDTLz75zxFokDlTGwrlugjPdIeaeYmzleuM7MZf9K2vlLt jHrw== 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=6nqlS4HJEPRuqGXDCJhKcOM7h4FYHZtSlqnLPCfi0Dk=; b=CYVocS/sR/+9ngzwNGLICrrLhgKnBubPKc5e+oJ5YOC7bqiR7FiUh99NranMRnTtOD jSoX1xmwKBSCfgorCdiH37dKu/ub5yzw93ok6SBks/3lFyXpVfEjcaLjfCtqrXmNtWqz I8hRdoga5VhSYhSIhiBl/tII1TY6kPNi8jcQz+i8trsk/TNuKgyNbwE+ytMXXdvPrAwn noHg72ASMOz7qeoYY0kW6Crpx5XztfNy88EMviuIL4rNnIw9fETcpT8VlzmwQXSSr3oH pxjG1BYT2KpnHY2GTl1aZYY9XFLbaKG/fT8OQlBTxNm6e+S3MiTK9vteqzBv5AwlVKNR QTjg== X-Gm-Message-State: AJIora9HHCLagRwtaegi8iQI89j//BO+yAEjz/xDsov2V6oB2hdUpgAS +jK8MV1Ei61BC4mOUn1OuXg36g== X-Google-Smtp-Source: AGRyM1v+9b1xcJVkyjHsDKyIMiEXCdIeWEBpxVHAXAVVYARXpuoGu5ErD/Dkeo9nxBMpRfF7q9WBlw== X-Received: by 2002:adf:ed10:0:b0:21d:a9a1:3526 with SMTP id a16-20020adfed10000000b0021da9a13526mr191708wro.403.1657488298373; Sun, 10 Jul 2022 14:24:58 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:24:58 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Andy Gross , Bjorn Andersson , Thara Gopinath , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH v1 11/33] thermal/drivers/qcom: Switch to new of API Date: Sun, 10 Jul 2022 23:24:01 +0200 Message-Id: <20220710212423.681301-12-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..dccbb66e5cd2 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 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..cb1d382e833f 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 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..f59ad42d94e6 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 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 Sat Apr 18 21:01:24 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 719B5C433EF for ; Sun, 10 Jul 2022 21:25:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbiGJVZn (ORCPT ); Sun, 10 Jul 2022 17:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbiGJVZM (ORCPT ); Sun, 10 Jul 2022 17:25:12 -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 13C24120B2 for ; Sun, 10 Jul 2022 14:25:01 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id o8so2053636wms.2 for ; Sun, 10 Jul 2022 14:25: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=6IoU0PuNuCRcBh+gum4Wd5t5Tge49JrI8fmxQkb2xQI=; b=VHvF9bowyvjKbhs3nKAQr0yL/YBT0FIp4Fpto86reo5w9jDV5TBOxiWH93V1G4UenW Eqp1O+ORe8DqWkkcTrZZuSpbp5BlxGr7LMzm1MT5bsVkpljWUqI9+GM3kZzdqsJ7u322 PkQ0qIKn3KAf9Ig9YeMmxQIPZ1o4558waWmxz2P9TE0Y40JifHASUmsajnjQvWqNJk5R 71uam9+sSqF1QTu8ZSDfUrfjrPbI/AeChPArx40sl16b20FXzqhXXWTU5597OTnfOR36 nG4Hyahg4H6OlL9BCUvwkZBczE/wbO0QsxUwGK8b5k95y58++P6PKJXponhL8LOaOU/k tKCQ== 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=6IoU0PuNuCRcBh+gum4Wd5t5Tge49JrI8fmxQkb2xQI=; b=AZj5JDiZ0wZntlKHJfQeAXrvt3dPl1q1nZwXr1PIA0nMqiiYVYExng81Twz17RaFY4 VZf2sVZNdJVrK7sL/3dZjFAyPN0X3HQ9CN9O718TZj3rQPyPzO7ybbWj7Qy26lJyBxOZ 5UJagtqrYNE6fVzthmOFwb0owQRlu2S6/4BXdhyX/hLczy2q/4G9AUueDQMIyMDvk70c Kj/UXD3Ney37I6uLR4aOEBWqX1f0uYns6xw6Po4tgtYYzEGRLooyR91lvOpQBN51zIt8 lTAZDz37kc3qEKUeo0oDAsX5do0irCkurDrH6XTLZmXD2NW1M50lX+tLSRMYS1Lq3Fp9 Ghow== X-Gm-Message-State: AJIora+xmxfI7On0x/mzq06Isql1Ioom4Sv5huMaqti2/2nSjPHvX46f 17MxE+oIlVezXHxXK+Q18eQZLA== X-Google-Smtp-Source: AGRyM1spXhMkMTmmqCi49PMudOLtGq3ZW+qNmbnk9hVYAcyFndJGxL+k0SSuo+aTO25YzIS1GQm9lQ== X-Received: by 2002:a05:600c:2059:b0:3a2:e5a4:ef8 with SMTP id p25-20020a05600c205900b003a2e5a40ef8mr4081389wmg.146.1657488300613; Sun, 10 Jul 2022 14:25:00 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:00 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Maxime Coquelin , 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 v1 12/33] thermal/drivers/st: Switch to new of API Date: Sun, 10 Jul 2022 23:24:02 +0200 Message-Id: <20220710212423.681301-13-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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 Sat Apr 18 21:01:24 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 41213C433EF for ; Sun, 10 Jul 2022 21:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbiGJVZp (ORCPT ); Sun, 10 Jul 2022 17:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiGJVZQ (ORCPT ); Sun, 10 Jul 2022 17:25:16 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BFA15FF8 for ; Sun, 10 Jul 2022 14:25:02 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id d13-20020a05600c34cd00b003a2dc1cf0b4so2016420wmq.4 for ; Sun, 10 Jul 2022 14:25: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=CDpLMifMj8xD25r4WkNfIKy72vVUOFHmRwDlvbLrKrs=; b=u5uV8L0CMYjZ3UtssL772lhFuB9HX5aWqtsXxGQc2rgGuqmKez0AwC+7jF26V6usaq kaXCQWAI9cMaimIXKKeZO2JP3bqaOMg8Ip0psbVMPamwv/Wicw2umoWRcM0qUQ8zD0O5 nNeC65Bf2xgedE35kO705wdh7C3apIrAHFsZL2CftoQt1m0zrkmp2llLnHJiRs2jnbrG bYWgGc5VHPLk4nOzpnEDeafE8GJdtgqSIclj4dtRwP/ULsfUPfqlM8Phvd2C3ZXSdWsz Gr00uwO7961qsnpSAZ+dlcXkEGnQEe9YEXrv04odFxZpI97Hbv+TZfXCwoqFMXB8ZxYs 44WA== 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=CDpLMifMj8xD25r4WkNfIKy72vVUOFHmRwDlvbLrKrs=; b=VAc7hHK3yp3QwdBl0Hh6cvuDaEdFwI7QckSQquO9lO898mq7TzrcVZ9r9HxKxIP4jA 7mUgLcPTsZ15nRThREFM3CBe+ggrDYRWYFOoaqvKeKdv3ScwJadaBsKu6aqMk/N1h/h3 hxkYAWZDSlpGGqbjkBv0gJDvMmsme6/EzkT8ugOV6DibS1Y0v3FE+A+ZlqDa4AmyKLnc RT3bLvzbDtdnV3vsfn/+TRDjXPeFUszecD2V4MRGZlzsu0RKIoAJSb/ZbSnD1vZqWLJt UZstc1vS0JAVBpG3OZO7/Az02X5rva03ZbYQmQru9ONo9CdEh5jbAXkgrjl6HC6p5FPT oRvQ== X-Gm-Message-State: AJIora8Qe09NgrQq0zrItpb299ENojXzQ2d+FIAkVOhtDPFf6L4RKoYa 4Hg2ujihiBVg/3Ur6qrc315DqA== X-Google-Smtp-Source: AGRyM1tb9dJ2C2FATBCjs5fyOV7YnyJ32Mmp+pPKK4xv6L6sx3r48q2s7ovpZXLuMvaIcd3yG41Sxg== X-Received: by 2002:a05:600c:22da:b0:3a0:4e7b:4237 with SMTP id 26-20020a05600c22da00b003a04e7b4237mr11879597wmg.101.1657488301801; Sun, 10 Jul 2022 14:25:01 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:01 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Guillaume La Roque , linux-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS) Subject: [PATCH v1 13/33] thermal/drivers/amlogic: Switch to new of API Date: Sun, 10 Jul 2022 23:24:03 +0200 Message-Id: <20220710212423.681301-14-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..53eb7612884f 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 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 Sat Apr 18 21:01:24 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 20D0ACCA479 for ; Sun, 10 Jul 2022 21:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbiGJV0V (ORCPT ); Sun, 10 Jul 2022 17:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiGJVZo (ORCPT ); Sun, 10 Jul 2022 17:25:44 -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 755AA165B7 for ; Sun, 10 Jul 2022 14:25:18 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id d16so4742852wrv.10 for ; Sun, 10 Jul 2022 14:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0VqD6Kev6VpOnlemDKOOgsLknXMbXjfC/c5SvSd/sfA=; b=3tN7jm+EAe27LAGDzDjITeX7X69ZTvKB7Pg2lBkNSRSxJpzDCk5NWODvshf2VgMO3P 3jYYCGHZNpdllYmBB0KZHDNPSj8v9uUFnQBK//R1QgcuYz0OTvtzRa3owN1WnOrvzUjC 5cTqpuptbLDB1tkB7cWPDiEmGBnvZAj+hRoDK03cTl6PPL9daSTzm1vw79TNALglN6l/ 4QULZnavS3EHGEZRHFJXYgiwo1a81rmEOqeqOKu8PHGypecspPsG6tKZdS5COhZnsnpo u2nAKw4E+cChsBlS91UMCepzS4w3TQIN0yWIkSfcx7UgsNHv9f631Mi592V4H/pxm+ex 4Mrw== 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=0VqD6Kev6VpOnlemDKOOgsLknXMbXjfC/c5SvSd/sfA=; b=P7ZYa4/eBhDjcSQAQ3W/nvb4ibTGyI8L7RmmRKPdCEp32k+1FOU7HWW2TsJe9+1VjP uRuTlBe0sFyjcFsK/32cq/9g9J2pfQAulX5kJoJIy30ZW7q9+5IB0fvi2Qs5K0859mHL bgp+40b5MvyAXV49Qav8talG6bHh/iCVsezyV3MGm19t4MEmz5LvDn8kxrgjGH1vSFai CrrvsAg0CBKx9S2sZ9WDG3lQUVIGlXaBUwX0MqAh7krQ9Kpxa2vmTrDybi6e0fNohT1e aruxH4i8YzPPX7tsIVIPRjNjEncEd17AUiV1UhbdXZ2atCEfSKkEzMnva6KgHvdO12AE CHfg== X-Gm-Message-State: AJIora+3QFdcUXOcjazRXqzOyDKllfghoX/GNKWBQbz/2qMqBSD/dSCJ X9Hqtw3MXmc5OU2CyLA2y72s7w== X-Google-Smtp-Source: AGRyM1sSzyB7CSYFxqqnGpSGjUZBq9fLCMzcB7U7MimlSfil5Ogoz1VbACTlDbQfsuw8bJXO2djvfw== X-Received: by 2002:a05:6000:15c3:b0:21d:9f5a:df83 with SMTP id y3-20020a05600015c300b0021d9f5adf83mr4931743wry.360.1657488302963; Sun, 10 Jul 2022 14:25:02 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:02 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Miquel Raynal Subject: [PATCH v1 14/33] thermal/drivers/armada: Switch to new of API Date: Sun, 10 Jul 2022 23:24:04 +0200 Message-Id: <20220710212423.681301-15-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..72346cf1335a 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 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 Sat Apr 18 21:01:24 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 79765CCA481 for ; Sun, 10 Jul 2022 21:26:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbiGJV01 (ORCPT ); Sun, 10 Jul 2022 17:26:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbiGJVZx (ORCPT ); Sun, 10 Jul 2022 17:25:53 -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 04D06167CD for ; Sun, 10 Jul 2022 14:25:20 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id v16so4734853wrd.13 for ; Sun, 10 Jul 2022 14:25:19 -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=XcpZSIH2SERO1GqyHwX4x93zMY30Y7mW4dlxxSKfG3U=; b=DkH+joBDC3nsJED1Ms9+qHjYNRXpFVkLjKKz8SDgtNuruLOmDbFn4tNLITaL/3fUs1 iEToE8oeRMl1JjC37xgHsLLgC7saTnUNTrkOQJfKLncPNSKkjCcp6j25vVS99YPZ26vV Am31ePHKac9HHpkYrgA5W8WpbfAJgTkufFqpkTW6tYr+YPzpHThobK2YkSsMZVQcCHdu +/V+uiIeH7MlD6TGzYjL43t4vZ2vprSvLZ90d8o5nNa1gBBCE213u5yPZhZoO9VdPjCZ hJZqD14CSBKPnfEG0pfu/u6fDbI7kimoEs0+bW0rBeIu0o2yN6W3oKJrDhWRq+cfem+I OxCQ== 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=XcpZSIH2SERO1GqyHwX4x93zMY30Y7mW4dlxxSKfG3U=; b=7cPBAp/iCHvGlx1S0plkBKWK4QW6a0batXg19aTuVbXwL8j0DDZAkXZCpmbX/yxbtg 01zCWOBDiD9XghNWVtPQY6PkthHOuX5yd1W+4RIrnUzoVFcPTYgCFlORPjzOIxR/u/m8 d3I/eDT+jMe2otFIwAj2m0O2i+gEE+a3uZ9LbzQ4qhmTv221HL3KlItS/sJe1ESAgwEM HtIVF05dRV2IUL8cE+VGXXOaDs+lUeNbxA0HNYr+VNiQqvEuGc0f2VvXiGnXcaO500ix 2DCY7Y82VK71SNMp7n5bDPVmPzrAQrdWpxtJEs7IxzBR9ucNgUDJUkVL5F70bAQnzEtx fkMw== X-Gm-Message-State: AJIora+QuNN8O0lp3SVq2EWynGiuXTS1w9/tYNZP0sYCejzNfpPeh98s oDsl8u/NNxj3TWShpu3Vj/AacQ== X-Google-Smtp-Source: AGRyM1uWETlLwBtF39e/Lb6B1+JJRTnU2AvJdn266EFJX8KSznhMv/Q3QD9dksIwZzaAGoR3NyBOcA== X-Received: by 2002:a05:6000:144b:b0:21d:a57d:8000 with SMTP id v11-20020a056000144b00b0021da57d8000mr2558397wrx.204.1657488304082; Sun, 10 Jul 2022 14:25:04 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:03 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 15/33] thermal/drivers/db8500: Switch to new of API Date: Sun, 10 Jul 2022 23:24:05 +0200 Message-Id: <20220710212423.681301-16-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..f06492824e27 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 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 Sat Apr 18 21:01:24 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 30115C43334 for ; Sun, 10 Jul 2022 21:25:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiGJVZz (ORCPT ); Sun, 10 Jul 2022 17:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiGJVZW (ORCPT ); Sun, 10 Jul 2022 17:25:22 -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 42F4A16596 for ; Sun, 10 Jul 2022 14:25:05 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id b26so4774176wrc.2 for ; Sun, 10 Jul 2022 14:25: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=tnXyKJKTkBqGsiKUGhGkbeXFD6onb5fWswWwbVX/pFQ=; b=vhcmz0M9eUi9D6XilJmP7d+qZHjtePvRIgrxmbiJk3imnF2qznCnLNs/dVzU03K+Za UjI1IJoJqhQ45tR0vzWPXWm7hP44ljUMxNjPG53CYFx2K2F6jEqr60Ch6ugZV+JFPipd eD68GXaBoUaZ9aQDpEBcTCQ8Sk4FaC2MVpWAupJMATt5cwyRb5wY5NnZTygSfM7Azn6d eZPxv4C/l4jFZJgWT7Stnn2C54hkpFAEy2Rcqdp/aUzlOf3eENQ8CTgvIFYfkDi3b2ug 13Y4rqvPYuMbaMxnjHy7UvCtDatLKSbauRWHKDpAgebPIjQs/tpFdmO3n6uky+EksNtT 2k6Q== 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=tnXyKJKTkBqGsiKUGhGkbeXFD6onb5fWswWwbVX/pFQ=; b=AhptXNDDu8jr0lfYnhXSEHpcALC8oSYlB+6sCG3V/lPftm1setPlp9AmJJ//sqMWtJ 49uLCm4XcKzlmZo44339krQ3Wfe0/RdvrRWLnUYMhuh01x1UC2M5vkZL+rhwZGlG6g8E HzdTMkekZ/HJkAgX8m1o9sYvsEmVtbSDTgQmlZkhojbE+RRqJrgQeoj0Kha22/KsdDQw TjezSLLyYyACIc0p0nplT1UJUiBoXrlgxWAUG5xSjQpJITCKg1zp0NJz36s6fjznNU5e 2KS5AVudAwRxKO6WJXP4hdQFBfWWbnXkj/BKY9zJsi1EUSGvwENpTyvPf+ntmc1t1vgb qD9g== X-Gm-Message-State: AJIora8UMlHi151Dk2NvP9cZY/Ps88s6/BiQrIbCmfZCpd78Vfe/3IYW q5J+PrnMZ3UzNyL9pt9h3HoRYZJaZd6VdA== X-Google-Smtp-Source: AGRyM1u2VSuddah2j1+0aAB24oYPEvM44DXJwM+PqvrQq/A0gZ16voHOyQTBglLyG5dtjregIBSYvA== X-Received: by 2002:adf:e30b:0:b0:21d:8f3e:a370 with SMTP id b11-20020adfe30b000000b0021d8f3ea370mr13587114wrj.124.1657488305467; Sun, 10 Jul 2022 14:25:05 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:05 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Shawn Guo , 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 v1 16/33] thermal/drivers/imx: Switch to new of API Date: Sun, 10 Jul 2022 23:24:06 +0200 Message-Id: <20220710212423.681301-17-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..90992eddd442 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 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..773d02b043be 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 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 Sat Apr 18 21:01:24 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 87E3AC43334 for ; Sun, 10 Jul 2022 21:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiGJV02 (ORCPT ); Sun, 10 Jul 2022 17:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbiGJVZ5 (ORCPT ); Sun, 10 Jul 2022 17:25:57 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E54DA11A2B for ; Sun, 10 Jul 2022 14:25:21 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id bi22-20020a05600c3d9600b003a04de22ab6so2026418wmb.1 for ; Sun, 10 Jul 2022 14:25:21 -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=CzlgEZhrlCFL+OQsf/SzUTaiNcFhv4XXUC/LzAeamWA=; b=4b2oQHMn1N6LHmtTd4eLIKOgP5mFZS8x6sOM2tys0hIGAdoPLysuHebHLdBNixoEG2 b2ufVF7p9CnW3H3KCCtfZLzdmfMxuDlV0dvrjeBFw/AkVSFgWALOPNkZjsNwWR6ciIPK 9+bLzPfv432FW7t9Fuv69r/RRS01BrFSSt0yWdXckILFmmKLxLeQnsiJTBVxjs4zrqd/ CrImGfrTo3K6DgWH+cadfQAfXEmD9O8RWcFt4fQb9Mveu+faJWrpGV+YHe3ecwVWe5/S zFXRs9ksSSwBk3FrpyhL40OCN5rgZWSji17di9jLuawzyRPGly6vZsV4QH3pBBCJZ+lS JPIg== 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=CzlgEZhrlCFL+OQsf/SzUTaiNcFhv4XXUC/LzAeamWA=; b=JTrcA6NFyAwlDw5Vl5zL8NFUivTY5H25DZlxeqnU07w2dkZ5rWtxgZ4HzPZRCrm3h4 h9Wif/8imlbznbYzieLgedOLs89b3p8l1J8deksLyeuVvuxVRq1IFKhJ9kOHW70vZ3rx 3cKFCt3PMwg2JRYWVk9hP02YU8/n8R46y0tBkFK+LydYAVMNfj+P7FegfN7dMylmbpwG d4N6zl9zCUQh+o24HolTmNPHM73qtXQJU270lFYiadW5IoY6ngKTZ6gxS9auo+L+IHND xK7QOIFnQMK4MxB+StHTx3ZDx7T83RSApLKce/bP2WxrcgnLJpUtT8RhgUd553tWTf31 xjKw== X-Gm-Message-State: AJIora+y2M2XDS7J2N/CF7H1UImvK4NCFieI6orcCMQTr8gi0Y1g7CZ1 1V55Myrgqy8NTh6WOPK5kaGaMw== X-Google-Smtp-Source: AGRyM1tUnSuEusuW6oUitN0W13iIYIqg1NdwqHUrz3fQTZ9nWgA73i89QNlbmbKyUHDhE0j/BiMP4g== X-Received: by 2002:a05:600c:3b13:b0:3a1:8ad9:9d2 with SMTP id m19-20020a05600c3b1300b003a18ad909d2mr12027916wms.129.1657488306697; Sun, 10 Jul 2022 14:25:06 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:06 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS) Subject: [PATCH v1 17/33] thermal/drivers/rcar: Switch to new of API Date: Sun, 10 Jul 2022 23:24:07 +0200 Message-Id: <20220710212423.681301-18-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano --- 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 Sat Apr 18 21:01:24 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 5F79FC43334 for ; Sun, 10 Jul 2022 21:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbiGJV0b (ORCPT ); Sun, 10 Jul 2022 17:26:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbiGJVZ7 (ORCPT ); Sun, 10 Jul 2022 17:25:59 -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 8FB3A15728 for ; Sun, 10 Jul 2022 14:25:22 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id r14so4782445wrg.1 for ; Sun, 10 Jul 2022 14:25: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=M2wfLrxXnyl/4VAOjy10YdLX3f8bz6C8KrI7vU13mPo=; b=GF3P6Ppzi5+tUgEUE3vCUVcj/Lq0AuDieMw0s4jyfEKnnDNqI0hX1t2JtNhMRXSERR dZ+pTJQx5YaUVt8cT8ctcyB8Oe+eQ36Pnvp+ICr5uH04C47g+yfNNxoBSrsZSLtqcWTC tDgwObfr8ClF78HSehzFcQ3jgomp5rag+Fqfz597GQt3mABMbgMIBUAgBQMvFx+6r30j rfXXXg52iclx77Enq9KsjF041SeWnpJx573n1qjlDMAF+F9wIFOak5pNAeQiRxDl2AIJ XpOEiPtT7yitt798THZk+5n7Pv5npwnuIycLTZ8pVN1VJAZJOoPaEKrjmPTCdTK6aNFn gY1g== 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=M2wfLrxXnyl/4VAOjy10YdLX3f8bz6C8KrI7vU13mPo=; b=z5ILkt9XDvQfX8XW3mGd2ag7IX8SsTInf+i2zdJaVO56RF6LXOZvrHL7nDn1es2YYk iSRJ/ySgPJzP3V1ShZIZg6P7iszFEcJnKrisU5DjF1y7Y298GWLp6/pJQ0PjbY8WxHZ3 UJze6531/8+SyGdC1qYiiU08jokS5B3VwaKKzGFIv6PKwB2v047Ke3sXlUMjIX0KbkR3 16KaTYBhqAL4MJPFac4dxejnLSmQRViHfsxHqfsNXXzzQTXtYC3cZhMXfNyq3lAiE26x NW5V2AW+/vR81yWKJqZ7DLWQ14vvylOr53pWf4TRN+vBgclqeoOvyniSABinmPu+pkA+ yIWw== X-Gm-Message-State: AJIora8/PM5MmIiN9ivO1cE5shFpiX/AoVOKFz+QuUA+BHQjqwkGGTjq 5tP2FmjBH0Zvf10rbz0b73L+VQ== X-Google-Smtp-Source: AGRyM1tbyrl3D/MULNcGXt5KDLm/AiRAo6WzJyqoCBnaHv/g+Na1lzusD3ORcFiw4Iiv/pgV6cV1VQ== X-Received: by 2002:adf:9d82:0:b0:21a:3906:59cc with SMTP id p2-20020adf9d82000000b0021a390659ccmr13761133wre.289.1657488307710; Sun, 10 Jul 2022 14:25:07 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:07 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 18/33] thermal/drivers/rzg2l: Switch to new of API Date: Sun, 10 Jul 2022 23:24:08 +0200 Message-Id: <20220710212423.681301-19-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..22eb58b69f4a 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 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 Sat Apr 18 21:01:24 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 7F0A8CCA479 for ; Sun, 10 Jul 2022 21:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbiGJV0i (ORCPT ); Sun, 10 Jul 2022 17:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiGJV0F (ORCPT ); Sun, 10 Jul 2022 17:26:05 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E00B215A1E for ; Sun, 10 Jul 2022 14:25:24 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id v16so4735012wrd.13 for ; Sun, 10 Jul 2022 14:25:24 -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=e9euVydakO8zgEHn2aQPblIk4q+hgF12Z+XIqfPeASw=; b=hnXTbPJRCGIFkI6ivd1ihUzIfiSxwyFh+Qi3UQcfdfFvQpPNY6PBiEz1p9kbtxYCT9 4PQE2w7kVW63GcS2Ng4qQRoxADhNJqhDs35xfqYTtZatSlE5CzZ13xnX9soEuJEvIR3K Phn8FVlUrQ95LsCzpUlDqq/icxQlA8uHZv2GeGshRwAMUVaq1eBrg7zchpTlzSguXbsn I+Q/7QISjRtsn/mZjzxAqN1I4eiMdh7ppEWXpGqteA6DUtpjRz8LXwib8BvLIyLd01A6 gCdyadMNr0SGdYrlE9pp6aA2vlHbAvhnxoqXZ19V9xhJIJ+0ntlNtGE/oQx45ZQZhiGI ZH/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=e9euVydakO8zgEHn2aQPblIk4q+hgF12Z+XIqfPeASw=; b=KO+g4OER1BzY5JKDDHC4BjHK3xVRQ1ct9rLAPay2AFfXEatxRQRbUNMKlioSTzBGMw Rp2eSp5hFrV0ZABJ1ijKSplMF0Sg8HrAITTF6gCYEAtj7dAd3NaaEEKbCfJghW3rY4Fb +LZOQr5FUe0CXDbNpwz3AcQ3xh+sDlDX+mgMcsnQzISKeL3pAFDAt748G53q/2VEnR9j jBR+JRSF21wP1kb0aDS+ASuXDgIP9lAVl/dDQUCluT0p29S1gPXQiQbw3UsDBpjaP0bY BA93/teFga1GBBJwwmRjuiHmq0fa1IUsJkYeZ/K43904G1ggX0ldKjER6kb2TpiIU2+E zGuQ== X-Gm-Message-State: AJIora/lnsrxV/NA1wlAtLHNrpeP5P1Bdzte8v8SBvhELOoDMXwL5BVK h8ii9VZ2lOSlZUIcyiTFXE+p5g== X-Google-Smtp-Source: AGRyM1vYpjOdERDPOQIs55QnVDI/7J8smEkbfJJ22XmivSSjHSSL2YJPvTD7VSmZE0/R1jc9gNPtog== X-Received: by 2002:a5d:6d0b:0:b0:21d:9f54:efa2 with SMTP id e11-20020a5d6d0b000000b0021d9f54efa2mr4860041wrq.607.1657488308788; Sun, 10 Jul 2022 14:25:08 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:08 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 19/33] thermal/drivers/qoriq: Switch to new of API Date: Sun, 10 Jul 2022 23:24:09 +0200 Message-Id: <20220710212423.681301-20-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..86c8cdabcbbe 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 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 Sat Apr 18 21:01:24 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 E6234CCA479 for ; Sun, 10 Jul 2022 21:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229622AbiGJV0A (ORCPT ); Sun, 10 Jul 2022 17:26:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiGJVZY (ORCPT ); Sun, 10 Jul 2022 17:25:24 -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 6A7BB14039 for ; Sun, 10 Jul 2022 14:25:10 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id f2so4761976wrr.6 for ; Sun, 10 Jul 2022 14:25:10 -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=a7qU0l11XuBaUxJzhKqB0uFCFxpqtrqPIbLk2Bb/IBU=; b=bViLhf8ekuUWaRy1driK478eBCats9Y5hHqzf3t8OuUIsIUJlRKiYgZCrGxQLMLqpc dSooLG6qwZTlKZ7bYeJbBVuG9Ro/m0yGY1VZUyXC1FnI1JvVNcd9yoEP+6LoZj+fSJ1u zkSflFutUDefFGp/TOZl+n71eitpTw93MUxamFSgMpgHJlGl14WuymrAYyZibHcMMlJK WGM29wuKfb1i7AV+1aD0oceriCGQu/w91N0xsc8uocJNovvMcsMf3qO+VNYGpJxtVm3h MfpufvYog+RHS0X0rsDQq1bWh2amnXqZWaEtCFKRLDut4dn8xUzp2esXsp7Q7u1bTGgY IrzQ== 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=a7qU0l11XuBaUxJzhKqB0uFCFxpqtrqPIbLk2Bb/IBU=; b=z62mHNqoe8w2u37Wfs6tpNujcDbYCZ1codocTgqRnpAQY5y1pvRPfVUnSBgYADh1gD ipBzFI0hkAPZsimc3EvakullH+5Ml3YgCgLBNBQdxv47z4KWNnFhQfSU5dCKlIJhTAHC vbpheZv9huvudIKAu7fkSj66hKVFhBrp70OdfFbQbuidks27nyCK6zeiDNUj5W9lMFdT PyXdNwPTb1K48KxaBrnemxcC0DGuFiBZPrkf81tfoeI7lRKQkn/giktGgJ7zT9LhgQTh 9qOMfd4ZWn0UG1MCeF/JquF3goPMCOwDj6VIaVRPYThZ+onaXhqdM/aodp/6r31cCCjL M/3Q== X-Gm-Message-State: AJIora8cKrYWLL855cOTA9EjTpWcOGvZn+A1yWUeBxpp37wJ5TITo0Dd DsSDzRvJ2ZCgaUY0WeSXNst+iQ== X-Google-Smtp-Source: AGRyM1vffzN5eiy27fcXyMoBJq1BVy3jqLfPjvEt5vtveDcNZJ5OnAIq2aniQxmH184KYKgCE6sxcA== X-Received: by 2002:a5d:58ef:0:b0:21d:9fc8:302e with SMTP id f15-20020a5d58ef000000b0021d9fc8302emr4587256wrd.22.1657488310058; Sun, 10 Jul 2022 14:25:10 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:09 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Matthias Brugger , 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 v1 20/33] thermal/drivers/mtk: Switch to new of API Date: Sun, 10 Jul 2022 23:24:10 +0200 Message-Id: <20220710212423.681301-21-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano --- 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..1dfa6b058d9c 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 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 Sat Apr 18 21:01:24 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 A099CC433EF for ; Sun, 10 Jul 2022 21:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbiGJV0l (ORCPT ); Sun, 10 Jul 2022 17:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbiGJV0B (ORCPT ); Sun, 10 Jul 2022 17:26:01 -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 262C015A21 for ; Sun, 10 Jul 2022 14:25:25 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id o19-20020a05600c511300b003a2de48b4bbso2622745wms.5 for ; Sun, 10 Jul 2022 14:25:24 -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=hFnV1hN/hxenyqnLB9iV9vmpJBpk4CMcqpbDLISp6AM=; b=SIiSiKuj20N+LfM/LDx1cVFlKYuGU5icx9eU44sY1bXS5J7U2YYnMYGItGn92wSu8r KJUSUdzSldUu632V4skHYDOUKhsIBU3NL5+zmVZY5WTda0yfdYRGn3C7YhBK4Ag7Ej9D rbeUxPddsiLuGI7ZUNh3aToKUk9qEhTPM63n8VNenQyvsAT5fNx+zq2Vvb+yXDSrclz+ QJPdzh8txzc3APbCs3RPBqCbWXdxUNz2bCbhnwou4PVXKJw86bPJVVNsldAA0CpP1Zh4 6qb2A5NYoJ/IhyRA/MK1ZTeMmZg24XWJkG4RK1gHwpX2we0z8XwIERw3/QmLlRFSomJJ foQw== 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=hFnV1hN/hxenyqnLB9iV9vmpJBpk4CMcqpbDLISp6AM=; b=FI2XtFLEcx7VyM5yQpmWiqT6FNKiOKNJiHSZmzYS/e+Jm1k7BHMBbTxbFaOP8oTNes 700ANmz+u6iP25yAOlShPUzZsXLQpgPb3WObSKiJJN8SbYDsZ/jPvyKvWLLHi759FqOf w66PLzkyyFyTw5RTDf3td+ZhoLwu6gfqdzjTdpBhYLQchqjivPWihnIeMNLzqTuR8fhP kqhzaYPLSq17UG6Te6jsWCF4yxCZVzeYkm+IX+PKzPLv26SOQZw6h4cM/WrQ26GV4Mr3 9wazRc2RqHP1Egaa/8XHG20v8r0Nal7YOZBrHz4W/ypS9r0VbHN/FX8Ai/u5HLUZvi7W +wcg== X-Gm-Message-State: AJIora8g5Fzg3KyauY2Inhax3Lcj3l9MgDkJ9Wa2/bFr69VMnKJDBfkY Sn+T5lxW2/EQHGe2dBlkEBi0Hw== X-Google-Smtp-Source: AGRyM1vbyaog5HoWRYB5ZVHu4ZIFJ6ipKb65WjWuHXRP7KDZfyZOtC2vPKGiHaXAWRplE3JxYqw63g== X-Received: by 2002:a7b:c458:0:b0:3a2:e8c9:afa7 with SMTP id l24-20020a7bc458000000b003a2e8c9afa7mr413726wmi.63.1657488311106; Sun, 10 Jul 2022 14:25:11 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:10 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 21/33] thermal/drivers/banggap: Switch to new of API Date: Sun, 10 Jul 2022 23:24:11 +0200 Message-Id: <20220710212423.681301-22-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..4c2af1469085 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 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..4ffe9dde0732 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 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 Sat Apr 18 21:01:24 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 700BDC433EF for ; Sun, 10 Jul 2022 21:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbiGJV0o (ORCPT ); Sun, 10 Jul 2022 17:26:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiGJV0G (ORCPT ); Sun, 10 Jul 2022 17:26:06 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 974FE15A2C for ; Sun, 10 Jul 2022 14:25:25 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id v14so4766546wra.5 for ; Sun, 10 Jul 2022 14:25: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=9855bcD552GJSWzdSCMScVvlZ52p09zVu+Xav1fO3uQ=; b=m/g9crDtZC0kIrS+BX9yIchWTNbmQnD5qx93xAy8gvioRQg3BDDaqAEWN+0Y98GC/3 US3JKNH/WviYe1i1bdTEhK2ZNv5uAmqbgxW+NsjlLB6FG9FObAd1aPjZ3DeMIEp7F/8R N69Cj3i0wKhXGgL79k3hYeMZ/cvqByDYlye0b0XFAnsFBJbtOq7/nsHzpcgMBorV7d4a A8y9bv4cYd6kqqWK0CIu6Wd+V+h3Jjv6gTSsO6uYavzZM0Zm0pKbwuiWcLDJZhFO1GO0 XeZCS9yRRMUDzGtsf/yG5bNgZ38VykvIYo5bYXwGd+f88UGWF82Dzc68xH2UctuYnQ1/ RZjA== 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=9855bcD552GJSWzdSCMScVvlZ52p09zVu+Xav1fO3uQ=; b=FWbGym8x7qZp99ynXSngsHhdYm+6biDHFsQNa44x2oCL4Qj3ppIjFnccyudtQr8gxE +bBYWOGqjDSTFE++WGV+MrTb1v5dqhnjGvtC1GzQ7AzV5Ktxti/DYCDv7pdP5L9KKUSw U5CUsqYekSSuQ7N8iuzAXM71EZqi9wQ3UBz18G9ipst+UNmavcmgkkvU81Meo/Sb9b2k dxIfDO3f4MNmdCj1b7JQGRJOcaBzDMG5M12Rmx54rcUD4e2FKb0ztlewmZCF8/47esT7 ++kDNkQxtESLYHQvB+f73Ws2GYnlffnvv4SnHUU2gXcT9K9GYYEAG9YR25loCD7MytnR 41UA== X-Gm-Message-State: AJIora+fWCNzVD+qdQqwDQL/Uw0+h288kPzM8Bg13FWGzuq+3BjVBnIs cqSXAnuyRCQV52re2C3ezeopjQ== X-Google-Smtp-Source: AGRyM1tt6ENRWIiaSfIKK6zn2vgRUnwKDlsTdemCipZ8p/zzmnqRH8+pNUZZCj7ShkPgfPflA1WmCA== X-Received: by 2002:a5d:47a4:0:b0:21d:99b2:9434 with SMTP id 4-20020a5d47a4000000b0021d99b29434mr8097259wrb.597.1657488312172; Sun, 10 Jul 2022 14:25:12 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:11 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 22/33] thermal/drivers/maxim: Switch to new of API Date: Sun, 10 Jul 2022 23:24:12 +0200 Message-Id: <20220710212423.681301-23-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..b64070cf17e7 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 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 Sat Apr 18 21:01:24 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 44C25C43334 for ; Sun, 10 Jul 2022 21:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbiGJV0O (ORCPT ); Sun, 10 Jul 2022 17:26:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbiGJVZ2 (ORCPT ); Sun, 10 Jul 2022 17:25:28 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB2A15808 for ; Sun, 10 Jul 2022 14:25:13 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id d13-20020a05600c34cd00b003a2dc1cf0b4so2016589wmq.4 for ; Sun, 10 Jul 2022 14:25: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=0Aunvp/iYMS8pcoGvhfIfGnTYbyHokkHTs118eswSpg=; b=w3hpVkQHlKdu2FNgs5CqaEdMDRWw8bypxs3lYUQaPMfhjwtp67Ase0c5cc+9euWkZK PqydKmrl1qG9jxOsyimgCQzFz7JwRMiAHwncz3eth9b3NnVIKC++F2+ilD+4nXli/3+z LE6ls0jC3L1WmSczRx4QJ5P1ItA4P5gFIru2PCNpWwKRz45UIGsNytNdkfXIxj62ZPE9 EMqlxuzzlKnBZ6paXDuM1vTW8EU44nyVz4CPAPlN/X8MJIOs7fYF0nOvHOJpPb3XkLwU A3alzVw9QdmkjllSJP9rQqFODOPvKCejvyTYb6Ht6vVal1CzVWSWDG4VxQ4icHaJRDTy q/zg== 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=0Aunvp/iYMS8pcoGvhfIfGnTYbyHokkHTs118eswSpg=; b=0rutyBzBsr3/kvxybzIj4WlxUQlku3VuowSitMRhKJr+8zTSZmDFgE/kYm8z/UVyG1 RKNwnv0cQ6A52quUf8lEXRtugIDj/6Oh/CQu4nUzclRX1Dt4I9JNaI1J/9RWUDMX6Gdx 4xpJgNs+JvIut4YHhqNj00MZHHOMtKAFfrbtCHSwp8Cdf9M4ouN+vF31xSkrHhUosqs8 6cv9/RCaAmGK/2krY2cSnwVogAO9kBsGjjkW3+RFOPk6NW8iOgrZtb13ufAT5pGRJ6Q+ LuM0ZqANtSEaYM/wlS1MOs1eDEsAT+QO397Q1irlNMT4eK3Dzq5WRJgd6cODMX+yXSmA /Z9Q== X-Gm-Message-State: AJIora8cdpHOQzDMehRBoeJv9PopcxFEL6C8vnBrx3fHSSYJ8eRba6UY RVsJSIluUkjtbzDWgAk/YLBQPQ== X-Google-Smtp-Source: AGRyM1uNKZQ3H9umrHP9IZ+HKT3YIJqmLCKPFJOqqPQG1gwI4h1VW7wlx7hom6nNQgThL6DCQeqaOQ== X-Received: by 2002:a05:600c:3592:b0:3a1:9e9d:2595 with SMTP id p18-20020a05600c359200b003a19e9d2595mr12531906wmq.76.1657488313198; Sun, 10 Jul 2022 14:25:13 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:12 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 23/33] thermal/drivers/hisilicon: Switch to new of API Date: Sun, 10 Jul 2022 23:24:13 +0200 Message-Id: <20220710212423.681301-24-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..a0911d31555f 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 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 Sat Apr 18 21:01:24 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 77B2CC43334 for ; Sun, 10 Jul 2022 21:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbiGJV05 (ORCPT ); Sun, 10 Jul 2022 17:26:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiGJV0O (ORCPT ); Sun, 10 Jul 2022 17:26:14 -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 14D2A167EB for ; Sun, 10 Jul 2022 14:25:30 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so2016082wmb.3 for ; Sun, 10 Jul 2022 14:25:29 -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=OIrYHdunDMNAaNv/cr2l2s9gzRoDCmmdOZhp9vHA0Pg=; b=xzuExPhLyZNT9Zy3FaJg94nYwhOlAT4SfKQiZUdd3fGjB7HzxRTlbiOJXjulUcfBHZ IZFIbV5UR9MpAPz6L5RXc/1LFwUbIfY/mDvZl8TlrG0tcWPU6/9TZ+IB0uwW4JXRdyVp DOWzb3doIR5w7in3sFPD7mbWEHK+rzFtsOh+LbcAOOL0BNgvUYQ25YHSOldWRkkIOjgc RkEm5UVwMeudS4OBhOhP4yf+HA7iJmCXSv5+WfUcwq5SwoHVNVR70MaTvtW9POVr44JU t3BRQqRVay5ADbzx95wU0M0BHxvdCvgCXYnKqvnlRg7CFXy8dCR2IMlFbUk6TGquiJ10 kAbg== 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=OIrYHdunDMNAaNv/cr2l2s9gzRoDCmmdOZhp9vHA0Pg=; b=f1ulzarZWNj/8dA1nf+rDmX79w9g8Gq5DGv7UNCIm9NJbyltZ/ujg0XjduimMvjuAq BQ3rd+1gPBF/dhvD5IuNBeMHlUKoAg7ZyM50a2dijIfAi8yht3iY6VgyCd+U/QWrSCKz X6yP1UZRS0tFLjyc5w+t89U7jrIyrZ9ej63iVMhg1stjqhYPtGDmwSPW8gevmMnIah0c q3BwaYhdsjMbwhMBPg2ssl6HcGVMoGDQJqo8Gj6CW3X9HJgJGwfAAcslGsP5ThZ51JSq 8AlWxOC649oXIDeb7H3yR43yf+BcgoIRtXTt0NPkdfQfgPHyiFZxzxmHKY0LQYyhwS1U cPgw== X-Gm-Message-State: AJIora/BB/f8nQ2MbHRskqzVA/vttuw0sLWzoBCegNxmFAy8zVRGTWae +8QXsDzP7oK21M7k89rS8Q1L/w== X-Google-Smtp-Source: AGRyM1uvzqJzJtxgyDE2ree8aDA6PbCq068TJrnL8apJqaRJojcR9D3XiSKrrlMvu0IWqqL2SLiqgA== X-Received: by 2002:a05:600c:1d94:b0:3a0:4e09:122f with SMTP id p20-20020a05600c1d9400b003a04e09122fmr12765276wms.190.1657488314376; Sun, 10 Jul 2022 14:25:14 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:14 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Eduardo Valentin , Keerthy , linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER) Subject: [PATCH v1 24/33] thermal/drivers/ti-soc: Switch to new of API Date: Sun, 10 Jul 2022 23:24:14 +0200 Message-Id: <20220710212423.681301-25-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..89a2bd46ebcf 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 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 Sat Apr 18 21:01:24 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 98B77C433EF for ; Sun, 10 Jul 2022 21:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbiGJV0w (ORCPT ); Sun, 10 Jul 2022 17:26:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiGJV0O (ORCPT ); Sun, 10 Jul 2022 17:26:14 -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 149DB167E9 for ; Sun, 10 Jul 2022 14:25:30 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id d16so4743224wrv.10 for ; Sun, 10 Jul 2022 14:25:29 -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=qWuLOj6nDfiApNSc64J2uRqACZX+IVavJuD3AMPKGUY=; b=cdYKu83P0gOPdJq4HqnHimBhZEQhFDIWWzxJRonAfn7A8HPPQ1Ra7rZ/q6UwVnfqm3 AwqqjY8+BZYNYi1rFjHrBccBWZF9f7o7L4dL/eWanJc7IM+adwgjgN/ZEuojhpOFdvJJ 9lAKbhl7+CSfOdVpINdyi2meeBdqKKWhggHBfJm0L21Uenxu6ekzeZ/BKa4cwsnTB7kb iREsWBLbQm6O4BI3/gLMkuCZMG6AwQ5yPN+iQPM84ZLXQOJoMfV3LXKBCQNk9OkSE9oP VSuXHjqgB31tAgwc/VXzGdxhh32uU53Twdu8mDKn9uuPvDrHy/OznX0++lluMvnnquf2 kWbA== 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=qWuLOj6nDfiApNSc64J2uRqACZX+IVavJuD3AMPKGUY=; b=aXiPowDdWjbtISxX01CAyItHPiEZycELAt5fDRgTCzpzY3qyGtYkv325stISnV6iW1 rb3d4EM8Ts3MRLkz28avTvoLVAm1v2Y1+cl0ZWdid4HYt+WDhoj4Yy0Qs9TCYIkL9sj9 10iklw9dKnU580GVxZuwUIqSHoRFkt4Vp4uaoxWDbf74WaH8x6TKp6b/bHbRiMdAmGti +mVvIreK+0XDaN51pn+a1APg4E9OKzPsvyLuFx0K5qUxL6U+9heXoc8M9PKgQQNzvUSq YKGTpVnbaHPzAd8gWeOycoAijyGyCjKakGevGxk6I/0/CQnVOqTJ/9YFp0Qn5OMj+N5A WetQ== X-Gm-Message-State: AJIora+Nn+TM67ZBH9QMB0nRRTJ9lcYwLGXRHMr7DlvoYD52AOSmaOzx tAL4BXLLI4CKGuT+lEf04XSlHg== X-Google-Smtp-Source: AGRyM1u7otQoNLhS1lQ+oub24K4MnjT+FBSWkx06RuIyOEGGrp95LgLnjfxEXYrnOsJCTwc0Ssd5Ww== X-Received: by 2002:adf:e18e:0:b0:21d:8d22:bb24 with SMTP id az14-20020adfe18e000000b0021d8d22bb24mr14143838wrb.397.1657488315767; Sun, 10 Jul 2022 14:25:15 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:15 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Damien Le Moal , Shawn Guo , 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 v1 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:15 +0200 Message-Id: <20220710212423.681301-26-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano --- 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..5ad9a890e71a 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 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 Sat Apr 18 21:01:24 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 D2EF1C433EF for ; Sun, 10 Jul 2022 21:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbiGJV1I (ORCPT ); Sun, 10 Jul 2022 17:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiGJV0R (ORCPT ); Sun, 10 Jul 2022 17:26:17 -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 6E62E15A1F for ; Sun, 10 Jul 2022 14:25:32 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id n10so4771989wrc.4 for ; Sun, 10 Jul 2022 14:25:32 -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=S9mNF5y6hvbSSl4tvgsF8Kv2RwpFYIr8c+Kq7IgCFys=; b=3sVLc/Zx5AnBXFBVcki0r+XQWrRbNr9YCtqlE7/2AIs8jkvPMqD4lVuuEuqp2ZxTYQ wIjB2uIl9wZz9ni2iFJYKnXyAqb0LwQPT8sqlyV4FWIksYWkFe5AROsQbCjgaFnrf0Fp qAjWUI5Nf2doAN6M5MOFX2O3VhHmnAThxRds7y32hMldcABdPPjtCs7ZamgfP0SRwssJ jHh/MNnrEQBnfcbublg2qCPnW7VPmtGs8wi1MJMuVcFNH17CXGRo1EjHYw453lVTyFV4 /QFVR+fVkE0O6kE795qD1o03VPzlwykftJLWjuitXjWeZ3q+M0zSEO+6qOS9q1wOUpj7 ZBuA== 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=S9mNF5y6hvbSSl4tvgsF8Kv2RwpFYIr8c+Kq7IgCFys=; b=Ns5+ufskNW7yj5JhTaUzE/NA8G8OPe4DeYqSsRWnhA/Fk5fonY/b7py/EvLz4kl/6j vSsZs8Ql+X6/QSw7KHT/yXksh1fi7lY+1BaDvfKZPNi/UN8wUX4cwmsfAx2tiVpjG47d P0T6uFw62kiNV1fauAB5OBWo+JKVmu+OMqkaRwFcSygamy3iPkeDPn7KWaBNh0JBiGEA wALZVRIVwjzFVAJLUa5go23/RDHfNwdzYPRzByDYduKr8oOg0R4dG/J9DBGKpEbTe0lG I7sECLo+a55kZlnyO0slsMMVNOPerZHl9R0wUY4CzjRuMODBPln8fxUS/MzF6Rz92abY Kp8A== X-Gm-Message-State: AJIora8XsDaBZJrvZjxL/HZRyZMrq9CGoX31/MO0YHlcJ+gWlmsiG//H LxNItu5yUP6hFUlbxCfbIyFFtA== X-Google-Smtp-Source: AGRyM1uyUPnikVLSWpibuGwqhmWE7zhM23GgVORCpj5IlAD6nOWU0REwHevqrsVReAOv+YqdqT90JA== X-Received: by 2002:a5d:4283:0:b0:21d:7ae3:71a3 with SMTP id k3-20020a5d4283000000b0021d7ae371a3mr13967643wrq.233.1657488316965; Sun, 10 Jul 2022 14:25:16 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:16 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v1 26/33] hwmon/drivers: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:16 +0200 Message-Id: <20220710212423.681301-27-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..a98c35fbce87 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 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..9c89db8e56a7 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 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 Sat Apr 18 21:01:24 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 DA398CCA479 for ; Sun, 10 Jul 2022 21:26:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbiGJV0X (ORCPT ); Sun, 10 Jul 2022 17:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiGJVZv (ORCPT ); Sun, 10 Jul 2022 17:25:51 -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 C25E2167CB for ; Sun, 10 Jul 2022 14:25:19 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id d13-20020a05600c34cd00b003a2dc1cf0b4so2016683wmq.4 for ; Sun, 10 Jul 2022 14:25:19 -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=bIVAQgjKJeGSe1gmg5bAAUf+sy08/mvTvr//Arvl8d4=; b=bwX6DCXV1ANz93kGzRrBmIE/uBbuJYI+xg3LHrquj+GqnzRrXEwv2HZISLJZRSW78o GODhKJHDXJfbj9ZT8y+gmA2bXumlAY4BOTyrDf9HbdkC1easWhcVHrvT+W+ZcdMoTRTr 0UiUeG5ZpH1hqUduzq5ntInHXeWUZec9LwsVNTISLAMTaEp0IGQS/lhesFRQb37jLfNv a5eJ9spCAqNawYa2oeQxtgldjk3j89qfJ6M9l03mEfjBnAAcl3qKuVMyT6hpIGP3WQjO 4JJlkE8MzN5CMvsuggDbJoehMwEB00/3fW6hE0yon1yGp65J0Vwdfjcq9rsQBxQUAGts kbjw== 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=bIVAQgjKJeGSe1gmg5bAAUf+sy08/mvTvr//Arvl8d4=; b=N228ErUvZkrGmc6+mgX8CrvXMayeWQO34gsn+nGqQhog2N+uxcwZfRz/Oa4hW1kBZ4 OrUznfz9AzK01IyzeT2BLWJmFPbqcoh+oGRvE1ygeBaSM2xyNqVg293aFuFm6X/JuAvx EaEjwrLlxdCFwLCWglgi4ocujpuhB+YPh7BUpFZarwDq/3pztl83TO1PUdeMMPW3gF0c JOspvWacYM0blq8EeC+rwuBalaRAF/xmVkvJ85HmeEBZv/8CfFvDGL9iFdbAxxd0CrwL UrmqU4p3aZDJbdBI51Tr0zfHo0cGTWbA5xW50BVXkMbNwgRfXqNHgshKbexDpFCIbbEI knNQ== X-Gm-Message-State: AJIora9B8TFr2N/Zr7f3CiBo2RDsfr7iOEVpO27MzjjxZpaoEkEqAnTW YdVqarLHZRMVF56/rUDKQ9L45fV2X1hdrw== X-Google-Smtp-Source: AGRyM1uo9Otvut72zMkDjHYnOsl3cCTcguJq1mSCKLu7tr3jw2jx6zah1dNAu0rjKPZTlUupXnCIMg== X-Received: by 2002:a05:600c:190a:b0:3a2:e8cc:57ca with SMTP id j10-20020a05600c190a00b003a2e8cc57camr383824wmq.118.1657488319230; Sun, 10 Jul 2022 14:25:19 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:18 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, 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 v1 27/33] iio/drivers/sun4i_gpadc: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:17 +0200 Message-Id: <20220710212423.681301-28-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..7aebfd337871 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 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 Sat Apr 18 21:01:24 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 094C6C433EF for ; Sun, 10 Jul 2022 21:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229917AbiGJV1K (ORCPT ); Sun, 10 Jul 2022 17:27:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbiGJV0W (ORCPT ); Sun, 10 Jul 2022 17:26:22 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBDFA17063 for ; Sun, 10 Jul 2022 14:25:36 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id v14so4766850wra.5 for ; Sun, 10 Jul 2022 14:25:36 -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=JHt96uT4Q7BwS4NdRXSU1MVIN9ZQRmgKBYoUqlA70sg=; b=FTmtHevb/2lCiduv1bxN2jNSRFQIRp1jQ/TUsaCdBwAW/diJI+MM6X5FtZpJwCzVf3 xFWyF1+0v3PX7grCleGiUZm577zgV6OCoxe/iNYb6agevNc8T+GA5VXWgMU5cpaWYEBF 7FDYF6mc+ZQkiaNF9fOgCkXuuWuHDE3v6XnFCI0Lfr/ViYuHr7P9EZThxmTbJYEqO7Lc 3kEoa0C2AA2hLg3U7vfgE7HgyBpa1NzcFta7EJPcXQvO8K+9vcDp834AfTGXBZ0+eZqT D/ZCenPS+afAUNbazuch9U8MPl56fezX+Sfhj2+98avOEg11/9H4dBRFDs+0XsBTrxTT nMfw== 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=JHt96uT4Q7BwS4NdRXSU1MVIN9ZQRmgKBYoUqlA70sg=; b=2LSj+rZCDRyGSROSoA9iDWYzJsW/g75iOUafr0PuXqdoLlqJ4VvIwjy4Uu6Bg/odIZ bMhaDQ/xMaJszumRaJKNuUYy4CD6jwxnaw1vKTytyJOzR96rRUQwfKvgeh8k7xSLV0rM Kt1qOWYjEUIYRbxpYDh7W4j9a+aRzl7dX+czAMcRmx0yVEfUNIqKIWETzYnOeRXorS9E S461lNUwjZzHCWUWOjKzh/M6wbNnCu6EbsC3wGRfev55oI9KkFoVGEkbr3AHo3bYJrf5 6olyP2SqrIG+zfL60wyJqJTedhmvJ6HX6ZLcdt9ogbhubzNjmP5Ciz//Og3fxyMoF3Do Masg== X-Gm-Message-State: AJIora9d+5TJgxyPcTzVLo3fTAYfs6MFC3CNQqCtqAthfHqx/mRabDUd HgkqxSBuXFU1JFJsFCiW/DUZjQ== X-Google-Smtp-Source: AGRyM1uU2a9N+Tlm73VXF1neUxMMjGVz19hV+EhKo6BBv9h2XUa3CSeloMqm50v7vGSnm5mdnJA8Kw== X-Received: by 2002:a5d:6d0d:0:b0:21d:7ae5:22ee with SMTP id e13-20020a5d6d0d000000b0021d7ae522eemr13289006wrq.152.1657488321495; Sun, 10 Jul 2022 14:25:21 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:21 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, 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 v1 28/33] input/drivers/touchscreen_sun4i: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:18 +0200 Message-Id: <20220710212423.681301-29-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. 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..7cee09504e34 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 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 Sat Apr 18 21:01:24 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 CB348C433EF for ; Sun, 10 Jul 2022 21:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbiGJV1O (ORCPT ); Sun, 10 Jul 2022 17:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbiGJV0X (ORCPT ); Sun, 10 Jul 2022 17:26:23 -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 3D6131706B for ; Sun, 10 Jul 2022 14:25:37 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id z12so4759041wrq.7 for ; Sun, 10 Jul 2022 14:25:36 -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=ZwqLH//W1+QEOMAk/S4a/3Zrx4GN2+Bea3NwAVXcO70=; b=clgX/y+/32mEh9l/6iuJB3mbxw5oYz4wdwoyICnbeWlyhTs62a/IQb2+0m0RoIii+r 9HGkAQBSuW4ev20frhVaMPM/82lKEeHJdn6gFM82nLeeZrdu0SKKGC0fbf6CLoYbClD9 2SviVQITEyeLGCpZ2jzA+yP7uePb3u8UAPCjBBTKedy0WRtpwCgvgr6KTEInvlOwWgjC cx5eCCnUBw5JzBjVu8ELgcblOhpc4m9DjEUjJJ0b0O/4oFT/Su0v1H5VxvOWU7n3qsZZ WiDGfGcyEikv93+5r5cKSu53Q98r7JlGUpk86h07BZQrY0HV+WCiFd2OtcOxBLlGoMKJ geGw== 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=ZwqLH//W1+QEOMAk/S4a/3Zrx4GN2+Bea3NwAVXcO70=; b=NYvpqCTUkaRjcpoA9kdVmRjLT273vVXXcDpwGerg6h0qjZm7hdnAmkkMiXnA9NsQH0 j0Gm2nX2oEDiGwGTLM3gWXl1JVRtd2KQ8w/2wg9MqlcJL4ijwIVrVgh5YntlOU5XGVeA T1u6j7eQ04aRALGmbEFGWs5MCsCcgmy5dKp5M0elqsjhLkcwz/rTolowPZ11kdfKNnMu D2dN9tFY/KrkqA1+OyCkLu4OboBeOWYHg+S8iFiOrXcxJ1i6cIJoeiw1TUm5mgTFWPPk xNPT9bNxWyTTcRAC2MtNdK0kckLU8cjb4lIAz/J7LabF9iythibLSI/IbyfJnBDuO75Y k3Fw== X-Gm-Message-State: AJIora/nDj5lpw9ynGea1H/IAP1tYtm6CkN45oOVcrzgfGBr1gDvAUb/ M5FNDENYb8cfjV8nTSD1SbCiRQ== X-Google-Smtp-Source: AGRyM1sjOeQpf0Z7hmGR89J+3e9HHSig/8dGQ1+XVo+nYwSo2953t3SZUm8Anb/OMRa0RMEkLOpbtw== X-Received: by 2002:a5d:47ca:0:b0:21d:9f54:ef97 with SMTP id o10-20020a5d47ca000000b0021d9f54ef97mr4924054wrc.478.1657488322655; Sun, 10 Jul 2022 14:25:22 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:22 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Liam Girdwood , Mark Brown Subject: [PATCH v1 29/33] regulator/drivers/max8976: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:19 +0200 Message-Id: <20220710212423.681301-30-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano --- 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..45d4395fcc06 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 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 Sat Apr 18 21:01:24 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 8727BC43334 for ; Sun, 10 Jul 2022 21:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbiGJV1S (ORCPT ); Sun, 10 Jul 2022 17:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiGJV03 (ORCPT ); Sun, 10 Jul 2022 17:26:29 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A08691706F for ; Sun, 10 Jul 2022 14:25:37 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id p4so2077540wms.0 for ; Sun, 10 Jul 2022 14:25:37 -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=5Y41vOcDtdL2yhYCNKjxuRzzCxuMEk7Llli1lwExUdg=; b=gRio6k2EfN0lPHxe9XKBa+OWp5nlOVY+HqFctDEILdSwLi5dcpH5D2LWh7Vt1IRY62 SsLQbXlJDTKw40zNL38akvijSko3+Cpus4a8fKWZQHeJGp4/3mhqwhvAPuEMIPIDnVyT B0z5SsSkklUDMi4XIMVCry/gSPTWv60RAIB4L3JPVQ9bK29VkMcdluSppqEavwO4d6Zi JlapfbIZDRQoG5gvKGlAnEdpFw5O5w0zDrbcWnr5eHQOwY6XAqUx4adp8ABC3ZoZM7gj RJouXsT+TFJuIRkU3Yql4isdaWVcCwbGQ2LG/rExqFbEmGSwKXijKUoF820eTrjCdKAQ FEOA== 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=5Y41vOcDtdL2yhYCNKjxuRzzCxuMEk7Llli1lwExUdg=; b=3Ypr9jWKNB6zWD0PowEZyQ8kDWB6fS/9jH4tDL1/mV4LkQUiVEgpBPACCRn0C6aSsp IzOhSirGZYpheLMqGvOHONtOPW8DtyAA8RpIuEjOSkaV0OQaiNzlIwYujCXwKeAKRxVM How8niaRq6oPwIbJu/+lrlyuoSLZpNMSqnycRzI4KbTv+TyDWgTXgHh7tTQVwD0Qjmhl 91YJukCeTb8hqsDhuNCGOviD2zn995tEFXrt+MvBPOKVtmy0Z7BD+hAhBnTVQPdaCfxN D8+mmSMeM0EjL0n5Yz8hTqiE7+ueJ3BPYPJ1SX/8DMjT1487GKILC2B2+lsDcnJf2WeP 2/9g== X-Gm-Message-State: AJIora9qEw1L4VujaEv3vMG0VOc1S7Iv6J51QVvHqydoN4aE0rsce+Vr E1KFZ/FopSh3IvqAmHneM2GLCw== X-Google-Smtp-Source: AGRyM1v0f0koxAy5K6IGmhH3p5egstHMC1RkTZGC8vOXm5s6fC2BXAXfbIKulZ9qLa6QN67JLNAj5A== X-Received: by 2002:a05:600c:206:b0:3a2:e224:da6f with SMTP id 6-20020a05600c020600b003a2e224da6fmr9346363wmi.167.1657488325026; Sun, 10 Jul 2022 14:25:25 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:24 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , 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 v1 30/33] thermal/drivers/bcm2835: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:20 +0200 Message-Id: <20220710212423.681301-31-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano Reviewed-by: Florian Fainelli --- drivers/thermal/broadcom/bcm2835_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/b= roadcom/bcm2835_thermal.c index c8e4344d5a3d..4a7c6270dfac 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 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; --=20 2.25.1 From nobody Sat Apr 18 21:01:24 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 D43EEC433EF for ; Sun, 10 Jul 2022 21:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbiGJV12 (ORCPT ); Sun, 10 Jul 2022 17:27:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbiGJV0h (ORCPT ); Sun, 10 Jul 2022 17:26:37 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686111707A for ; Sun, 10 Jul 2022 14:25:38 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id v14so4766957wra.5 for ; Sun, 10 Jul 2022 14:25: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=L3V7lM+PKZJPdGAry6EvNSx9MSPO4LjJsX3vGmcJ/BA=; b=yxc/oK5aCS5ms9I4RGzuBdlDYggoOliY1mPDU5jGMNF+Dh5GD0GI9yiVq3ABuGHmiV nXUrW7TnrhbILY2eDD1HNzbE6hA5CeZanwEpTTAK0tUI9Je9/1acxJBcublaoGRM7u2v YVkJ5kGZQ5dRt9qhoFjH1JEfUelWCO7nMJAHzT+jMdLr4TAQzt1j07Dn4lMGV0FgWe92 I380FR3XUSXrIo17u2ZJv4mrm/r0F4vODAwe16HfthyjX/u6QRfRasP8bv38K0K+s7hj Xl3umzSOtQHX33AR3ZwHOu2JWWXyRsgrOWD2qoeebdFqUoDT6Uxuc8eF4hlkfEznhktk IHtw== 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=L3V7lM+PKZJPdGAry6EvNSx9MSPO4LjJsX3vGmcJ/BA=; b=Tw0virTUjfFktI1BrPwUk6EDeI/RNdGF2a803BoB5F16ibvdVsRLhCWh5fdWZi98l2 3vzB5sIf/xMu1u49ft2NGiIg58Q/7RZ94UGQNu0TuYGcH0wsCjTyigtM19+PpV02E4pX +rzCnCUyQf2SZWP7mlq6eyF75EykuxsCfOGCqsbyPTg1aJgMmgwLHnxKGRFIR8vQhMHm g6TUgDu9tSqSme+y+OFl5Svzy1n0Akv+g90hA465vVGaWQCNJJMkwzjNgeO7V2+BFaoT I2BhZUI0Vip7uFk9MnIjUu2zjZcD6RlIjYk795WEiatW4nshARKmTzxbDSXjqIwBnnTP 6chw== X-Gm-Message-State: AJIora9mSscVNtDwNQfFvVz/uv8k/HF4rtdm0b/On8LMlTOTa868d0ts 10KvDBi4/I91r58P2FT8lcZDgw== X-Google-Smtp-Source: AGRyM1s2ZmJIzs6aaXoZTMV85jwGiiSQla4rOuyky0RhtFtwMDQH+ChBIvuZQm2m6YWb4dYKfZRzQA== X-Received: by 2002:a05:6000:1d1:b0:21d:6673:9894 with SMTP id t17-20020a05600001d100b0021d66739894mr13927211wrx.640.1657488326338; Sun, 10 Jul 2022 14:25:26 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:26 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , 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 v1 31/33] thermal/drivers/samsung: Switch to new of thermal API Date: Sun, 10 Jul 2022 23:24:21 +0200 Message-Id: <20220710212423.681301-32-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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. Use this new API. Signed-off-by: Daniel Lezcano --- drivers/thermal/samsung/exynos_tmu.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung= /exynos_tmu.c index f4ab4c5b4b62..2bd7b3b57b28 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 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) @@ -1118,7 +1118,7 @@ static int exynos_tmu_probe(struct platform_device *p= dev) return 0; =20 err_thermal: - thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); + thermal_of_zone_unregister(data->tzd); err_sclk: clk_disable_unprepare(data->sclk); err_clk: @@ -1138,7 +1138,7 @@ 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); + thermal_of_zone_unregister(tzd); exynos_tmu_control(pdev, false); =20 clk_disable_unprepare(data->sclk); --=20 2.25.1 From nobody Sat Apr 18 21:01:24 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 640E6C433EF for ; Sun, 10 Jul 2022 21:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbiGJV1d (ORCPT ); Sun, 10 Jul 2022 17:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229865AbiGJV0i (ORCPT ); Sun, 10 Jul 2022 17:26:38 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8960F15FF5 for ; Sun, 10 Jul 2022 14:25:40 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id z23-20020a7bc7d7000000b003a2e00222acso1117800wmk.0 for ; Sun, 10 Jul 2022 14:25: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=OG0J5UXur47VUkQJyMswMokKl0Ud/3VRKQ3CS1V7X0Y=; b=liiAN3xSPx3ND+hbz8Xf+UfC/kuiWklRynbKojZgrL1yTt06ctYmxYZHJ+vd1RmToi Gdkdn79fR/8yfBQuwjkxGdVvHMYQV3kGynnksuTYD1ZIBayjGfS91n7J5DQKSTcOwcNG +WU+QC3TyFpqGQ/zd1sBIacTEQVQoywPaie1C6ES+giNEEi73G0SBKBGmjVttIQL9cZe VQZh2j5K26aZlzxSiLF50lwEoeszx/aBXzPsj9Q0al5USJ7jvFe98g9xtn0QiP6v2v4I WV624/QfQJMIDRCvk6asiBx9XinQB9nHE72wjATfGrwKUkqDko0tyWiv9/XaeSpdIfl+ GTIQ== 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=OG0J5UXur47VUkQJyMswMokKl0Ud/3VRKQ3CS1V7X0Y=; b=hyCgdBOz8rDJ7eQ6Y3JwhWVeg647mNpsvD+6T0JK7SYFW5WnvoEEVEoVmHuY1lk0WJ HFDclLQLrchw2bVDRdKRPcB/uTcUQ5dSxzrc8IVQ4q8axCReWda1fF0c5SGqMBcZFbTe 6VbSY4Rs3FYkwAzMMuCWJ9G5nIP8bqUgJd3t3M2FVrQnkZKqYNcJ8/rCpkenRq5RxcJY vAS+tmdfwcDiODS4dQ1m5w2Mtp78RtAe/DzRONT061O3B4ElJundgN0TMfGyxEUAjLNt jSxlIspxk9ndUka5RR5hGqU35IrpJHRlp6F53e53s0FEAuTz6THEGmrp/b8PqES6ZGgu d1Mw== X-Gm-Message-State: AJIora9YZFdC3YD+SgkGuKzXp17g1RuX35qC8iq2Levr49ZjKxkBk9De uaKQhiqCYZBvOO1bOcrrbSosmA== X-Google-Smtp-Source: AGRyM1vMcDJfYD6KDwtKJIJibBcRMvnNOAQVeMgfH7jzNgMMPr6aYcq20t6rwPk360aQxiJiyq9q9Q== X-Received: by 2002:a05:600c:4e8d:b0:3a1:2e4d:1dd2 with SMTP id f13-20020a05600c4e8d00b003a12e4d1dd2mr12452610wmq.85.1657488327448; Sun, 10 Jul 2022 14:25:27 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:27 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 32/33] thermal/core: Move set_trip_temp ops to the sysfs code Date: Sun, 10 Jul 2022 23:24:22 +0200 Message-Id: <20220710212423.681301-33-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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 60ce270f2add..5219d67ac045 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 Sat Apr 18 21:01:24 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 E99F3C433EF for ; Sun, 10 Jul 2022 21:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbiGJV0t (ORCPT ); Sun, 10 Jul 2022 17:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbiGJV0L (ORCPT ); Sun, 10 Jul 2022 17:26:11 -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 613041571B for ; Sun, 10 Jul 2022 14:25:29 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id r14so4783050wrg.1 for ; Sun, 10 Jul 2022 14:25:29 -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=SPJSrsryQMOk3F+5rWpra8ECe/+Fdubpa/uxGkNOCx8=; b=LM5c981KtIvXAJ/zhU5uSdBH38CkG/L0oEhn+x6fnto5fCgMzmK5Y4kolGUETVJ5CQ ahEKTj8Kyb/WKLxpAfAik3uNVyaUs+s1XH83BPJCX7UczF0hlmylkf4KOt6phyg+GyGl D0jjHi8W5Gui38+1zrQMtFkdsBR2U0XNam/mdshcISTeZegktakqWqT3e1JkYO6xF1lG BHNN+b4Sh3qygsYhw6vZLQxhmVjyJhDi+8HIxabZxUaeNVOxDHNUiUIBR5e3fc3zFb1z suOfU2WvobDppxw0EzG7IZLmWeGv9lx796t06dsv/TZFQJT/3eBaJ1KTt9eZuAhOAvN4 TetA== 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=SPJSrsryQMOk3F+5rWpra8ECe/+Fdubpa/uxGkNOCx8=; b=jyFeMxUl99iXvXwazMFLhx02udNz4dstZNm/Tf2CV0jCMxkFfxzcybWtK5cho6GmKn a/esVM++c8gGaqwX2TgGYCHhYxA1gPYUOPI+7sQi85GrXKpeaG1K6QRWyZ+SOUBOq0i/ +ujWMOA7tR7Avq2fz6//Qx3nJFUiBvaifwXAIxCcgzBSnyjwT4Xj/SV3KX5jgYRXD3/c v2rH3WKzv6C5lWWajfazXpNPwl0npxbQQlUafOnCNMEZAoxCQq+nBYO5WnHl2RteB+Tu ddS5xBGlx4YoHKcHswDwJjUaQ64Ro95m5r1mCakCmA5selUQ3tHNTrTC+B1In5mD0oyF FmRQ== X-Gm-Message-State: AJIora+udAuLjNcH9GCcH3F0O+9VXlkNT0HRTatF2mPuS43ZPHbdB9m0 fzLJlyDrX1tm9fAUHUtfqjzzkA== X-Google-Smtp-Source: AGRyM1v8gxLeI+NqAfhVPIjg08rP9QwU9sqbZowt1WoT3JMgGAhwQZ2YmSOrmENlZdaY1mhYOXl0Fg== X-Received: by 2002:adf:d4c4:0:b0:21d:6c8f:4da3 with SMTP id w4-20020adfd4c4000000b0021d6c8f4da3mr14087023wrk.325.1657488328802; Sun, 10 Jul 2022 14:25:28 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:c7c0:6823:f3ce:2447]) by smtp.gmail.com with ESMTPSA id m19-20020a05600c3b1300b003a2dd0d21f0sm7142759wms.13.2022.07.10.14.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 14:25:28 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com, amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v1 33/33] thermal/of: Remove old OF code Date: Sun, 10 Jul 2022 23:24:23 +0200 Message-Id: <20220710212423.681301-34-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220710212423.681301-1-daniel.lezcano@linexp.org> References: <20220710212423.681301-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 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 a4e730391cab..874effb988eb 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -145,13 +145,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 5219d67ac045..4a457868415e 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; - } -=09 - 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; @@ -1478,95 +758,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 0335aeec56ce..76417e75c9d8 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); =09 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);=09 } =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