Skip to contentSkip to conversation

thermal: Constify the trip argument of the .get_trend() zone callback

PATCH In review Rafael J. Wysocki 2 participants 2 messages Sep 7, 2023 – Sep 8, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: Constify the trip argument of the .get_trend() zone callback

From: Rafael J. Wysocki <[email protected]>

Add 'const' to the definition of the 'trip' argument of the .get_trend() thermal zone callback to indicate that the trip point passed to it should not be modified by it and adjust the callback functions implementing it, thermal_get_trend() in the ACPI thermal driver and __ti_thermal_get_trend(), accordingly.

No intentional functional impact.

---
 drivers/acpi/thermal.c                             |    2 +-
 drivers/thermal/ti-soc-thermal/ti-thermal-common.c |    3 ++-
 include/linux/thermal.h                            |    4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)
drivers/thermal/ti-soc-thermal/ti-thermal-common.c +2 -1
Index: linux-pm/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
===================================================================
@@ -110,7 +110,8 @@ static inline int __ti_thermal_get_temp(
 }
 
 static int __ti_thermal_get_trend(struct thermal_zone_device *tz,
-				  struct thermal_trip *trip, enum thermal_trend *trend)
+				  const struct thermal_trip *trip,
+				  enum thermal_trend *trend)
 {
 	struct ti_thermal_data *data = thermal_zone_device_priv(tz);
 	struct ti_bandgap *bgp;
include/linux/thermal.h +2 -2
Index: linux-pm/include/linux/thermal.h
===================================================================
@@ -80,8 +80,8 @@ struct thermal_zone_device_ops {
 	int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
 	int (*get_crit_temp) (struct thermal_zone_device *, int *);
 	int (*set_emul_temp) (struct thermal_zone_device *, int);
-	int (*get_trend) (struct thermal_zone_device *, struct thermal_trip *,
-			  enum thermal_trend *);
+	int (*get_trend) (struct thermal_zone_device *,
+			  const struct thermal_trip *, enum thermal_trend *);
 	void (*hot)(struct thermal_zone_device *);
 	void (*critical)(struct thermal_zone_device *);
 };
drivers/acpi/thermal.c +1 -1
Index: linux-pm/drivers/acpi/thermal.c
===================================================================
@@ -531,7 +531,7 @@ static int thermal_get_temp(struct therm
 }
 
 static int thermal_get_trend(struct thermal_zone_device *thermal,
-			     struct thermal_trip *trip,
+			     const struct thermal_trip *trip,
 			     enum thermal_trend *trend)
 {
 	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 52 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Add 'const' to the definition of the 'trip' argument of the .get_trend() thermal zone callback to indicate that the trip point passed to it should not be modified by it and adjust the callback functions implementing it, thermal_get_trend() in the ACPI thermal driver and __ti_thermal_get_trend(), accordingly.

No intentional functional impact.

---
 drivers/acpi/thermal.c                             |    2 +-
 drivers/thermal/ti-soc-thermal/ti-thermal-common.c |    3 ++-
 include/linux/thermal.h                            |    4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

Index: linux-pm/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
===================================================================

drivers/thermal/ti-soc-thermal/ti-thermal-common.c +2 -1
@@ -110,7 +110,8 @@ static inline int __ti_thermal_get_temp(
 }
 
 static int __ti_thermal_get_trend(struct thermal_zone_device *tz,
-				  struct thermal_trip *trip, enum thermal_trend *trend)
+				  const struct thermal_trip *trip,
+				  enum thermal_trend *trend)
 {
 	struct ti_thermal_data *data = thermal_zone_device_priv(tz);
 	struct ti_bandgap *bgp;

Index: linux-pm/include/linux/thermal.h
===================================================================

include/linux/thermal.h +2 -2
@@ -80,8 +80,8 @@ struct thermal_zone_device_ops {
 	int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
 	int (*get_crit_temp) (struct thermal_zone_device *, int *);
 	int (*set_emul_temp) (struct thermal_zone_device *, int);
-	int (*get_trend) (struct thermal_zone_device *, struct thermal_trip *,
-			  enum thermal_trend *);
+	int (*get_trend) (struct thermal_zone_device *,
+			  const struct thermal_trip *, enum thermal_trend *);
 	void (*hot)(struct thermal_zone_device *);
 	void (*critical)(struct thermal_zone_device *);
 };

Index: linux-pm/drivers/acpi/thermal.c
===================================================================

drivers/acpi/thermal.c static int thermal_get_temp(struct therm · line 537

Quoted 8 lines
drivers/acpi/thermal.c +1 -1
@@ -531,7 +531,7 @@ static int thermal_get_temp(struct therm
 }
 
 static int thermal_get_trend(struct thermal_zone_device *thermal,
-			     struct thermal_trip *trip,
+			     const struct thermal_trip *trip,
 			     enum thermal_trend *trend)
 {
 	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

Looks good to me,

Quoted 1 line