Skip to contentSkip to conversation

thermal: core: Relocate the struct thermal_governor definition

PATCH In review Rafael J. Wysocki 3 participants 3 messages Apr 4, 2024 – Apr 5, 2024 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: core: Relocate the struct thermal_governor definition

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

Notice that struct thermal_governor is only used by the thermal core and so move its definition to thermal_core.h.

No functional impact.

---
 drivers/thermal/thermal_core.h |   25 +++++++++++++++++++++++++
 include/linux/thermal.h        |   25 -------------------------
 2 files changed, 25 insertions(+), 25 deletions(-)
drivers/thermal/thermal_core.h +25 -0
Index: linux-pm/drivers/thermal/thermal_core.h
===================================================================
@@ -23,6 +23,31 @@ struct thermal_trip_desc {
 };
 
 /**
+ * struct thermal_governor - structure that holds thermal governor information
+ * @name:	name of the governor
+ * @bind_to_tz: callback called when binding to a thermal zone.  If it
+ *		returns 0, the governor is bound to the thermal zone,
+ *		otherwise it fails.
+ * @unbind_from_tz:	callback called when a governor is unbound from a
+ *			thermal zone.
+ * @throttle:	callback called for every trip point even if temperature is
+ *		below the trip point temperature
+ * @update_tz:	callback called when thermal zone internals have changed, e.g.
+ *		thermal cooling instance was added/removed
+ * @governor_list:	node in thermal_governor_list (in thermal_core.c)
+ */
+struct thermal_governor {
+	const char *name;
+	int (*bind_to_tz)(struct thermal_zone_device *tz);
+	void (*unbind_from_tz)(struct thermal_zone_device *tz);
+	int (*throttle)(struct thermal_zone_device *tz,
+			const struct thermal_trip *trip);
+	void (*update_tz)(struct thermal_zone_device *tz,
+			  enum thermal_notify_event reason);
+	struct list_head	governor_list;
+};
+
+/**
  * struct thermal_zone_device - structure for a thermal zone
  * @id:		unique id number for each thermal zone
  * @type:	the thermal zone device type
include/linux/thermal.h +0 -25
Index: linux-pm/include/linux/thermal.h
===================================================================
@@ -126,31 +126,6 @@ struct thermal_cooling_device {
 #endif
 };
 
-/**
- * struct thermal_governor - structure that holds thermal governor information
- * @name:	name of the governor
- * @bind_to_tz: callback called when binding to a thermal zone.  If it
- *		returns 0, the governor is bound to the thermal zone,
- *		otherwise it fails.
- * @unbind_from_tz:	callback called when a governor is unbound from a
- *			thermal zone.
- * @throttle:	callback called for every trip point even if temperature is
- *		below the trip point temperature
- * @update_tz:	callback called when thermal zone internals have changed, e.g.
- *		thermal cooling instance was added/removed
- * @governor_list:	node in thermal_governor_list (in thermal_core.c)
- */
-struct thermal_governor {
-	const char *name;
-	int (*bind_to_tz)(struct thermal_zone_device *tz);
-	void (*unbind_from_tz)(struct thermal_zone_device *tz);
-	int (*throttle)(struct thermal_zone_device *tz,
-			const struct thermal_trip *trip);
-	void (*update_tz)(struct thermal_zone_device *tz,
-			  enum thermal_notify_event reason);
-	struct list_head	governor_list;
-};
-
 /* Structure to define Thermal Zone parameters */
 struct thermal_zone_params {
 	const char *governor_name;
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Rafael J. Wysocki

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

Notice that struct thermal_governor is only used by the thermal core and so move its definition to thermal_core.h.

No functional impact.

Quoted 80 lines
---
  drivers/thermal/thermal_core.h |   25 +++++++++++++++++++++++++
  include/linux/thermal.h        |   25 -------------------------
  2 files changed, 25 insertions(+), 25 deletions(-)

Index: linux-pm/drivers/thermal/thermal_core.h
===================================================================

drivers/thermal/thermal_core.h +25 -0
@@ -23,6 +23,31 @@ struct thermal_trip_desc {
  };
 
  /**
+ * struct thermal_governor - structure that holds thermal governor information
+ * @name:	name of the governor
+ * @bind_to_tz: callback called when binding to a thermal zone.  If it
+ *		returns 0, the governor is bound to the thermal zone,
+ *		otherwise it fails.
+ * @unbind_from_tz:	callback called when a governor is unbound from a
+ *			thermal zone.
+ * @throttle:	callback called for every trip point even if temperature is
+ *		below the trip point temperature
+ * @update_tz:	callback called when thermal zone internals have changed, e.g.
+ *		thermal cooling instance was added/removed
+ * @governor_list:	node in thermal_governor_list (in thermal_core.c)
+ */
+struct thermal_governor {
+	const char *name;
+	int (*bind_to_tz)(struct thermal_zone_device *tz);
+	void (*unbind_from_tz)(struct thermal_zone_device *tz);
+	int (*throttle)(struct thermal_zone_device *tz,
+			const struct thermal_trip *trip);
+	void (*update_tz)(struct thermal_zone_device *tz,
+			  enum thermal_notify_event reason);
+	struct list_head	governor_list;
+};
+
+/**
   * struct thermal_zone_device - structure for a thermal zone
   * @id:		unique id number for each thermal zone
   * @type:	the thermal zone device type

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

include/linux/thermal.h +0 -25
@@ -126,31 +126,6 @@ struct thermal_cooling_device {
  #endif
  };
 
-/**
- * struct thermal_governor - structure that holds thermal governor information
- * @name:	name of the governor
- * @bind_to_tz: callback called when binding to a thermal zone.  If it
- *		returns 0, the governor is bound to the thermal zone,
- *		otherwise it fails.
- * @unbind_from_tz:	callback called when a governor is unbound from a
- *			thermal zone.
- * @throttle:	callback called for every trip point even if temperature is
- *		below the trip point temperature
- * @update_tz:	callback called when thermal zone internals have changed, e.g.
- *		thermal cooling instance was added/removed
- * @governor_list:	node in thermal_governor_list (in thermal_core.c)
- */
-struct thermal_governor {
-	const char *name;
-	int (*bind_to_tz)(struct thermal_zone_device *tz);
-	void (*unbind_from_tz)(struct thermal_zone_device *tz);
-	int (*throttle)(struct thermal_zone_device *tz,
-			const struct thermal_trip *trip);
-	void (*update_tz)(struct thermal_zone_device *tz,
-			  enum thermal_notify_event reason);
-	struct list_head	governor_list;
-};
-
  /* Structure to define Thermal Zone parameters */
  struct thermal_zone_params {
  	const char *governor_name;
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rafael J. Wysocki
Quoted 78 lines · Rafael J. Wysocki

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

Notice that struct thermal_governor is only used by the thermal core and so move its definition to thermal_core.h.

No functional impact.

---
  drivers/thermal/thermal_core.h |   25 +++++++++++++++++++++++++
  include/linux/thermal.h        |   25 -------------------------
  2 files changed, 25 insertions(+), 25 deletions(-)

Index: linux-pm/drivers/thermal/thermal_core.h
===================================================================

drivers/thermal/thermal_core.h +25 -0
@@ -23,6 +23,31 @@ struct thermal_trip_desc {
  };
 
  /**
+ * struct thermal_governor - structure that holds thermal governor information
+ * @name:	name of the governor
+ * @bind_to_tz: callback called when binding to a thermal zone.  If it
+ *		returns 0, the governor is bound to the thermal zone,
+ *		otherwise it fails.
+ * @unbind_from_tz:	callback called when a governor is unbound from a
+ *			thermal zone.
+ * @throttle:	callback called for every trip point even if temperature is
+ *		below the trip point temperature
+ * @update_tz:	callback called when thermal zone internals have changed, e.g.
+ *		thermal cooling instance was added/removed
+ * @governor_list:	node in thermal_governor_list (in thermal_core.c)
+ */
+struct thermal_governor {
+	const char *name;
+	int (*bind_to_tz)(struct thermal_zone_device *tz);
+	void (*unbind_from_tz)(struct thermal_zone_device *tz);
+	int (*throttle)(struct thermal_zone_device *tz,
+			const struct thermal_trip *trip);
+	void (*update_tz)(struct thermal_zone_device *tz,
+			  enum thermal_notify_event reason);
+	struct list_head	governor_list;
+};
+
+/**
   * struct thermal_zone_device - structure for a thermal zone
   * @id:		unique id number for each thermal zone
   * @type:	the thermal zone device type

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

include/linux/thermal.h +0 -18
@@ -126,31 +126,6 @@ struct thermal_cooling_device {
  #endif
  };
 
-/**
- * struct thermal_governor - structure that holds thermal governor information
- * @name:	name of the governor
- * @bind_to_tz: callback called when binding to a thermal zone.  If it
- *		returns 0, the governor is bound to the thermal zone,
- *		otherwise it fails.
- * @unbind_from_tz:	callback called when a governor is unbound from a
- *			thermal zone.
- * @throttle:	callback called for every trip point even if temperature is
- *		below the trip point temperature
- * @update_tz:	callback called when thermal zone internals have changed, e.g.
- *		thermal cooling instance was added/removed
- * @governor_list:	node in thermal_governor_list (in thermal_core.c)
- */
-struct thermal_governor {
-	const char *name;
-	int (*bind_to_tz)(struct thermal_zone_device *tz);
-	void (*unbind_from_tz)(struct thermal_zone_device *tz);

include/linux/thermal.h struct thermal_cooling_device { · line 131

Quoted 10 lines
include/linux/thermal.h +0 -7
-	int (*throttle)(struct thermal_zone_device *tz,
-			const struct thermal_trip *trip);
-	void (*update_tz)(struct thermal_zone_device *tz,
-			  enum thermal_notify_event reason);
-	struct list_head	governor_list;
-};
-
  /* Structure to define Thermal Zone parameters */
  struct thermal_zone_params {
  	const char *governor_name;

That makes perfectly sense IMO. We don't have drivers which come together with some custom governor just for them (like IIRC some devfreq more complex devices do/did).

Lets close that open dimension.