From patchwork Tue Jan 30 11:12:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768148 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 112BD66B5E; Tue, 30 Jan 2024 11:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613200; cv=none; b=hbk9tC1LPtbNWJNo7ovBwOYvy9mIfmi1EuKepMJuVR+gPapso26JV0FJd1A3KHMx/EitL1I3dsFoi85qyCXIIimzEESI6yIqHm2UoUu0w8012xcrjDXn0y3teYOE0qbCh5fVj84kVrWbH2ja60undy5EAyB1KNbH2RUgS4GHE2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613200; c=relaxed/simple; bh=K9DIWCqRftNmAdLpTI5zlUjzjPBqeZyH/4bsZP2hZCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XhYsd+XyVo2eL/unuwl4dbCkEjEDskx8WmJA4HqamZW1+aep1nx+AL+6xRpIyduesr7XjoeAaKg0NoxkoBtYHUfT06lUT8b0k4p3IEz/VU9FeFTYQfA/6blUx9a3cJ4IkCVYlQTr8ljz1zwj8vmRAnNUJWH+KqGCAtgPMYavYno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Z9tPo+Z7; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Z9tPo+Z7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613196; bh=K9DIWCqRftNmAdLpTI5zlUjzjPBqeZyH/4bsZP2hZCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9tPo+Z7eXCToDiRV5CgFUeD7VDvEgBUavru6Wjyv3bYY3CqzRuXhqFubn01Zg+pG ldrgAOOMyXzZZ0U8z3WbHXRRBPMT9Lsx0kPWyQKwZWJcY3xvegg4jj9/20tnloT03O IWhb9n4qixWGyLN25VoXy4m25qA8tTMTQwGAOsILnwR2rGRSmrpPzQ6ilraDwtOmC0 g6nCHVDVf6sa+qb/D77cFN7CBctxOrisV1MLZGRwlukCMkzdKi4BLVpH2QbwGaHs9z 7brVnKi0PrbmDLRiAKKHYAcNdGIB+5Isk0jxaJw327X4HUwzfzggEfEJeR1Jvs3vBj c6rkSk9IEMlNw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 738AD378208C; Tue, 30 Jan 2024 11:13:14 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 03/18] thermal: Directly use thermal_zone_platform_params for thermal_zone_device Date: Tue, 30 Jan 2024 12:12:35 +0100 Message-ID: <20240130111250.185718-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove all duplicate members from thermal_zone_device and directly use the corresponding ones from struct thermal_zone_platform_params. Please note that this also changes thermal_zone_device's type member from char[THERMAL_NAME_LENGTH] to a const char *pointer, as the only reason for this to not be const was that thermal_core was performing a string copy operation, which is no more. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/gov_user_space.c | 2 +- drivers/thermal/thermal_core.c | 65 ++++++++++++++----------------- drivers/thermal/thermal_core.h | 6 ++- drivers/thermal/thermal_helpers.c | 14 +++---- drivers/thermal/thermal_hwmon.c | 8 ++-- drivers/thermal/thermal_of.c | 12 +++--- drivers/thermal/thermal_sysfs.c | 48 +++++++++++------------ drivers/thermal/thermal_trace.h | 8 ++-- drivers/thermal/thermal_trip.c | 14 +++---- include/linux/thermal.h | 10 ----- 10 files changed, 87 insertions(+), 100 deletions(-) diff --git a/drivers/thermal/gov_user_space.c b/drivers/thermal/gov_user_space.c index 7a1790b7e8f5..905f89f4aa4b 100644 --- a/drivers/thermal/gov_user_space.c +++ b/drivers/thermal/gov_user_space.c @@ -37,7 +37,7 @@ static int notify_user_space(struct thermal_zone_device *tz, lockdep_assert_held(&tz->lock); - thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", tz->type); + thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", tz->tzp->type); thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", tz->temperature); thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=%d", thermal_zone_trip_id(tz, trip)); diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 3150475b947f..5694e2df158e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -75,7 +75,7 @@ static void bind_previous_governor(struct thermal_zone_device *tz, if (tz->governor->bind_to_tz(tz)) { dev_err(&tz->device, "governor %s failed to bind and the previous one (%s) failed to bind again, thermal zone %s has no governor\n", - failed_gov_name, tz->governor->name, tz->type); + failed_gov_name, tz->governor->name, tz->tzp->type); tz->governor = NULL; } } @@ -156,7 +156,7 @@ int thermal_register_governor(struct thermal_governor *governor) if (ret) dev_err(&pos->device, "Failed to set governor %s for thermal zone %s: %d\n", - governor->name, pos->type, ret); + governor->name, pos->tzp->type, ret); } } @@ -327,7 +327,7 @@ static void thermal_zone_device_halt(struct thermal_zone_device *tz, bool shutdo int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS; const char *msg = "Temperature too high"; - dev_emerg(&tz->device, "%s: critical temperature reached\n", tz->type); + dev_emerg(&tz->device, "%s: critical temperature reached\n", tz->tzp->type); if (shutdown) hw_protection_shutdown(msg, poweroff_delay_ms); @@ -356,9 +356,9 @@ static void handle_critical_trips(struct thermal_zone_device *tz, trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, trip), trip->type); if (trip->type == THERMAL_TRIP_CRITICAL) - tz->ops->critical(tz); - else if (tz->ops->hot) - tz->ops->hot(tz); + tz->tzp->ops->critical(tz); + else if (tz->tzp->ops->hot) + tz->tzp->ops->hot(tz); } static void handle_thermal_trip(struct thermal_zone_device *tz, @@ -493,8 +493,8 @@ static int thermal_zone_device_set_mode(struct thermal_zone_device *tz, return ret; } - if (tz->ops->change_mode) - ret = tz->ops->change_mode(tz, mode); + if (tz->tzp->ops->change_mode) + ret = tz->tzp->ops->change_mode(tz, mode); if (!ret) tz->mode = mode; @@ -764,10 +764,10 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, unsigned long upper, unsigned long lower, unsigned int weight) { - if (trip_index < 0 || trip_index >= tz->num_trips) + if (trip_index < 0 || trip_index >= tz->tzp->num_trips) return -EINVAL; - return thermal_bind_cdev_to_trip(tz, &tz->trips[trip_index], cdev, + return thermal_bind_cdev_to_trip(tz, &tz->tzp->trips[trip_index], cdev, upper, lower, weight); } EXPORT_SYMBOL_GPL(thermal_zone_bind_cooling_device); @@ -823,10 +823,10 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, int trip_index, struct thermal_cooling_device *cdev) { - if (trip_index < 0 || trip_index >= tz->num_trips) + if (trip_index < 0 || trip_index >= tz->tzp->num_trips) return -EINVAL; - return thermal_unbind_cdev_from_trip(tz, &tz->trips[trip_index], cdev); + return thermal_unbind_cdev_from_trip(tz, &tz->tzp->trips[trip_index], cdev); } EXPORT_SYMBOL_GPL(thermal_zone_unbind_cooling_device); @@ -858,7 +858,7 @@ void print_bind_err_msg(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev, int ret) { dev_err(&tz->device, "binding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); + tz->tzp->type, cdev->type, ret); } static void bind_cdev(struct thermal_cooling_device *cdev) @@ -867,8 +867,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev) struct thermal_zone_device *pos = NULL; list_for_each_entry(pos, &thermal_tz_list, node) { - if (pos->ops->bind) { - ret = pos->ops->bind(pos, cdev); + if (pos->tzp->ops->bind) { + ret = pos->tzp->ops->bind(pos, cdev); if (ret) print_bind_err_msg(pos, cdev, ret); } @@ -1184,8 +1184,8 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) /* Unbind all thermal zones associated with 'this' cdev */ list_for_each_entry(tz, &thermal_tz_list, node) { - if (tz->ops->unbind) - tz->ops->unbind(tz, cdev); + if (tz->tzp->ops->unbind) + tz->tzp->ops->unbind(tz, cdev); } mutex_unlock(&thermal_list_lock); @@ -1199,13 +1199,13 @@ static void bind_tz(struct thermal_zone_device *tz) int ret; struct thermal_cooling_device *pos = NULL; - if (!tz->ops->bind) + if (!tz->tzp->ops->bind) return; mutex_lock(&thermal_list_lock); list_for_each_entry(pos, &thermal_cdev_list, node) { - ret = tz->ops->bind(tz, pos); + ret = tz->tzp->ops->bind(tz, pos); if (ret) print_bind_err_msg(tz, pos, ret); } @@ -1224,17 +1224,17 @@ int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp) { int i, ret = -EINVAL; - if (tz->ops->get_crit_temp) - return tz->ops->get_crit_temp(tz, temp); + if (tz->tzp->ops->get_crit_temp) + return tz->tzp->ops->get_crit_temp(tz, temp); - if (!tz->trips) + if (!tz->tzp->trips) return -EINVAL; mutex_lock(&tz->lock); - for (i = 0; i < tz->num_trips; i++) { - if (tz->trips[i].type == THERMAL_TRIP_CRITICAL) { - *temp = tz->trips[i].temperature; + for (i = 0; i < tz->tzp->num_trips; i++) { + if (tz->tzp->trips[i].type == THERMAL_TRIP_CRITICAL) { + *temp = tz->tzp->trips[i].temperature; ret = 0; break; } @@ -1417,16 +1417,11 @@ struct thermal_zone_device *thermal_zone_device_register(struct thermal_zone_dev } tz->id = id; - strscpy(tz->type, tzdp->tzp.type, sizeof(tz->type)); if (!tzdp->tzp.ops->critical) tzdp->tzp.ops->critical = thermal_zone_device_critical; - tz->ops = tzdp->tzp.ops; tz->device.class = thermal_class; - tz->devdata = tzdp->tzp.devdata; - tz->trips = tzdp->tzp.trips; - tz->num_trips = tzdp->tzp.num_trips; thermal_set_delay_jiffies(&tz->passive_delay_jiffies, tzdp->tzp.passive_delay); thermal_set_delay_jiffies(&tz->polling_delay_jiffies, tzdp->tzp.polling_delay); @@ -1509,13 +1504,13 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_register); void *thermal_zone_device_priv(struct thermal_zone_device *tzd) { - return tzd->devdata; + return tzd->tzp->devdata; } EXPORT_SYMBOL_GPL(thermal_zone_device_priv); const char *thermal_zone_device_type(struct thermal_zone_device *tzd) { - return tzd->type; + return tzd->tzp->type; } EXPORT_SYMBOL_GPL(thermal_zone_device_type); @@ -1561,8 +1556,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) /* Unbind all cdevs associated with 'this' thermal zone */ list_for_each_entry(cdev, &thermal_cdev_list, node) - if (tz->ops->unbind) - tz->ops->unbind(tz, cdev); + if (tz->tzp->ops->unbind) + tz->tzp->ops->unbind(tz, cdev); mutex_unlock(&thermal_list_lock); @@ -1607,7 +1602,7 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name) mutex_lock(&thermal_list_lock); list_for_each_entry(pos, &thermal_tz_list, node) - if (!strncasecmp(name, pos->type, THERMAL_NAME_LENGTH)) { + if (!strncasecmp(name, pos->tzp->type, THERMAL_NAME_LENGTH)) { found++; ref = pos; } diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index e9c099ecdd0f..b09c23a7a764 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -120,8 +120,10 @@ void thermal_governor_update_tz(struct thermal_zone_device *tz, enum thermal_notify_event reason); /* Helpers */ -#define for_each_trip(__tz, __trip) \ - for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++) +#define for_each_trip(__tz, __trip) \ + for (__trip = __tz->tzp->trips; \ + __trip - __tz->tzp->trips < __tz->tzp->num_trips; \ + __trip++) void __thermal_zone_set_trips(struct thermal_zone_device *tz); int thermal_zone_trip_id(const struct thermal_zone_device *tz, diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index a72095cfb771..f6d55ba853b5 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -26,8 +26,8 @@ int get_tz_trend(struct thermal_zone_device *tz, const struct thermal_trip *trip { enum thermal_trend trend; - if (tz->emul_temperature || !tz->ops->get_trend || - tz->ops->get_trend(tz, trip, &trend)) { + if (tz->emul_temperature || !tz->tzp->ops->get_trend || + tz->tzp->ops->get_trend(tz, trip, &trend)) { if (tz->temperature > tz->last_temperature) trend = THERMAL_TREND_RAISING; else if (tz->temperature < tz->last_temperature) @@ -50,7 +50,7 @@ get_thermal_instance(struct thermal_zone_device *tz, mutex_lock(&tz->lock); mutex_lock(&cdev->lock); - trip = &tz->trips[trip_index]; + trip = &tz->tzp->trips[trip_index]; list_for_each_entry(pos, &tz->thermal_instances, tz_node) { if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { @@ -74,8 +74,8 @@ EXPORT_SYMBOL(get_thermal_instance); * When a valid thermal zone reference is passed, it will fetch its * temperature and fill @temp. * - * Both tz and tz->ops must be valid pointers when calling this function, - * and the tz->ops->get_temp callback must be provided. + * Both tz and tz->tzp->ops must be valid pointers when calling this function, + * and the tz->tzp->ops->get_temp callback must be provided. * The function must be called under tz->lock. * * Return: On success returns 0, an error code otherwise @@ -88,7 +88,7 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) lockdep_assert_held(&tz->lock); - ret = tz->ops->get_temp(tz, temp); + ret = tz->tzp->ops->get_temp(tz, temp); if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { for_each_trip(tz, trip) { @@ -132,7 +132,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) mutex_lock(&tz->lock); - if (!tz->ops->get_temp) { + if (!tz->tzp->ops->get_temp) { ret = -EINVAL; goto unlock; } diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 252116f1e535..38edad3865f8 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -80,7 +80,7 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf) mutex_lock(&tz->lock); - ret = tz->ops->get_crit_temp(tz, &temperature); + ret = tz->tzp->ops->get_crit_temp(tz, &temperature); mutex_unlock(&tz->lock); @@ -99,7 +99,7 @@ thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) mutex_lock(&thermal_hwmon_list_lock); list_for_each_entry(hwmon, &thermal_hwmon_list, node) { - strcpy(type, tz->type); + strcpy(type, tz->tzp->type); strreplace(type, '-', '_'); if (!strcmp(hwmon->type, type)) { mutex_unlock(&thermal_hwmon_list_lock); @@ -132,7 +132,7 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) { int temp; - return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); + return tz->tzp->ops->get_crit_temp && !tz->tzp->ops->get_crit_temp(tz, &temp); } int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) @@ -153,7 +153,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) return -ENOMEM; INIT_LIST_HEAD(&hwmon->tz_list); - strscpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); + strscpy(hwmon->type, tz->tzp->type, THERMAL_NAME_LENGTH); strreplace(hwmon->type, '-', '_'); hwmon->device = hwmon_device_register_for_thermal(&tz->device, hwmon->type, hwmon); diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 4d6c22e0ed85..9f4c2c0cd7d8 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -274,7 +274,7 @@ static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone_devic if (!np) return ERR_PTR(-ENODEV); - tz_np = of_get_child_by_name(np, tz->type); + tz_np = of_get_child_by_name(np, tz->tzp->type); of_node_put(np); @@ -310,7 +310,7 @@ static int __thermal_of_unbind(struct device_node *map_np, int index, int trip_i ret = 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, ret); + pr_err("Failed to unbind '%s' with '%s': %d\n", tz->tzp->type, cdev->type, ret); return ret; } @@ -345,7 +345,7 @@ static int __thermal_of_bind(struct device_node *map_np, int index, int trip_id, cooling_spec.args[0], weight); if (ret) - pr_err("Failed to bind '%s' with '%s': %d\n", tz->type, cdev->type, ret); + pr_err("Failed to bind '%s' with '%s': %d\n", tz->tzp->type, cdev->type, ret); return ret; } @@ -438,8 +438,8 @@ static int thermal_of_unbind(struct thermal_zone_device *tz, */ static void thermal_of_zone_unregister(struct thermal_zone_device *tz) { - struct thermal_trip *trips = tz->trips; - struct thermal_zone_device_ops *ops = tz->ops; + struct thermal_trip *trips = tz->tzp->trips; + struct thermal_zone_device_ops *ops = tz->tzp->ops; thermal_zone_device_disable(tz); thermal_zone_device_unregister(tz); @@ -529,7 +529,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * ret = thermal_zone_device_enable(tz); if (ret) { pr_err("Failed to enabled thermal zone '%s', id=%d: %d\n", - tz->type, tz->id, ret); + tz->tzp->type, tz->id, ret); thermal_of_zone_unregister(tz); return ERR_PTR(ret); } diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 3f5f4a04a754..87a20ced7864 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -28,7 +28,7 @@ type_show(struct device *dev, struct device_attribute *attr, char *buf) { struct thermal_zone_device *tz = to_thermal_zone(dev); - return sprintf(buf, "%s\n", tz->type); + return sprintf(buf, "%s\n", tz->tzp->type); } static ssize_t @@ -88,7 +88,7 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_type", &trip_id) != 1) return -EINVAL; - switch (tz->trips[trip_id].type) { + switch (tz->tzp->trips[trip_id].type) { case THERMAL_TRIP_CRITICAL: return sprintf(buf, "critical\n"); case THERMAL_TRIP_HOT: @@ -120,11 +120,11 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr, mutex_lock(&tz->lock); - trip = &tz->trips[trip_id]; + trip = &tz->tzp->trips[trip_id]; if (temp != trip->temperature) { - if (tz->ops->set_trip_temp) { - ret = tz->ops->set_trip_temp(tz, trip_id, temp); + if (tz->tzp->ops->set_trip_temp) { + ret = tz->tzp->ops->set_trip_temp(tz, trip_id, temp); if (ret) goto unlock; } @@ -150,7 +150,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_temp", &trip_id) != 1) return -EINVAL; - return sprintf(buf, "%d\n", tz->trips[trip_id].temperature); + return sprintf(buf, "%d\n", tz->tzp->trips[trip_id].temperature); } static ssize_t @@ -171,11 +171,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, mutex_lock(&tz->lock); - trip = &tz->trips[trip_id]; + trip = &tz->tzp->trips[trip_id]; if (hyst != trip->hysteresis) { - if (tz->ops->set_trip_hyst) { - ret = tz->ops->set_trip_hyst(tz, trip_id, hyst); + if (tz->tzp->ops->set_trip_hyst) { + ret = tz->tzp->ops->set_trip_hyst(tz, trip_id, hyst); if (ret) goto unlock; } @@ -201,7 +201,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1) return -EINVAL; - return sprintf(buf, "%d\n", tz->trips[trip_id].hysteresis); + return sprintf(buf, "%d\n", tz->tzp->trips[trip_id].hysteresis); } static ssize_t @@ -250,10 +250,10 @@ emul_temp_store(struct device *dev, struct device_attribute *attr, mutex_lock(&tz->lock); - if (!tz->ops->set_emul_temp) + if (!tz->tzp->ops->set_emul_temp) tz->emul_temperature = temperature; else - ret = tz->ops->set_emul_temp(tz, temperature); + ret = tz->tzp->ops->set_emul_temp(tz, temperature); if (!ret) __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); @@ -405,22 +405,22 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) int indx; /* This function works only for zones with at least one trip */ - if (tz->num_trips <= 0) + if (tz->tzp->num_trips <= 0) return -EINVAL; - tz->trip_type_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_type_attrs), + tz->trip_type_attrs = kcalloc(tz->tzp->num_trips, sizeof(*tz->trip_type_attrs), GFP_KERNEL); if (!tz->trip_type_attrs) return -ENOMEM; - tz->trip_temp_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_temp_attrs), + tz->trip_temp_attrs = kcalloc(tz->tzp->num_trips, sizeof(*tz->trip_temp_attrs), GFP_KERNEL); if (!tz->trip_temp_attrs) { kfree(tz->trip_type_attrs); return -ENOMEM; } - tz->trip_hyst_attrs = kcalloc(tz->num_trips, + tz->trip_hyst_attrs = kcalloc(tz->tzp->num_trips, sizeof(*tz->trip_hyst_attrs), GFP_KERNEL); if (!tz->trip_hyst_attrs) { @@ -429,7 +429,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) return -ENOMEM; } - attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); + attrs = kcalloc(tz->tzp->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); if (!attrs) { kfree(tz->trip_type_attrs); kfree(tz->trip_temp_attrs); @@ -437,7 +437,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) return -ENOMEM; } - for (indx = 0; indx < tz->num_trips; indx++) { + for (indx = 0; indx < tz->tzp->num_trips; indx++) { /* create trip type attribute */ snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, "trip_point_%d_type", indx); @@ -464,7 +464,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) tz->trip_temp_attrs[indx].attr.store = trip_point_temp_store; } - attrs[indx + tz->num_trips] = &tz->trip_temp_attrs[indx].attr.attr; + attrs[indx + tz->tzp->num_trips] = &tz->trip_temp_attrs[indx].attr.attr; snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, "trip_point_%d_hyst", indx); @@ -474,15 +474,15 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) tz->trip_hyst_attrs[indx].name; tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; - if (tz->ops->set_trip_hyst) { + if (tz->tzp->ops->set_trip_hyst) { tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_hyst_attrs[indx].attr.store = trip_point_hyst_store; } - attrs[indx + tz->num_trips * 2] = + attrs[indx + tz->tzp->num_trips * 2] = &tz->trip_hyst_attrs[indx].attr.attr; } - attrs[tz->num_trips * 3] = NULL; + attrs[tz->tzp->num_trips * 3] = NULL; tz->trips_attribute_group.attrs = attrs; @@ -522,7 +522,7 @@ int thermal_zone_create_device_groups(struct thermal_zone_device *tz, for (i = 0; i < size - 2; i++) groups[i] = thermal_zone_attribute_groups[i]; - if (tz->num_trips) { + if (tz->tzp->num_trips) { result = create_trip_attrs(tz, mask); if (result) { kfree(groups); @@ -543,7 +543,7 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) if (!tz) return; - if (tz->num_trips) + if (tz->tzp->num_trips) destroy_trip_attrs(tz); kfree(tz->device.groups); diff --git a/drivers/thermal/thermal_trace.h b/drivers/thermal/thermal_trace.h index 459c8ce6cf3b..4bd8b0be4280 100644 --- a/drivers/thermal/thermal_trace.h +++ b/drivers/thermal/thermal_trace.h @@ -28,14 +28,14 @@ TRACE_EVENT(thermal_temperature, TP_ARGS(tz), TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, tz->tzp->type) __field(int, id) __field(int, temp_prev) __field(int, temp) ), TP_fast_assign( - __assign_str(thermal_zone, tz->type); + __assign_str(thermal_zone, tz->tzp->type); __entry->id = tz->id; __entry->temp_prev = tz->last_temperature; __entry->temp = tz->temperature; @@ -73,14 +73,14 @@ TRACE_EVENT(thermal_zone_trip, TP_ARGS(tz, trip, trip_type), TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, tz->tzp->type) __field(int, id) __field(int, trip) __field(enum thermal_trip_type, trip_type) ), TP_fast_assign( - __assign_str(thermal_zone, tz->type); + __assign_str(thermal_zone, tz->tzp->type); __entry->id = tz->id; __entry->trip = trip; __entry->trip_type = trip_type; diff --git a/drivers/thermal/thermal_trip.c b/drivers/thermal/thermal_trip.c index c875a26d5adf..9cccda973756 100644 --- a/drivers/thermal/thermal_trip.c +++ b/drivers/thermal/thermal_trip.c @@ -42,7 +42,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_for_each_trip); int thermal_zone_get_num_trips(struct thermal_zone_device *tz) { - return tz->num_trips; + return tz->tzp->num_trips; } EXPORT_SYMBOL_GPL(thermal_zone_get_num_trips); @@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_num_trips); * driver to let it set its own notification mechanism (usually an * interrupt). * - * This function must be called with tz->lock held. Both tz and tz->ops + * This function must be called with tz->lock held. Both tz and tz->tzp->ops * must be valid pointers. * * It does not return a value @@ -70,7 +70,7 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) lockdep_assert_held(&tz->lock); - if (!tz->ops->set_trips) + if (!tz->tzp->ops->set_trips) return; for_each_trip(tz, trip) { @@ -114,7 +114,7 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) * Set a temperature window. When this window is left the driver * must inform the thermal core via thermal_zone_device_update. */ - ret = tz->ops->set_trips(tz, low, high); + ret = tz->tzp->ops->set_trips(tz, low, high); if (ret) dev_err(&tz->device, "Failed to set trips: %d\n", ret); } @@ -122,10 +122,10 @@ void __thermal_zone_set_trips(struct thermal_zone_device *tz) int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id, struct thermal_trip *trip) { - if (!tz || !tz->trips || trip_id < 0 || trip_id >= tz->num_trips || !trip) + if (!tz || !tz->tzp->trips || trip_id < 0 || trip_id >= tz->tzp->num_trips || !trip) return -EINVAL; - *trip = tz->trips[trip_id]; + *trip = tz->tzp->trips[trip_id]; return 0; } EXPORT_SYMBOL_GPL(__thermal_zone_get_trip); @@ -150,7 +150,7 @@ int thermal_zone_trip_id(const struct thermal_zone_device *tz, * Assume the trip to be located within the bounds of the thermal * zone's trips[] table. */ - return trip - tz->trips; + return trip - tz->tzp->trips; } void thermal_zone_trip_updated(struct thermal_zone_device *tz, const struct thermal_trip *trip) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 7a540b746703..65db38acd20b 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -122,16 +122,12 @@ struct thermal_cooling_device { /** * struct thermal_zone_device - structure for a thermal zone * @id: unique id number for each thermal zone - * @type: the thermal zone device type * @device: &struct device for this thermal zone * @removal: removal completion * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature * @trip_type_attrs: attributes for trip points for sysfs: trip type * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis * @mode: current mode of this thermal zone - * @devdata: private pointer for device private data - * @trips: an array of struct thermal_trip - * @num_trips: number of trip points the thermal zone supports * @passive_delay_jiffies: number of jiffies to wait between polls when * performing passive cooling. * @polling_delay_jiffies: number of jiffies to wait between polls when @@ -148,7 +144,6 @@ struct thermal_cooling_device { * @prev_high_trip: the above current temperature if you've crossed a passive trip point. * @need_update: if equals 1, thermal_zone_device_update needs to be invoked. - * @ops: operations this &thermal_zone_device supports * @tzp: Thermal zone parameters * @tgp: Thermal zone governor parameters * @governor: pointer to the governor for this thermal zone @@ -164,7 +159,6 @@ struct thermal_cooling_device { */ struct thermal_zone_device { int id; - char type[THERMAL_NAME_LENGTH]; struct device device; struct completion removal; struct attribute_group trips_attribute_group; @@ -172,9 +166,6 @@ struct thermal_zone_device { struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; enum thermal_device_mode mode; - void *devdata; - struct thermal_trip *trips; - int num_trips; unsigned long passive_delay_jiffies; unsigned long polling_delay_jiffies; int temperature; @@ -184,7 +175,6 @@ struct thermal_zone_device { int prev_low_trip; int prev_high_trip; atomic_t need_update; - struct thermal_zone_device_ops *ops; struct thermal_zone_platform_params *tzp; struct thermal_governor_params *tgp; struct thermal_governor *governor; From patchwork Tue Jan 30 11:12:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768147 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D2B367A0B; Tue, 30 Jan 2024 11:13:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613204; cv=none; b=bXUyspxzM9KPy8nVY1IdewpdJrrXVltlhwm+7vRv1ZX+kaEi+46CWckP2854cZIKTLWW++wcGZ5nR+pl5azVCMJB0XbFLtv4KaESd6T0yNh+8dJRdbA9OMHp9bxirSv7Q2tZ8gQUkUimAxTfHvEvw1ohAqfU2emkKy4JJrN5/lU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613204; c=relaxed/simple; bh=X32Bcgql6uQHTDnzXYAHs6Ep92uAw8IaBvn5qiYUvoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oU+ICtqbzYe+y5kq/Z0xJJeC89QeA6P17Awb0PLsczbXjghqFAsGVsDDzBQWGBd94XMDUzZYWU9rhzUEj0eHPz79pAUEz5vq21/XC+uKwW8nMtxVofEEVkxlQos1l/n0rmbRqYaPxYb0rbCQhtzcDsjv+Mlzfx+VdfMK2J1UAik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=ktna+Kv7; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ktna+Kv7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613201; bh=X32Bcgql6uQHTDnzXYAHs6Ep92uAw8IaBvn5qiYUvoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktna+Kv7gfh7dk/63on+MZmh7HvZIJKzc/m0yfqmwGfo5hx0NNfEha4GXbFQvmHwR OJ6fj4vz1P+UE5mn5+5GlaDR23qM5foBhIcP5qvh41k44f6y95fFJhmajFqInrtlDl SEHtJY3yfUyQOELakeI944UolMKSxiqY5VPbIg3KmluUPJkE6Trjr7qcJirhFdsdrW Gd90I/qARmjUPlohsvCbZMBc9ML05RSKKNkOLDS7TgXhvq7gBX4tJta6QqkFhk1pjU zHCWcBu6WA9LNkz5OLhfGx4Muwjtzfwnr5khGaOQpMp03aCHRyDV7/s+LS4muL819z 5NFPmb2KLjhGA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id EAED0378208D; Tue, 30 Jan 2024 11:13:18 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 05/18] thermal/drivers/imx: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:37 +0100 Message-ID: <20240130111250.185718-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/imx_thermal.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 7019c4fdd549..16fb49194fb3 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -599,6 +599,15 @@ static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data static int imx_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "imx_thermal_zone", + .ops = &imx_tz_ops, + .mask = BIT(IMX_TRIP_PASSIVE), + .passive_delay = IMX_PASSIVE_DELAY, + .polling_delay = IMX_POLLING_DELAY, + } + }; struct imx_thermal_data *data; struct regmap *map; int measure_freq; @@ -696,13 +705,11 @@ static int imx_thermal_probe(struct platform_device *pdev) goto legacy_cleanup; } - data->tz = thermal_zone_device_register_with_trips("imx_thermal_zone", - trips, - ARRAY_SIZE(trips), - BIT(IMX_TRIP_PASSIVE), data, - &imx_tz_ops, NULL, - IMX_PASSIVE_DELAY, - IMX_POLLING_DELAY); + tzdp.tzp.devdata = data; + tzdp.tzp.trips = &trips; + tzdp.tzp.num_trips = ARRAY_SIZE(trips); + + data->tz = thermal_zone_device_register(&tzdp); if (IS_ERR(data->tz)) { ret = PTR_ERR(data->tz); dev_err(&pdev->dev, From patchwork Tue Jan 30 11:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768146 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F30AF6A35F; Tue, 30 Jan 2024 11:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613208; cv=none; b=lH0sDFFCpz6KJ+s5NQreeJNo6oRfXQTUD2ZJGVQQ0kSJVKfj3EH72mJ1ZTkq6LCKpcSmtrXbPpn0gIAGsr30zDZb+l6ZDH/F+iRJOSVJc65YCfo/XOrlx7D0DKjM7GLkm9yA+gz4RFWSyH7y4YaYj/ZDSEMaH4Q8Y0kI/xKQ8u0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613208; c=relaxed/simple; bh=SKppNY4y88YWZiAw2UK5DtE27VayRH8M42y87uCkgxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GliNzxGXyUX7aOe6q7vxxZhRrQjM2YR/l2cZKiXXqfFFtsb7RzpW0jC8FbKd8rXRNVD/gKl0d+tWso16plAVMtvSm/D8tJEXXVOqlloYL0HlezcKDPcvfHm2MkQ4DQdqXBAxKIE9e2loBBGpaUx5/xO072cZIsB5cmQTgsJ85Dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=lVC64xCk; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="lVC64xCk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613205; bh=SKppNY4y88YWZiAw2UK5DtE27VayRH8M42y87uCkgxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVC64xCk8sDHIzLwI/8kQl+6GHoL27D7uzAPQWBJkq5e7JFhlBhhkhJMqNBJk4bBn kgfQuTfqBtn+R1qVhTIv6C/Af26MyfOrr6eBJxf5EKSl2FyRvWjZ7Y2POcJIfvCWYB hGqNxr1xbCWw9fmsK4YRuFVUfRj/5f4zukWxF3N0KERLN5CBh9Tw1X1Zqy6LqsfMaG ghuwbM5CuK9ntb2PXesJJsn10fwh4TfLlwN1wKLlXZUVkr3cI5BXQFdP6YgfGo8GiH 1zcE71dkgHMFFnsyW2+CTsDHZdYKFWdax2ZMtrLO+gBEef2YOjoh70cxKyhDClknqq QWJI8+H3T6Udg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 6BB713782089; Tue, 30 Jan 2024 11:13:23 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 07/18] thermal/drivers/st: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:39 +0100 Message-ID: <20240130111250.185718-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/st/st_thermal.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 0d6249b36609..2f7b22764bd0 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -143,9 +143,9 @@ int st_thermal_register(struct platform_device *pdev, struct st_thermal_sensor *sensor; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + struct thermal_zone_device_params tzdp; const struct of_device_id *match; - int polling_delay; int ret; if (!np) { @@ -197,14 +197,17 @@ int st_thermal_register(struct platform_device *pdev, if (ret) goto sensor_off; - polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; - trip.temperature = sensor->cdata->crit_temp; trip.type = THERMAL_TRIP_CRITICAL; - sensor->thermal_dev = - thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, 0, sensor, - &st_tz_ops, NULL, 0, polling_delay); + tzdp.tzp.type = dev_name(dev); + tzdp.tzp.ops = &st_tz_ops; + tzdp.tzp.devdata = sensor; + tzdp.tzp.trips = &trip; + tzdp.tzp.num_trips = 1; + tzdp.tzp.polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; + + sensor->thermal_dev = thermal_zone_device_register(&tzdp); if (IS_ERR(sensor->thermal_dev)) { dev_err(dev, "failed to register thermal zone device\n"); ret = PTR_ERR(sensor->thermal_dev); From patchwork Tue Jan 30 11:12:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768145 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18A436BB4B; Tue, 30 Jan 2024 11:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613211; cv=none; b=qgz5RtnZbliwZAK8pRS3glGgo/li0zbe5hvgZ/Wo1AY5arNt6BmjQta26PLt4AM77OgEzQbxxC5MwyPeha2MTe7FwMcebqFz9/04PgO/WBsIonqy8xCgi9nuJstfmAKx0aXHDSAQGrcVrraqi6LpKRtHu+VIR68VpL8PqgDcRu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613211; c=relaxed/simple; bh=tALIom+m2UHdd4MK7i96Hl0n8kwKYP1fIX+bHaIVr5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TSRwgsKrdKhNH5OMWQ/AyavFD80puuCq3GmmNfeC7/kuSwCxPxuxpQU7Uy25TjK0oCkbQNOuMI/l737eBFP+amB7pQl/3MdkZkeeQogyrVx+DSrinZtSWLLmRIzMBhiI8M6pTELn9Wc4vhjv+j+yT5w/PmY+n7Mr/j+95atMJIM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=rUFMvo3s; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="rUFMvo3s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613207; bh=tALIom+m2UHdd4MK7i96Hl0n8kwKYP1fIX+bHaIVr5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rUFMvo3sF6288p/svf/iiNTjMvBJ7/BzP6UOsscYf7QMifiGGb/vb+JQk3FOhdIlV eng+RaU5Qt3T075W1v3+urH/MHY1FTo3LdDa8NoJIOiR56zC01WrRBxGL5R8qBxCZN aaXVTNue3NnAdoG91/1g1oibI7B2clwdqRiimkUFJqvFDTQkmJCTlNocNxxgfA5OBi b0HM2hwvOPecrep4f6scSKICFvS2pt8OdSWh8If65gshtAKNMIhZDhbtK9xE400ZXo 172jBuREMQ7r3jwu1zN54kdDUJHPkBOmicQKy5cikJTyUltYPFYGvBW+8VM/fLezf+ qt2Ro2VCKxj6Q== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A4B29378208B; Tue, 30 Jan 2024 11:13:25 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 08/18] thermal: intel: pch_thermal: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:40 +0100 Message-ID: <20240130111250.185718-9-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/intel/intel_pch_thermal.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index b3905e34c507..73d7c2ac7dbc 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -160,6 +160,7 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, const struct pci_device_id *id) { enum pch_board_ids board_id = id->driver_data; + struct thermal_zone_device_params tzdp; struct pch_thermal_device *ptd; int nr_trips = 0; u16 trip_temp; @@ -233,10 +234,13 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, nr_trips += pch_wpt_add_acpi_psv_trip(ptd, nr_trips); - ptd->tzd = thermal_zone_device_register_with_trips(board_names[board_id], - ptd->trips, nr_trips, - 0, ptd, &tzd_ops, - NULL, 0, 0); + tzdp.tzp.type = board_names[board_id]; + tzdp.tzp.devdata = ptd; + tzdp.tzp.trips = ptd->trips; + tzdp.tzp.num_trips = nr_trips; + tzdp.tzp.ops = &tzd_ops; + + ptd->tzd = thermal_zone_device_register(&tzdp); if (IS_ERR(ptd->tzd)) { dev_err(&pdev->dev, "Failed to register thermal zone %s\n", board_names[board_id]); From patchwork Tue Jan 30 11:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768144 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF4166DD09; Tue, 30 Jan 2024 11:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613215; cv=none; b=ZgBlxaFh11kKCwPQ48q92nK3gRicQO38pYtnHXcNkEnMA+zBep3zeV5WSIo5z2QZJYhrZIwFNWahhRqc7S3f+XAUEQO/82PK8bqiIk/k17JSL0fHk7k5heuG66IFKqgT3WuqT1crTKUst6vObbtLHKIna7E+XrQhkmDbjJfbwlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613215; c=relaxed/simple; bh=xF+/wSXIq5fE1Hx9RSY2i9M69cbEXmtjt5ngzeA8uxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qREj2fU4Okjw9eOl2i0lhkp5CMxDl5ihQBZmI5XfZrPRP1Ef6/KLL2R7SFLEkOGEi7cUBWfXWH2Jox0RkgPzb9q4uE/cnepsKdPdtrHTzFLDOhdBW62HVgfJnYmbnbIVDttneMfkKH43hhwKhiLnPLQbDbRRX3TpM570MYPlqog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=qPNQW+T2; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="qPNQW+T2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613212; bh=xF+/wSXIq5fE1Hx9RSY2i9M69cbEXmtjt5ngzeA8uxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPNQW+T201OxgVKSszDbRWd4p2jvdQZiIVNgD0+YhC88KZXrs8xyKLIoqBhTBe9n9 ZpYyl7yX7PLi3/dqS+rkh8PfILSkQvsk3thd0Lm6P3wr7rdcu04lDun1EqwB4Lx7iq 3G17PLpzNJ6mHBUYU2R3Js8SUe2oK6B0Kve84Ab1n5Uuu1j5wwEiqeFqA2qU1qg+Dw b8s+24AN+Cw+I/M3KOknDvG04jW9+PTzAOAX6NZ6uojs0pQI8gyapk7lnXJFjP6Oky txbeThlekjBx0ybhCGCWhXZuBpSGVyBQRzlAcaGvROTGSrICiKWNrOBPXLKHvnVicY l3EZfinvdpXLw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 220C23782084; Tue, 30 Jan 2024 11:13:30 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 10/18] thermal: intel: soc_dts_iosf: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:42 +0100 Message-ID: <20240130111250.185718-11-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/intel/intel_soc_dts_iosf.c | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c index d00def3c4703..78dceb117ed8 100644 --- a/drivers/thermal/intel/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -220,8 +220,15 @@ static void remove_dts_thermal_zone(struct intel_soc_dts_sensor_entry *dts) static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, bool critical_trip) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .devdata = dts, + .ops = &tzone_ops, + .trips = dts->trips, + .num_trips = SOC_MAX_DTS_TRIPS, + } + }; int writable_trip_cnt = SOC_MAX_DTS_TRIPS; - char name[10]; unsigned long trip; int trip_mask; unsigned long ptps; @@ -253,12 +260,15 @@ static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, trip_mask &= ~BIT(i / 8); } dts->trip_mask = trip_mask; - snprintf(name, sizeof(name), "soc_dts%d", id); - dts->tzone = thermal_zone_device_register_with_trips(name, dts->trips, - SOC_MAX_DTS_TRIPS, - trip_mask, - dts, &tzone_ops, - NULL, 0, 0); + + tzdp.tzp.type = kasprintf(GFP_KERNEL, "soc_dts%d", id); + if (!tzdp.tzp.type) + return -ENOMEM; + + tzdp.tzp.mask = trip_mask; + + dts->tzone = thermal_zone_device_register(&tzdp); + kfree(tzdp.tzp.type); if (IS_ERR(dts->tzone)) { ret = PTR_ERR(dts->tzone); goto err_ret; From patchwork Tue Jan 30 11:12:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768143 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0F6274E0D; Tue, 30 Jan 2024 11:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613219; cv=none; b=NTmg5F1FQWf83lhqxDdjVXonyiSZsDSUnZw6mY6aZxBqcsMEHXImpA07CxQRWU0r2aL+0l7c8rcpeXV0FNO15ixX2RgLFXo4YYTJP6uX0Ze9pPrIIyHwfGI1r842Kk+UqZ409GASG1e4eThcZs0R3nLy6M7WufDEHRVtJSZOVHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613219; c=relaxed/simple; bh=jX8eexMy1avLh8dlPbkEyo4c5yBA7XPn/CK+R650NbY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FNVaqNxAXpB49wac9i9G/Vzsk/7M0p5ZowglsoYR6W1/Ubu4roTmCrn7AVqBYFtlSfhi9SY6JtRlrp6+aI8LvSeEpvib+aEqWz7CofqGFlaMHiXVJltpNCJ8aWjBzCP/VTtdFR3TzMHE3SpzSZNgMMtKQCT4QxBA32/2Pei29bU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=1lPMjJgz; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="1lPMjJgz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613216; bh=jX8eexMy1avLh8dlPbkEyo4c5yBA7XPn/CK+R650NbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1lPMjJgzotfkB90XRVoWGZlENgOEHhc7wkebDfMVFSons4LdaXxnWLlgTJHquu3bj qUlJ/KqMhF7Uc0qtf1K+jYdXnrE7z+HcfdPmomI02IXIZHGrZCRVDj+2t+rZewbuW4 n598Lj0/FjURzHIjqSgv2/oqR1kf253bx9CdsfW0H9eSlo8+uPYsxDlPabyqpH1o8V L7Xr3HvHtpGH5eJVVzO2ReIXQrIQiIsz5zK4C7IKCz1Y3O847OruuGHb4hd4L2sJ+9 OcxXiixsSuIFTxXRN060iKRrO5hTnD7grEagsne3m7VK4O2rPBVmQmISKwnNEZXYX1 65zueO5ac3IxA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 7A9043782081; Tue, 30 Jan 2024 11:13:34 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 12/18] thermal: int340x: processor: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:44 +0100 Message-ID: <20240130111250.185718-13-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- .../processor_thermal_device_pci.c | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index d7495571dd5d..3170eab57e32 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -242,13 +242,19 @@ static struct thermal_zone_device_ops tzone_ops = { .set_trip_temp = sys_set_trip_temp, }; -static struct thermal_zone_params tzone_params = { - .governor_name = "user_space", - .no_hwmon = true, -}; - static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "TCPU_PCI", + .mask = 1, + .no_hwmon = true, + .ops = &tzone_ops, + }, + }; + struct thermal_governor_params tgp = { + .governor_name = "user_space" + }; struct proc_thermal_device *proc_priv; struct proc_thermal_pci *pci_info; int irq_flag = 0, irq, ret; @@ -289,10 +295,12 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ psv_trip.temperature = get_trip_temp(pci_info); - pci_info->tzone = thermal_zone_device_register_with_trips("TCPU_PCI", &psv_trip, - 1, 1, pci_info, - &tzone_ops, - &tzone_params, 0, 0); + tzdp.tzp.devdata = pci_info; + tzdp.tzp.trips = &psv_trip; + tzdp.tzp.num_trips = 1; + tzdp.tgp = &tgp; + + pci_info->tzone = thermal_zone_device_register(&tzdp); if (IS_ERR(pci_info->tzone)) { ret = PTR_ERR(pci_info->tzone); goto err_del_legacy; From patchwork Tue Jan 30 11:12:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768142 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F54B77627; Tue, 30 Jan 2024 11:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613224; cv=none; b=ejeeEIxbKDEHeUJAb8M9VSTILcYdTJ1vIND+Q3mv7FlGYehPK33L0gnHto9SgVJXgSCdesIvf9SArUJhGTyTSg4EhuZvQosY4xv8P4UOwYh+piYHINS1O0E33bnWQW0JN1Ig4ith8zDU2xScKVWLhU1fhzM2tGy5/ciF/qPtjF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613224; c=relaxed/simple; bh=+RsoYewyOO14ouzshvdt3gaki76JepljIejGBDHOp2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ede6puU50NDxRJ8M28WgJ+JZhUjQibl5cKmsNbWHhyK0tuDOy04pP11mH18RTHd5fXXfdnSWi42+sWUqINclT8rbUm0C9esH1BZJwVKpZbeT0sMzBx7xVUBtujq/0dUDSP4Pyqx9saVJVoOdMTEBAHGx+O9aMDnQRaycPOvJdAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=mQShp5b1; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="mQShp5b1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613221; bh=+RsoYewyOO14ouzshvdt3gaki76JepljIejGBDHOp2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQShp5b1PaO4pA1N+3guPpQZJZY4gb3CAPdmzQX6EG9oF+WTF3rCekCrmOSuETOu6 YtEcPGn/EqC6U2JFbtiqOk2+ZU7Q7K9DWbUM1Cy/ncgnUsLKGblrHVRN83nJClmULc HqD4TzRhxRlKWOMXbznz/UNNyWdDgm/XVCbRr5lND+3/+/vcK9UR6f7Jig7il28Q5Y Hq70U3yTeQMUoy0NaPd8COeuZJ1+ZMDvwqeaiRqLbQZ0DasqVXManUz2jGZFoHy/zc 1VJtPAoszlMx1E/Xpjqpm9fkQvdH/Qmz4VOsbbtYoalHnXlemVubDaOwVBGXVTyFmN dH1HBGS/Mi9eg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id E9A86378208B; Tue, 30 Jan 2024 11:13:38 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 14/18] thermal/drivers/armada: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:46 +0100 Message-ID: <20240130111250.185718-15-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/armada_thermal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index f783547ef964..e07bee0440fe 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -864,8 +864,16 @@ static int armada_thermal_probe(struct platform_device *pdev) * into it, which requires the use of regmaps across all the driver. */ if (IS_ERR(syscon_node_to_regmap(pdev->dev.parent->of_node))) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .ops = &legacy_ops, + .devdata = priv + } + }; + /* Ensure device name is correct for the thermal core */ armada_set_sane_name(pdev, priv); + tzdp.tzp.type = priv->zone_name; ret = armada_thermal_probe_legacy(pdev, priv); if (ret) @@ -876,9 +884,7 @@ static int armada_thermal_probe(struct platform_device *pdev) /* Wait the sensors to be valid */ armada_wait_sensor_validity(priv); - tz = thermal_tripless_zone_device_register(priv->zone_name, - priv, &legacy_ops, - NULL); + tz = thermal_zone_device_register(&tzdp); if (IS_ERR(tz)) { dev_err(&pdev->dev, "Failed to register thermal zone device\n"); From patchwork Tue Jan 30 11:12:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768141 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7EFC7E578; Tue, 30 Jan 2024 11:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613228; cv=none; b=FIyGAxUuAJ5PzWnAyEXyscpdVys9vbv1kcMERFEcOg7aEtmb1lUsA4mug33QaqAxQoJyvn68iGQZivcPqlbCJ8nH32RSzdgEsscbac/NIVX2Pip5D8mXPl341XxhYFB0dhXPXbIQdVkdzkHQ2M7b9mZVvBcOpifO5bt6MWFCyAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613228; c=relaxed/simple; bh=lvc56XBEENzj3l1vBHl7W+VJWa9O58KHS2L6cWEnb0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qCI2lDpPsqLzNCmHAOZDTU+9nYyV3nm+x8H4qrtTj4xihiEaGvyCr+CIcvw407FiFJBunYXeRwmYwkbh+KOZvi9wfAo05PYgEQeV8nyo/1Uzkrp3AxcNAH9EhubAJI7qlVDCk4ZT3ynLszu3GJZsOjq+g2payNYoIeHJITUce6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=s72H3QsU; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="s72H3QsU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613225; bh=lvc56XBEENzj3l1vBHl7W+VJWa9O58KHS2L6cWEnb0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s72H3QsUQJtWRsvyRQo2gC69r8xWecWDNtEu34plUdOpog/Hur9EDM0g+aCe08MxJ YOA4Qu0/x5kpR4+jO1IB0l+U2xa9VSjbAXnLYIfTQu2R3dMjk1S9LSv5uzkQez/vE/ 8icQBb2gXuJ+2KTC41lYp0YzpsAWXPJCAiyejzit/s5yqoPLhwt51J2C86uCQGK1T+ jCGbNe+Dg4B2xdBI4gfs0ulYbYZiQ1vy6yXMqYbrPqKAhpcHPraKVXWfFyPuKPPjt+ 0HIzjC16W+YWOV/lyHwygw9Dui/JIaoNyjpjPmoKldYhog3+LsTlXYsgvV57eRIGRL TyqycCMQP/9ew== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 5C188378208C; Tue, 30 Jan 2024 11:13:43 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 16/18] thermal/drivers/kirkwood: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:48 +0100 Message-ID: <20240130111250.185718-17-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- drivers/thermal/kirkwood_thermal.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index a18158ebe65f..0e4f24a91bb0 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -59,6 +59,12 @@ static const struct of_device_id kirkwood_thermal_id_table[] = { static int kirkwood_thermal_probe(struct platform_device *pdev) { + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "kirkwood_thermal", + .ops = &ops + } + }; struct thermal_zone_device *thermal = NULL; struct kirkwood_thermal_priv *priv; int ret; @@ -71,8 +77,8 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) if (IS_ERR(priv->sensor)) return PTR_ERR(priv->sensor); - thermal = thermal_tripless_zone_device_register("kirkwood_thermal", - priv, &ops, NULL); + tzdp.tzp.devdata = priv; + thermal = thermal_zone_device_register(&tzdp); if (IS_ERR(thermal)) { dev_err(&pdev->dev, "Failed to register thermal zone device\n"); From patchwork Tue Jan 30 11:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 768140 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38AE56EB50; Tue, 30 Jan 2024 11:13:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613232; cv=none; b=de3e41KbJzTCrRGcIsvKrM9xsWOQw5+8tayIIFiSQmmPcpkw5yp/0s8non8PoE/PuLJyTT6GXUm9fq0mV+TIxMoiAekGjXViBmSJfBzIo9gqxjumNZwoSGa3JsfjxP+diVBZaNaZV8MA6C57ejNjt01K53L79WaY8n6ptMLiGG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706613232; c=relaxed/simple; bh=1MaXaoAlGaux22185ES05zD+Vc6KSQlHot9SWkJLGp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m/TtpW19r7WBY8lBgKcbGa/sVEKE1PDQeaiJpBOxQuOiBUbPQfTLJhPxXuP4wFISCSYKQHSaG/DmtCkSrroMqUh+R1XomHpaslMYLMouxDHz49bS1AkK2C+CJDgdLvHUGUrgCUq0qKLsMU+aPEHVIg4p9pbGwMx0qGnw8iDmPVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=HlU33HM8; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="HlU33HM8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706613229; bh=1MaXaoAlGaux22185ES05zD+Vc6KSQlHot9SWkJLGp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlU33HM8DXvNnHd5pfL0Un12V2JosWoeboB5m/VaZSU7mn27JZRL7n0hOSbYmEV63 nbQXPRYgNnV9Tg09ybHmHOhmVp5umMRDpOApeet2UUjPgeUG/2TZDKp/Kpyz+HgXZG HjC+6zWpXXGHJzQMPFzdZYEqaqQZxazoLeLlMmgd8mLUOxWzvFSmQESaHg+0Dz/Gh2 HAyBQd2ww0Hzr2aKjZ1depqQEX+Q9jSqA9P+yS8KR91henEbqscmEDj2/qaW9sT9sq 9WWEE88qf6woeJXZQ4+1zKcYguqf9dKIOVMXS0iAcsTnVywM4v2EaqrU0mJlnhEql4 bXn5tAHgulcXA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id CCFE93780FC7; Tue, 30 Jan 2024 11:13:47 +0000 (UTC) From: AngeloGioacchino Del Regno To: daniel.lezcano@linaro.org Cc: miquel.raynal@bootlin.com, rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, andersson@kernel.org, konrad.dybcio@linaro.org, amitk@kernel.org, thara.gopinath@gmail.com, niklas.soderlund@ragnatech.se, srinivas.pandruvada@linux.intel.com, angelogioacchino.delregno@collabora.com, baolin.wang@linux.alibaba.com, u.kleine-koenig@pengutronix.de, hayashi.kunihiko@socionext.com, d-gole@ti.com, linus.walleij@linaro.org, DLG-Adam.Ward.opensource@dm.renesas.com, error27@gmail.com, heiko@sntech.de, hdegoede@redhat.com, jernej.skrabec@gmail.com, f.fainelli@gmail.com, bchihi@baylibre.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 18/18] thermal/drivers/int340x: Migrate to thermal_zone_device_register() Date: Tue, 30 Jan 2024 12:12:50 +0100 Message-ID: <20240130111250.185718-19-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> References: <20240130111250.185718-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The thermal API has a new thermal_zone_device_register() function which is deprecating the older thermal_zone_device_register_with_trips() and thermal_tripless_zone_device_register(). Migrate to the new thermal zone device registration function. Signed-off-by: AngeloGioacchino Del Regno --- .../intel/int340x_thermal/int3400_thermal.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 427d370648d5..d8ca7ed37950 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -536,11 +536,6 @@ static struct thermal_zone_device_ops int3400_thermal_ops = { .change_mode = int3400_thermal_change_mode, }; -static struct thermal_zone_params int3400_thermal_params = { - .governor_name = "user_space", - .no_hwmon = true, -}; - static void int3400_setup_gddv(struct int3400_thermal_priv *priv) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -572,6 +567,16 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) static int int3400_thermal_probe(struct platform_device *pdev) { struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); + struct thermal_zone_device_params tzdp = { + .tzp = { + .type = "INT3400 Thermal", + .no_hwmon = true, + .ops = &int3400_thermal_ops, + } + }; + struct thermal_governor_params tgp = { + .governor_name = "user_space" + }; struct int3400_thermal_priv *priv; int result; @@ -609,9 +614,8 @@ static int int3400_thermal_probe(struct platform_device *pdev) evaluate_odvp(priv); - priv->thermal = thermal_tripless_zone_device_register("INT3400 Thermal", priv, - &int3400_thermal_ops, - &int3400_thermal_params); + tzdp.tgp = &tgp; + priv->thermal = thermal_zone_device_register(&tzdp); if (IS_ERR(priv->thermal)) { result = PTR_ERR(priv->thermal); goto free_art_trt;