From nobody Sat Apr 11 21:14:18 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 9324CC25B06 for ; Thu, 4 Aug 2022 22:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236063AbiHDWwE (ORCPT ); Thu, 4 Aug 2022 18:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232665AbiHDWv6 (ORCPT ); Thu, 4 Aug 2022 18:51:58 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E1D631238 for ; Thu, 4 Aug 2022 15:51:54 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id j1so1384173wrw.1 for ; Thu, 04 Aug 2022 15:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=iAArs4SXUCAacYGBv7Awb3AFLncqE6fDpHGHh6AQFsQ=; b=U8qJSdviovFiSLKRwXMKZdVymAp8sInYUoUyIF3A0yDvHuSO+KMnQx19gEtpeLtftF h2IS75eE5u5wSnM9LItsAM/1oB9JtPyWkTLhkW5n+YADZX8+ncAB5OWYnr4WmyGcPXbx 6dS/RremOyrH9pvUy7Ng4dWTkCyS6GlwB48JocGTXL6ddM+ANuzu6T7II6XXso6WNLqR E+psNskrmsF6OZnv5/oYktspbDLjo7EXuDrG29GKRnn9IoQ7+HvlPtDENdSYout3Ie0M HDiJq+WXQHkqMzz7oz1H3fGX2V4/jjntoG/SgBpSf62Bci8DsLJ9rsJ7Z46zm8SgNIR4 SPJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=iAArs4SXUCAacYGBv7Awb3AFLncqE6fDpHGHh6AQFsQ=; b=Ynd8xzJ2qLdcsYcbjeSnPnE8nAgLvT5p1Qsr+Rcs4LUrXATHwF1e6orHwDLb+9Cl+l 5F70iZyk05kwzzffMEdzWlkwKcfNcJwBHKqElXGx+QQRTEx5OTP+Mb6s3DLBYn24h30Y rnu5sBDi6UUDNVGcPck7oHcwxfBVECx+x+Rs2wdfyX1pa8hwhGjGCNlNI0vGBtguCCV+ rbHEgKbzOtyy+Qidwy/ObEGkYcZb2/IwXmXPdYBh5umqIjIPUdZG3PQQqGYR+qML19rI LoR4y49a16mOX0ZKxMw9z/7GNN1cyMVF7iqEbm/RPmB19hY5m9h0PLgAm99jBHVR6+6Y y00Q== X-Gm-Message-State: ACgBeo0xQkLmQgiIuLW9ckE+1Ptyx+6iELClEpF6DQnm559P3xUo+wrD aseh1mPMXSRTV0PfKU8b3kmBLQ== X-Google-Smtp-Source: AA6agR44kHwGwfoG/iAiP1j6nrFZwUXBgEQph7OOvbzZwRw0euzlS8qHoobCh1U2tdQj6Dw8I/AAjQ== X-Received: by 2002:a5d:6705:0:b0:21f:1520:5095 with SMTP id o5-20020a5d6705000000b0021f15205095mr2537666wru.240.1659653512823; Thu, 04 Aug 2022 15:51:52 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:51:52 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 01/33] thermal/of: Rework the thermal device tree initialization Date: Fri, 5 Aug 2022 00:43:17 +0200 Message-Id: <20220804224349.1926752-2-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/thermal_of.c | 460 ++++++++++++++++++++++++++++++++++- include/linux/thermal.h | 18 ++ 2 files changed, 468 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 802c30b72a92..d4fd06b576aa 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -811,16 +811,6 @@ static int thermal_of_get_trip_type(struct device_node= *np, return -ENODEV; } =20 -/** - * thermal_of_populate_trip - parse and fill one trip point data - * @np: DT node containing a trip point node - * @trip: trip point data structure to be filled up - * - * This function parses a trip point type of node represented by - * @np parameter and fills the read data into @trip data structure. - * - * Return: 0 on success, proper error code otherwise - */ static int thermal_of_populate_trip(struct device_node *np, struct thermal_trip *trip) { @@ -1065,6 +1055,456 @@ static __init void of_thermal_destroy_zones(void) of_node_put(np); } =20 +static struct device_node *of_thermal_zone_find(struct device_node *sensor= , int id) +{ + struct device_node *np, *tz; + struct of_phandle_args sensor_specs; + + np =3D of_find_node_by_name(NULL, "thermal-zones"); + if (!np) { + pr_err("Unable to find thermal zones description\n"); + return ERR_PTR(-EINVAL); + } + + /* + * Search for each thermal zone, a defined sensor + * corresponding to the one passed as parameter + */ + for_each_available_child_of_node(np, tz) { + + int count, i; + + count =3D of_count_phandle_with_args(tz, "thermal-sensors", + "#thermal-sensor-cells"); + if (count <=3D 0) { + pr_err("%pOFn: missing thermal sensor\n", tz); + tz =3D ERR_PTR(-EINVAL); + goto out; + } + + for (i =3D 0; i < count; i++) { + + int ret; + + ret =3D of_parse_phandle_with_args(tz, "thermal-sensors", + "#thermal-sensor-cells", + i, &sensor_specs); + if (ret < 0) { + pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", tz, ret); + tz =3D ERR_PTR(ret); + goto out; + } + + if ((sensor =3D=3D sensor_specs.np) && id =3D=3D (sensor_specs.args_cou= nt ? + sensor_specs.args[0] : 0)) { + pr_debug("sensor %pOFn id=3D%d belongs to %pOFn\n", sensor, id, tz); + goto out; + } + } + } +out: + of_node_put(np); + return tz; +} + +static int thermal_of_monitor_init(struct device_node *np, int *delay, int= *pdelay) +{ + int ret; + + ret =3D of_property_read_u32(np, "polling-delay-passive", pdelay); + if (ret < 0) { + pr_err("%pOFn: missing polling-delay-passive property\n", np); + return ret; + } + + ret =3D of_property_read_u32(np, "polling-delay", delay); + if (ret < 0) { + pr_err("%pOFn: missing polling-delay property\n", np); + return ret; + } + + return 0; +} + +static struct thermal_zone_params *thermal_of_parameters_init(struct devic= e_node *np) +{ + struct thermal_zone_params *tzp; + int coef[2]; + int ncoef =3D ARRAY_SIZE(coef); + int prop, ret; + + tzp =3D kzalloc(sizeof(*tzp), GFP_KERNEL); + if (!tzp) + return ERR_PTR(-ENOMEM); + + tzp->no_hwmon =3D true; + + if (!of_property_read_u32(np, "sustainable-power", &prop)) + tzp->sustainable_power =3D prop; + + /* + * For now, the thermal framework supports only one sensor per + * thermal zone. Thus, we are considering only the first two + * values as slope and offset. + */ + ret =3D of_property_read_u32_array(np, "coefficients", coef, ncoef); + if (ret) { + coef[0] =3D 1; + coef[1] =3D 0; + } + + tzp->slope =3D coef[0]; + tzp->offset =3D coef[1]; + + return tzp; +} + +static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone= _device *tz) +{ + struct device_node *np, *tz_np; + + np =3D of_find_node_by_name(NULL, "thermal-zones"); + if (!np) + return ERR_PTR(-ENODEV); + + tz_np =3D of_get_child_by_name(np, tz->type); + + of_node_put(np); + + if (!tz_np) + return ERR_PTR(-ENODEV); + + return tz_np; +} + +static int __thermal_of_unbind(struct device_node *map_np, int index, int = trip_id, + struct thermal_zone_device *tz, struct thermal_cooling_device *c= dev) +{ + struct of_phandle_args cooling_spec; + int ret; + + ret =3D of_parse_phandle_with_args(map_np, "cooling-device", "#cooling-ce= lls", + index, &cooling_spec); + + of_node_put(cooling_spec.np); + + if (ret < 0) { + pr_err("Invalid cooling-device entry\n"); + return ret; + } + + if (cooling_spec.args_count < 2) { + pr_err("wrong reference to cooling device, missing limits\n"); + return -EINVAL; + } + + if (cooling_spec.np !=3D cdev->np) + return 0; + + ret =3D thermal_zone_unbind_cooling_device(tz, trip_id, cdev); + if (ret) + pr_err("Failed to unbind '%s' with '%s': %d\n", tz->type, cdev->type, re= t); + + return ret; +} + +static int __thermal_of_bind(struct device_node *map_np, int index, int tr= ip_id, + struct thermal_zone_device *tz, struct thermal_cooling_device *cde= v) +{ + struct of_phandle_args cooling_spec; + int ret, weight =3D THERMAL_WEIGHT_DEFAULT; + + of_property_read_u32(map_np, "contribution", &weight); + + ret =3D of_parse_phandle_with_args(map_np, "cooling-device", "#cooling-ce= lls", + index, &cooling_spec); + + of_node_put(cooling_spec.np); + + if (ret < 0) { + pr_err("Invalid cooling-device entry\n"); + return ret; + } + + if (cooling_spec.args_count < 2) { + pr_err("wrong reference to cooling device, missing limits\n"); + return -EINVAL; + } + + if (cooling_spec.np !=3D cdev->np) + return 0; + + ret =3D thermal_zone_bind_cooling_device(tz, trip_id, cdev, cooling_spec.= args[1], + cooling_spec.args[0], + weight); + if (ret) + pr_err("Failed to bind '%s' with '%s': %d\n", tz->type, cdev->type, ret); + + return ret; +} + +static int thermal_of_for_each_cooling_device(struct device_node *tz_np, s= truct device_node *map_np, + struct thermal_zone_device *tz, struct thermal_cooling_device *= cdev, + int (*action)(struct device_node *, int, int, + struct thermal_zone_device *, struct thermal_cooling_device *)) +{ + struct device_node *tr_np; + int count, i, trip_id; + + tr_np =3D of_parse_phandle(map_np, "trip", 0); + if (!tr_np) + return -ENODEV; + + trip_id =3D of_find_trip_id(tz_np, tr_np); + if (trip_id < 0) + return trip_id; + + count =3D of_count_phandle_with_args(map_np, "cooling-device", "#cooling-= cells"); + if (count <=3D 0) { + pr_err("Add a cooling_device property with at least one device\n"); + return -ENOENT; + } + + /* + * At this point, we don't want to bail out when there is an + * error, we will try to bind/unbind as many as possible + * cooling devices + */ + for (i =3D 0; i < count; i++) + action(map_np, i, trip_id, tz, cdev); + + return 0; +} + +static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev, + int (*action)(struct device_node *, int, int, + struct thermal_zone_device *, struct thermal_cooling_device *)) +{ + struct device_node *tz_np, *cm_np, *child; + int ret =3D 0; + + tz_np =3D thermal_of_zone_get_by_name(tz); + if (IS_ERR(tz_np)) { + pr_err("Failed to get node tz by name\n"); + return PTR_ERR(tz_np); + } + + cm_np =3D of_get_child_by_name(tz_np, "cooling-maps"); + if (!cm_np) + goto out; + + for_each_child_of_node(cm_np, child) { + ret =3D thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, actio= n); + if (ret) + break; + } + + of_node_put(cm_np); +out: + of_node_put(tz_np); + + return ret; +} + +static int thermal_of_bind(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev) +{ + return thermal_of_for_each_cooling_maps(tz, cdev, __thermal_of_bind); +} + +static int thermal_of_unbind(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev) +{ + return thermal_of_for_each_cooling_maps(tz, cdev, __thermal_of_unbind); +} + +/** + * thermal_of_zone_unregister - Cleanup the specific allocated ressources + * + * This function disables the thermal zone and frees the different + * ressources allocated specific to the thermal OF. + * + * @tz: a pointer to the thermal zone structure + */ +void thermal_of_zone_unregister(struct thermal_zone_device *tz) +{ + thermal_zone_device_disable(tz); + thermal_zone_device_unregister(tz); + kfree(tz->trips); + kfree(tz->tzp); + kfree(tz->ops); +} +EXPORT_SYMBOL_GPL(thermal_of_zone_unregister); + +/** + * thermal_of_zone_register - Register a thermal zone with device node + * sensor + * + * The thermal_of_zone_register() parses a device tree given a device + * node sensor and identifier. It searches for the thermal zone + * associated to the couple sensor/id and retrieves all the thermal + * zone properties and registers new thermal zone with those + * properties. + * + * @sensor: A device node pointer corresponding to the sensor in the devic= e tree + * @id: An integer as sensor identifier + * @data: A private data to be stored in the thermal zone dedicated privat= e area + * @ops: A set of thermal sensor ops + * + * Return: a valid thermal zone structure pointer on success. + * - EINVAL: if the device tree thermal description is malformed + * - ENOMEM: if one structure can not be allocated + * - Other negative errors are returned by the underlying called functions + */ +struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, void *data, + const struct thermal_zone_device_ops *ops) +{ + struct thermal_zone_device *tz; + struct thermal_trip *trips; + struct thermal_zone_params *tzp; + struct thermal_zone_device_ops *of_ops; + struct device_node *np; + int delay, pdelay; + int ntrips, mask; + int ret; + + of_ops =3D kmemdup(ops, sizeof(*ops), GFP_KERNEL); + if (!of_ops) + return ERR_PTR(-ENOMEM); +=09 + np =3D of_thermal_zone_find(sensor, id); + if (IS_ERR(np)) { + pr_err("Failed to find thermal zone for %pOFn id=3D%d\n", sensor, id); + return ERR_CAST(np); + } + + trips =3D thermal_of_trips_init(np, &ntrips); + if (IS_ERR(trips)) { + pr_err("Failed to find trip points for %pOFn id=3D%d\n", sensor, id); + return ERR_CAST(trips); + } + + ret =3D thermal_of_monitor_init(np, &delay, &pdelay); + if (ret) { + pr_err("Failed to initialize monitoring delays from %pOFn\n", np); + goto out_kfree_trips; + } + + tzp =3D thermal_of_parameters_init(np); + if (IS_ERR(tzp)) { + ret =3D PTR_ERR(tzp); + pr_err("Failed to initialize parameter from %pOFn: %d\n", np, ret); + goto out_kfree_trips; + } + + of_ops->get_trip_type =3D of_ops->get_trip_type ? : of_thermal_get_trip_t= ype; + of_ops->get_trip_temp =3D of_ops->get_trip_temp ? : of_thermal_get_trip_t= emp; + of_ops->get_trip_hyst =3D of_ops->get_trip_hyst ? : of_thermal_get_trip_h= yst; + of_ops->set_trip_hyst =3D of_ops->set_trip_hyst ? : of_thermal_set_trip_h= yst; + of_ops->get_crit_temp =3D of_ops->get_crit_temp ? : of_thermal_get_crit_t= emp; + of_ops->bind =3D thermal_of_bind; + of_ops->unbind =3D thermal_of_unbind; + + mask =3D GENMASK_ULL((ntrips) - 1, 0); + + tz =3D thermal_zone_device_register_with_trips(np->name, trips, ntrips, + mask, data, of_ops, tzp, + pdelay, delay); + if (IS_ERR(tz)) { + ret =3D PTR_ERR(tz); + pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); + goto out_kfree_tzp; + } + + ret =3D thermal_zone_device_enable(tz); + if (ret) { + pr_err("Failed to enabled thermal zone '%s', id=3D%d: %d\n", + tz->type, tz->id, ret); + thermal_of_zone_unregister(tz); + return ERR_PTR(ret); + } + + return tz; + +out_kfree_tzp: + kfree(tzp); +out_kfree_trips: + kfree(trips); + + return ERR_PTR(ret); +} +EXPORT_SYMBOL_GPL(thermal_of_zone_register); + +static void devm_thermal_of_zone_release(struct device *dev, void *res) +{ + thermal_of_zone_unregister(*(struct thermal_zone_device **)res); +} + +static int devm_thermal_of_zone_match(struct device *dev, void *res, + void *data) +{ + struct thermal_zone_device **r =3D res; + + if (WARN_ON(!r || !*r)) + return 0; + + return *r =3D=3D data; +} + +/** + * devm_thermal_of_zone_register - register a thermal tied with the sensor= life cycle + * + * This function is the device version of the thermal_of_zone_register() f= unction. + * + * @dev: a device structure pointer to sensor to be tied with the thermal = zone OF life cycle + * @sensor_id: the sensor identifier + * @data: a pointer to a private data to be stored in the thermal zone 'de= vdata' field + * @ops: a pointer to the ops structure associated with the sensor + */ +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int sensor_id, void *data, + const struct thermal_zone_device_ops *ops) +{ + struct thermal_zone_device **ptr, *tzd; + + ptr =3D devres_alloc(devm_thermal_of_zone_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tzd =3D thermal_of_zone_register(dev->of_node, sensor_id, data, ops); + if (IS_ERR(tzd)) { + devres_free(ptr); + return tzd; + } + + *ptr =3D tzd; + devres_add(dev, ptr); + + return tzd; +} +EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); + +/** + * devm_thermal_of_zone_unregister - Resource managed version of + * thermal_of_zone_unregister(). + * @dev: Device for which which resource was allocated. + * @tz: a pointer to struct thermal_zone where the sensor is registered. + * + * This function removes the sensor callbacks and private data from the + * thermal zone device registered with devm_thermal_zone_of_sensor_registe= r() + * API. It will also silent the zone by remove the .get_temp() and .get_tr= end() + * thermal zone device callbacks. + * Normally this function will not need to be called and the resource + * management code will ensure that the resource is freed. + */ +void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz) +{ + WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, + devm_thermal_of_zone_match, tz)); +} +EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); + /** * of_parse_thermal_zones - parse device tree thermal data * diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 1386c713885d..e2ac9d473bd6 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -325,6 +325,16 @@ struct thermal_zone_of_device_ops { =20 /* Function declarations */ #ifdef CONFIG_THERMAL_OF +struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, void *data, + const struct thermal_zone_device_ops *ops); + +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int id, void *data, + const struct thermal_zone_device_ops *ops); + +void thermal_of_zone_unregister(struct thermal_zone_device *tz); + +void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz); + int thermal_zone_of_get_sensor_id(struct device_node *tz_np, struct device_node *sensor_np, u32 *id); @@ -366,6 +376,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 11 21:14:18 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 8D0D2C25B0C for ; Thu, 4 Aug 2022 22:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiHDWwM (ORCPT ); Thu, 4 Aug 2022 18:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239275AbiHDWv7 (ORCPT ); Thu, 4 Aug 2022 18:51:59 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DB513C8D4 for ; Thu, 4 Aug 2022 15:51:56 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id ay36-20020a05600c1e2400b003a4e30d7995so3168944wmb.5 for ; Thu, 04 Aug 2022 15:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Qj/girp3QZIjTVT0mlN9J9xZSF+SZjyq2BVb0HmFUYI=; b=gDrKK+ABb++UEN5IohDsJzyGk+rDGu+3S5fXSEpKqR8svo0vm9z9XqRCMQDd1DQ/li NvevuLYuXv0pKqtTfpGmLagFbHrDED0K77NPeSqhiSZNZUaJPOuugLvc3iKTDtGDul6M pmRXtBfeJTa6OlV0eiZEum+kxEJ8rgk2XIXU9owLnTUiWI9cqzUSWJljhGs5eFLnL4BR NLcmd1wWvc/iOn6OpEa7yUWvkKSc+T16K7d19Nab+25GgCGLd7kI1xmoZqoX5MX/udhs BNxbA6wMuql7rovDGUx64AmeIokgGX09MKj6pJRgxhPmaGgAO32WLgRM2ypPLUum3d8v E+3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Qj/girp3QZIjTVT0mlN9J9xZSF+SZjyq2BVb0HmFUYI=; b=7Ra7nlu44xXU9AJ8YuJcVWeMePVU9jfGReNwDlIWHTL319hfpPZC/gvUAH3WXr9m+7 jUXql1wCq/PitkxzCnR7rMWqMeZpvk1xLvZV+IR6xuc7AuMuEwQQf3RG0+KcHVy6cu8K 6MEqW6YYiOZDPEeP2TMhozxn4P9OcL12v6SnC2RfFmBDE51glWaFKKOJfK19OUgVHv3P pGMnxg8bwFUPJ+l5tjSiyIoLyeh7GJ9Sogvma8zSdlk/Qh7kmjW9HgFEfmlTzDQTSYX/ lgI4kbw4E4E5orwzhZstRRLUZmf4t74smk99OZIiovLZgKFgz1yJ6eKfvni8J9T2+Ydm Qy5A== X-Gm-Message-State: ACgBeo0gli7DWmlmvc4P7OmihyjhOdgOq8yBAM/de9+WDqfG4C+E1sfE aOUqFysZk9Z8S6FvsmLJGb0w9A== X-Google-Smtp-Source: AA6agR4yzg6P2Wq5LquxIwEqYsgiFcBCZCqmZPNRBaz0QKzziuNvGijBJqPtBb0vVxxt3kOwTBbQ0w== X-Received: by 2002:a05:600c:3553:b0:3a3:2b65:299e with SMTP id i19-20020a05600c355300b003a32b65299emr7295841wmq.145.1659653514941; Thu, 04 Aug 2022 15:51:54 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:51:54 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 02/33] thermal/of: Make new code and old code co-exist Date: Fri, 5 Aug 2022 00:43:18 +0200 Message-Id: <20220804224349.1926752-3-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 Acked-by: for the hwmon patches in this series until it is guaranteed --- 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 f50098d33152..b4c68410c158 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1491,10 +1491,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", @@ -1502,8 +1498,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 d4fd06b576aa..07bde07ddc04 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -485,6 +485,15 @@ thermal_zone_of_sensor_register(struct device *dev, in= t sensor_id, void *data, { struct device_node *np, *child, *sensor_np; struct thermal_zone_device *tzd =3D ERR_PTR(-ENODEV); + static int old_tz_initialized; + int ret; + + if (!old_tz_initialized) { + ret =3D of_parse_thermal_zones(); + if (ret) + return ERR_PTR(ret); + old_tz_initialized =3D 1; + } =20 np =3D of_find_node_by_name(NULL, "thermal-zones"); if (!np) @@ -1004,7 +1013,7 @@ __init *thermal_of_build_thermal_zone(struct device_n= ode *np) return ERR_PTR(ret); } =20 -static __init void of_thermal_free_zone(struct __thermal_zone *tz) +static void of_thermal_free_zone(struct __thermal_zone *tz) { struct __thermal_bind_params *tbp; int i, j; @@ -1517,7 +1526,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); * Return: 0 on success, proper error code otherwise * */ -int __init of_parse_thermal_zones(void) +int of_parse_thermal_zones(void) { struct device_node *np, *child; struct __thermal_zone *tz; --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 D9C60C25B06 for ; Thu, 4 Aug 2022 22:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235262AbiHDWwU (ORCPT ); Thu, 4 Aug 2022 18:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239651AbiHDWv7 (ORCPT ); Thu, 4 Aug 2022 18:51:59 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC6693E773 for ; Thu, 4 Aug 2022 15:51:58 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id v131-20020a1cac89000000b003a4bb3f786bso3187907wme.0 for ; Thu, 04 Aug 2022 15:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=bjRNYXxMr1okCGj2grS3n0YP83rNlXVFleMjal7EwMQ=; b=vbw135BzoF5BZ3lqxmC26ZTkmuAengG0jZ8dEp7H8cB9kuSJpS2x+dzQ2BkUsXXb3u imvV3FlLlFGpENNBGbg/GP3hIklTyCirTOP6FsbFzXEUsdU2wu3cxP5djpVBE0xBLD9h /qnekkn6WjyApUeOaREApf3bwGnrDgkJMpWM7Jsx7+Be3W9DFgxv7Eg2zz83iZU3gnNj y49S+b4oloRPYLpTiIZNgfAjSiyULwxb7WkQLQvb9i/DI1tY0YiJpJyL7OQ5sbfOAp3S Q+UYIgF/ZkN7RuaEBmjsUQj9xAtbiEtHMswYadwB65Xy7xRTgEViYevk77E4PiYyl+x7 3n4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=bjRNYXxMr1okCGj2grS3n0YP83rNlXVFleMjal7EwMQ=; b=5iBKPz9ioAtVxtmzrYBEs09QQbtU0L8Evu8G2VSodij8ABi6JJCX0i5s9opQ+Qw1rE ZttWN+zCb8yOEFWH0hCd282pcs90XX4s/pAouUuo1N5kaXyCHBcRSUBvX0o9YnoyBVoN BwdTiPRC5arIW3nmp3tcrVIHZlZyKWjVbUhE/0lGpsyZ3R6yxAP9l9F+dzBoDNOYC9pL gsWMdXsBreJtPnV54uVjr2yMTviAnSKsbHlx1a9trvVuA4CWn5ViElUzr5SU8XeouEa0 ayJU5TpXAWEDViQWBfEaEVNc/CDF96aK37P0+9lSq45Xk5UOGR7JTrY/J9kMYmDuwPZ3 BEBA== X-Gm-Message-State: ACgBeo0yMKJ/H7lh5EFx2NlwEPXcvXT/6jH4h9zOq1KU167p+OWlbz96 mfWIZH7AmxGXvJXI2YuAnrxQY9s+aaS5gw== X-Google-Smtp-Source: AA6agR6q28Mx32cRNjSkFW4TaARIl2DEgVd8hO7IIdM/pkDfQQWbHZLtvoX6xXuojEWqNfePhxyO5w== X-Received: by 2002:a05:600c:2244:b0:3a5:1207:a1aa with SMTP id a4-20020a05600c224400b003a51207a1aamr2777096wmm.176.1659653517197; Thu, 04 Aug 2022 15:51:57 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:51:56 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v5 03/33] thermal/drivers/rockchip: Switch to new of API Date: Fri, 5 Aug 2022 00:43:19 +0200 Message-Id: <20220804224349.1926752-4-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/rockchip_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_= thermal.c index dc3a9c276a09..819e059cde71 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1211,9 +1211,9 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(= int irq, void *dev) return IRQ_HANDLED; } =20 -static int rockchip_thermal_set_trips(void *_sensor, int low, int high) +static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int = low, int high) { - struct rockchip_thermal_sensor *sensor =3D _sensor; + struct rockchip_thermal_sensor *sensor =3D tz->devdata; struct rockchip_thermal_data *thermal =3D sensor->thermal; const struct rockchip_tsadc_chip *tsadc =3D thermal->chip; =20 @@ -1224,9 +1224,9 @@ static int rockchip_thermal_set_trips(void *_sensor, = int low, int high) sensor->id, thermal->regs, high); } =20 -static int rockchip_thermal_get_temp(void *_sensor, int *out_temp) +static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *= out_temp) { - struct rockchip_thermal_sensor *sensor =3D _sensor; + struct rockchip_thermal_sensor *sensor =3D tz->devdata; struct rockchip_thermal_data *thermal =3D sensor->thermal; const struct rockchip_tsadc_chip *tsadc =3D sensor->thermal->chip; int retval; @@ -1239,7 +1239,7 @@ static int rockchip_thermal_get_temp(void *_sensor, i= nt *out_temp) return retval; } =20 -static const struct thermal_zone_of_device_ops rockchip_of_thermal_ops =3D= { +static const struct thermal_zone_device_ops rockchip_of_thermal_ops =3D { .get_temp =3D rockchip_thermal_get_temp, .set_trips =3D rockchip_thermal_set_trips, }; @@ -1326,8 +1326,8 @@ rockchip_thermal_register_sensor(struct platform_devi= ce *pdev, =20 sensor->thermal =3D thermal; sensor->id =3D id; - sensor->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, id, - sensor, &rockchip_of_thermal_ops); + sensor->tzd =3D devm_thermal_of_zone_register(&pdev->dev, id, sensor, + &rockchip_of_thermal_ops); if (IS_ERR(sensor->tzd)) { error =3D PTR_ERR(sensor->tzd); dev_err(&pdev->dev, "failed to register sensor %d: %d\n", --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 7986AC25B08 for ; Thu, 4 Aug 2022 22:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239891AbiHDWwP (ORCPT ); Thu, 4 Aug 2022 18:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239844AbiHDWwC (ORCPT ); Thu, 4 Aug 2022 18:52:02 -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 B632E3D5BF for ; Thu, 4 Aug 2022 15:52:00 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id l22so1347836wrz.7 for ; Thu, 04 Aug 2022 15:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=NVvhouf/ZsSYzyYoQ6bj2MFHWvALAEEXijoyeWSBKFg=; b=uulocpG76CYBWxwLA5GEXzKdDuKGpYq9LwU4SDLA8pxC41uy9gzVFVcJJI69zANnHU ldxRzTvckXpDK76LQ8K+UTsGtHOd1l2H5aGcZ5MtxoAyW6ymJlgCfSsoKWilg6zkP8H4 LfYGDZkcqlHNgo9xDsl5Cvr+wSVju+bBWSKGmsdOCOqBwcMIyMgN7iFPgE4y4DLeCFOJ 73g5s/7rkNoknPQxJrEqi+PJAnv5h0D2B92fADbgyTWOr+wmneoLuwVIg8qJjg44b/u6 c76AP/EbWH9DTMnGw9dqKlF/RQwJf7mofuHLhOExnsZhJ2TBy7uASYcOE/CqOXYIgDwK WFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=NVvhouf/ZsSYzyYoQ6bj2MFHWvALAEEXijoyeWSBKFg=; b=F3ypn/Ybtg1EXHwkX4AUu1LjuPvrqVzFgapx7+YFtFwkTABHe3ylW74V4fxMQAziCQ NqFTXXri3FQl5X1v9kvdt3bzii8Yc08UfEp6T2dj59ez7xI6fuX/ifFZIB9z3OdwQI+w 9v6WJpwxVPwpuVWp0C4+0d7eLitSPT+urul+MDb1MYojB6M4a1Edy2oyEuOVg51IOGf/ JB8gLxaEmh5H1v17c8FF5freJ5YnbRCyVHCdAom755c0/DPoVWx2PpH77+aMdfW8jEC/ I10ocEoqQyI3aeCSRgFE5zHPG6ynQNExn7s5bmIB0E3jFm6TAHhWR/26/4nru8mHqhAa P3kQ== X-Gm-Message-State: ACgBeo0nZZT5u1w4qhrCGce4Erxe/0UVvnYmUG9cWJD+iIDzH6bscR7x CIyiQNk2FSwGZPJlblddgT5Fug== X-Google-Smtp-Source: AA6agR6HvXFtI57ltAEhsG8lThHVAc2eG2lOpuZr9RKn9yTuCAcxSLLJgoF5FO4a22lPVSu83bX+yw== X-Received: by 2002:adf:fe42:0:b0:21f:8df:2239 with SMTP id m2-20020adffe42000000b0021f08df2239mr2524670wrs.644.1659653519299; Thu, 04 Aug 2022 15:51:59 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:51:59 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , linux-arm-kernel@lists.infradead.org (moderated list:ARM/UNIPHIER ARCHITECTURE) Subject: [PATCH v5 04/33] thermal/drivers/uniphier: Switch to new of API Date: Fri, 5 Aug 2022 00:43:20 +0200 Message-Id: <20220804224349.1926752-5-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed Reviewed-by: Kunihiko Hayashi --- drivers/thermal/uniphier_thermal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_= thermal.c index 4cae5561a2a3..4111d99ef50e 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -187,9 +187,9 @@ static void uniphier_tm_disable_sensor(struct uniphier_= tm_dev *tdev) usleep_range(1000, 2000); /* The spec note says at least 1ms */ } =20 -static int uniphier_tm_get_temp(void *data, int *out_temp) +static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_t= emp) { - struct uniphier_tm_dev *tdev =3D data; + struct uniphier_tm_dev *tdev =3D tz->devdata; struct regmap *map =3D tdev->regmap; int ret; u32 temp; @@ -204,7 +204,7 @@ static int uniphier_tm_get_temp(void *data, int *out_te= mp) return 0; } =20 -static const struct thermal_zone_of_device_ops uniphier_of_thermal_ops =3D= { +static const struct thermal_zone_device_ops uniphier_of_thermal_ops =3D { .get_temp =3D uniphier_tm_get_temp, }; =20 @@ -289,8 +289,8 @@ static int uniphier_tm_probe(struct platform_device *pd= ev) =20 platform_set_drvdata(pdev, tdev); =20 - tdev->tz_dev =3D devm_thermal_zone_of_sensor_register(dev, 0, tdev, - &uniphier_of_thermal_ops); + tdev->tz_dev =3D devm_thermal_of_zone_register(dev, 0, tdev, + &uniphier_of_thermal_ops); if (IS_ERR(tdev->tz_dev)) { dev_err(dev, "failed to register sensor device\n"); return PTR_ERR(tdev->tz_dev); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 63737C25B06 for ; Thu, 4 Aug 2022 22:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240086AbiHDWwW (ORCPT ); Thu, 4 Aug 2022 18:52:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240058AbiHDWwF (ORCPT ); Thu, 4 Aug 2022 18:52:05 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD55D481D5 for ; Thu, 4 Aug 2022 15:52:02 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id j15so1370328wrr.2 for ; Thu, 04 Aug 2022 15:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=0/7L9Lc2wRZZo52YCs91vi96h8X92jsylQFQZGCnX0s=; b=Uy4/PmcDOe2Eof+0b+O/7o+pqZYYipxVXGrQMmZN5OI42mD7hQdvXvaw2QGdZV6xAj b8Kg7QbEojFnmj883y9T6VEb5J/AT0pINLeJwdZchf4K2yEOxLSCawtQqgpVvPxa4Lu7 73zFqv+f0sQUjqSYkVXYEuRICcywEVOd2TUbso0ZjGqiIf668+ZNibK6AyIf8KnpCGcw 3VrsVhdfdGOwxCuyll8sVOzDXOR29+Yj8QalGUbbBlSaeNoUxFbo6YvbxaWu2e+BcRVS OR+STRQOAdIr+xERdigPLfMAp2p13sFmmvpUmHBWzmXfZC+FcqoHfr2J2UaE5CCkN1LZ lUFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=0/7L9Lc2wRZZo52YCs91vi96h8X92jsylQFQZGCnX0s=; b=0VTUhOhqsX9ChjlrvYYD1gWLnVO7wgKJE3bW9nWxMuHnpa2vz0Cl2NjUmsKcCTnUhJ Z5b4zCN3W0Obi7z4eKZUOTxxjzTS4BanrIATT5VTh2M1zUea5P3hEkhk7W+m/d1+Sxpz o0sGjS9EPnthKxqMYBeXooq1rDZD7o5sTxw6VODpaXk/oLCj+nWDgdbtGLyuWVRrYGh6 CLgVFPg++/vvknPvfEO8iZyBkhYh5HjsR4j3A3+ZuX/ZQKA6OE+FWg4WdLVJbTHy6m5D rEj2gDFYE0gXQhknxDMOblbjJ50cRP6HVm47UiMObLfxOwlFuIJlNPnAbb6Poca+anMc EG6g== X-Gm-Message-State: ACgBeo2VAvu0Yf4zpjxVtIRtZ53Iv/Gb0SPxZ/6P77xTVft8d5gSMKKF Fv6XAUEa/avGSgktmI4F4bU1gw== X-Google-Smtp-Source: AA6agR7S80zLKj6REvRGOQ79tjssRS7dol4Zsknr1lEVxrkb/3a1IeO+7V6QVVOgHUxNtU0UhnxWaw== X-Received: by 2002:a5d:6512:0:b0:21e:cdab:1598 with SMTP id x18-20020a5d6512000000b0021ecdab1598mr2532679wru.687.1659653521316; Thu, 04 Aug 2022 15:52:01 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:01 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 05/33] thermal/drivers/generic-adc: Switch to new of API Date: Fri, 5 Aug 2022 00:43:21 +0200 Message-Id: <20220804224349.1926752-6-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/thermal-generic-adc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/therma= l-generic-adc.c index 73665c3ccfe0..323e273e3298 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -52,9 +52,9 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_i= nfo *gti, int val) return temp; } =20 -static int gadc_thermal_get_temp(void *data, int *temp) +static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct gadc_thermal_info *gti =3D data; + struct gadc_thermal_info *gti =3D tz->devdata; int val; int ret; =20 @@ -68,7 +68,7 @@ static int gadc_thermal_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops gadc_thermal_ops =3D { +static const struct thermal_zone_device_ops gadc_thermal_ops =3D { .get_temp =3D gadc_thermal_get_temp, }; =20 @@ -143,8 +143,8 @@ static int gadc_thermal_probe(struct platform_device *p= dev) gti->dev =3D &pdev->dev; platform_set_drvdata(pdev, gti); =20 - gti->tz_dev =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, gti, - &gadc_thermal_ops); + gti->tz_dev =3D devm_thermal_of_zone_register(&pdev->dev, 0, gti, + &gadc_thermal_ops); if (IS_ERR(gti->tz_dev)) { ret =3D PTR_ERR(gti->tz_dev); if (ret !=3D -EPROBE_DEFER) --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 11D11C25B06 for ; Thu, 4 Aug 2022 22:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240356AbiHDWwZ (ORCPT ); Thu, 4 Aug 2022 18:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240103AbiHDWwG (ORCPT ); Thu, 4 Aug 2022 18:52:06 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7EFB30F45 for ; Thu, 4 Aug 2022 15:52:03 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id v3so1427335wrp.0 for ; Thu, 04 Aug 2022 15:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=4gLdF8Z9GXjLkyxJDJeMcMe40YjZXEY+RZQOYoJu4Mg=; b=SV9FayxLpHGjzaI4EaNO5sxgsvLqpjtrdaUFKN2/kSh/+s1uj3wpMLX3Z9L6QbZ5hW Wg10Jlq/UHdBCF8rGeXO5GYIe4qGrNuVKlh6ZJy9uMuRR2g4ifm24YW415A76Usc/eUN heJ7rsXs6HXWKvbbANjWwLliNbD+t8T2SQBz8gynEHMslxEjMelPAa6zRBQ3YpyEWalQ BXaVqKNWzrIzR/1b9MAvMjmdUQcRq4Ru+dMxyBz30NMx6H1jfXTfwxDFGNMv+9aaW7SQ zUFv1wMs9NuCR8WIKE0rr06NU3XWU1KAdyKdu4gxskdo7qbTI4FSOWkIpmMoytF3Ysd5 8i1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=4gLdF8Z9GXjLkyxJDJeMcMe40YjZXEY+RZQOYoJu4Mg=; b=lMsbvU6ki2FMewlXTFQ8R9El6OOmFj0PqDVwA1SA9WR+rtDwRCU9eVvkaenxHI3/q5 NYVNemRH+Ph1+IRVXSER0t+Sro5FMNfc9GJZjWIv1xZVys7CjDThe7Bt0LchNfTZcgIf N7TZDS3KB2OgcKCd9om5DvLUlt0fpBLI0OL+VvlyDdnMAKAkjLNUaybCauPVINyf35nD OXyH/F4pKOBSWCsKg9k+MYzmhwvch490HkXHK80TNf9CCbbTrbFa2XiuUrN/yFBnW7YO pwvDfPKaYtpNWRSKmR+C3YWGvF5udf/OzUjkVE38Z8zSM/2Lol07+vBgCs3GhXAcuRZt x6QA== X-Gm-Message-State: ACgBeo1K8cfAuweEuew2xLY4xI8lQftkYYJ7ZDN/Bd2PHW69IlggP2Or wpcyzlx6MTUPWBTxDaAvWwiRug== X-Google-Smtp-Source: AA6agR4KA7nFWxHCy1LP1ha2yqeypoamenwWu8KDXBL0rxjw6w7kFRQdcR735hSJSHU9wzvisePuNw== X-Received: by 2002:a5d:6e8d:0:b0:21e:48a4:b267 with SMTP id k13-20020a5d6e8d000000b0021e48a4b267mr2393881wrz.507.1659653523446; Thu, 04 Aug 2022 15:52:03 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:03 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 06/33] thermal/drivers/mmio: Switch to new of API Date: Fri, 5 Aug 2022 00:43:22 +0200 Message-Id: <20220804224349.1926752-7-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Reviewed-by: Talel Shenhar Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/thermal_mmio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c index 360b0dfdc3b0..1bf1a16533da 100644 --- a/drivers/thermal/thermal_mmio.c +++ b/drivers/thermal/thermal_mmio.c @@ -20,11 +20,10 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base) return readb(mmio_base); } =20 -static int thermal_mmio_get_temperature(void *private, int *temp) +static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, in= t *temp) { int t; - struct thermal_mmio *sensor =3D - (struct thermal_mmio *)private; + struct thermal_mmio *sensor =3D tz->devdata; =20 t =3D sensor->read_mmio(sensor->mmio_base) & sensor->mask; t *=3D sensor->factor; @@ -34,7 +33,7 @@ static int thermal_mmio_get_temperature(void *private, in= t *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops thermal_mmio_ops =3D { +static const struct thermal_zone_device_ops thermal_mmio_ops =3D { .get_temp =3D thermal_mmio_get_temperature, }; =20 @@ -68,10 +67,10 @@ static int thermal_mmio_probe(struct platform_device *p= dev) } } =20 - thermal_zone =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - 0, - sensor, - &thermal_mmio_ops); + thermal_zone =3D devm_thermal_of_zone_register(&pdev->dev, + 0, + sensor, + &thermal_mmio_ops); if (IS_ERR(thermal_zone)) { dev_err(&pdev->dev, "failed to register sensor (%ld)\n", @@ -79,7 +78,7 @@ static int thermal_mmio_probe(struct platform_device *pde= v) return PTR_ERR(thermal_zone); } =20 - thermal_mmio_get_temperature(sensor, &temperature); + thermal_mmio_get_temperature(thermal_zone, &temperature); dev_info(&pdev->dev, "thermal mmio sensor %s registered, current temperature: %d\n", pdev->name, temperature); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 6A5F4C25B06 for ; Thu, 4 Aug 2022 22:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240377AbiHDWwm (ORCPT ); Thu, 4 Aug 2022 18:52:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240109AbiHDWwO (ORCPT ); Thu, 4 Aug 2022 18:52:14 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4106539BB5 for ; Thu, 4 Aug 2022 15:52:12 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id bv3so1355234wrb.5 for ; Thu, 04 Aug 2022 15:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vJqB3DsidiN9nPhS4su/6uSlvLZimTeb9ZrCY8jA13M=; b=ywNDi5DlzfdiSw+Wek8UweNt+1cORGZIl0TiY0LahA+zegr97zHUu1bMR9080FcqEU dSqFgcdJIxpBUNjA0i5szx8JLSn1UWQwhbyHZpUTNje0bugjrSHgqa4sj0pXpchDR1F3 FyqYK4bPVnJk43ZWZLXj0qL1k9DIxzcTPUYRlHix8KSpYuOD8ZtdTGiz+7XxYnWVYNQO z3THZH8BwKyb7I2IV4BulTi76NYra85R4u/SnLuQZ0ChfGgLD+aIJoyfPtI0ddsvgI9z lYRhO4eku4GSwSukfJqeuXyHqIpZKkJ2qRxoNI+9aUKGno6OZdVl/j2lziBqtm23XnZS 9svg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vJqB3DsidiN9nPhS4su/6uSlvLZimTeb9ZrCY8jA13M=; b=BC0YobK2ggTfbykWhNMEwT9GZtZQlnsmo6u3dYGbhjUGNI5ADI8jBmUOH8gj6I6hNc IV0B3sVeZA5HCC0aj/DKelilxN2XqJfqMvi4X0aZqwAAVObQRuN9qbVsUwz8nvxltNc4 rK+KYbzjh8OQb3LvsvIRkIWMYm/GKP3oW1dJz3GLnlTiO9GDiJD46ZziSno0XVgZXupO NWFfR5QD6RooAluW7bd8svHT+kzOtWdh9ibkwSfrGsYUloYWivcs8yrV7yoJTv0AnzK7 4HhjWWcK0pWQg/61sFomEJaQZdTn9qPYqqTIJS5G6qa6cZYY9H5gLjcfYQaCruDApDKO WSwQ== X-Gm-Message-State: ACgBeo0/WEp7tAdmrdzE1inJ+ilvQlvugBc73wJZXI+KaTvE/2Ueh+uw CIMY66bOIoLlhCkASu7qOhbdJQ== X-Google-Smtp-Source: AA6agR4gPK2BFTS+f/e1TuM189EKCXODMRpapXlBFbhupBNMZ+wRdcTkc60a5Q4HLqzrKYg1t8mhxw== X-Received: by 2002:adf:fe42:0:b0:21f:8df:2239 with SMTP id m2-20020adffe42000000b0021f08df2239mr2524925wrs.644.1659653530594; Thu, 04 Aug 2022 15:52:10 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:10 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , Mikko Perttunen , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v5 07/33] thermal/drivers/tegra: Switch to new of API Date: Fri, 5 Aug 2022 00:43:23 +0200 Message-Id: <20220804224349.1926752-8-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed Tested-by: Dmitry Osipenko # Nexus7 --- drivers/thermal/tegra/soctherm.c | 21 ++++++++++----------- drivers/thermal/tegra/tegra-bpmp-thermal.c | 19 ++++++++++++------- drivers/thermal/tegra/tegra30-tsensor.c | 12 ++++++------ 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/socth= erm.c index 825eab526619..1efe470f31e9 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; @@ -657,9 +656,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); @@ -682,7 +681,7 @@ static int tegra_thermctl_set_trips(void *data, int lo,= int hi) return 0; } =20 -static const struct thermal_zone_of_device_ops tegra_of_thermal_ops =3D { +static const struct thermal_zone_device_ops tegra_of_thermal_ops =3D { .get_temp =3D tegra_thermctl_get_temp, .set_trip_temp =3D tegra_thermctl_set_trip_temp, .set_trips =3D tegra_thermctl_set_trips, @@ -2194,9 +2193,9 @@ static int tegra_soctherm_probe(struct platform_devic= e *pdev) zone->sg =3D soc->ttgs[i]; zone->ts =3D tegra; =20 - z =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - soc->ttgs[i]->id, zone, - &tegra_of_thermal_ops); + z =3D devm_thermal_of_zone_register(&pdev->dev, + soc->ttgs[i]->id, zone, + &tegra_of_thermal_ops); if (IS_ERR(z)) { err =3D PTR_ERR(z); dev_err(&pdev->dev, "failed to register sensor: %d\n", diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/t= egra/tegra-bpmp-thermal.c index 5affc3d196be..eb84f0b9dc7c 100644 --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c @@ -30,9 +30,9 @@ struct tegra_bpmp_thermal { struct tegra_bpmp_thermal_zone **zones; }; =20 -static int tegra_bpmp_thermal_get_temp(void *data, int *out_temp) +static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *z= one, + int *out_temp) { - struct tegra_bpmp_thermal_zone *zone =3D data; struct mrq_thermal_host_to_bpmp_request req; union mrq_thermal_bpmp_to_host_response reply; struct tegra_bpmp_message msg; @@ -60,9 +60,14 @@ static int tegra_bpmp_thermal_get_temp(void *data, int *= out_temp) return 0; } =20 -static int tegra_bpmp_thermal_set_trips(void *data, int low, int high) +static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int= *out_temp) { - struct tegra_bpmp_thermal_zone *zone =3D data; + return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp); +} + +static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, in= t low, int high) +{ + struct tegra_bpmp_thermal_zone *zone =3D tz->devdata; struct mrq_thermal_host_to_bpmp_request req; struct tegra_bpmp_message msg; int err; @@ -157,7 +162,7 @@ static int tegra_bpmp_thermal_get_num_zones(struct tegr= a_bpmp *bpmp, return 0; } =20 -static const struct thermal_zone_of_device_ops tegra_bpmp_of_thermal_ops = =3D { +static const struct thermal_zone_device_ops tegra_bpmp_of_thermal_ops =3D { .get_temp =3D tegra_bpmp_thermal_get_temp, .set_trips =3D tegra_bpmp_thermal_set_trips, }; @@ -200,13 +205,13 @@ static int tegra_bpmp_thermal_probe(struct platform_d= evice *pdev) zone->idx =3D i; zone->tegra =3D tegra; =20 - err =3D tegra_bpmp_thermal_get_temp(zone, &temp); + err =3D __tegra_bpmp_thermal_get_temp(zone, &temp); if (err < 0) { devm_kfree(&pdev->dev, zone); continue; } =20 - tzd =3D devm_thermal_zone_of_sensor_register( + tzd =3D devm_thermal_of_zone_register( &pdev->dev, i, zone, &tegra_bpmp_of_thermal_ops); if (IS_ERR(tzd)) { if (PTR_ERR(tzd) =3D=3D -EPROBE_DEFER) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegr= a/tegra30-tsensor.c index 05886684f429..c34501287e96 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -159,9 +159,9 @@ static void devm_tegra_tsensor_hw_disable(void *data) tegra_tsensor_hw_disable(ts); } =20 -static int tegra_tsensor_get_temp(void *data, int *temp) +static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *tem= p) { - const struct tegra_tsensor_channel *tsc =3D data; + const struct tegra_tsensor_channel *tsc =3D tz->devdata; const struct tegra_tsensor *ts =3D tsc->ts; int err, c1, c2, c3, c4, counter; u32 val; @@ -217,9 +217,9 @@ static int tegra_tsensor_temp_to_counter(const struct t= egra_tsensor *ts, int tem return DIV_ROUND_CLOSEST(c2 * 1000000 - ts->calib.b, ts->calib.a); } =20 -static int tegra_tsensor_set_trips(void *data, int low, int high) +static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low= , int high) { - const struct tegra_tsensor_channel *tsc =3D data; + const struct tegra_tsensor_channel *tsc =3D tz->devdata; const struct tegra_tsensor *ts =3D tsc->ts; u32 val; =20 @@ -240,7 +240,7 @@ static int tegra_tsensor_set_trips(void *data, int low,= int high) return 0; } =20 -static const struct thermal_zone_of_device_ops ops =3D { +static const struct thermal_zone_device_ops ops =3D { .get_temp =3D tegra_tsensor_get_temp, .set_trips =3D tegra_tsensor_set_trips, }; @@ -516,7 +516,7 @@ static int tegra_tsensor_register_channel(struct tegra_= tsensor *ts, tsc->id =3D id; tsc->regs =3D ts->regs + 0x40 * (hw_id + 1); =20 - tsc->tzd =3D devm_thermal_zone_of_sensor_register(ts->dev, id, tsc, &ops); + tsc->tzd =3D devm_thermal_of_zone_register(ts->dev, id, tsc, &ops); if (IS_ERR(tsc->tzd)) { if (PTR_ERR(tsc->tzd) !=3D -ENODEV) return dev_err_probe(ts->dev, PTR_ERR(tsc->tzd), --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 2D3B5C25B06 for ; Thu, 4 Aug 2022 22:52:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240360AbiHDWwq (ORCPT ); Thu, 4 Aug 2022 18:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240229AbiHDWwQ (ORCPT ); Thu, 4 Aug 2022 18:52:16 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 606396FA07 for ; Thu, 4 Aug 2022 15:52:13 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id l4so1307339wrm.13 for ; Thu, 04 Aug 2022 15:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=KoCo3jVOreA60M5B2h+gu+yJSl6IxRYoUlnzq7WRBI0=; b=tK8BZUrYjVSQkECpXaiG1qT4bYmfWcZCkyTFwzwm2zJsiqOs2137daSTFMuKmG6ZWf 6uxkl6beWGwhQZETcttDQAPtqpYYgBIkCsMTq+ac+SYyQFmkkzYYfgb7SPtRylhlT1MY hbSCVHmggrCRjLOEhccrCXswC8ML7Siwn7aI4rS4H4ZnDUU8pSwx+gPcUPFvtZQfqB6u /1CoVD3XIICZRz210i7lsScpbpQguQur0gISJO46OEXFjAtdMr5Jk7IBpqGU7KDXVn6G dObIG9YBDlYlvqHkRfawbEOcWbsiYobcEwnVQ1+hckMOCfjwPnrwFE8aqdcCAXFWBm3d QgSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KoCo3jVOreA60M5B2h+gu+yJSl6IxRYoUlnzq7WRBI0=; b=RUQ/4Z93sye7Qd7hgTzaVOCnxE31SkHfqb0zVI1MqPuCo6pFXaLTpBp0mqbcVB2SgG YHAn7hhQE+E9SEdPVm8eTOQdZCbJWMAvN/Qi89yDwLTWNvD07Bj4bh97M7aQTwqdX0yq 8rNKRzjUAyWfzqtU1wJBiZR669x7hWsZ5+a5uEy4mYL3HgwFqmElIZgO6CcV/qLLlNI5 Oe/AwU5OCyi6j3Qni7XBor/zO9WTQ6fWsaiW2WskdesnaSHz27JRm9DYEOwF0zp2QRcd caSoBRvTD2NdIKr/1KnCWC0cjEZDn+1SQOBe13RU3zCNNMStolvFYTp/kYXpTKtR0pq9 d0Iw== X-Gm-Message-State: ACgBeo0rAEU679yxQD01rrMpo/5kZglVAYZJyzf8qtzL96nKxWfyCgxH ZYIxH3BAWP+zUBBvOj8SXUDnwQ== X-Google-Smtp-Source: AA6agR57CkmUOuQZ/UDgeWmNjX/seB7gnWJdHW8biXGloj7zueDyqn8OOWCYGy0WwgScQ6ACI16iOg== X-Received: by 2002:a5d:5957:0:b0:220:79d5:f8ae with SMTP id e23-20020a5d5957000000b0022079d5f8aemr2588998wri.160.1659653532830; Thu, 04 Aug 2022 15:52:12 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:12 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v5 08/33] thermal/drivers/sun8i: Switch to new of API Date: Fri, 5 Aug 2022 00:43:24 +0200 Message-Id: <20220804224349.1926752-9-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- 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 212c87e63a66..e64d06d1328c 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -108,9 +108,9 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev, return -1590 * reg / 10 + 276000; } =20 -static int sun8i_ths_get_temp(void *data, int *temp) +static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsensor *s =3D data; + struct tsensor *s =3D tz->devdata; struct ths_device *tmdev =3D s->tmdev; int val =3D 0; =20 @@ -135,7 +135,7 @@ static int sun8i_ths_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops ths_ops =3D { +static const struct thermal_zone_device_ops ths_ops =3D { .get_temp =3D sun8i_ths_get_temp, }; =20 @@ -468,10 +468,10 @@ static int sun8i_ths_register(struct ths_device *tmde= v) tmdev->sensor[i].tmdev =3D tmdev; tmdev->sensor[i].id =3D i; tmdev->sensor[i].tzd =3D - devm_thermal_zone_of_sensor_register(tmdev->dev, - i, - &tmdev->sensor[i], - &ths_ops); + devm_thermal_of_zone_register(tmdev->dev, + i, + &tmdev->sensor[i], + &ths_ops); if (IS_ERR(tmdev->sensor[i].tzd)) return PTR_ERR(tmdev->sensor[i].tzd); =20 --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 6E348C25B06 for ; Thu, 4 Aug 2022 22:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239924AbiHDWwu (ORCPT ); Thu, 4 Aug 2022 18:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240205AbiHDWwc (ORCPT ); Thu, 4 Aug 2022 18:52:32 -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 97F856FA1C for ; Thu, 4 Aug 2022 15:52:15 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id l22so1348415wrz.7 for ; Thu, 04 Aug 2022 15:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=3rC2SEgtKSVYrTT7ru1qnZcNbf0y/uFQwB+BT2UAJtk=; b=Qr+Mq0euvweA+TndSV4WEFl5Wuf4P1I4vcd5dZzxhGtogWzjuXQfIw1uPMLTgp6G0/ B73QBMlb1qFacraxUFeUVtmsajPi+Edam36i6HuFTCiGaK/c5LRypwd1om1DX7STEGoG qMk11tBHm/6+ao6WjV/gDDufCiak4N6sKWYw2gCCVS6zLcmzf8QqxViYuV+seFzcFcx+ 944WMdHa6mYMyxkQUEoFFzPeGjpNOkakqCLRDUkPv8dkmr0dmjDIXgZW3QOBsEPQYQl7 +E7xX875es5+/dViYVFXlEMF7A5vmDv2NVbg4KRXq2skW9yCSifMxXp6Odyt7UUU5M4g DtQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=3rC2SEgtKSVYrTT7ru1qnZcNbf0y/uFQwB+BT2UAJtk=; b=WMg0452OZ32givUwGXYY+rIyCJ9AEYhASQLxdl28JsrDlOrjDesh2H1NKrXYinPG0J 1iZf6uM+t71t5pwlAIGs29dOdZaEvfLgrYT0xQwt2vcLqq2jK5g1XMBB+EWLIqVcyd8c Xr+4roQBnuvUjjJK+rnzx7tICqg4+FniVczVyfQcFkF24zD3jsjjbMWVvSHU4LYaTlqr yXcdwQdKznO52Pf/I14Z2htu+zOrR5ukcCrzKCxIoeD1T8uOP1o7zLU4hkv/udjppCS7 xKHcIeuEaOIkhSEIIREWi5PL+T7gTsyErsRsXiK/ZrYEM/FBDKcCYxyO04IIsc9MbH/s lXHw== X-Gm-Message-State: ACgBeo1H4TB5e/7g5JIfS9CXKr7UDQrCMAFVatQeRXWrvz6CehkABb4L U9V9pYIVQf1Jd0xie0sAEZSqJw== X-Google-Smtp-Source: AA6agR4xnRrnN7fHMJPWjS3C+aziwCwTm6AHBR+56Dsqq+d72y2sjpoGuNSgwo1mGcz+0/3LDOrLsA== X-Received: by 2002:a5d:4dc4:0:b0:21f:abb:fcef with SMTP id f4-20020a5d4dc4000000b0021f0abbfcefmr2569270wru.486.1659653534997; Thu, 04 Aug 2022 15:52:14 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:14 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , Orson Zhai , Chunyan Zhang Subject: [PATCH v5 09/33] thermal/drivers/sprd: Switch to new of API Date: Fri, 5 Aug 2022 00:43:25 +0200 Message-Id: <20220804224349.1926752-10-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/sprd_thermal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index fff80fc18002..ac884514f116 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -204,9 +204,9 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sp= rd_thermal_sensor *sen) return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); } =20 -static int sprd_thm_read_temp(void *devdata, int *temp) +static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) { - struct sprd_thermal_sensor *sen =3D devdata; + struct sprd_thermal_sensor *sen =3D tz->devdata; u32 data; =20 data =3D readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & @@ -217,7 +217,7 @@ static int sprd_thm_read_temp(void *devdata, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops sprd_thm_ops =3D { +static const struct thermal_zone_device_ops sprd_thm_ops =3D { .get_temp =3D sprd_thm_read_temp, }; =20 @@ -408,10 +408,10 @@ static int sprd_thm_probe(struct platform_device *pde= v) =20 sprd_thm_sensor_init(thm, sen); =20 - sen->tzd =3D devm_thermal_zone_of_sensor_register(sen->dev, - sen->id, - sen, - &sprd_thm_ops); + sen->tzd =3D devm_thermal_of_zone_register(sen->dev, + sen->id, + sen, + &sprd_thm_ops); if (IS_ERR(sen->tzd)) { dev_err(&pdev->dev, "register thermal zone failed %d\n", sen->id); @@ -523,8 +523,8 @@ static int sprd_thm_remove(struct platform_device *pdev) =20 for (i =3D 0; i < thm->nr_sensors; i++) { sprd_thm_toggle_sensor(thm->sensor[i], false); - devm_thermal_zone_of_sensor_unregister(&pdev->dev, - thm->sensor[i]->tzd); + devm_thermal_of_zone_unregister(&pdev->dev, + thm->sensor[i]->tzd); } =20 clk_disable_unprepare(thm->clk); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 173D2C25B06 for ; Thu, 4 Aug 2022 22:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240212AbiHDWxJ (ORCPT ); Thu, 4 Aug 2022 18:53:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240104AbiHDWwk (ORCPT ); Thu, 4 Aug 2022 18:52:40 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B041B71BEC for ; Thu, 4 Aug 2022 15:52:21 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id v3so1427923wrp.0 for ; Thu, 04 Aug 2022 15:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ApxyJvlL0EgkjxePD3esAQ9IvkzW++CVryyDi4r5gNo=; b=eY3xD1ZjuxjP7xBOvgVLiIQoxGfgyEGYFowg4+Btj9qQiIv11D1G9JSrt/1uMtXhip 5fW/Y8tOqFeyODCL93RspZZIzh3+fzcK61O84uzW5Y1FALekpUl9j9Nrs5hWhiwTEh9U qyUW6V7oWaFAEG9d8ZFrYLTQRvb5+XO9kq+A2J10lF5ttZcck017toGYheg2QnpDxuyw /8W45dAx7aX1q7GQwNhwabNghxfyKKKm3GGD5+Ifvnd9G3dny9Bd1SPXhCT3XcmrhTqc MA5vvPPUupjitmMMrysTQOYbf+uM7mUAMTlPSu5NsefiO90wzKuXVXokWmEAqFhIDup7 v3Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ApxyJvlL0EgkjxePD3esAQ9IvkzW++CVryyDi4r5gNo=; b=BLKj3/Urw8SfGMqDia5nAdvzBIkfHmqCViGJcaAwjVxV9AUDPvN4vq7upHOn8nRD00 any9uxBGRmMdsysBckvbkxsf1GxIKkFxGcKB105Mb9dibYgKve8dNNczsPEmT49yYJUS eXPocT4/psRxm0AsLoO52nFZuS3H338W6oFQntbe7Rt6Zoioe8KS95quneA2NWv79+Bv JQaS3zkOZtp5/DM8RWfxG9dkdS8tHBFzcLUciNJLz5VgnnQx9EzZmREFPTNJ2V5j2vzO 25oi06/vYkJWiNHxIsAmohq66Hw+7i0XPQVyvGU4+JJSqy6zF6iT6A1yfkIbRlTzwsA4 NEZw== X-Gm-Message-State: ACgBeo1ia0cHynXI3vbVDyS7nRwzk/ZgHmJ0p985RzVPXJ+PAuGwUVg3 m/xjw5tWfbykGVlJcoJs+l8hmw== X-Google-Smtp-Source: AA6agR4aSg8teCBJxejK1RkANcbfs43cG7YNdhtu5gN1poVC23v7vj2cFM1T8w55mzy/RT8AZ5EfNg== X-Received: by 2002:a5d:64cf:0:b0:220:6d8e:1db0 with SMTP id f15-20020a5d64cf000000b002206d8e1db0mr2475124wri.564.1659653541283; Thu, 04 Aug 2022 15:52:21 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:21 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , Nicolas Saenz Julienne , Broadcom internal kernel review list , Ray Jui , Scott Branden , Markus Mayer , Stefan Wahren , Zheng Yongjun , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE) Subject: [PATCH v5 10/33] thermal/drivers/broadcom: Switch to new of API Date: Fri, 5 Aug 2022 00:43:26 +0200 Message-Id: <20220804224349.1926752-11-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Tested-by: Florian Fainelli Reviewed-by: Florian Fainelli Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/broadcom/bcm2711_thermal.c | 14 +++--- drivers/thermal/broadcom/bcm2835_thermal.c | 14 +++--- drivers/thermal/broadcom/brcmstb_thermal.c | 20 ++++----- drivers/thermal/broadcom/ns-thermal.c | 50 +++++++++------------- drivers/thermal/broadcom/sr-thermal.c | 16 +++---- 5 files changed, 53 insertions(+), 61 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/b= roadcom/bcm2711_thermal.c index e9bef5c3414b..1f8651d15160 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -31,11 +31,11 @@ struct bcm2711_thermal_priv { struct thermal_zone_device *thermal; }; =20 -static int bcm2711_get_temp(void *data, int *temp) +static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2711_thermal_priv *priv =3D data; - int slope =3D thermal_zone_get_slope(priv->thermal); - int offset =3D thermal_zone_get_offset(priv->thermal); + struct bcm2711_thermal_priv *priv =3D tz->devdata; + int slope =3D thermal_zone_get_slope(tz); + int offset =3D thermal_zone_get_offset(tz); u32 val; int ret; =20 @@ -54,7 +54,7 @@ static int bcm2711_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops bcm2711_thermal_of_ops =3D { +static const struct thermal_zone_device_ops bcm2711_thermal_of_ops =3D { .get_temp =3D bcm2711_get_temp, }; =20 @@ -88,8 +88,8 @@ static int bcm2711_thermal_probe(struct platform_device *= pdev) } priv->regmap =3D regmap; =20 - thermal =3D devm_thermal_zone_of_sensor_register(dev, 0, priv, - &bcm2711_thermal_of_ops); + thermal =3D devm_thermal_of_zone_register(dev, 0, priv, + &bcm2711_thermal_of_ops); if (IS_ERR(thermal)) { ret =3D PTR_ERR(thermal); dev_err(dev, "could not register sensor: %d\n", ret); diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/b= roadcom/bcm2835_thermal.c index c8e4344d5a3d..2c67841a1115 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -88,9 +88,9 @@ static int bcm2835_thermal_temp2adc(int temp, int offset,= int slope) return temp; } =20 -static int bcm2835_thermal_get_temp(void *d, int *temp) +static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *t= emp) { - struct bcm2835_thermal_data *data =3D d; + struct bcm2835_thermal_data *data =3D tz->devdata; u32 val =3D readl(data->regs + BCM2835_TS_TSENSSTAT); =20 if (!(val & BCM2835_TS_TSENSSTAT_VALID)) @@ -135,7 +135,7 @@ static void bcm2835_thermal_debugfs(struct platform_dev= ice *pdev) debugfs_create_regset32("regset", 0444, data->debugfsdir, regset); } =20 -static const struct thermal_zone_of_device_ops bcm2835_thermal_ops =3D { +static const struct thermal_zone_device_ops bcm2835_thermal_ops =3D { .get_temp =3D bcm2835_thermal_get_temp, }; =20 @@ -206,8 +206,8 @@ static int bcm2835_thermal_probe(struct platform_device= *pdev) data->clk, rate); =20 /* register of thermal sensor and get info from DT */ - tz =3D thermal_zone_of_sensor_register(&pdev->dev, 0, data, - &bcm2835_thermal_ops); + tz =3D devm_thermal_of_zone_register(&pdev->dev, 0, data, + &bcm2835_thermal_ops); if (IS_ERR(tz)) { err =3D PTR_ERR(tz); dev_err(&pdev->dev, @@ -277,7 +277,7 @@ static int bcm2835_thermal_probe(struct platform_device= *pdev) =20 return 0; err_tz: - thermal_zone_of_sensor_unregister(&pdev->dev, tz); + thermal_of_zone_unregister(tz); err_clk: clk_disable_unprepare(data->clk); =20 @@ -290,7 +290,7 @@ static int bcm2835_thermal_remove(struct platform_devic= e *pdev) struct thermal_zone_device *tz =3D data->tz; =20 debugfs_remove_recursive(data->debugfsdir); - thermal_zone_of_sensor_unregister(&pdev->dev, tz); + thermal_of_zone_unregister(tz); clk_disable_unprepare(data->clk); =20 return 0; diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/b= roadcom/brcmstb_thermal.c index 0cedb8b4f00a..c79c6cfdd74d 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -105,7 +105,7 @@ static struct avs_tmon_trip avs_tmon_trips[] =3D { struct brcmstb_thermal_params { unsigned int offset; unsigned int mult; - const struct thermal_zone_of_device_ops *of_ops; + const struct thermal_zone_device_ops *of_ops; }; =20 struct brcmstb_thermal_priv { @@ -150,9 +150,9 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_= thermal_priv *priv, return (u32)((offset - temp) / mult); } =20 -static int brcmstb_get_temp(void *data, int *temp) +static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) { - struct brcmstb_thermal_priv *priv =3D data; + struct brcmstb_thermal_priv *priv =3D tz->devdata; u32 val; long t; =20 @@ -260,9 +260,9 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, voi= d *data) return IRQ_HANDLED; } =20 -static int brcmstb_set_trips(void *data, int low, int high) +static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int = high) { - struct brcmstb_thermal_priv *priv =3D data; + struct brcmstb_thermal_priv *priv =3D tz->devdata; =20 dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high); =20 @@ -288,7 +288,7 @@ static int brcmstb_set_trips(void *data, int low, int h= igh) return 0; } =20 -static const struct thermal_zone_of_device_ops brcmstb_16nm_of_ops =3D { +static const struct thermal_zone_device_ops brcmstb_16nm_of_ops =3D { .get_temp =3D brcmstb_get_temp, }; =20 @@ -298,7 +298,7 @@ static const struct brcmstb_thermal_params brcmstb_16nm= _params =3D { .of_ops =3D &brcmstb_16nm_of_ops, }; =20 -static const struct thermal_zone_of_device_ops brcmstb_28nm_of_ops =3D { +static const struct thermal_zone_device_ops brcmstb_28nm_of_ops =3D { .get_temp =3D brcmstb_get_temp, .set_trips =3D brcmstb_set_trips, }; @@ -318,7 +318,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table); =20 static int brcmstb_thermal_probe(struct platform_device *pdev) { - const struct thermal_zone_of_device_ops *of_ops; + const struct thermal_zone_device_ops *of_ops; struct thermal_zone_device *thermal; struct brcmstb_thermal_priv *priv; struct resource *res; @@ -341,8 +341,8 @@ static int brcmstb_thermal_probe(struct platform_device= *pdev) platform_set_drvdata(pdev, priv); of_ops =3D priv->temp_params->of_ops; =20 - thermal =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, - of_ops); + thermal =3D devm_thermal_of_zone_register(&pdev->dev, 0, priv, + of_ops); if (IS_ERR(thermal)) { ret =3D PTR_ERR(thermal); dev_err(&pdev->dev, "could not register sensor: %d\n", ret); diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadc= om/ns-thermal.c index c9468ba9d449..07a8a3f49bd0 100644 --- a/drivers/thermal/broadcom/ns-thermal.c +++ b/drivers/thermal/broadcom/ns-thermal.c @@ -14,19 +14,14 @@ #define PVTMON_CONTROL0_SEL_TEST_MODE 0x0000000e #define PVTMON_STATUS 0x08 =20 -struct ns_thermal { - struct thermal_zone_device *tz; - void __iomem *pvtmon; -}; - -static int ns_thermal_get_temp(void *data, int *temp) +static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct ns_thermal *ns_thermal =3D data; - int offset =3D thermal_zone_get_offset(ns_thermal->tz); - int slope =3D thermal_zone_get_slope(ns_thermal->tz); + void __iomem *pvtmon =3D tz->devdata; + int offset =3D thermal_zone_get_offset(tz); + int slope =3D thermal_zone_get_slope(tz); u32 val; =20 - val =3D readl(ns_thermal->pvtmon + PVTMON_CONTROL0); + val =3D readl(pvtmon + PVTMON_CONTROL0); if ((val & PVTMON_CONTROL0_SEL_MASK) !=3D PVTMON_CONTROL0_SEL_TEMP_MONITO= R) { /* Clear current mode selection */ val &=3D ~PVTMON_CONTROL0_SEL_MASK; @@ -34,50 +29,47 @@ static int ns_thermal_get_temp(void *data, int *temp) /* Set temp monitor mode (it's the default actually) */ val |=3D PVTMON_CONTROL0_SEL_TEMP_MONITOR; =20 - writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0); + writel(val, pvtmon + PVTMON_CONTROL0); } =20 - val =3D readl(ns_thermal->pvtmon + PVTMON_STATUS); + val =3D readl(pvtmon + PVTMON_STATUS); *temp =3D slope * val + offset; =20 return 0; } =20 -static const struct thermal_zone_of_device_ops ns_thermal_ops =3D { +static const struct thermal_zone_device_ops ns_thermal_ops =3D { .get_temp =3D ns_thermal_get_temp, }; =20 static int ns_thermal_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - struct ns_thermal *ns_thermal; - - ns_thermal =3D devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL); - if (!ns_thermal) - return -ENOMEM; + struct thermal_zone_device *tz; + void __iomem *pvtmon; =20 - ns_thermal->pvtmon =3D of_iomap(dev_of_node(dev), 0); - if (WARN_ON(!ns_thermal->pvtmon)) + pvtmon =3D of_iomap(dev_of_node(dev), 0); + if (WARN_ON(!pvtmon)) return -ENOENT; =20 - ns_thermal->tz =3D devm_thermal_zone_of_sensor_register(dev, 0, - ns_thermal, - &ns_thermal_ops); - if (IS_ERR(ns_thermal->tz)) { - iounmap(ns_thermal->pvtmon); - return PTR_ERR(ns_thermal->tz); + tz =3D devm_thermal_of_zone_register(dev, 0, + pvtmon, + &ns_thermal_ops); + if (IS_ERR(tz)) { + iounmap(pvtmon); + return PTR_ERR(tz); } =20 - platform_set_drvdata(pdev, ns_thermal); + platform_set_drvdata(pdev, pvtmon); =20 return 0; } =20 static int ns_thermal_remove(struct platform_device *pdev) { - struct ns_thermal *ns_thermal =3D platform_get_drvdata(pdev); + void __iomem *pvtmon =3D platform_get_drvdata(pdev); =20 - iounmap(ns_thermal->pvtmon); + iounmap(pvtmon); =20 return 0; } diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadc= om/sr-thermal.c index 85ab9edd580c..2b93502543ff 100644 --- a/drivers/thermal/broadcom/sr-thermal.c +++ b/drivers/thermal/broadcom/sr-thermal.c @@ -19,7 +19,6 @@ #define SR_TMON_MAX_LIST 6 =20 struct sr_tmon { - struct thermal_zone_device *tz; unsigned int crit_temp; unsigned int tmon_id; struct sr_thermal *priv; @@ -31,9 +30,9 @@ struct sr_thermal { struct sr_tmon tmon[SR_TMON_MAX_LIST]; }; =20 -static int sr_get_temp(void *data, int *temp) +static int sr_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sr_tmon *tmon =3D data; + struct sr_tmon *tmon =3D tz->devdata; struct sr_thermal *sr_thermal =3D tmon->priv; =20 *temp =3D readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id)); @@ -41,13 +40,14 @@ static int sr_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops sr_tz_ops =3D { +static const struct thermal_zone_device_ops sr_tz_ops =3D { .get_temp =3D sr_get_temp, }; =20 static int sr_thermal_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; + struct thermal_zone_device *tz; struct sr_thermal *sr_thermal; struct sr_tmon *tmon; struct resource *res; @@ -84,10 +84,10 @@ static int sr_thermal_probe(struct platform_device *pde= v) writel(0, sr_thermal->regs + SR_TMON_TEMP_BASE(i)); tmon->tmon_id =3D i; tmon->priv =3D sr_thermal; - tmon->tz =3D devm_thermal_zone_of_sensor_register(dev, i, tmon, - &sr_tz_ops); - if (IS_ERR(tmon->tz)) - return PTR_ERR(tmon->tz); + tz =3D devm_thermal_of_zone_register(dev, i, tmon, + &sr_tz_ops); + if (IS_ERR(tz)) + return PTR_ERR(tz); =20 dev_dbg(dev, "thermal sensor %d registered\n", i); } --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 5D3B1C25B08 for ; Thu, 4 Aug 2022 22:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240365AbiHDWxS (ORCPT ); Thu, 4 Aug 2022 18:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239986AbiHDWwn (ORCPT ); Thu, 4 Aug 2022 18:52:43 -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 8F9D972ECD for ; Thu, 4 Aug 2022 15:52:25 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id v3so1427990wrp.0 for ; Thu, 04 Aug 2022 15:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vL3GxmFU1PfAZ2z+EriRN+gI33Lgd51OZIsIx0JbBgQ=; b=yM44Wh6z3wJTBMnHfb3b1dfUay/HasrI8/FPqDYipy7laYSv8NBJjoiujkVFmaNbWf knliAe/emTNw8WpEGJLMoF8BsHjT4vFMPWkB3SIsFPTlX+YuizukuUsMXnfBY0U3k5kS M8m0JI+mbMtXAZaLLIGK+jaeUQMGxe8R+bEMzOeeEJkMByJsYihMjgZu/L2B6cW1VN02 Fmexa+z/yVq0Fl0ug0IpRm9rXqHCluUsygqxJ0lrzJGy8e3j3O7ZeewJScNNl6QJfZBX XAONeDF2jTlOBaTzCLKGY5LPIuESKIY7u44+YnAc1W2bb6Q3kLC3Bfz2gVV7n91K7dlo 9mgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vL3GxmFU1PfAZ2z+EriRN+gI33Lgd51OZIsIx0JbBgQ=; b=C2lKqZp0UtXiXAVrGsziIJfrJOnthjQIAvgVf/gLxX/hH9WOQdIhqf8x5eGdHm4WFp iTuCT/VE1CUfhIteheIfdgPlEmshxS07H+S5cKGk/LoQ+zTMhmI8QKiGx0xK1rTFGkSR /1NF4n5KoXw9nFiZwzhGT3hKqN+yLRxMgbiN55zx1h1hYmpNMtunporfBOj0UE5xuw5I dkCWytaQ7hXw7wyUJlJBI5KTpqkxA+9gSUcVzgMuqHrZjpOWrB5t7MAmw/tKAt+1mP06 VSH3uFUA/CRHrNlKOZrSJQUgMr3Dd3Y1CnbB76RDJgzLp6b+xhAZR7hD1wUxyC8j70Uu Sqvw== X-Gm-Message-State: ACgBeo0LOEL1dGO8Arg0SzMGvQwrudcnm1xYPUwAsONcNbLLN4fjIN9y qS11M8n73MlRsDH6HuYJ/2fCpA== X-Google-Smtp-Source: AA6agR7GtRRrwnORSwHv9+/lG71h9IqM8KPR+qQP8MisIhY2vs7sXJ3Mv8MiOtY6l6s2gE9uVzoqoQ== X-Received: by 2002:a5d:638b:0:b0:220:6f3e:9186 with SMTP id p11-20020a5d638b000000b002206f3e9186mr2444214wru.49.1659653543594; Thu, 04 Aug 2022 15:52:23 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:23 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Dmitry Baryshkov , Andy Gross , Amit Kucheria , Thara Gopinath , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH v5 11/33] thermal/drivers/qcom: Switch to new of API Date: Fri, 5 Aug 2022 00:43:27 +0200 Message-Id: <20220804224349.1926752-12-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Reviewed-by: Dmitry Baryshkov Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 19 +++++++++---------- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 12 ++++++------ drivers/thermal/qcom/tsens.c | 16 ++++++++-------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qco= m/qcom-spmi-adc-tm5.c index 073943cbcc2b..add6f40e5e2a 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -357,9 +357,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) @@ -639,9 +639,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 @@ -660,7 +660,7 @@ static int adc_tm5_set_trips(void *data, int low, int h= igh) return ret; } =20 -static struct thermal_zone_of_device_ops adc_tm5_thermal_ops =3D { +static const struct thermal_zone_device_ops adc_tm5_thermal_ops =3D { .get_temp =3D adc_tm5_get_temp, .set_trips =3D adc_tm5_set_trips, }; @@ -672,11 +672,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 770f82cc9bca..be785ab37e53 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -186,9 +186,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) @@ -263,9 +263,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 @@ -283,7 +283,7 @@ static int qpnp_tm_set_trip_temp(void *data, int trip, = int temp) return ret; } =20 -static const struct thermal_zone_of_device_ops qpnp_tm_sensor_ops =3D { +static const struct thermal_zone_device_ops qpnp_tm_sensor_ops =3D { .get_temp =3D qpnp_tm_get_temp, .set_trip_temp =3D qpnp_tm_set_trip_temp, }; @@ -446,7 +446,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 e49f58e83513..b1b10005fb28 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,9 +925,9 @@ 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); @@ -991,7 +991,7 @@ static const struct of_device_id tsens_table[] =3D { }; MODULE_DEVICE_TABLE(of, tsens_table); =20 -static const struct thermal_zone_of_device_ops tsens_of_ops =3D { +static const struct thermal_zone_device_ops tsens_of_ops =3D { .get_temp =3D tsens_get_temp, .set_trips =3D tsens_set_trips, }; @@ -1044,9 +1044,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 11 21:14:18 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 AA355C25B06 for ; Thu, 4 Aug 2022 22:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240142AbiHDWx0 (ORCPT ); Thu, 4 Aug 2022 18:53:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240233AbiHDWwp (ORCPT ); Thu, 4 Aug 2022 18:52:45 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7261272EEF for ; Thu, 4 Aug 2022 15:52:27 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id j1so1385358wrw.1 for ; Thu, 04 Aug 2022 15:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=yY7L3sqNECPS66oxsrQOipowqI7T9PMCADR4st5QAxA=; b=3Y9D4c0pyJct0t/fz7pa2WXBbqdvotgWraefV8v2UY7pxsaEPt47JCaSTkf6H1qQLb zbV5fNW+BcLlFmg4MLjR1sDclhAnx2dD40KR0SZYM4m84+448LPEWoXQ5iGn+K1PJfI6 yB0eq540SKxHm53nel5dNm8EomKKvVGli1jwkxbvVnldrZQIDKz0QECXvKW8wDvKfpyi FdMpej2QIt8qODrFpHMwTvjfVSqtT9u4ICOpLczrwXysPLZQlLbOAIqXJI0mwg0K/hKB 9Nj+dxEcYXA6UYrxN5KSthGlB9t+c0NsF7xYrUQ0oD6HeLXnhB2iF/4Qw0dDWT1rDRjI K+MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=yY7L3sqNECPS66oxsrQOipowqI7T9PMCADR4st5QAxA=; b=lA1a7gQrNfLP8RAQ/C56/gq9p0kQaJYDCjbc3VD/Qhf9ef/GsoZawtD0qQRtV7eJe8 z+YrNuDglhs0Q0scmYMtlT0YzaO/ZI6s2D+qm9un2QR3wKD/kyoOSspyjIcQU0iIeP6G Vh0tVgMalam7nxE434Wzq6CV7M7T0lnhZTMgZLtnVhrz8lBSyI7y6ueTG4hch/JUBbJv kEauFcrblbmxlXh79gwMp2lLXvd1BufuXwTatQ0Z9hiZou5cO1OaZErRZvg+B+pD+qnU xTM7FSR8kmRaBoIic1BBXceJeq1MrzRaDOYDGyFTIO/km1UAPMjoDh33bOYCpkkMvGl5 ieUg== X-Gm-Message-State: ACgBeo10BRm1HdQn3ioNChVhRtzuLcNOaWXepK3/V5Wkk5x59bt/BF72 XG/w1xTPPOPLS981PlFOQKCP0Q== X-Google-Smtp-Source: AA6agR5kNFd41Sa5oFqkxaJt/vY0sCyYBpHlLVNk5sjOZyy1oAqv1odmMR8zg0KdC1W58YFZxfJbeA== X-Received: by 2002:a5d:6512:0:b0:21e:cdab:1598 with SMTP id x18-20020a5d6512000000b0021ecdab1598mr2533247wru.687.1659653546829; Thu, 04 Aug 2022 15:52:26 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:26 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com (moderated list:ARM/STM32 ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:ARM/STM32 ARCHITECTURE) Subject: [PATCH v5 12/33] thermal/drivers/st: Switch to new of API Date: Fri, 5 Aug 2022 00:43:28 +0200 Message-Id: <20220804224349.1926752-13-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/st/stm_thermal.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_ther= mal.c index 5fd3fb8912a6..78feb802a87d 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", @@ -572,7 +572,6 @@ static int stm_thermal_probe(struct platform_device *pd= ev) return 0; =20 err_tz: - thermal_zone_of_sensor_unregister(&pdev->dev, sensor->th_dev); return ret; } =20 @@ -582,7 +581,6 @@ static int stm_thermal_remove(struct platform_device *p= dev) =20 stm_thermal_sensor_off(sensor); thermal_remove_hwmon_sysfs(sensor->th_dev); - thermal_zone_of_sensor_unregister(&pdev->dev, sensor->th_dev); =20 return 0; } --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 14C4FC25B06 for ; Thu, 4 Aug 2022 22:53:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239982AbiHDWxe (ORCPT ); Thu, 4 Aug 2022 18:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239962AbiHDWw5 (ORCPT ); Thu, 4 Aug 2022 18:52: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 9085573905 for ; Thu, 4 Aug 2022 15:52:30 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id p8-20020a05600c05c800b003a50311d75cso2691525wmd.4 for ; Thu, 04 Aug 2022 15:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=YLbrdXUnmrQegHQ4ArILFVac507m4xUt/E4MiWL2p00=; b=aFhzj5S7cwF1iOCecWm82eQU6McBfgSTPX45J0fnRoQZNIevy+1bRoUm1Ey/y3bEm9 mIfKVl6+oUu46UHACCXtykLrlntdDaaea3/EohI7qi/jKdlZhI0siirJJAhl9YUSaiIH MUJ/2OSN806EZjmC8cTVPZ7R66ddAcD2v3cywdgmuYq6ZtUww5bmgnxnAcePM34VVhxN JVDNDuUKmjs3fqNJ0f5GrCUz0+fA+hAWtEjNV5HTVyyPq5TGey6MrR4bRNEpoqC4Xozk p8ZR6igzNcjkYbtLB8BcKH3626bQAvcpUqnSq0PWZfH1mBUaWiKLw1nv1KwxX35Rdy9N 4gfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=YLbrdXUnmrQegHQ4ArILFVac507m4xUt/E4MiWL2p00=; b=zRkGKG1IUNktHdKJRiMWS5kwwyIBNmSqiL4+prclsvJLFlCS4hp5t7j76tkUQsURhp GVXrMHwaupxxrp/wwaCrSwreSp53tMaj0Tg/TFuZ6Sposj3Ti69Bth+YG2EBBTxI8YDA lhHoxEneyHQm2zQY0a7xigrbYFjKEtbs+UjiMOq+WjXqjoxqh7Bh1I3nUI/zkV7equBi R9pBhuxq2aJP+WQoD+rZOry7zMQ5TNSrr+KRRCGoQ0GHm6wxYn76YDWk9aomcNu8O4If FFJ9I8asuc6HzudPdE5CbbfJ3EAZiVtu8HZUHpCLrUm5krmTSQ1iEpB7tJoVBtk6a0xk oxtg== X-Gm-Message-State: ACgBeo3HiO2Rl8rFlixdLhE82oRmIQHAYhQlXh9aAPEgfzhOR02IYfFm oYcKF6BLddHUZz7xYF3FzcXXhA== X-Google-Smtp-Source: AA6agR4ULFOekFqR1S23ofy2jgc1fgTjsC4bmHGRK9CQ5SrpNqwQUdtYwfFJ6ZBkTrRq8vCZMKDn6A== X-Received: by 2002:a05:600c:35c7:b0:3a3:2612:f823 with SMTP id r7-20020a05600c35c700b003a32612f823mr2664666wmq.33.1659653548997; Thu, 04 Aug 2022 15:52:28 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:28 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , linux-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS) Subject: [PATCH v5 13/33] thermal/drivers/amlogic: Switch to new of API Date: Fri, 5 Aug 2022 00:43:29 +0200 Message-Id: <20220804224349.1926752-14-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed Reviewed-by: Neil Armstrong --- drivers/thermal/amlogic_thermal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_th= ermal.c index e61b91d14ad1..d30cb791e63c 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -179,12 +179,12 @@ static int amlogic_thermal_disable(struct amlogic_the= rmal *data) return 0; } =20 -static int amlogic_thermal_get_temp(void *data, int *temp) +static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *t= emp) { unsigned int tval; - struct amlogic_thermal *pdata =3D data; + struct amlogic_thermal *pdata =3D tz->devdata; =20 - if (!data) + if (!pdata) return -EINVAL; =20 regmap_read(pdata->regmap, TSENSOR_STAT0, &tval); @@ -195,7 +195,7 @@ static int amlogic_thermal_get_temp(void *data, int *te= mp) return 0; } =20 -static const struct thermal_zone_of_device_ops amlogic_thermal_ops =3D { +static const struct thermal_zone_device_ops amlogic_thermal_ops =3D { .get_temp =3D amlogic_thermal_get_temp, }; =20 @@ -276,10 +276,10 @@ static int amlogic_thermal_probe(struct platform_devi= ce *pdev) return PTR_ERR(pdata->sec_ao_map); } =20 - pdata->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - 0, - pdata, - &amlogic_thermal_ops); + pdata->tzd =3D devm_thermal_of_zone_register(&pdev->dev, + 0, + pdata, + &amlogic_thermal_ops); if (IS_ERR(pdata->tzd)) { ret =3D PTR_ERR(pdata->tzd); dev_err(dev, "Failed to register tsensor: %d\n", ret); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 65C4FC25B06 for ; Thu, 4 Aug 2022 22:53:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239954AbiHDWxi (ORCPT ); Thu, 4 Aug 2022 18:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235490AbiHDWxC (ORCPT ); Thu, 4 Aug 2022 18:53:02 -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 CEE3473910 for ; Thu, 4 Aug 2022 15:52:32 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id h13so1355788wrf.6 for ; Thu, 04 Aug 2022 15:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=3KXZ40ukCVssYokTyD4CFy6bR4TME8bIQCib4ndaUEM=; b=Hapj0n4cQ17IpR6CaDW8h880hkcV9+OjY0LG1WLlOnTq9iPkGKning/o3qI8Lk7UyC GuVOYAcnUSAc3X5VY9fkZb2Xo78TbnWnZ7MggW/1QwVqV69WryDDC/uzEqU0M+HBY5eL o6j3m6UKDfZH3qjYVOya76HsKWNBVhnzOY9BOlMemIio0+hw9CVQAFEXxHdH37cu0Mvh omO3oDYiU1sVcZqV713g+4RK3asDdc00GK0FbnuQpzZZOMafRqvP5vmq00U1ZkuIEDxm EYIQbbe/kIrh9/tluD0++4AC4MtFuTCJLJB1In/KsYZel4Mzk2Mrvm3HyY+d6Hr4DFva X0Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=3KXZ40ukCVssYokTyD4CFy6bR4TME8bIQCib4ndaUEM=; b=OL8w/BemOkVCUMrQ5gZ8fMVCvg0s8vvlXK9N0/y9Gx9HA/+RI/lvcbnufRxICc9wuE V7CLA6oGwiidVHgwKfBzbZ3fPmSjXmj3p2oQ3JMRYpFRuJIL0FQFaUBKoyB7Op7xjp5V T7Srg4LXO4QOwAlDqq/tNfDxRv44C7prVYFLvNN72oNFusiPM3fGbdfUka47bhCbT1aO 4R0h09o+9MFBVqslzOWsXeFRiBxDHQYILGbhzNnDeBlXCAPsjrjW/hMbF5tP+mSAt1Z7 L/7LUgDW/znOG4hc8Qih3zUIylcvzjGR7wtibthds/LJTXvsaltOijOM8fP+lxDEWa4L 6YyQ== X-Gm-Message-State: ACgBeo1skGGeE0qAWD0SkR8Pi8Kr2X+jYMxqdniabcRcXo0wXWxAcVh6 sq3NeqFixGOZ23TCEMkIR1kp9g== X-Google-Smtp-Source: AA6agR6XBzG5opbz+XZ7m4ZPUXzByIn/JHHEjCOPcZvW6A6LV2ZqB627kacVLnmaJT2AhBc3d3lkhQ== X-Received: by 2002:a5d:47a1:0:b0:21d:a4c6:352b with SMTP id 1-20020a5d47a1000000b0021da4c6352bmr2529176wrb.365.1659653551042; Thu, 04 Aug 2022 15:52:31 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:30 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 14/33] thermal/drivers/armada: Switch to new of API Date: Fri, 5 Aug 2022 00:43:30 +0200 Message-Id: <20220804224349.1926752-15-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/armada_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_ther= mal.c index c2ebfb5be4b3..52d63b3997fe 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -420,9 +420,9 @@ static struct thermal_zone_device_ops legacy_ops =3D { .get_temp =3D armada_get_temp_legacy, }; =20 -static int armada_get_temp(void *_sensor, int *temp) +static int armada_get_temp(struct thermal_zone_device *tz, int *temp) { - struct armada_thermal_sensor *sensor =3D _sensor; + struct armada_thermal_sensor *sensor =3D tz->devdata; struct armada_thermal_priv *priv =3D sensor->priv; int ret; =20 @@ -450,7 +450,7 @@ static int armada_get_temp(void *_sensor, int *temp) return ret; } =20 -static const struct thermal_zone_of_device_ops of_ops =3D { +static const struct thermal_zone_device_ops of_ops =3D { .get_temp =3D armada_get_temp, }; =20 @@ -928,9 +928,9 @@ static int armada_thermal_probe(struct platform_device = *pdev) /* Register the sensor */ sensor->priv =3D priv; sensor->id =3D sensor_id; - tz =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->id, sensor, - &of_ops); + tz =3D devm_thermal_of_zone_register(&pdev->dev, + sensor->id, sensor, + &of_ops); if (IS_ERR(tz)) { dev_info(&pdev->dev, "Thermal sensor %d unavailable\n", sensor_id); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 0A839C25B06 for ; Thu, 4 Aug 2022 22:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240251AbiHDWxw (ORCPT ); Thu, 4 Aug 2022 18:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240198AbiHDWxI (ORCPT ); Thu, 4 Aug 2022 18:53:08 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4197391D for ; Thu, 4 Aug 2022 15:52:34 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id a11so604227wmq.3 for ; Thu, 04 Aug 2022 15:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=BqOsgjVEw9Tt6uQERI+yLCfRaS3oyJEXM6rueaWDbTA=; b=OCD0y3QgfAQloSgUF+zgv7CA7DEWyXGFNLika9s+rO/f5K5SEp2+xcNUfT+hikmJ0L 7B4oEOoZe5kERppsB3aHyT2fi0ZQ9sCR9V2CgML5jAGXOhkTQeJxT3g8NuKtAGrxbuRo wNHiGGyEimXMiDuCs/IRSFxwqtFD6GoF1CF0J5zpGwwJxoiihbeJKN18owk4DXpb3tDO wcHgOat2GagF0ZezvxMGV4gHfMr9y9NBDi/fKjRUN/NzwEJZcG1TSPzEE7TyQ899tD5/ UgmVYOftMlK8jKb7rs5/LDpsvLUv21bl/75BuDlDuEvuRSSXcyGWNJHbXNfEcyZvKo2J 0scA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=BqOsgjVEw9Tt6uQERI+yLCfRaS3oyJEXM6rueaWDbTA=; b=wzEM5wBYDdcs/mZFlVP2ygQdgG/sIaeeFRiuytrW5hKjbuSi9WkZ3PYyllb496C62h 5FjVepnknLkE4G68ZL5S35S/nH6NpgcAeG/3EwgZUSWocVUQ+NrxegSERtQtKrL49W0x IRcH65pbxsGCl6GyRjJQtgBPCRfqJ/yricr2dFZ380x+P1hrA5AAFpJmmn9seM1PegWq dBJAs6R2DoPwZViGab0v7zzbQK6JE/GK3spJf78ao7JrfJrffflf8mEt+qrGtmGUH+al kmPWvHgeMcBRAdAD/RI56usfjmLpXRX6H8DKrNOZqBBdOiErRnUM33PJDZeuvl4i994d tP+w== X-Gm-Message-State: ACgBeo1QhuCgULjyaHw46/0sdPlZeQNvHLjcjK4Pxz3UFMhFz7CSG9ZU 5I302TzSs6309bCUYPVolMouqw== X-Google-Smtp-Source: AA6agR4Q/pp5eAxAatZvxQ81jOJXnhc9G7oQn37iUavXl9RM8lOiCKFSkD0sbxFc0a8hBci25BgozA== X-Received: by 2002:a05:600c:3b15:b0:3a5:49e:81a6 with SMTP id m21-20020a05600c3b1500b003a5049e81a6mr4331582wms.49.1659653553087; Thu, 04 Aug 2022 15:52:33 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:32 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 15/33] thermal/drivers/db8500: Switch to new of API Date: Fri, 5 Aug 2022 00:43:31 +0200 Message-Id: <20220804224349.1926752-16-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/db8500_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_ther= mal.c index 121cf853e545..cb10e280681f 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -58,9 +58,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, @@ -72,7 +72,7 @@ static int db8500_thermal_get_temp(void *data, int *temp) return 0; } =20 -static struct thermal_zone_of_device_ops thdev_ops =3D { +static const struct thermal_zone_device_ops thdev_ops =3D { .get_temp =3D db8500_thermal_get_temp, }; =20 @@ -182,7 +182,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 11 21:14:18 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 5B6C2C25B08 for ; Thu, 4 Aug 2022 22:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240246AbiHDWyE (ORCPT ); Thu, 4 Aug 2022 18:54:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239940AbiHDWxL (ORCPT ); Thu, 4 Aug 2022 18:53:11 -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 2066773928 for ; Thu, 4 Aug 2022 15:52:38 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id p8-20020a05600c05c800b003a50311d75cso2691662wmd.4 for ; Thu, 04 Aug 2022 15:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=BnUNUZYLN7ye95mrTNiuuTRdjINFgpZDmCQNh/1OQ+ENDcf7DLutgXECkAisxOizCh Fcx1GPr9x9ucUiL1dpmhJSo1m5G+ZHUxOhPWJeDeKoZU4VgCt6lWMK9BSw8f68WEq+E9 V/JCMmc9L2TbCHxldIBDdywRSdKg5gvABW20mWM6XBaUz2ds0p8MrJPe+BHjjysdrmla V8uqRUw7ANKPDuKOMrcnm75alHOjyrtd+Pt6feqr4Ul1emiH9yiXM1eBQo0XuPg1g81D lVq+naLM5MDcBXkj0Co1SrcgZ8y6lP8Bq/2hU7VPcXvbtXZDPEMryVxMal4cpZv/Fysy ywrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=lgLe7sgvzaU3jF4XA+SfoE2vippSYThYf8kMVph3yKg=; b=ZMPHpGBwG5TE9A7Jwha4TeDgucoqvXLfQTOcipF55sphJ/CLctrLsu+3R4N88GpJJh EsDNk73vGEWfBhwowIym4D+pxGAXi4pbp+L22VQHjQMYZgxGC5rw6CdrOfbh1/Z8oMzr gTICzQH1dfD1R8FG8Pc/4BKuPdr07lTgx0oP6O+8v4yTnID/RluO1AdEftJvyGNITH53 cFhmW2LbD8F2l41bHNj2Dd5deWPn+JG40DIvDnF0qUOn7W1+dkLI9DBgiDm5Svulrz+x P3Jk+ObWaSKKuOmc2v+oIV+4SLofqhlwDJWgdfaODfOksIsn2dS8dw19MiKs8KrvdP4b tBAw== X-Gm-Message-State: ACgBeo1NKvSxS541Nmps010sSNheNdf7NUey1HrFmtGySCQZYRTIq2yY OkLmE2mNxmcqTWSVjOKZBn0yNw== X-Google-Smtp-Source: AA6agR5QyPu3uRUeCiCJ42UmZqVJIVRkJlxI0ymgy5gtoBV4l1VoQoknXLstuesOJR/T9yR6ehtu/w== X-Received: by 2002:a05:600c:a146:b0:3a3:1e79:4446 with SMTP id ib6-20020a05600ca14600b003a31e794446mr2795380wmb.158.1659653555553; Thu, 04 Aug 2022 15:52:35 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:35 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v5 16/33] thermal/drivers/imx: Switch to new of API Date: Fri, 5 Aug 2022 00:43:32 +0200 Message-Id: <20220804224349.1926752-17-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/imx8mm_thermal.c | 14 +++++++------- drivers/thermal/imx_sc_thermal.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_ther= mal.c index af666bd9e8d4..e2c2673025a7 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -96,15 +96,15 @@ static int imx8mp_tmu_get_temp(void *data, int *temp) return 0; } =20 -static int tmu_get_temp(void *data, int *temp) +static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tmu_sensor *sensor =3D data; + struct tmu_sensor *sensor =3D tz->devdata; struct imx8mm_tmu *tmu =3D sensor->priv; =20 - return tmu->socdata->get_temp(data, temp); + return tmu->socdata->get_temp(sensor, temp); } =20 -static struct thermal_zone_of_device_ops tmu_tz_ops =3D { +static const struct thermal_zone_device_ops tmu_tz_ops =3D { .get_temp =3D tmu_get_temp, }; =20 @@ -165,9 +165,9 @@ static int imx8mm_tmu_probe(struct platform_device *pde= v) for (i =3D 0; i < data->num_sensors; i++) { tmu->sensors[i].priv =3D tmu; tmu->sensors[i].tzd =3D - devm_thermal_zone_of_sensor_register(&pdev->dev, i, - &tmu->sensors[i], - &tmu_tz_ops); + devm_thermal_of_zone_register(&pdev->dev, i, + &tmu->sensors[i], + &tmu_tz_ops); if (IS_ERR(tmu->sensors[i].tzd)) { ret =3D PTR_ERR(tmu->sensors[i].tzd); dev_err(&pdev->dev, diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_ther= mal.c index 331a241eb0ef..10bfa6507eb4 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -43,11 +43,11 @@ struct imx_sc_msg_misc_get_temp { } data; } __packed __aligned(4); =20 -static int imx_sc_thermal_get_temp(void *data, int *temp) +static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *te= mp) { struct imx_sc_msg_misc_get_temp msg; struct imx_sc_rpc_msg *hdr =3D &msg.hdr; - struct imx_sc_sensor *sensor =3D data; + struct imx_sc_sensor *sensor =3D tz->devdata; int ret; =20 msg.data.req.resource_id =3D sensor->resource_id; @@ -70,7 +70,7 @@ static int imx_sc_thermal_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops imx_sc_thermal_ops =3D { +static const struct thermal_zone_device_ops imx_sc_thermal_ops =3D { .get_temp =3D imx_sc_thermal_get_temp, }; =20 @@ -109,10 +109,10 @@ static int imx_sc_thermal_probe(struct platform_devic= e *pdev) break; } =20 - sensor->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->resource_id, - sensor, - &imx_sc_thermal_ops); + sensor->tzd =3D devm_thermal_of_zone_register(&pdev->dev, + sensor->resource_id, + sensor, + &imx_sc_thermal_ops); if (IS_ERR(sensor->tzd)) { dev_err(&pdev->dev, "failed to register thermal zone\n"); ret =3D PTR_ERR(sensor->tzd); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 660C2C25B08 for ; Thu, 4 Aug 2022 22:54:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240257AbiHDWyI (ORCPT ); Thu, 4 Aug 2022 18:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240104AbiHDWxL (ORCPT ); Thu, 4 Aug 2022 18:53:11 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 704E27392C for ; Thu, 4 Aug 2022 15:52:38 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id bk11so1321615wrb.10 for ; Thu, 04 Aug 2022 15:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=jlDWsEd+wOoGzBZpyJ8BDcfladI9aAAtZW/e15zk8sAHVnlKD6ERBLT8tY5/g5CgCm b++ei1BHOYgf23U7K9lVfMY5RAqDlK+zOaiZ+vVpLbuBMp4sdwcI7hW/gGKN6T/q01XV sFJ597LNi0BNlqPmli3sPfUNJHton7Q9JWkleRUwZsgdI8rWIayNl+p/9RvDvSdfuXhC oQtK4uxTjW6hF8/U7RZQoCBMWA7L6PCjLyQDLJpXPLWSpyJC7GOCG+MK928lsZ/FuEEJ pwwcR48oh6UiJ/VHejaPU7XaihErE3TknDwDW9vAJE45TXJnL/4dnTVJ1HM9v2q70D0t WWNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=862ebCD8XkBY+/fgfesDVhZbuj5QTeks1/6fcN22nnM=; b=uMBx03fPehy0VNyAjldc0doTfWcMzaUDcewzsQN1FP7hFp5Kqgy4/B0IQo401M0YvD sp6tcOTob7EPYzGjYfkgSKrzRyo8ru401rIBDZLXPGmoTLq6ivR/Ru6iuV/9g7vR9OEn jkqhfF0Jb4zxTWRu267n0DhecdZRlVjLFGdSOWKCoJ+pu2hR8NGmy4arZIl2IlMxUEkQ S2mk/wk7wQdX+EO025RLGpQfHump+Dh8rpwFMHl7UyklVT3Bcd9t/Z2GtA0906WhgMyz Y5e/WpWG6nqTl31+xtbZOhQjpW8X6ObumtieHRskMUdro27Ksduzd3RBG00KF5Aqe32+ W8lw== X-Gm-Message-State: ACgBeo1FVx2qWZKz7etirjG6iQOW48vs1q6pADSJp3QWU917ky1TTeOu DLUpIcKqTC6DWIwFfzB/vvR6FA== X-Google-Smtp-Source: AA6agR644uZ11Mg+m/Ue7F6oUbIEJ6cxYuXrqDLksyGDcOFFz5vgUkBzcLT3EBvKmDlc+HUxvWl3IA== X-Received: by 2002:a5d:4802:0:b0:21e:c78b:30b5 with SMTP id l2-20020a5d4802000000b0021ec78b30b5mr2399636wrq.203.1659653557759; Thu, 04 Aug 2022 15:52:37 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:37 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Amit Kucheria , linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS) Subject: [PATCH v5 17/33] thermal/drivers/rcar: Switch to new of API Date: Fri, 5 Aug 2022 00:43:33 +0200 Message-Id: <20220804224349.1926752-18-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Tested-by: Niklas S=C3=B6derlund Acked-by: for the hwmon patches in this series until it is guaranteed --- 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 e2020c6308cc..40ec63ad0a1b 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, "Sensor %u: Can't register thermal zone\n", i); 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 11 21:14:18 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 1FD27C25B06 for ; Thu, 4 Aug 2022 22:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240375AbiHDWyK (ORCPT ); Thu, 4 Aug 2022 18:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240364AbiHDWxR (ORCPT ); Thu, 4 Aug 2022 18:53:17 -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 302436FA01 for ; Thu, 4 Aug 2022 15:52:40 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id l22so1349199wrz.7 for ; Thu, 04 Aug 2022 15:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ZFiHrv2DBvb+sLFBPejQnOaA+sJY54jHJpFAimKLr80=; b=eoyzE7ogFywED2/EUtpLvsOwJZPBVONDzJsiY6NeAaLB8x5JI4mbNdWjh/F3Fzqv8W fz7yFNHgJjb4VGgZ8tfrCyWGHeR0h3RWAmwKAFk0qVXSdOBiPSpv2a2+5TtHrv9gLYy7 wqDAyJTocy52jndl7jRbdRYR9I1Ef7MsnSheSqxKwu927wQmH3joTxnrJ7X/QC2b9dHb 9Wz2pFrdD+VFzT49HaofwCIU69bJjAvX13+HZsQYrUftqNYxeUXMKehYslHfjHnIMN1w zV5ZwXBfqchJq/pfLNloqVp87612VVsMGDd4syPqXhnlC7c6BDCHlassJjortxwUXQNz cMkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ZFiHrv2DBvb+sLFBPejQnOaA+sJY54jHJpFAimKLr80=; b=Jh5QiIs/IAwdPAQ+mzs8pkZsORdS2fQr1pkEusTWyZ9hFofgFM3S4/jqTp13/xDkzI CcxHTpkqyLIzpfIWDNi44nYX2UgyKspMAxjoBLsP800X48Uk1lLhvsYnvzsgY3ZI5tQg UX4jjpuv5bziJICF29iALbaS/C9tolifBvwdFMDvSO8tuvBMHcIuJZ7EMBuOAV1NgwYz 0ebxZeGUN/MGGyFCzwXNw0qJAxI0RszvJdLHZH3CxuH1zkDdcsotFrJo67ze1sBG0VHb k2ruxJ392zr+Hj2vpDR2154aCcSgccozoTEBlRXmA7U8NwJvgoo7yuGmyih+RBlqcacK LiLQ== X-Gm-Message-State: ACgBeo0I3RJGoBOAZmC9CfWCiAyuYPJFeXQ4Tv0hqe23M2Ko/1OgXdVg oJ1mkFVZdtxPUznH6IVuy8OJxQ== X-Google-Smtp-Source: AA6agR6dY6X4w6WCQa4LgXn/5/Zwevkpd2oU/ZegzE4zaMHCf136q7tOMGKjDAvCkAV0/gVz6ccU7A== X-Received: by 2002:a05:6000:1682:b0:221:599b:a41e with SMTP id y2-20020a056000168200b00221599ba41emr1299592wrd.522.1659653559829; Thu, 04 Aug 2022 15:52:39 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:39 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 18/33] thermal/drivers/rzg2l: Switch to new of API Date: Fri, 5 Aug 2022 00:43:34 +0200 Message-Id: <20220804224349.1926752-19-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- 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 51ae80eda6af..2e0649f38506 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 @@ -114,7 +114,7 @@ static int rzg2l_thermal_get_temp(void *devdata, int *t= emp) return 0; } =20 -static const struct thermal_zone_of_device_ops rzg2l_tz_of_ops =3D { +static const struct thermal_zone_device_ops rzg2l_tz_of_ops =3D { .get_temp =3D rzg2l_thermal_get_temp, }; =20 @@ -207,8 +207,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 11 21:14:18 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 42688C25B06 for ; Thu, 4 Aug 2022 22:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234994AbiHDWyQ (ORCPT ); Thu, 4 Aug 2022 18:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239986AbiHDWxS (ORCPT ); Thu, 4 Aug 2022 18:53:18 -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 2D6536FA13 for ; Thu, 4 Aug 2022 15:52:42 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id p8-20020a05600c05c800b003a50311d75cso2691740wmd.4 for ; Thu, 04 Aug 2022 15:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=CsU6ca+7WX/xVGECcsjSjS8CnQ/NXZV7RYxDyAjfgbo=; b=ALcEQOT4UjCCUh1CGJZLBpDmxr47aIzLLlFqmAsK1poo9ss/PJkxR9pWxpzF0SGzMb BA9eQjJ1TwUAz/3fK4FG3Qy2VzxAzbKlB3VpV6hPzfQ0dbM0i6VNJ1coqjl5eHgd3GX4 bvdwhMiPAtWCbNCBeHV6JwRpq17dFtkuCJ3FGZBydPfzjbVXkK8ylJ15Kx5ihd1/Imzj y12B8kJnZREDhjnf79o8tXFWxg+kuir3lLh7wu7fOw1wozPANA+xJxmoidqUK6i0BaV8 hpwHIQjqgdxT/rexH2wak5aUZWh/hD1898V7t53LGmOXl60vYM3kHsbtAj68ZEgCr59z 2zmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=CsU6ca+7WX/xVGECcsjSjS8CnQ/NXZV7RYxDyAjfgbo=; b=V9IiI8dM5L7H5aeT2oY6axA8PPzj/dmjda20e333wf2Ll+NQBktC16m8ELh00jGMKf jsNmlBJOKoRVSaI94dIhOAS7BkLEwFvJNj7exvCRjRx+19diLFPRAPggB8luXynk5w8x 0y+be2eSda3m7PtoWwRXxqkNyQtNPsMHYCYmYS+obguZWRN6JFImXN1HQfaGYVVl43KQ 7ZrwkWDGUCXJ8p3ZEgkUVRTg2uyuNE3AU+2Dr1FRCi/6V7djMS/XgHgJ2igelMPpvu2T EMIwpBAbNtZVdVK+rFOSmDdHJ6n9JXdvA7cqLxrkJdEL7vKtajwldewb4QPOKnHNDPlm T6bw== X-Gm-Message-State: ACgBeo1U/0qvdIEE1aqnpwBAV2DIbTJEFw2M4tOO5O/NUpfDMyAW+Mwl SKMPf60rmrPTIH5FLxn5Ar5qzg== X-Google-Smtp-Source: AA6agR6EfPaJIYJTfKnXdv1KX0HQkB/Up4VuVWbI6QAKwVwSlti+IGk5hm53ZI7uBim9Ljqc50OygQ== X-Received: by 2002:a05:600c:224d:b0:3a5:17db:de75 with SMTP id a13-20020a05600c224d00b003a517dbde75mr738542wmm.80.1659653561814; Thu, 04 Aug 2022 15:52:41 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:41 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 19/33] thermal/drivers/qoriq: Switch to new of API Date: Fri, 5 Aug 2022 00:43:35 +0200 Message-Id: <20220804224349.1926752-20-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/qoriq_thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_therma= l.c index 73049f9bea25..d111e218f362 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -82,9 +82,9 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct= qoriq_sensor *s) return container_of(s, struct qoriq_tmu_data, sensor[s->id]); } =20 -static int tmu_get_temp(void *p, int *temp) +static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qoriq_sensor *qsensor =3D p; + struct qoriq_sensor *qsensor =3D tz->devdata; struct qoriq_tmu_data *qdata =3D qoriq_sensor_to_data(qsensor); u32 val; /* @@ -122,7 +122,7 @@ static int tmu_get_temp(void *p, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops tmu_tz_ops =3D { +static const struct thermal_zone_device_ops tmu_tz_ops =3D { .get_temp =3D tmu_get_temp, }; =20 @@ -146,9 +146,9 @@ static int qoriq_tmu_register_tmu_zone(struct device *d= ev, =20 sensor->id =3D id; =20 - tzd =3D devm_thermal_zone_of_sensor_register(dev, id, - sensor, - &tmu_tz_ops); + tzd =3D devm_thermal_of_zone_register(dev, id, + sensor, + &tmu_tz_ops); ret =3D PTR_ERR_OR_ZERO(tzd); if (ret) { if (ret =3D=3D -ENODEV) --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 A23AFC25B06 for ; Thu, 4 Aug 2022 22:54:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237575AbiHDWyX (ORCPT ); Thu, 4 Aug 2022 18:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240379AbiHDWxW (ORCPT ); Thu, 4 Aug 2022 18:53:22 -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 5F2B973935 for ; Thu, 4 Aug 2022 15:52:44 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id q30so1317645wra.11 for ; Thu, 04 Aug 2022 15:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=f4QJf8ruUt+YX0IWOG7trN4ZQXuWHdSPHvGfzpjTqBk=; b=rvexQfHPZzZ0D0GkqyhLJgFnmk7R3q2g2qgNiF2HS6jGBCBhwo0ISJafzMy+JGDQAa o+DjjRHYAEu/LrFNS2puklAcJ/uJPc7dbbMky+y3poaBslmZ6H5t0DHrtg7CxcozwCoC /O0fGXHclLxaJXmJ2Zx+BI9V4aKmkwyAk9MVqk5wqs1Yj+U04G8l/aywlcVAFXQmUNx1 YASI/NqbzbtmLZADj4Fj+Kx8An+imvG/YdTcvRdJ5u4ZmE2lgcX7fdTKUvjiignMXfXe 59E1BL3Mp6I0z7rcuQch+JtP/7mSiQsBI20wAU64p5WLwZFWiTzq+PBTipdqZCqIoeft YJSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=f4QJf8ruUt+YX0IWOG7trN4ZQXuWHdSPHvGfzpjTqBk=; b=JidW8lSjhHRiI4Mm/PVVMyjaP0YX1+B0xq7pGG9i3t8IxqsXtz94+FUXDMErhvImbw +O6SX1CLlFcy4EswNYJzR7pwe9+d7GbBRW7AnLkIQ9QQfpx2ZJPfnmsIzLZpTua75vyY tATfEOWFdhGifyGH3ityA8YJHABr88VvW/nzfSj1Cf5cJpNI/rwLDWFjH+C+/tbo5Xd3 gk9B/oLcF217WUn6HCB45vQtxWC3HNxcBmfAdCWqsWHnsAqmnbnoOn8QOOfKnOaB8RFq ltRJTvinLU9dsXvtub4dcM55RK/lV2bAAwnW0rgEI24WzCk7K16X3LVrUCrobTGkZ5NE fmHQ== X-Gm-Message-State: ACgBeo2XECWC7w91WB4/x6N3IQF0qpUe0yKoWjZWbGSk3AUlVD0bExhi jpwxjT/yifioF5I6fsGziGv1QA== X-Google-Smtp-Source: AA6agR6gXUzDG0SVDH9UUJyKV7MukOfFADrlBb8tsIlCRCKwbxjhGuEBW6mFCtVwwijD4CGvXUsgUg== X-Received: by 2002:a05:6000:178d:b0:21d:a3cc:54c8 with SMTP id e13-20020a056000178d00b0021da3cc54c8mr2511734wrg.602.1659653563947; Thu, 04 Aug 2022 15:52:43 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:43 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, AngeloGioacchino Del Regno , Amit Kucheria , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v5 20/33] thermal/drivers/mtk: Switch to new of API Date: Fri, 5 Aug 2022 00:43:36 +0200 Message-Id: <20220804224349.1926752-21-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Reviewed-by: AngeloGioacchino Del Regno Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/mtk_thermal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index ede94eadddda..8440692e3890 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -679,9 +679,9 @@ static int mtk_thermal_bank_temperature(struct mtk_ther= mal_bank *bank) return max; } =20 -static int mtk_read_temp(void *data, int *temperature) +static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) { - struct mtk_thermal *mt =3D data; + struct mtk_thermal *mt =3D tz->devdata; int i; int tempmax =3D INT_MIN; =20 @@ -700,7 +700,7 @@ static int mtk_read_temp(void *data, int *temperature) return 0; } =20 -static const struct thermal_zone_of_device_ops mtk_thermal_ops =3D { +static const struct thermal_zone_device_ops mtk_thermal_ops =3D { .get_temp =3D mtk_read_temp, }; =20 @@ -1082,8 +1082,8 @@ static int mtk_thermal_probe(struct platform_device *= pdev) =20 platform_set_drvdata(pdev, mt); =20 - tzdev =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, - &mtk_thermal_ops); + tzdev =3D devm_thermal_of_zone_register(&pdev->dev, 0, mt, + &mtk_thermal_ops); if (IS_ERR(tzdev)) { ret =3D PTR_ERR(tzdev); goto err_disable_clk_peri_therm; --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 E63CDC25B07 for ; Thu, 4 Aug 2022 22:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240284AbiHDWya (ORCPT ); Thu, 4 Aug 2022 18:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240020AbiHDWxb (ORCPT ); Thu, 4 Aug 2022 18:53:31 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 834566FA2D for ; Thu, 4 Aug 2022 15:52:46 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id b6so595950wmq.5 for ; Thu, 04 Aug 2022 15:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=yKzLkry3f0ucVVy+WiLh8Z5rguSF04AWiaZnad/6qXc=; b=5XbbUHk6pZHx7L1UObi97tRtcLQbugm+p60O7OD16K8G29ipTKm6zNk1yCHtHK405/ mtS+jyOjwOrp/Th75e3PcKk92TJD5jQdAQiG55eEBdx4o1xwcWLcDFtoe0kibf6ZerCA 8SDNWWjyEUAfezqYJkIaAEaxwZARUvtqYjnmua0IAwSReuGvRdVCwjFk6uEw2alactHp 3ScRY13O8wCb6aE//IMzjqFLoVo3A8bPTHKjd5v6ap1u8vj6N1uEgPm+bA3H3EWFGENt B5Teb24V1zctslz14TmPYWgI6+3fGErZWU0BBBnvyahMfZZXiUOySyJchuQOe5rLg7ty BHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=yKzLkry3f0ucVVy+WiLh8Z5rguSF04AWiaZnad/6qXc=; b=SxsA3uwMauzNiJHY1DuqpZM4JPjbnQXdl1mG0vakiCFwosh76wOopmagdpNaVpN8Xr yjgu2jS0QDO4TxjUwXd93Jw0VEqh7G155SVKmWgkq2Kal02vfwT/kwkm+c+f+JLl+FKq Bh12yrX1uqox0+6v7yU2xysqHSmUihDK+2lZizjygY/zXls0xs819CkTJg9E2XGVlZx3 jj4LUBg6ns6eJrrWwInjtFy1WPl67L/HLGiO5paQfj/aZrSmoopqrKTg6TIByC4mQyJQ wxnxImYRAEdoHoTrwNX3Qe1WB//U4flRZi/Y+jpa2yreS72GCxbfYagRO7uwxwDT91CW CttQ== X-Gm-Message-State: ACgBeo0Fc5Imn8nMWINFNwUjm0bIih6uAa/ialVELqa3kQNPKX4Eg9c4 MR/GLwyu1C5Lr/YB+hVEaWuxXw== X-Google-Smtp-Source: AA6agR5e+U9L1aPO1rNsa78rgW4IKb7eu6MYHFIV4BZGL3TuiZfNWy/THrM349VMVJFVAgJU7B+tlg== X-Received: by 2002:a05:600c:4113:b0:3a3:4b67:d086 with SMTP id j19-20020a05600c411300b003a34b67d086mr7418689wmi.20.1659653566045; Thu, 04 Aug 2022 15:52:46 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:45 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 21/33] thermal/drivers/banggap: Switch to new of API Date: Fri, 5 Aug 2022 00:43:37 +0200 Message-Id: <20220804224349.1926752-22-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed Reviewed-by: Bryan Brattlof --- drivers/thermal/k3_bandgap.c | 12 ++++++------ drivers/thermal/k3_j72xx_bandgap.c | 12 +++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 5d0b3ffc6f46..22c9bcb899c3 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -139,9 +139,9 @@ static int k3_bgp_read_temp(struct k3_thermal_data *dev= data, return 0; } =20 -static int k3_thermal_get_temp(void *devdata, int *temp) +static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct k3_thermal_data *data =3D devdata; + struct k3_thermal_data *data =3D tz->devdata; int ret =3D 0; =20 ret =3D k3_bgp_read_temp(data, temp); @@ -151,7 +151,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp) return ret; } =20 -static const struct thermal_zone_of_device_ops k3_of_thermal_ops =3D { +static const struct thermal_zone_device_ops k3_of_thermal_ops =3D { .get_temp =3D k3_thermal_get_temp, }; =20 @@ -213,9 +213,9 @@ static int k3_bandgap_probe(struct platform_device *pde= v) writel(val, data[id].bgp->base + data[id].ctrl_offset); =20 data[id].tzd =3D - devm_thermal_zone_of_sensor_register(dev, id, - &data[id], - &k3_of_thermal_ops); + devm_thermal_of_zone_register(dev, id, + &data[id], + &k3_of_thermal_ops); if (IS_ERR(data[id].tzd)) { dev_err(dev, "thermal zone device is NULL\n"); ret =3D PTR_ERR(data[id].tzd); diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_= bandgap.c index 115a44eb4fbf..16b6bcf1bf4f 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -247,9 +247,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); @@ -259,7 +259,7 @@ static int k3_thermal_get_temp(void *devdata, int *temp) return ret; } =20 -static const struct thermal_zone_of_device_ops k3_of_thermal_ops =3D { +static const struct thermal_zone_device_ops k3_of_thermal_ops =3D { .get_temp =3D k3_thermal_get_temp, }; =20 @@ -474,10 +474,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 11 21:14:18 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 10FA4C25B06 for ; Thu, 4 Aug 2022 22:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240103AbiHDWyh (ORCPT ); Thu, 4 Aug 2022 18:54:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240397AbiHDWxg (ORCPT ); Thu, 4 Aug 2022 18:53:36 -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 C167574342 for ; Thu, 4 Aug 2022 15:52:49 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id j1so1386068wrw.1 for ; Thu, 04 Aug 2022 15:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=5vPTvuI94uga8nmWiqOTMlhssMKMlt7Rbmmokv8UyAg=; b=SZ6V+1lExXvLh4LvWQCQc1cdewDYX86v39ZS27fUDa5bAIvFFjdXQLUWZvlmfjnH1N ge8pL9ckIml8VuVvCF92rlWFFzdIem08ud8X6QULHEMjbr/EWtkgi36XYJC6a3/jZnbW 2N9hK+T8Tk+ajtTWnWJr8ZXhf0NoGWhCNlmBsY+73OxL5ZlZfiXeVl+Mv8lySzSikIAK TWFtvEwj/BmrKQYun1QTJBYpnkJXataeeArL4rpRUgcpyhmXnhQj6h9ljsOihGVgyYTy ypsdiGlK8l49com6bhOHioAG9MRk5os3IP6kYEzhGOxachUcedNsaGmRtM89qcvDizXB P9vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=5vPTvuI94uga8nmWiqOTMlhssMKMlt7Rbmmokv8UyAg=; b=PZK/fVnL1vrf1S727oxeUBMLzsSdMrH2Ci8h6cZTL+mkLEFynbhyrU6KblKBM5SCsn phbq/wdzlzUW5T9iBhVMMYrqNbCq5wM5bphjB8XjxlqrLoN9W9bdusHCu6OlzHgdFOo/ jA6msRvoIm5Ct/QSLTUdTKhSnosSSzFAVXH9xjQbIbHnaSmyHXiTGJ3kZ1KR+gL67SbP beZ4FAew92/BK6CXEg1WYV7bYA83BLPbexzC+Z5de+vbj8utLojYEqwGkUOPqCOMNwBY WQ8MULvQg2lFzvdxDNZNGCVgIKN6QlpS9MFwEACAuo31Ja4MMnptmMI2Apt2Yek/n2zo zadg== X-Gm-Message-State: ACgBeo0KcObTZUwhLvPKaiZzSapQ6nEFJChchDvLBUQ/O9K1M0UGznJT pNL746jdJwZ2cyVC4LzqmK7COQ== X-Google-Smtp-Source: AA6agR70LCT7ArA2AFR6OMTZ5hXElDUOJkkKBvF3u0JiAGSJmwxkhnwBTR5o4wkSEiuGv5OthtlOOA== X-Received: by 2002:a5d:5a1a:0:b0:21f:a9b:62c6 with SMTP id bq26-20020a5d5a1a000000b0021f0a9b62c6mr2541655wrb.20.1659653568158; Thu, 04 Aug 2022 15:52:48 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:47 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 22/33] thermal/drivers/maxim: Switch to new of API Date: Fri, 5 Aug 2022 00:43:38 +0200 Message-Id: <20220804224349.1926752-23-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/max77620_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_= thermal.c index 82d06c7411eb..6451a55eb582 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -44,9 +44,9 @@ struct max77620_therm_info { * Return 0 on success otherwise error number to show reason of failure. */ =20 -static int max77620_thermal_read_temp(void *data, int *temp) +static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int = *temp) { - struct max77620_therm_info *mtherm =3D data; + struct max77620_therm_info *mtherm =3D tz->devdata; unsigned int val; int ret; =20 @@ -66,7 +66,7 @@ static int max77620_thermal_read_temp(void *data, int *te= mp) return 0; } =20 -static const struct thermal_zone_of_device_ops max77620_thermal_ops =3D { +static const struct thermal_zone_device_ops max77620_thermal_ops =3D { .get_temp =3D max77620_thermal_read_temp, }; =20 @@ -114,7 +114,7 @@ static int max77620_thermal_probe(struct platform_devic= e *pdev) */ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); =20 - mtherm->tz_device =3D devm_thermal_zone_of_sensor_register(&pdev->dev, 0, + mtherm->tz_device =3D devm_thermal_of_zone_register(&pdev->dev, 0, mtherm, &max77620_thermal_ops); if (IS_ERR(mtherm->tz_device)) { ret =3D PTR_ERR(mtherm->tz_device); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 7DC0FC25B06 for ; Thu, 4 Aug 2022 22:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236752AbiHDWyp (ORCPT ); Thu, 4 Aug 2022 18:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240184AbiHDWxm (ORCPT ); Thu, 4 Aug 2022 18:53:42 -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 AB2427434C for ; Thu, 4 Aug 2022 15:52:51 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id z16so1308719wrh.12 for ; Thu, 04 Aug 2022 15:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=dtIC8RNPtrIhefVP3qkzn/ojto5ZENqxzOLIoU7Obsk=; b=ONlXQ4NqB3vgSX4uSliFdY3yNlFX4bZpvvDzZwFlFyr3ZLlO88lqPwrXqS55YesZ8e DTNI6aZvNZa2na35TxUOXs3x3d49FOgnNOoYfs/vJILt0dYPqOf4ABwjmHtSgR0D7FpC WycjoVoygBDjT52fGODVRcdVJzy1YQ2V+Nw8Rqa7NIEoqq4gXVPLR9RRsV/3+vhGBTqd L3IJqGo6PjzX0ddEmVsYl0sWpZXATF6aXd6drTHsACjXMHaaJB/jNfq2YQin+4IhhxBb +GqCpqocpp7NCuRG/ZvpnxDqD0gJM3/uSpyXLNj3Sp4cJRsENgfSb2c5USnGVYkeXte+ MH3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=dtIC8RNPtrIhefVP3qkzn/ojto5ZENqxzOLIoU7Obsk=; b=QT/bGFQKbt+rHuDfF5rcHSrP8u64+uiCYZ1vZUez9Tq4m2ewd/NofivWblKVXYzlxU 3AAU8tHz+I+wmb0Y0Pu1hJ8PoPWHgF+JxqxPqH7LaXYM9rdU6D6/f+MBljt0EPkm1Pjn yJXQ0MgBcoe67qwUojhx0hlyiyY4G4M0DGnChRqerxoRuPmzqO4kbMTwmZTydCAVjzNq PZSr/eKPgLr/Owvy0Y7Vonxrzf91bQg8HGQYJdt+Y0UUS2nqZsCkPMrubovRRqv3O3Jl iObZW0+nDMJ45X6q8LabaPX89/UoaM0ZfO+Z3yrC+orNX5FMaZWb+56cn0vXsE6nVHv0 ayvA== X-Gm-Message-State: ACgBeo04lGnT69Uh2T4skHwZfZ9eNyY6JnULJVpdKY7Vh4jN2ib/U7gl muWCpp4cFAcA5ehDeNkbp9D5MA== X-Google-Smtp-Source: AA6agR4g6r3oo/+sIPWsD7u5j6HFVbp0preuyhSD5qWUNZsEWfYRsGmZe6bMtIT4YaLiq7NckvDkzQ== X-Received: by 2002:a5d:64e2:0:b0:220:7dfb:ab6f with SMTP id g2-20020a5d64e2000000b002207dfbab6fmr2549880wri.664.1659653570191; Thu, 04 Aug 2022 15:52:50 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:49 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 23/33] thermal/drivers/hisilicon: Switch to new of API Date: Fri, 5 Aug 2022 00:43:39 +0200 Message-Id: <20220804224349.1926752-24-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/hisi_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index b29ab09040d5..cc5da71b6f55 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -442,9 +442,9 @@ static int hi3660_thermal_probe(struct hisi_thermal_dat= a *data) return 0; } =20 -static int hisi_thermal_get_temp(void *__data, int *temp) +static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hisi_thermal_sensor *sensor =3D __data; + struct hisi_thermal_sensor *sensor =3D tz->devdata; struct hisi_thermal_data *data =3D sensor->data; =20 *temp =3D data->ops->get_temp(sensor); @@ -455,7 +455,7 @@ static int hisi_thermal_get_temp(void *__data, int *tem= p) return 0; } =20 -static const struct thermal_zone_of_device_ops hisi_of_thermal_ops =3D { +static const struct thermal_zone_device_ops hisi_of_thermal_ops =3D { .get_temp =3D hisi_thermal_get_temp, }; =20 @@ -467,7 +467,7 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int ir= q, void *dev) =20 data->ops->irq_handler(sensor); =20 - hisi_thermal_get_temp(sensor, &temp); + temp =3D data->ops->get_temp(sensor); =20 if (temp >=3D sensor->thres_temp) { dev_crit(&data->pdev->dev, @@ -492,9 +492,9 @@ static int hisi_thermal_register_sensor(struct platform= _device *pdev, int ret, i; const struct thermal_trip *trip; =20 - sensor->tzd =3D devm_thermal_zone_of_sensor_register(&pdev->dev, - sensor->id, sensor, - &hisi_of_thermal_ops); + sensor->tzd =3D devm_thermal_of_zone_register(&pdev->dev, + sensor->id, sensor, + &hisi_of_thermal_ops); if (IS_ERR(sensor->tzd)) { ret =3D PTR_ERR(sensor->tzd); sensor->tzd =3D NULL; --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 486B9C25B08 for ; Thu, 4 Aug 2022 22:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240400AbiHDWyy (ORCPT ); Thu, 4 Aug 2022 18:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240156AbiHDWyC (ORCPT ); Thu, 4 Aug 2022 18:54:02 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EB1574361 for ; Thu, 4 Aug 2022 15:52:54 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso3172670wma.2 for ; Thu, 04 Aug 2022 15:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=fQwrODMneSzL3hNZushZmArM7t54Sdd+4j1p+OO3JS8=; b=du0U1yNvWqPDOLaD9/Y8e2EHjChbPfu2bij7Evl0yVU/i9/mMb1oF1T6TpbGAj5zdU rrbD3I65hi7nREk9+kUuEOTazN7fRYqcURJCPUEfB9+niqI6/ZjieaXoCMoDI8ege/Z7 sHpzoVL0pCH/zEMlRjGF1Yf6T4uWklDCSN7hbyK8LpMF9JM/e4/UMASJ9Lr0QVyurGhL p/B2/aQcqStizpp3/Eyo8Kzw4skoUOcrY9YoUG4sXPnRavucHFb/LkzyN51QxrC8Af2K TzZ4cK2LxAvvK/pnKMpwH/VyMRZwpYen+XJson4vn+e5rk3b5NBLWF8pcnnSwfC7O3NX +7xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=fQwrODMneSzL3hNZushZmArM7t54Sdd+4j1p+OO3JS8=; b=p9oEIje+Tab8DTfVbxC//0jgPFucrok3j4dZfB35V97g267nYggIutWlxR2RJF8Fpx Vb+VOp/0XTwQR0PdCN6Xst2KIQnlKm/ZYe9Vu+lwi6lD/bWPb3k0fN93Y9+ZbTeruN4P 4RMNFzuoxXvTXyPihjFf+4y75zsflXLjgRVO8zCnu89CDwLr7gwi5gosO2ijhwN2dDYj ccBXRbQ8E4YolSUw5FWBMcO/ocNPR4HmKHZX1+0ecY1TZyfu0s8wAWz31i8SNgVW43Db 9ugugAfJpbmRmunCQ34CZN0X2VyTTMO/2l2XdYmRszKqa87SuqxYVn7KXJsGk7dSiahU +bZA== X-Gm-Message-State: ACgBeo2y0F6DJFfKBHvEr4Xw1a/MedFYDFyD11JFMRBnBMs639uFcPMo 7ueAWv+O4OuOjBf8W7JhYz2OSg== X-Google-Smtp-Source: AA6agR61gObp1WwJEmt1JV7w7kk0h9azvSbbNkoEAcEXeQ5zOCvxZNEWJU7W+OLQ/WJ1PcnyMOlXQQ== X-Received: by 2002:a1c:7401:0:b0:3a3:182f:7be9 with SMTP id p1-20020a1c7401000000b003a3182f7be9mr7393098wmc.189.1659653572336; Thu, 04 Aug 2022 15:52:52 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:52 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Eduardo Valentin , Amit Kucheria , linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER) Subject: [PATCH v5 24/33] thermal/drivers/ti-soc: Switch to new of API Date: Fri, 5 Aug 2022 00:43:40 +0200 Message-Id: <20220804224349.1926752-25-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: Keerthy Acked-by: for the hwmon patches in this series until it is guaranteed --- .../thermal/ti-soc-thermal/ti-thermal-common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 703039d8b937..8a9055bd376e 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -65,10 +65,10 @@ static inline int ti_thermal_hotspot_temperature(int t,= int s, int c) =20 /* thermal zone ops */ /* Get temperature callback function for thermal zone */ -static inline int __ti_thermal_get_temp(void *devdata, int *temp) +static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, in= t *temp) { struct thermal_zone_device *pcb_tz =3D NULL; - struct ti_thermal_data *data =3D devdata; + struct ti_thermal_data *data =3D tz->devdata; struct ti_bandgap *bgp; const struct ti_temp_sensor *s; int ret, tmp, slope, constant; @@ -85,8 +85,8 @@ static inline int __ti_thermal_get_temp(void *devdata, in= t *temp) return ret; =20 /* Default constants */ - slope =3D thermal_zone_get_slope(data->ti_thermal); - constant =3D thermal_zone_get_offset(data->ti_thermal); + slope =3D thermal_zone_get_slope(tz); + constant =3D thermal_zone_get_offset(tz); =20 pcb_tz =3D data->pcb_tz; /* In case pcb zone is available, use the extrapolation rule with it */ @@ -107,9 +107,9 @@ static inline int __ti_thermal_get_temp(void *devdata, = int *temp) return ret; } =20 -static int __ti_thermal_get_trend(void *p, int trip, enum thermal_trend *t= rend) +static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip= , enum thermal_trend *trend) { - struct ti_thermal_data *data =3D p; + struct ti_thermal_data *data =3D tz->devdata; struct ti_bandgap *bgp; int id, tr, ret =3D 0; =20 @@ -130,7 +130,7 @@ static int __ti_thermal_get_trend(void *p, int trip, en= um thermal_trend *trend) return 0; } =20 -static const struct thermal_zone_of_device_ops ti_of_thermal_ops =3D { +static const struct thermal_zone_device_ops ti_of_thermal_ops =3D { .get_temp =3D __ti_thermal_get_temp, .get_trend =3D __ti_thermal_get_trend, }; @@ -170,7 +170,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, in= t id, return -EINVAL; =20 /* in case this is specified by DT */ - data->ti_thermal =3D devm_thermal_zone_of_sensor_register(bgp->dev, id, + data->ti_thermal =3D devm_thermal_of_zone_register(bgp->dev, id, data, &ti_of_thermal_ops); if (IS_ERR(data->ti_thermal)) { dev_err(bgp->dev, "thermal zone device is NULL\n"); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 2AC6DC25B06 for ; Thu, 4 Aug 2022 22:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240440AbiHDWzE (ORCPT ); Thu, 4 Aug 2022 18:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240256AbiHDWyE (ORCPT ); Thu, 4 Aug 2022 18:54:04 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05AD71714 for ; Thu, 4 Aug 2022 15:52:56 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id j7so1373142wrh.3 for ; Thu, 04 Aug 2022 15:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Y+8gnJ68hJod6uvQUR4L1wvFSKnRgzdO4yxaDxG616M=; b=dfd1RDzSjLjHExV+EaGPHEXW2HbH1qMEV5PNCZClRbql6yUUuCwFoQgJcS/SRTVrVN h7B2rJDg2Gy3V9EADURhz914xMJYqf4diGNP1Q5DQ0vsoVkiChDVBhu2pYeJ16+0Ew2r W+hhliRFKa9YT0AyAgqsFVeojh4oBpPHcyiiIcRdVa4uMhpT5rjKeeR6P/DStWG2fyio O8xedJQJzpnryKXIRo+azAVUH5qRcAJ4vqsZswN3RdCvQDulevNaAxQTQ6lzaRxlhbc8 cvpCDIV9+6Jq9Dnh3E6KQLox6nn/KQMzCUPZKpC/lExk8aVzf8EVzGia+jmvGsHCFTYx AhxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Y+8gnJ68hJod6uvQUR4L1wvFSKnRgzdO4yxaDxG616M=; b=jbv/RxiM26H/c9ng3aV6KUCNTDi6WhmgetvjI6jsBtjdEpP1S+QbHZbgydenRgsc2d H1rfXQqJUpyIBQhEGs4qoQJXDGZ5MHVJQt7Xrk7KVU3mTjBFNbTyxM8HRY0PZ8W+MTvY b91bmkhbKFSBjV0pW3pSarqjsu4spbW5f1B6xVMD0XVB7TdFNR2yfJB6PXRkfAcdhy1M dyJTia3b+uI8eo2l230fjvaMxji9s0mE6o35Ixvg9twXO36GJmWgdwiEDsCmzldYGpkZ oFl+ZlSqCxSsqTiuAnfm0Ppoj4yiSgSIgM4TgE8Le8cHMBVAWK9KQLImhW2Kg+Pl0nME GfsA== X-Gm-Message-State: ACgBeo2euz39NSG6TD5NEdmq8QB6zEWHh1E0ro9mFQmeWIBfsMLcs2C6 qXF+ntBUiGC92Ti6vhCGMuZLVg== X-Google-Smtp-Source: AA6agR5yGSclA5gFlTAnvgte1BCgtH6uZwtDoYlN40D/6jt4Q0TuIARi9wLNQjI3X6Ocf7C00QWqOA== X-Received: by 2002:adf:fe0d:0:b0:220:5f88:ebef with SMTP id n13-20020adffe0d000000b002205f88ebefmr2462048wrr.349.1659653574611; Thu, 04 Aug 2022 15:52:54 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:54 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v5 25/33] ata/drivers/ahci_imx: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:41 +0200 Message-Id: <20220804224349.1926752-26-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. sata_ahci_read_temperature() is used by sata_ahci_show_temp() also. So in order to change the function prototype for the get_temp ops which does not take a void* but a thermal_zone_device* structure, this function wraps the call. Signed-off-by: Daniel Lezcano Acked-by: Damien Le Moal Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/ata/ahci_imx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 79aa9f285312..b734e069034d 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, v= oid __iomem * mmio) } =20 /* SATA AHCI temperature monitor */ -static int sata_ahci_read_temperature(void *dev, int *temp) +static int __sata_ahci_read_temperature(void *dev, int *temp) { u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum; u32 str1, str2, str3, str4; @@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *= temp) return 0; } =20 +static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int = *temp) +{ + return __sata_ahci_read_temperature(tz->devdata, temp); +} + static ssize_t sata_ahci_show_temp(struct device *dev, struct device_attribute *da, char *buf) @@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev, unsigned int temp =3D 0; int err; =20 - err =3D sata_ahci_read_temperature(dev, &temp); + err =3D __sata_ahci_read_temperature(dev, &temp); if (err < 0) return err; =20 return sprintf(buf, "%u\n", temp); } =20 -static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_op= s =3D { +static const struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = =3D { .get_temp =3D sata_ahci_read_temperature, }; =20 @@ -1131,8 +1136,8 @@ static int imx_ahci_probe(struct platform_device *pde= v) ret =3D PTR_ERR(hwmon_dev); goto disable_clk; } - devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, - &fsl_sata_ahci_of_thermal_ops); + devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev, + &fsl_sata_ahci_of_thermal_ops); dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev)); } =20 --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 AF988C25B06 for ; Thu, 4 Aug 2022 22:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232665AbiHDWzU (ORCPT ); Thu, 4 Aug 2022 18:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240409AbiHDWyL (ORCPT ); Thu, 4 Aug 2022 18:54:11 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380B474375 for ; Thu, 4 Aug 2022 15:52:57 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id p10so1336115wru.8 for ; Thu, 04 Aug 2022 15:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=507KINL6A4/AmFndHS1iP7gQvMCv3nao7sFdYMMwu/Q=; b=SXwwjHMSFBkV6d3469j+NGk8We34QnvhrAFoCUQy19G/CXiE8tYZi9XqMgsGr+jFyE Xelv0ZhLlbiXuGahZu23c1X6O1vdQ6ITYqy8IvtQ/E24plUi803+XJSfWsaQ9w9nAgNZ o3Zo5Re3uYnblJhzl2e/gNOmbi08DEjJQvpRg50yZMDPblEi+5mJH5JPd8SsvhRWXoK/ WDZA8OdIGNiK5ve1+zUq1MyrGFmF5pKr9w/6AdTAYbdc//8sLdAHJjS5VLI37KWzLb/M 6X3a+fSAwCkyq5qGOCu0TcGWC3SXKqsmUBU+e0oHWEmzENa8hGpbpybU2AnNvQDwQ8q+ Q2AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=507KINL6A4/AmFndHS1iP7gQvMCv3nao7sFdYMMwu/Q=; b=daPZDSS13j8RqpenyfEr/hDxYpnlghTAnq96fDvmG5eGNmzaIJQyCamZMO/uhJD+/p hR5al4lmL14KwlVb8eI2Gimqk9HW7X/Tb4lFfp/+u8AjuUirniXbAKwjUKcOiEiSyIDm wtqFJ1uSpfgnnmS3U49YHtEPF0zlgwSxGmR3m6iYwXe5bxd5KfYSMg0EGI8TlPlyOUDm 5hczBZr5wduL6lr3RSLzZdPXEyM44SERxaZUbYD8iGC6I83Cmhbjy4RlBEiXVplCnWrS WodYPRvRZYe78zOy+BkzMa6qmEMO8rRceGmW3YzqrwC07mEUqA+rmoAtCp9uMWLxKpoc 32lQ== X-Gm-Message-State: ACgBeo0wgnicBXAU8OE3NQCOWP1dwvhG+y2BZPXM+BZFNIRvv3sh6N38 AQmfNFEO1iFzo55ItakQiY+I6g== X-Google-Smtp-Source: AA6agR5FB/1c0hMGtxm0/d0QPNlvMrEglZyNig5yfbDgVc3THf+62GhkvC52FzxRKY7DlFnXy24cQA== X-Received: by 2002:a05:6000:1447:b0:21d:b22b:e5d with SMTP id v7-20020a056000144700b0021db22b0e5dmr2442958wrx.189.1659653576746; Thu, 04 Aug 2022 15:52:56 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:56 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org (open list:PMBUS HARDWARE MONITORING DRIVERS) Subject: [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:42 +0200 Message-Id: <20220804224349.1926752-27-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/hwmon/pmbus/pmbus_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_c= ore.c index 02912022853d..3b9bb2123a1a 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1109,9 +1109,9 @@ struct pmbus_thermal_data { struct pmbus_sensor *sensor; }; =20 -static int pmbus_thermal_get_temp(void *data, int *temp) +static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *tem= p) { - struct pmbus_thermal_data *tdata =3D data; + struct pmbus_thermal_data *tdata =3D tz->devdata; struct pmbus_sensor *sensor =3D tdata->sensor; struct pmbus_data *pmbus_data =3D tdata->pmbus_data; struct i2c_client *client =3D to_i2c_client(pmbus_data->dev); @@ -1135,7 +1135,7 @@ static int pmbus_thermal_get_temp(void *data, int *te= mp) return ret; } =20 -static const struct thermal_zone_of_device_ops pmbus_thermal_ops =3D { +static const struct thermal_zone_device_ops pmbus_thermal_ops =3D { .get_temp =3D pmbus_thermal_get_temp, }; =20 @@ -1153,8 +1153,8 @@ static int pmbus_thermal_add_sensor(struct pmbus_data= *pmbus_data, tdata->sensor =3D sensor; tdata->pmbus_data =3D pmbus_data; =20 - tzd =3D devm_thermal_zone_of_sensor_register(dev, index, tdata, - &pmbus_thermal_ops); + tzd =3D devm_thermal_of_zone_register(dev, index, tdata, + &pmbus_thermal_ops); /* * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV, * so ignore that error but forward any other error. --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 916ECC25B06 for ; Thu, 4 Aug 2022 22:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240429AbiHDWzh (ORCPT ); Thu, 4 Aug 2022 18:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240433AbiHDWyb (ORCPT ); Thu, 4 Aug 2022 18:54:31 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8956774CC3 for ; Thu, 4 Aug 2022 15:53:03 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id c22so615092wmr.2 for ; Thu, 04 Aug 2022 15:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=wQo/UV9mshrZkcNDdjalDKNxK63vlfmQjhNxevBHCxrFdsMT7nB90i1ZE6huszQ/db 2bl8ZrWoUnMQJhVWhbw8Q/cKmO/0nt2z4svjTvqbUUY0tQ7fXuI4fcdsSiGl67GACG1n bSMGo7EjTT0N8vsk5TsxgVEDLH3cwt/P9BpYOJ6Z/kwcEwWWk23H2GdFzVF9PoC3iB8O 760MdX6i3YhxrwszI6CwkNH0YgSTqG1hckIvey/rwgjFdQELdtDtIrz/saHyXZO5h/eO by8fOA6f7Q2assdrf+1iuG+Q38rAred/Dsh7mcOEEMwB3Ygh21+2eneqL2IZG8ngs08k l/Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Mb4JyaEjxL4JDBtXDcGCWHFGP5KgiZCOnINym1JdoVI=; b=YMk1xKaoeUSA2butYWQtTrixKnDZnHqdmF19whBxnshr7Zyp2HjH1FKvI9y9WzhNOu FCnKgjiNfO7uSbvUoD6uBi13ie6bftxI3OByoTzuzqv0BxX5IaNaNAxUdse4RqRi+cbY Q0rm+uGUrhmA5OrvaesxuuDW1adaNuC+iwQMZTIQxb5jmdLpo/R/kt0zkBPVnMSq+h3x 0WSPm7qrqOOLrOC6A0PrMF0Mm7flmNBWDk06IsO7cLU6nJm/3XeIRSw3cmcDgLHscpPt GZC5RkxMl66DlmpcsPYtWfTKTvoRUE11KIty4DhAXheis3bCPVdMSx99JtPcnV5N7S09 YO1A== X-Gm-Message-State: ACgBeo01LCpTdNEg5huGQbrA6BOKIC155uHOArTvoWkJNtmapaeuUs9a e2V0tWgt8kpMfTgBv+WIRTHTfg== X-Google-Smtp-Source: AA6agR5VKn8mBE1+7AKB21QkxmN4RJNv5p+IzBpLUtP9ibque/PJyyCzb0QuN6l6KiTs8FG5xCb8LA== X-Received: by 2002:a05:600c:4f07:b0:3a3:2277:7064 with SMTP id l7-20020a05600c4f0700b003a322777064mr2707995wmq.181.1659653578896; Thu, 04 Aug 2022 15:52:58 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:52:58 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v5 27/33] hwmon/drivers/core: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:43 +0200 Message-Id: <20220804224349.1926752-28-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/hwmon/hwmon.c | 14 +++++++------- drivers/hwmon/scpi-hwmon.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 2e2cd79d89eb..4218750d5a66 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -151,9 +151,9 @@ static DEFINE_IDA(hwmon_ida); * between hwmon and thermal_sys modules. */ #ifdef CONFIG_THERMAL_OF -static int hwmon_thermal_get_temp(void *data, int *temp) +static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *tem= p) { - struct hwmon_thermal_data *tdata =3D data; + struct hwmon_thermal_data *tdata =3D tz->devdata; struct hwmon_device *hwdev =3D to_hwmon_device(tdata->dev); int ret; long t; @@ -168,9 +168,9 @@ static int hwmon_thermal_get_temp(void *data, int *temp) return 0; } =20 -static int hwmon_thermal_set_trips(void *data, int low, int high) +static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low= , int high) { - struct hwmon_thermal_data *tdata =3D data; + struct hwmon_thermal_data *tdata =3D tz->devdata; struct hwmon_device *hwdev =3D to_hwmon_device(tdata->dev); const struct hwmon_chip_info *chip =3D hwdev->chip; const struct hwmon_channel_info **info =3D chip->info; @@ -203,7 +203,7 @@ static int hwmon_thermal_set_trips(void *data, int low,= int high) return 0; } =20 -static const struct thermal_zone_of_device_ops hwmon_thermal_ops =3D { +static const struct thermal_zone_device_ops hwmon_thermal_ops =3D { .get_temp =3D hwmon_thermal_get_temp, .set_trips =3D hwmon_thermal_set_trips, }; @@ -227,8 +227,8 @@ static int hwmon_thermal_add_sensor(struct device *dev,= int index) tdata->dev =3D dev; tdata->index =3D index; =20 - tzd =3D devm_thermal_zone_of_sensor_register(dev, index, tdata, - &hwmon_thermal_ops); + tzd =3D devm_thermal_of_zone_register(dev, index, tdata, + &hwmon_thermal_ops); if (IS_ERR(tzd)) { if (PTR_ERR(tzd) !=3D -ENODEV) return PTR_ERR(tzd); diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index 5187c6dd5a4f..4d75385f7d5e 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -62,9 +62,9 @@ static void scpi_scale_reading(u64 *value, struct sensor_= data *sensor) } } =20 -static int scpi_read_temp(void *dev, int *temp) +static int scpi_read_temp(struct thermal_zone_device *tz, int *temp) { - struct scpi_thermal_zone *zone =3D dev; + struct scpi_thermal_zone *zone =3D tz->devdata; struct scpi_sensors *scpi_sensors =3D zone->scpi_sensors; struct scpi_ops *scpi_ops =3D scpi_sensors->scpi_ops; struct sensor_data *sensor =3D &scpi_sensors->data[zone->sensor_id]; @@ -121,7 +121,7 @@ scpi_show_label(struct device *dev, struct device_attri= bute *attr, char *buf) return sprintf(buf, "%s\n", sensor->info.name); } =20 -static const struct thermal_zone_of_device_ops scpi_sensor_ops =3D { +static const struct thermal_zone_device_ops scpi_sensor_ops =3D { .get_temp =3D scpi_read_temp, }; =20 @@ -275,10 +275,10 @@ static int scpi_hwmon_probe(struct platform_device *p= dev) =20 zone->sensor_id =3D i; zone->scpi_sensors =3D scpi_sensors; - z =3D devm_thermal_zone_of_sensor_register(dev, - sensor->info.sensor_id, - zone, - &scpi_sensor_ops); + z =3D devm_thermal_of_zone_register(dev, + sensor->info.sensor_id, + zone, + &scpi_sensor_ops); /* * The call to thermal_zone_of_sensor_register returns * an error for sensors that are not associated with --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 3F877C25B07 for ; Thu, 4 Aug 2022 22:56:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240463AbiHDWzm (ORCPT ); Thu, 4 Aug 2022 18:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240233AbiHDWym (ORCPT ); Thu, 4 Aug 2022 18:54:42 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F9D474CD6 for ; Thu, 4 Aug 2022 15:53:06 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id p10so1336285wru.8 for ; Thu, 04 Aug 2022 15:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=yipcQksn9MduY+PrR9+yWSi0xxvFjS5CwaaNjBD2ByY=; b=S2KeqwvZfM0DPDER/HvTE1y7NC0Tm55kidKrq4rL9Xc+H5FYrDFcOIEUseaTva7uYi gOmq2+048MZMCI5bmYJPloNqAjC1K6mmudPkBFRO8oiuPeQL6Bz4Lzl1YStR/7lc2Oar 2Nz4T74ZBqdaBtnEewTm91x8SpaNS37CdueA7seKTB6jF/fePFHsjFh4qSlZdEYUpY7b jqq2/IkZyj+cY1ZoQ6hWwNO2ogtxb1g6GZ9AvqtmMvc7x7efNe4bmIK8pTqEFpQ0C/0z J6h9xVBHJcwCw5kK2n9qFH77EJEB6W7snEUk0Px5FLTeOWm97Mq0XcVv7C1dAce9aZm0 WqwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=yipcQksn9MduY+PrR9+yWSi0xxvFjS5CwaaNjBD2ByY=; b=eeIUn4QSig+HlYxpWo5JHR+/zYoJZ7RCaCZLteZV5Ho4IQw0EAjXd9V2XGAP0inkUo 9024LlMS5VQGCNr73i7mYUVo2x5mZGYVbPzH4a/xqEGfF7lEJ0qf3Uazj6+3CmZfiJtz Yiz27ravPoaKtZIGDdQ8QzRumJStQ9geMbsSTArW3ZrJEM5R2zX7OUoiXm7y8neGpbyT zoQuHL9EM0tGCCUL6bVoMpYUg+PP8UxxOIfLbRCVlZUaA65T0eKlCU9MYHO/oGSkDAUK 68d4o9twF3CHWlfnTu4wS+kvTEvij5ZZ5eoe1hW5FFO9a3zV0xuIcBEAt+CcGJK56XcH 7ysg== X-Gm-Message-State: ACgBeo3t7ua6HhSL5EM0OLOL3cXcTtQGxAPlOflk+1KYqEEoqQFXBT85 XCtZK5F7ooh8PRhw7YGEIUqJXA== X-Google-Smtp-Source: AA6agR4prrBJ88PSOCbYsd4L35ffscHB6L1wapJ//I4njEFFbXzHgn8YPQNRIl2SjuMcoU8cCP/aiA== X-Received: by 2002:a5d:6e8d:0:b0:21e:48a4:b267 with SMTP id k13-20020a5d6e8d000000b0021e48a4b267mr2395012wrz.507.1659653582142; Thu, 04 Aug 2022 15:53:02 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:53:01 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Jonathan Cameron , 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 v5 28/33] iio/drivers/sun4i_gpadc: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:44 +0200 Message-Id: <20220804224349.1926752-29-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: Jonathan Cameron Acked-by: Jernej Skrabec Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/iio/adc/sun4i-gpadc-iio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpad= c-iio.c index 2d393a4dfff6..a6ade70dedf8 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -412,9 +412,9 @@ static int sun4i_gpadc_runtime_resume(struct device *de= v) return 0; } =20 -static int sun4i_gpadc_get_temp(void *data, int *temp) +static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sun4i_gpadc_iio *info =3D data; + struct sun4i_gpadc_iio *info =3D tz->devdata; int val, scale, offset; =20 if (sun4i_gpadc_temp_read(info->indio_dev, &val)) @@ -428,7 +428,7 @@ static int sun4i_gpadc_get_temp(void *data, int *temp) return 0; } =20 -static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops =3D { +static const struct thermal_zone_device_ops sun4i_ts_tz_ops =3D { .get_temp =3D &sun4i_gpadc_get_temp, }; =20 @@ -637,9 +637,9 @@ static int sun4i_gpadc_probe(struct platform_device *pd= ev) pm_runtime_enable(&pdev->dev); =20 if (IS_ENABLED(CONFIG_THERMAL_OF)) { - info->tzd =3D thermal_zone_of_sensor_register(info->sensor_device, - 0, info, - &sun4i_ts_tz_ops); + info->tzd =3D devm_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. @@ -681,8 +681,6 @@ static int sun4i_gpadc_remove(struct platform_device *p= dev) if (!IS_ENABLED(CONFIG_THERMAL_OF)) return 0; =20 - thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd); - if (!info->no_irq) iio_map_array_unregister(indio_dev); =20 --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 05A8DC25B08 for ; Thu, 4 Aug 2022 22:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240306AbiHDW4Z (ORCPT ); Thu, 4 Aug 2022 18:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240397AbiHDWyy (ORCPT ); Thu, 4 Aug 2022 18:54:54 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E060774CD7 for ; Thu, 4 Aug 2022 15:53:07 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id z17so1362296wrq.4 for ; Thu, 04 Aug 2022 15:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=kpAJvHnsGVgVYdV6CGwRXamKol+XLg/BJyowOdExSUs=; b=W3cU+eWftwod/gCCEn4RF6D7EDBHd9HP5Cy2gZBlBBe8SyqLB424UiO5yQ9/meWDAW tnLWYXRnRl1Ey5cgoNvNP7eFz9G5zR5z7h8meNq54WbpA63LDnP5UUpy6sZB+qk5mMoi Wq0tCL+soGYDBzUpQB19pONUQ1IFKfw/91eaM2V4KdbqTWeNaJLNDx1gs757ZOxhO5N6 UCORYdZTHrwj+mPxVhQjmnqZXpn0eB4zHMqs/eAPkQoqsvsq8m5l38M1h/fpSMfHQJXS UqRikfL2/jGXGWXtTPSMcqjwCXygVwn7U9+i+xiOUiBRi7H9Any6ZVrjOsBsszElFiTs jsRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=kpAJvHnsGVgVYdV6CGwRXamKol+XLg/BJyowOdExSUs=; b=J3wZmbtrRok7VkvLyHnBfpuh3n9LKpMjpdV/iM/+joNAnnalMV/6J++h4HcKwMuA8A XkqjflUice/ogCIWQ8ypQHN1E5UCFuPdtYrRERYOKv4I81qSxV0Wtd4Zf1sHo8n9OeJp P9QDQfW4LTzBnE1BTfedv9TO4C6nJ3G2GJdms4AP9O1nw5gBsmIil5SvZionTk2Y/OxM wGAo5uVgw9j2jFigi8JHN2J2VWT3vgzNyrFwhUyQ/+gYrBxuM4oA/mmPxxkFAf9DLBIL QpwI7uphm4qTziqE75mdSC7xmttjF4IAWACZFfVSxi9PFHO6w2h1gUMSRphni2uGwj7N 4KRw== X-Gm-Message-State: ACgBeo3SAQpHgFa9n0/a//9J7sakqW6MuPaHDW26y6S/BdRilryCVkaL RmP08N1L72sQnGjQJx1nR99rdQ== X-Google-Smtp-Source: AA6agR5Ha3VmIOQi6HqXaFNq4+uOYAdNMIGg2F5UmBMHHeRJ1PozwZCiQ9FAcStTb/q3qk7rfALfsQ== X-Received: by 2002:adf:f386:0:b0:220:44e9:ea5 with SMTP id m6-20020adff386000000b0022044e90ea5mr2530945wro.555.1659653585234; Thu, 04 Aug 2022 15:53:05 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:53:04 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Dmitry Torokhov , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK , TOUCHSCREEN)...), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v5 29/33] Input: sun4i-ts - switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:45 +0200 Message-Id: <20220804224349.1926752-30-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: Dmitry Torokhov Acked-by: Jernej Skrabec Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/input/touchscreen/sun4i-ts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscre= en/sun4i-ts.c index 742a7e96c1b5..73eb8f80be6e 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -192,12 +192,12 @@ static int sun4i_get_temp(const struct sun4i_ts_data = *ts, int *temp) return 0; } =20 -static int sun4i_get_tz_temp(void *data, int *temp) +static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp) { - return sun4i_get_temp(data, temp); + return sun4i_get_temp(tz->devdata, temp); } =20 -static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops =3D { +static const struct thermal_zone_device_ops sun4i_ts_tz_ops =3D { .get_temp =3D sun4i_get_tz_temp, }; =20 @@ -356,8 +356,8 @@ static int sun4i_ts_probe(struct platform_device *pdev) if (IS_ERR(hwmon)) return PTR_ERR(hwmon); =20 - thermal =3D devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, - &sun4i_ts_tz_ops); + thermal =3D devm_thermal_of_zone_register(ts->dev, 0, ts, + &sun4i_ts_tz_ops); if (IS_ERR(thermal)) return PTR_ERR(thermal); =20 --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 422BDC25B08 for ; Thu, 4 Aug 2022 22:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240181AbiHDW4R (ORCPT ); Thu, 4 Aug 2022 18:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240290AbiHDWyv (ORCPT ); Thu, 4 Aug 2022 18:54:51 -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 0195A71BFB for ; Thu, 4 Aug 2022 15:53:08 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id bv3so1356967wrb.5 for ; Thu, 04 Aug 2022 15:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Y6LxKgZwFvrUFcWeNV79IxBK5DkuqAc3CHWOKwe+2Kg=; b=Id7pKweYUatJROorXv8gDRF6wOlhQYhoHYCgkiawGsi5z1/06p2q/2zVrrHjJJLL4+ cJfswWG9mCrhUj4ZKuNWoNX+fC3638GGqxxqmIHqJuDNziuEQDGjr1cuz2jISKJ/+Pzg SsYoEZKBeEUadva58HJM/00F5Gh0GPeOXzh8JeMgu4SsRXGxwRBnpLCuo/oc96bWpYzI ySepH49uraSqsJ6f9l/pvVNlVjG7QMvT/1ouzlRSMPHFQfNzDQDmzcG0wO75Dr7zSxOE squ2SZkwzow4QkW3fPr4qWvxZcpQp9QhCeRFPWDXYmHYQFmouYPcmcEv6srclO7gAg41 wF0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Y6LxKgZwFvrUFcWeNV79IxBK5DkuqAc3CHWOKwe+2Kg=; b=qWUcNH2IEw/+AZI05djnSbpK3y3TwpZNHVflaNcQZlYaYmIOpscyyLydIt2neZLcyI iqTVXOFQ5Re8myPyThm+XKVUndsc+mUAFpelBH20hwp117WvCWKY2Q++ujGEsA4hXFl2 VvxHlwfXetyM8lbB3VeQgHR/x+wnCaFCPBn72mWvy5FVQoEgbPsH5+1GHKgekVeu6aBS 6btghIYDEwjIdiD/GsLObKGhwnnuZrNTRW53cLkpwnMlEIun57gK7OWua8qbljyubQRK vkIQcNeeS+XEp8bNvdnRrlKFU89JR11fO6CcgRV7QQyC+M15YjoYFgvJHPF7kbAhSz1n H63Q== X-Gm-Message-State: ACgBeo2H6yqlyhd5PxCoW8GbrAFOq23ifNRLqDHZEMtxEaHjLUf/x/lx FfjT+FhOQRFEybqLNujoKHB7VA== X-Google-Smtp-Source: AA6agR6C7kB9euhycbz6D2Hp/WjyYK2+u2NklN5QEy26sFT93OJIpIYnk3FMTGQ8ir7oO6wiI2oZYA== X-Received: by 2002:adf:efc3:0:b0:21f:15aa:1b40 with SMTP id i3-20020adfefc3000000b0021f15aa1b40mr2560700wrp.159.1659653587248; Thu, 04 Aug 2022 15:53:07 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:53:06 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Liam Girdwood Subject: [PATCH v5 30/33] regulator/drivers/max8976: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:46 +0200 Message-Id: <20220804224349.1926752-31-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Acked-by: Mark Brown Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/regulator/max8973-regulator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8= 973-regulator.c index cb7e50003f70..61211c462b1a 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -447,9 +447,9 @@ static int max8973_init_dcdc(struct max8973_chip *max, return ret; } =20 -static int max8973_thermal_read_temp(void *data, int *temp) +static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *= temp) { - struct max8973_chip *mchip =3D data; + struct max8973_chip *mchip =3D tz->devdata; unsigned int val; int ret; =20 @@ -478,7 +478,7 @@ static irqreturn_t max8973_thermal_irq(int irq, void *d= ata) return IRQ_HANDLED; } =20 -static const struct thermal_zone_of_device_ops max77621_tz_ops =3D { +static const struct thermal_zone_device_ops max77621_tz_ops =3D { .get_temp =3D max8973_thermal_read_temp, }; =20 @@ -492,8 +492,8 @@ static int max8973_thermal_init(struct max8973_chip *mc= hip) if (mchip->id !=3D MAX77621) return 0; =20 - tzd =3D devm_thermal_zone_of_sensor_register(mchip->dev, 0, mchip, - &max77621_tz_ops); + tzd =3D devm_thermal_of_zone_register(mchip->dev, 0, mchip, + &max77621_tz_ops); if (IS_ERR(tzd)) { ret =3D PTR_ERR(tzd); dev_err(mchip->dev, "Failed to register thermal sensor: %d\n", --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 7349EC25B07 for ; Thu, 4 Aug 2022 22:56:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240280AbiHDW4V (ORCPT ); Thu, 4 Aug 2022 18:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240194AbiHDWyz (ORCPT ); Thu, 4 Aug 2022 18:54:55 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1690672EC7 for ; Thu, 4 Aug 2022 15:53:09 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id v3so1429386wrp.0 for ; Thu, 04 Aug 2022 15:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=xUX4AQdo9GYJmtYjB+hfDgjJZM4lq/oFDHVqWDRlU7w=; b=OsYA087HggoOVIxGhpRtZt/GnLwNF1z+Q+oLgZ4Ingx+0fIGANLidXptXIYeXAD3Es aJfk5G8kwhFZcgS2TBdK/STTqiPa+YngQnqqdpyr5wKstqckYS59KB7UuXoVLjVdAlt/ 0lm6Se/D3cpF50+Dgr8h5utAJTFsrZb/bMHlRCcAzQxUKnD9qLdYAerlaJfyuWWzfuVT PtQ2nPNxfz9oM4+04oYlUMs59E1ATmMKxWQosifIRLG8JNflzyMuMQTfxlsEiGUKko5h mlqnMXc5sbDH7hNG/EuYDJeDSLCoXeDjIqH3Stw16ApAs17RRPshOwLAjv8f6P20Pm8n hcGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=xUX4AQdo9GYJmtYjB+hfDgjJZM4lq/oFDHVqWDRlU7w=; b=X3lSVV/njwXZWYsZomPcFx7gG7g++9OTBzmKy3PKTC8X4TItqh/pLGq199lXFZItG5 cuKpoTAWTE3mHpCsBv8iJnDWiOX9ADftQm5lHMrlma1LIFhyJSlik6dAFcwRdr/wA0dz 72EmGN7XjHj8a6ojHXm9CA7k2Zxwf1Bf7zau9KawF3QtmjaYL1H1q++bBYlih+0UYM81 CExn4TAK2vUnwOqV/sCHBYA/ztso2Z/cwpIPnhp3SJvxYThSAPjgRSxxEyyy/KDlURXy yFuw3BkGmcjr2LBLFUpZz7NjITWoMkFZp47vuwqkylkrjNhWCc4ocaoFBpmkPN+A50HP 7l6Q== X-Gm-Message-State: ACgBeo339al0CazDiLw0E/XHtVTvW9MNclgNMZ9WNTEZSZ2FmGYqLpOm BycfN+YmgjL/1PBHYOOyfsy9Kw== X-Google-Smtp-Source: AA6agR4bSUevL2Ruhn1zVM5mgDq9+HwcUAW2lcA6dLdUlzLdc2PrF29c7CQETsT9jN0w2yGEJDO5ug== X-Received: by 2002:a5d:560d:0:b0:21f:1619:ba0 with SMTP id l13-20020a5d560d000000b0021f16190ba0mr2586639wrv.318.1659653589491; Thu, 04 Aug 2022 15:53:09 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:53:09 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Amit Kucheria , Alim Akhtar , linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES) Subject: [PATCH v5 31/33] thermal/drivers/samsung: Switch to new of thermal API Date: Fri, 5 Aug 2022 00:43:47 +0200 Message-Id: <20220804224349.1926752-32-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano Reviewed-by: Krzysztof Kozlowski Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/samsung/exynos_tmu.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung= /exynos_tmu.c index f4ab4c5b4b62..51874d0a284c 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_device *tz, int te= mp) { return -EINVAL; } #endif /* CONFIG_THERMAL_EMULATION */ =20 @@ -997,7 +997,7 @@ static int exynos_map_dt_data(struct platform_device *p= dev) return 0; } =20 -static const struct thermal_zone_of_device_ops exynos_sensor_ops =3D { +static const struct thermal_zone_device_ops exynos_sensor_ops =3D { .get_temp =3D exynos_get_temp, .set_emul_temp =3D exynos_tmu_set_emulation, }; @@ -1091,8 +1091,8 @@ static int exynos_tmu_probe(struct platform_device *p= dev) * data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd =3D thermal_zone_of_sensor_register(&pdev->dev, 0, data, - &exynos_sensor_ops); + data->tzd =3D devm_thermal_of_zone_register(&pdev->dev, 0, data, + &exynos_sensor_ops); if (IS_ERR(data->tzd)) { ret =3D PTR_ERR(data->tzd); if (ret !=3D -EPROBE_DEFER) @@ -1104,21 +1104,19 @@ static int exynos_tmu_probe(struct platform_device = *pdev) ret =3D exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_thermal; + goto err_sclk; } =20 ret =3D devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - goto err_thermal; + goto err_sclk; } =20 exynos_tmu_control(pdev, true); return 0; =20 -err_thermal: - thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); err_sclk: clk_disable_unprepare(data->sclk); err_clk: @@ -1136,9 +1134,7 @@ static int exynos_tmu_probe(struct platform_device *p= dev) static int exynos_tmu_remove(struct platform_device *pdev) { struct exynos_tmu_data *data =3D platform_get_drvdata(pdev); - struct thermal_zone_device *tzd =3D data->tzd; =20 - thermal_zone_of_sensor_unregister(&pdev->dev, tzd); exynos_tmu_control(pdev, false); =20 clk_disable_unprepare(data->sclk); --=20 2.25.1 From nobody Sat Apr 11 21:14:18 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 D8F51C25B06 for ; Thu, 4 Aug 2022 22:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240318AbiHDW4a (ORCPT ); Thu, 4 Aug 2022 18:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240186AbiHDWzc (ORCPT ); Thu, 4 Aug 2022 18:55:32 -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 EF23C71BEC for ; Thu, 4 Aug 2022 15:53:13 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id q30so1318567wra.11 for ; Thu, 04 Aug 2022 15:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=NA8ooyNHoaigd+w7aJNo47HL4zS61/xJOAD4qh1CGLU=; b=FKX9Z3lu5p9+zkxIPUhM8w/C+z3omPAZDXnCqkhm/HhFv+gh13aDbT05TjJA3ILAbk ZOFjwZyB4Y5xrz5OKqNYQFIIA6F7zmwDh1bIyHOVcbEYOSyd52vjA6leaJ9fsYXafaQ/ XOYlTZuAGiACFmVbrLcSq8Bjz/kB5+1YOg+YbG27XJv0phaWr5J6UtyKz94hHIjEtclY KziHlXU0EivRamGugK/H48E9H4aEFsmbSZGWBi2cwYJECDcO7zwOu1pjxUIsB0GrdCO5 aoI7kqavYh6mtfC216jlPD5IZR6Ve6go9A3xpozyplhzO17cEat57RAMfjMzwiJQ97UQ GWWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=NA8ooyNHoaigd+w7aJNo47HL4zS61/xJOAD4qh1CGLU=; b=tbjv7FRbhESLwromDU1okCYAO5hQeHjJ26VxgXJTUwFoG5OdJvhiQuw/3o6uUi3p2F +zTt1++eGsJzI2wvNoyNWEYvtPA2YEBbpVcxzX/SzX1Q8HI389fR34lzd1PTDS5OFbuI 5xHjAuRjYakZKtDcrDkWuQ+QZV5/91YIp6gof8OZjzqTDgiJGB6rKYF8Umgg1xAeYRK/ 8TzfoRuIwpuwIcbP6FMfY+0ML5hZMJ3o8lPXhoYpdQFvHiO77i7c6JB844iUG2AOxuuo jsFzA+AuarXqZLGHUfrMgdRptWTKrY/eqCoQ6kHUR675GV4PdGwJJuAsTqx8zFLykl/V Y6yw== X-Gm-Message-State: ACgBeo02izBwrVerP5W1IPLyWoqDa+wlGy0TMhrGrT9/JBDigJHUfvvg FJO4bkxpDrtiCSZZaEGWmz2ZKg== X-Google-Smtp-Source: AA6agR7ho7QImhaAw1LcxS3fxp/Cg3TdgRBKRAy6d/Xa2F8/R1HTHGhUfKjZTQ9Ff/1SdIr/2zoEwQ== X-Received: by 2002:adf:fc47:0:b0:220:5f01:6a10 with SMTP id e7-20020adffc47000000b002205f016a10mr2653829wrs.7.1659653591566; Thu, 04 Aug 2022 15:53:11 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:53:11 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 32/33] thermal/core: Move set_trip_temp ops to the sysfs code Date: Fri, 5 Aug 2022 00:43:48 +0200 Message-Id: <20220804224349.1926752-33-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 Acked-by: for the hwmon patches in this series until it is guaranteed --- 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 07bde07ddc04..403064fed438 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 11 21:14:18 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 58D96C25B06 for ; Thu, 4 Aug 2022 22:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240373AbiHDW4f (ORCPT ); Thu, 4 Aug 2022 18:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240408AbiHDWze (ORCPT ); Thu, 4 Aug 2022 18:55:34 -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 8D7A574DD1 for ; Thu, 4 Aug 2022 15:53:15 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso3172969wma.2 for ; Thu, 04 Aug 2022 15:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=SaWI06cWFQKgmERnibE1OWNcLwwTzmBHUDxX+/AClv8=; b=EwGY4yYAMgcyrhodebPiLYA95LucgFex9xQyyi/NHpZKCFdX89Oz+NM5mqVf8FIpr6 F53WlgDUPQXreM68613Ge9n0fAwavJkw9+tPeDG51fFSQUUvzB/+6GhaO+nxfx8DDX92 bbenr1LY7e2e2KYIANWYvOVGOpCV4ZyN5FsAc5mVFR+brBdhk0NyQEq6xm67+0XmKR/y lEedbTAbYVa8ZWwgyuXwAqAmGXN67pvYKcsaNmmClt+lWMqIX/ZHiTti0P6ekjqWxkGw AYg04hVxsSaCam925PCbOu9/KNdux1ZeUKQAlXS727Cvcy1S4UhkxCSdaAMvL28GbYGT IMJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=SaWI06cWFQKgmERnibE1OWNcLwwTzmBHUDxX+/AClv8=; b=rPtYx4Shjg1BXS2LpcYuRGLWYkI77wnS71YAtFQsME7qLTKBn8iQsmRqxlZO6yawe7 8j0M0855i+lSh7iHZMcn3BiFfgh1VwKFXYu7TJqhncQqlcA+HLhy6biXwvqhvjH8dEaf rCaa13A1whGgFopIGdCz3jcDZHvQ4lS8p56X99+GdgHDsJj87OoohYvSUTzSfgVB/R3o E6f4Ljwl8L4Zfo5hm7wJSN5m74Q7YljADB+157837HlrbWHHBGo6ZPIrCOVMHDoxPsIp +KhxEiMFakTEJTz6Ok7x0qGDPef2erHCj1W5REFBur/XC5EmITxnSwJOoLeeXUmfy94P 91Ow== X-Gm-Message-State: ACgBeo29Y5dHiZPCPoM+MbfKUwXzj3G26GbiG+QBKnQrSkTPJsl52qV9 a2Ux+c9mtmR/e2GDA7yyxbOe1A== X-Google-Smtp-Source: AA6agR62IMIgIGGGAdHSXEDOd69LuvukfCPJeLYvzYmvMTjmeGx8PXE51CdIV+ayFcbE9wOfWgN/qg== X-Received: by 2002:a05:600c:3553:b0:3a3:2b65:299e with SMTP id i19-20020a05600c355300b003a32b65299emr7297769wmq.145.1659653593881; Thu, 04 Aug 2022 15:53:13 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:31aa:ed2c:3f7:19d]) by smtp.gmail.com with ESMTPSA id a16-20020a056000051000b0021f87e8945asm2495906wrf.12.2022.08.04.15.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 15:53:13 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v5 33/33] thermal/of: Remove old OF code Date: Fri, 5 Aug 2022 00:43:49 +0200 Message-Id: <20220804224349.1926752-34-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804224349.1926752-1-daniel.lezcano@linexp.org> References: <20220804224349.1926752-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" All the drivers are converted to the new OF API, remove the old OF code. Signed-off-by: Daniel Lezcano Acked-by: for the hwmon patches in this series until it is guaranteed --- drivers/thermal/thermal_core.h | 2 - drivers/thermal/thermal_of.c | 810 +-------------------------------- include/linux/thermal.h | 77 +--- 3 files changed, 16 insertions(+), 873 deletions(-) diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index c991bb290512..2241d2dce017 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -135,13 +135,11 @@ thermal_cooling_device_stats_update(struct thermal_co= oling_device *cdev, =20 /* device tree support */ #ifdef CONFIG_THERMAL_OF -int of_parse_thermal_zones(void); int of_thermal_get_ntrips(struct thermal_zone_device *); bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); const struct thermal_trip * of_thermal_get_trip_points(struct thermal_zone_device *); #else -static inline int of_parse_thermal_zones(void) { return 0; } static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) { return 0; diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 403064fed438..4a036129ae5e 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -19,93 +19,6 @@ =20 #include "thermal_core.h" =20 -/*** Private data structures to represent thermal device tree data ***/ - -/** - * struct __thermal_cooling_bind_param - a cooling device for a trip point - * @cooling_device: a pointer to identify the referred cooling device - * @min: minimum cooling state used at this trip point - * @max: maximum cooling state used at this trip point - */ - -struct __thermal_cooling_bind_param { - struct device_node *cooling_device; - unsigned long min; - unsigned long max; -}; - -/** - * struct __thermal_bind_params - a match between trip and cooling device - * @tcbp: a pointer to an array of cooling devices - * @count: number of elements in array - * @trip_id: the trip point index - * @usage: the percentage (from 0 to 100) of cooling contribution - */ - -struct __thermal_bind_params { - struct __thermal_cooling_bind_param *tcbp; - unsigned int count; - unsigned int trip_id; - unsigned int usage; -}; - -/** - * struct __thermal_zone - internal representation of a thermal zone - * @passive_delay: polling interval while passive cooling is activated - * @polling_delay: zone polling interval - * @slope: slope of the temperature adjustment curve - * @offset: offset of the temperature adjustment curve - * @ntrips: number of trip points - * @trips: an array of trip points (0..ntrips - 1) - * @num_tbps: number of thermal bind params - * @tbps: an array of thermal bind params (0..num_tbps - 1) - * @sensor_data: sensor private data used while reading temperature and tr= end - * @ops: set of callbacks to handle the thermal zone based on DT - */ - -struct __thermal_zone { - int passive_delay; - int polling_delay; - int slope; - int offset; - - /* trip data */ - int ntrips; - struct thermal_trip *trips; - - /* cooling binding data */ - int num_tbps; - struct __thermal_bind_params *tbps; - - /* sensor interface */ - void *sensor_data; - const struct thermal_zone_of_device_ops *ops; -}; - -/*** DT thermal zone device callbacks ***/ - -static int of_thermal_get_temp(struct thermal_zone_device *tz, - int *temp) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->get_temp) - return -EINVAL; - - return data->ops->get_temp(data->sensor_data, temp); -} - -static int of_thermal_set_trips(struct thermal_zone_device *tz, - int low, int high) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->set_trips) - return -EINVAL; - - return data->ops->set_trips(data->sensor_data, low, high); -} - /** * of_thermal_get_ntrips - function to export number of available trip * points. @@ -158,114 +71,6 @@ of_thermal_get_trip_points(struct thermal_zone_device = *tz) } EXPORT_SYMBOL_GPL(of_thermal_get_trip_points); =20 -/** - * of_thermal_set_emul_temp - function to set emulated temperature - * - * @tz: pointer to a thermal zone - * @temp: temperature to set - * - * This function gives the ability to set emulated value of temperature, - * which is handy for debugging - * - * Return: zero on success, error code otherwise - */ -static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, - int temp) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->set_emul_temp) - return -EINVAL; - - return data->ops->set_emul_temp(data->sensor_data, temp); -} - -static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, - enum thermal_trend *trend) -{ - struct __thermal_zone *data =3D tz->devdata; - - if (!data->ops || !data->ops->get_trend) - return -EINVAL; - - return data->ops->get_trend(data->sensor_data, trip, trend); -} - -static int of_thermal_change_mode(struct thermal_zone_device *tz, - enum thermal_device_mode mode) -{ - struct __thermal_zone *data =3D tz->devdata; - - return data->ops->change_mode(data->sensor_data, mode); -} - -static int of_thermal_bind(struct thermal_zone_device *thermal, - struct thermal_cooling_device *cdev) -{ - struct __thermal_zone *data =3D thermal->devdata; - struct __thermal_bind_params *tbp; - struct __thermal_cooling_bind_param *tcbp; - int i, j; - - if (!data || IS_ERR(data)) - return -ENODEV; - - /* find where to bind */ - for (i =3D 0; i < data->num_tbps; i++) { - tbp =3D data->tbps + i; - - for (j =3D 0; j < tbp->count; j++) { - tcbp =3D tbp->tcbp + j; - - if (tcbp->cooling_device =3D=3D cdev->np) { - int ret; - - ret =3D thermal_zone_bind_cooling_device(thermal, - tbp->trip_id, cdev, - tcbp->max, - tcbp->min, - tbp->usage); - if (ret) - return ret; - } - } - } - - return 0; -} - -static int of_thermal_unbind(struct thermal_zone_device *thermal, - struct thermal_cooling_device *cdev) -{ - struct __thermal_zone *data =3D thermal->devdata; - struct __thermal_bind_params *tbp; - struct __thermal_cooling_bind_param *tcbp; - int i, j; - - if (!data || IS_ERR(data)) - return -ENODEV; - - /* find where to unbind */ - for (i =3D 0; i < data->num_tbps; i++) { - tbp =3D data->tbps + i; - - for (j =3D 0; j < tbp->count; j++) { - tcbp =3D tbp->tcbp + j; - - if (tcbp->cooling_device =3D=3D cdev->np) { - int ret; - - ret =3D thermal_zone_unbind_cooling_device(thermal, - tbp->trip_id, cdev); - if (ret) - return ret; - } - } - } - - return 0; -} - static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int tr= ip, enum thermal_trip_type *type) { @@ -325,61 +130,6 @@ static int of_thermal_get_crit_temp(struct thermal_zon= e_device *tz, return -EINVAL; } =20 -static struct thermal_zone_device_ops of_thermal_ops =3D { - .get_trip_type =3D of_thermal_get_trip_type, - .get_trip_temp =3D of_thermal_get_trip_temp, - .get_trip_hyst =3D of_thermal_get_trip_hyst, - .set_trip_hyst =3D of_thermal_set_trip_hyst, - .get_crit_temp =3D of_thermal_get_crit_temp, - - .bind =3D of_thermal_bind, - .unbind =3D of_thermal_unbind, -}; - -/*** sensor API ***/ - -static struct thermal_zone_device * -thermal_zone_of_add_sensor(struct device_node *zone, - struct device_node *sensor, void *data, - const struct thermal_zone_of_device_ops *ops) -{ - struct thermal_zone_device *tzd; - struct __thermal_zone *tz; - - tzd =3D thermal_zone_get_zone_by_name(zone->name); - if (IS_ERR(tzd)) - return ERR_PTR(-EPROBE_DEFER); - - tz =3D tzd->devdata; - - if (!ops) - return ERR_PTR(-EINVAL); - - mutex_lock(&tzd->lock); - tz->ops =3D ops; - tz->sensor_data =3D data; - - tzd->ops->get_temp =3D of_thermal_get_temp; - tzd->ops->get_trend =3D of_thermal_get_trend; - - /* - * The thermal zone core will calculate the window if they have set the - * optional set_trips pointer. - */ - if (ops->set_trips) - tzd->ops->set_trips =3D of_thermal_set_trips; - - if (ops->set_emul_temp) - tzd->ops->set_emul_temp =3D of_thermal_set_emul_temp; - - if (ops->change_mode) - tzd->ops->change_mode =3D of_thermal_change_mode; - - mutex_unlock(&tzd->lock); - - return tzd; -} - /** * thermal_zone_of_get_sensor_id - get sensor ID from a DT thermal zone * @tz_np: a valid thermal zone device node. @@ -424,216 +174,6 @@ int thermal_zone_of_get_sensor_id(struct device_node = *tz_np, } EXPORT_SYMBOL_GPL(thermal_zone_of_get_sensor_id); =20 -/** - * thermal_zone_of_sensor_register - registers a sensor to a DT thermal zo= ne - * @dev: a valid struct device pointer of a sensor device. Must contain - * a valid .of_node, for the sensor node. - * @sensor_id: a sensor identifier, in case the sensor IP has more - * than one sensors - * @data: a private pointer (owned by the caller) that will be passed - * back, when a temperature reading is needed. - * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_t= emp. - * - * This function will search the list of thermal zones described in device - * tree and look for the zone that refer to the sensor device pointed by - * @dev->of_node as temperature providers. For the zone pointing to the - * sensor node, the sensor will be added to the DT thermal zone device. - * - * The thermal zone temperature is provided by the @get_temp function - * pointer. When called, it will have the private pointer @data back. - * - * The thermal zone temperature trend is provided by the @get_trend functi= on - * pointer. When called, it will have the private pointer @data back. - * - * TODO: - * 01 - This function must enqueue the new sensor instead of using - * it as the only source of temperature values. - * - * 02 - There must be a way to match the sensor with all thermal zones - * that refer to it. - * - * Return: On success returns a valid struct thermal_zone_device, - * otherwise, it returns a corresponding ERR_PTR(). Caller must - * check the return value with help of IS_ERR() helper. - */ -struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *d= ata, - const struct thermal_zone_of_device_ops *ops) -{ - struct device_node *np, *child, *sensor_np; - struct thermal_zone_device *tzd =3D ERR_PTR(-ENODEV); - static int old_tz_initialized; - int ret; - - if (!old_tz_initialized) { - ret =3D of_parse_thermal_zones(); - if (ret) - return ERR_PTR(ret); - old_tz_initialized =3D 1; - } - - np =3D of_find_node_by_name(NULL, "thermal-zones"); - if (!np) - return ERR_PTR(-ENODEV); - - if (!dev || !dev->of_node) { - of_node_put(np); - return ERR_PTR(-ENODEV); - } - - sensor_np =3D of_node_get(dev->of_node); - - for_each_available_child_of_node(np, child) { - int ret, id; - - /* For now, thermal framework supports only 1 sensor per zone */ - ret =3D thermal_zone_of_get_sensor_id(child, sensor_np, &id); - if (ret) - continue; - - if (id =3D=3D sensor_id) { - tzd =3D thermal_zone_of_add_sensor(child, sensor_np, - data, ops); - if (!IS_ERR(tzd)) - thermal_zone_device_enable(tzd); - - of_node_put(child); - goto exit; - } - } -exit: - of_node_put(sensor_np); - of_node_put(np); - - return tzd; -} -EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register); - -/** - * thermal_zone_of_sensor_unregister - unregisters a sensor from a DT ther= mal zone - * @dev: a valid struct device pointer of a sensor device. Must contain - * a valid .of_node, for the sensor node. - * @tzd: a pointer to struct thermal_zone_device where the sensor is regis= tered. - * - * This function removes the sensor callbacks and private data from the - * thermal zone device registered with thermal_zone_of_sensor_register() - * API. It will also silent the zone by remove the .get_temp() and .get_tr= end() - * thermal zone device callbacks. - * - * TODO: When the support to several sensors per zone is added, this - * function must search the sensor list based on @dev parameter. - * - */ -void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tzd) -{ - struct __thermal_zone *tz; - - if (!dev || !tzd || !tzd->devdata) - return; - - tz =3D tzd->devdata; - - /* no __thermal_zone, nothing to be done */ - if (!tz) - return; - - /* stop temperature polling */ - thermal_zone_device_disable(tzd); - - mutex_lock(&tzd->lock); - tzd->ops->get_temp =3D NULL; - tzd->ops->get_trend =3D NULL; - tzd->ops->set_emul_temp =3D NULL; - tzd->ops->change_mode =3D NULL; - - tz->ops =3D NULL; - tz->sensor_data =3D NULL; - mutex_unlock(&tzd->lock); -} -EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_unregister); - -static void devm_thermal_zone_of_sensor_release(struct device *dev, void *= res) -{ - thermal_zone_of_sensor_unregister(dev, - *(struct thermal_zone_device **)res); -} - -static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, - void *data) -{ - struct thermal_zone_device **r =3D res; - - if (WARN_ON(!r || !*r)) - return 0; - - return *r =3D=3D data; -} - -/** - * devm_thermal_zone_of_sensor_register - Resource managed version of - * thermal_zone_of_sensor_register() - * @dev: a valid struct device pointer of a sensor device. Must contain - * a valid .of_node, for the sensor node. - * @sensor_id: a sensor identifier, in case the sensor IP has more - * than one sensors - * @data: a private pointer (owned by the caller) that will be passed - * back, when a temperature reading is needed. - * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_t= emp. - * - * Refer thermal_zone_of_sensor_register() for more details. - * - * Return: On success returns a valid struct thermal_zone_device, - * otherwise, it returns a corresponding ERR_PTR(). Caller must - * check the return value with help of IS_ERR() helper. - * Registered thermal_zone_device device will automatically be - * released when device is unbounded. - */ -struct thermal_zone_device *devm_thermal_zone_of_sensor_register( - struct device *dev, int sensor_id, - void *data, const struct thermal_zone_of_device_ops *ops) -{ - struct thermal_zone_device **ptr, *tzd; - - ptr =3D devres_alloc(devm_thermal_zone_of_sensor_release, sizeof(*ptr), - GFP_KERNEL); - if (!ptr) - return ERR_PTR(-ENOMEM); - - tzd =3D thermal_zone_of_sensor_register(dev, sensor_id, data, ops); - if (IS_ERR(tzd)) { - devres_free(ptr); - return tzd; - } - - *ptr =3D tzd; - devres_add(dev, ptr); - - return tzd; -} -EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register); - -/** - * devm_thermal_zone_of_sensor_unregister - Resource managed version of - * thermal_zone_of_sensor_unregister(). - * @dev: Device for which which resource was allocated. - * @tzd: a pointer to struct thermal_zone_device where the sensor is regis= tered. - * - * This function removes the sensor callbacks and private data from the - * thermal zone device registered with devm_thermal_zone_of_sensor_registe= r() - * API. It will also silent the zone by remove the .get_temp() and .get_tr= end() - * thermal zone device callbacks. - * Normally this function will not need to be called and the resource - * management code will ensure that the resource is freed. - */ -void devm_thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tzd) -{ - WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, - devm_thermal_zone_of_sensor_match, tzd)); -} -EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_unregister); - /*** functions parsing device tree nodes ***/ =20 static int of_find_trip_id(struct device_node *np, struct device_node *tri= p) @@ -665,98 +205,6 @@ static int of_find_trip_id(struct device_node *np, str= uct device_node *trip) return i; } =20 -/** - * thermal_of_populate_bind_params - parse and fill cooling map data - * @np: DT node containing a cooling-map node - * @__tbp: data structure to be filled with cooling map info - * @trips: array of thermal zone trip points - * @ntrips: number of trip points inside trips. - * - * This function parses a cooling-map type of node represented by - * @np parameter and fills the read data into @__tbp data structure. - * It needs the already parsed array of trip points of the thermal zone - * in consideration. - * - * Return: 0 on success, proper error code otherwise - */ -static int thermal_of_populate_bind_params(struct device_node *tz_np, - struct device_node *np, - struct __thermal_bind_params *__tbp) -{ - struct of_phandle_args cooling_spec; - struct __thermal_cooling_bind_param *__tcbp; - struct device_node *trip; - int ret, i, count; - int trip_id; - u32 prop; - - /* Default weight. Usage is optional */ - __tbp->usage =3D THERMAL_WEIGHT_DEFAULT; - ret =3D of_property_read_u32(np, "contribution", &prop); - if (ret =3D=3D 0) - __tbp->usage =3D prop; - - trip =3D of_parse_phandle(np, "trip", 0); - if (!trip) { - pr_err("missing trip property\n"); - return -ENODEV; - } - - trip_id =3D of_find_trip_id(tz_np, trip); - if (trip_id < 0) { - ret =3D trip_id; - goto end; - } - - __tbp->trip_id =3D trip_id; - - count =3D of_count_phandle_with_args(np, "cooling-device", - "#cooling-cells"); - if (count <=3D 0) { - pr_err("Add a cooling_device property with at least one device\n"); - ret =3D -ENOENT; - goto end; - } - - __tcbp =3D kcalloc(count, sizeof(*__tcbp), GFP_KERNEL); - if (!__tcbp) { - ret =3D -ENOMEM; - goto end; - } - - for (i =3D 0; i < count; i++) { - ret =3D of_parse_phandle_with_args(np, "cooling-device", - "#cooling-cells", i, &cooling_spec); - if (ret < 0) { - pr_err("Invalid cooling-device entry\n"); - goto free_tcbp; - } - - __tcbp[i].cooling_device =3D cooling_spec.np; - - if (cooling_spec.args_count >=3D 2) { /* at least min and max */ - __tcbp[i].min =3D cooling_spec.args[0]; - __tcbp[i].max =3D cooling_spec.args[1]; - } else { - pr_err("wrong reference to cooling device, missing limits\n"); - } - } - - __tbp->tcbp =3D __tcbp; - __tbp->count =3D count; - - goto end; - -free_tcbp: - for (i =3D i - 1; i >=3D 0; i--) - of_node_put(__tcbp[i].cooling_device); - kfree(__tcbp); -end: - of_node_put(trip); - - return ret; -} - /* * It maps 'enum thermal_trip_type' found in include/linux/thermal.h * into the device tree binding of 'trip', property type. @@ -873,174 +321,6 @@ static struct thermal_trip *thermal_of_trips_init(str= uct device_node *np, int *n return ERR_PTR(ret); } =20 -/** - * thermal_of_build_thermal_zone - parse and fill one thermal zone data - * @np: DT node containing a thermal zone node - * - * This function parses a thermal zone type of node represented by - * @np parameter and fills the read data into a __thermal_zone data struct= ure - * and return this pointer. - * - * TODO: Missing properties to parse: thermal-sensor-names - * - * Return: On success returns a valid struct __thermal_zone, - * otherwise, it returns a corresponding ERR_PTR(). Caller must - * check the return value with help of IS_ERR() helper. - */ -static struct __thermal_zone -__init *thermal_of_build_thermal_zone(struct device_node *np) -{ - struct device_node *child =3D NULL, *gchild; - struct __thermal_zone *tz; - int ret, i; - u32 prop, coef[2]; - - if (!np) { - pr_err("no thermal zone np\n"); - return ERR_PTR(-EINVAL); - } - - tz =3D kzalloc(sizeof(*tz), GFP_KERNEL); - if (!tz) - return ERR_PTR(-ENOMEM); - - ret =3D of_property_read_u32(np, "polling-delay-passive", &prop); - if (ret < 0) { - pr_err("%pOFn: missing polling-delay-passive property\n", np); - goto free_tz; - } - tz->passive_delay =3D prop; - - ret =3D of_property_read_u32(np, "polling-delay", &prop); - if (ret < 0) { - pr_err("%pOFn: missing polling-delay property\n", np); - goto free_tz; - } - tz->polling_delay =3D prop; - - /* - * REVIST: for now, the thermal framework supports only - * one sensor per thermal zone. Thus, we are considering - * only the first two values as slope and offset. - */ - ret =3D of_property_read_u32_array(np, "coefficients", coef, 2); - if (ret =3D=3D 0) { - tz->slope =3D coef[0]; - tz->offset =3D coef[1]; - } else { - tz->slope =3D 1; - tz->offset =3D 0; - } - - tz->trips =3D thermal_of_trips_init(np, &tz->ntrips); - if (IS_ERR(tz->trips)) { - ret =3D PTR_ERR(tz->trips); - goto finish; - } - - /* cooling-maps */ - child =3D of_get_child_by_name(np, "cooling-maps"); - - /* cooling-maps not provided */ - if (!child) - goto finish; - - tz->num_tbps =3D of_get_child_count(child); - if (tz->num_tbps =3D=3D 0) - goto finish; - - tz->tbps =3D kcalloc(tz->num_tbps, sizeof(*tz->tbps), GFP_KERNEL); - if (!tz->tbps) { - ret =3D -ENOMEM; - goto free_trips; - } - - i =3D 0; - for_each_child_of_node(child, gchild) { - ret =3D thermal_of_populate_bind_params(np, gchild, &tz->tbps[i++]); - if (ret) { - of_node_put(gchild); - goto free_tbps; - } - } - -finish: - of_node_put(child); - - return tz; - -free_tbps: - for (i =3D i - 1; i >=3D 0; i--) { - struct __thermal_bind_params *tbp =3D tz->tbps + i; - int j; - - for (j =3D 0; j < tbp->count; j++) - of_node_put(tbp->tcbp[j].cooling_device); - - kfree(tbp->tcbp); - } - - kfree(tz->tbps); -free_trips: - kfree(tz->trips); -free_tz: - kfree(tz); - of_node_put(child); - - return ERR_PTR(ret); -} - -static void of_thermal_free_zone(struct __thermal_zone *tz) -{ - struct __thermal_bind_params *tbp; - int i, j; - - for (i =3D 0; i < tz->num_tbps; i++) { - tbp =3D tz->tbps + i; - - for (j =3D 0; j < tbp->count; j++) - of_node_put(tbp->tcbp[j].cooling_device); - - kfree(tbp->tcbp); - } - - kfree(tz->tbps); - kfree(tz->trips); - kfree(tz); -} - -/** - * of_thermal_destroy_zones - remove all zones parsed and allocated resour= ces - * - * Finds all zones parsed and added to the thermal framework and remove th= em - * from the system, together with their resources. - * - */ -static __init void of_thermal_destroy_zones(void) -{ - struct device_node *np, *child; - - np =3D of_find_node_by_name(NULL, "thermal-zones"); - if (!np) { - pr_debug("unable to find thermal zones\n"); - return; - } - - for_each_available_child_of_node(np, child) { - struct thermal_zone_device *zone; - - zone =3D thermal_zone_get_zone_by_name(child->name); - if (IS_ERR(zone)) - continue; - - thermal_zone_device_unregister(zone); - kfree(zone->tzp); - kfree(zone->ops); - of_thermal_free_zone(zone->devdata); - } - of_node_put(np); -} - static struct device_node *of_thermal_zone_find(struct device_node *sensor= , int id) { struct device_node *np, *tz; @@ -1486,95 +766,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); */ void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz) { - WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, + WARN_ON(devres_release(dev, devm_thermal_of_zone_release, devm_thermal_of_zone_match, tz)); } EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); - -/** - * of_parse_thermal_zones - parse device tree thermal data - * - * Initialization function that can be called by machine initialization - * code to parse thermal data and populate the thermal framework - * with hardware thermal zones info. This function only parses thermal zon= es. - * Cooling devices and sensor devices nodes are supposed to be parsed - * by their respective drivers. - * - * Return: 0 on success, proper error code otherwise - * - */ -int of_parse_thermal_zones(void) -{ - struct device_node *np, *child; - struct __thermal_zone *tz; - struct thermal_zone_device_ops *ops; - - np =3D of_find_node_by_name(NULL, "thermal-zones"); - if (!np) { - pr_debug("unable to find thermal zones\n"); - return 0; /* Run successfully on systems without thermal DT */ - } - - for_each_available_child_of_node(np, child) { - struct thermal_zone_device *zone; - struct thermal_zone_params *tzp; - int i, mask =3D 0; - u32 prop; - - tz =3D thermal_of_build_thermal_zone(child); - if (IS_ERR(tz)) { - pr_err("failed to build thermal zone %pOFn: %ld\n", - child, - PTR_ERR(tz)); - continue; - } - - ops =3D kmemdup(&of_thermal_ops, sizeof(*ops), GFP_KERNEL); - if (!ops) - goto exit_free; - - tzp =3D kzalloc(sizeof(*tzp), GFP_KERNEL); - if (!tzp) { - kfree(ops); - goto exit_free; - } - - /* No hwmon because there might be hwmon drivers registering */ - tzp->no_hwmon =3D true; - - if (!of_property_read_u32(child, "sustainable-power", &prop)) - tzp->sustainable_power =3D prop; - - for (i =3D 0; i < tz->ntrips; i++) - mask |=3D 1 << i; - - /* these two are left for temperature drivers to use */ - tzp->slope =3D tz->slope; - tzp->offset =3D tz->offset; - - zone =3D thermal_zone_device_register_with_trips(child->name, tz->trips,= tz->ntrips, - mask, tz, ops, tzp, tz->passive_delay, - tz->polling_delay); - if (IS_ERR(zone)) { - pr_err("Failed to build %pOFn zone %ld\n", child, - PTR_ERR(zone)); - kfree(tzp); - kfree(ops); - of_thermal_free_zone(tz); - /* attempting to build remaining zones still */ - } - } - of_node_put(np); - - return 0; - -exit_free: - of_node_put(child); - of_node_put(np); - of_thermal_free_zone(tz); - - /* no memory available, so free what we have built */ - of_thermal_destroy_zones(); - - return -ENOMEM; -} diff --git a/include/linux/thermal.h b/include/linux/thermal.h index e2ac9d473bd6..86c24ddd5985 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -296,33 +296,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, @@ -335,61 +308,41 @@ void thermal_of_zone_unregister(struct thermal_zone_d= evice *tz); =20 void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz); =20 +void thermal_of_zone_unregister(struct thermal_zone_device *tz); + int thermal_zone_of_get_sensor_id(struct device_node *tz_np, struct device_node *sensor_np, u32 *id); -struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops); -void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz); -struct thermal_zone_device *devm_thermal_zone_of_sensor_register( - struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops); -void devm_thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz); #else - -static inline int thermal_zone_of_get_sensor_id(struct device_node *tz_np, - struct device_node *sensor_np, - u32 *id) -{ - return -ENOENT; -} -static inline struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops) -{ - return ERR_PTR(-ENODEV); -} - static inline -void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz) +struct thermal_zone_device *thermal_of_zone_register(struct device_node *s= ensor, int id, void *data, + const struct thermal_zone_device_ops *ops) { + return ERR_PTR(-ENOTSUPP); } =20 -static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_regi= ster( - struct device *dev, int id, void *data, - const struct thermal_zone_of_device_ops *ops) +static inline +struct thermal_zone_device *devm_thermal_of_zone_register(struct device *d= ev, int id, void *data, + const struct thermal_zone_device_ops *ops) { - return ERR_PTR(-ENODEV); + return ERR_PTR(-ENOTSUPP); } =20 static inline void thermal_of_zone_unregister(struct thermal_zone_device *= tz) { } =20 -static inline void devm_thermal_of_zone_unregister(struct device *dev, str= uct thermal_zone_device *tz) +static inline void devm_thermal_of_zone_unregister(struct device *dev, + struct thermal_zone_device *tz) { } =20 -static inline -void devm_thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz) +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