Skip to contentSkip to conversation

thermal: Move default governor config option to the internal header

PATCH In review Daniel Lezcano 3 participants 20 messages Apr 2, 2020 – Apr 12, 2020 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/9 thermal: Move default governor config option to the internal header

The default governor set at compilation time is a thermal internal business, no need to export to the global thermal header.

Move the config options to the internal header.

---
 drivers/thermal/thermal_core.h | 11 +++++++++++
 include/linux/thermal.h        | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/thermal/thermal_core.h +11 -0
index 37cd4e2bead2..828305508556 100644
@@ -12,6 +12,17 @@
 #include <linux/device.h>
 #include <linux/thermal.h>
 
+/* Default Thermal Governor */
+#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
+#define DEFAULT_THERMAL_GOVERNOR       "step_wise"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
+#define DEFAULT_THERMAL_GOVERNOR       "fair_share"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
+#define DEFAULT_THERMAL_GOVERNOR       "user_space"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
+#define DEFAULT_THERMAL_GOVERNOR       "power_allocator"
+#endif
+
 /* Initial state of a cooling device during binding */
 #define THERMAL_NO_TARGET -1UL
 
include/linux/thermal.h +0 -11
index 448841ab0dca..71cff87dcb46 100644
@@ -32,17 +32,6 @@
 /* use value, which < 0K, to indicate an invalid/uninitialized temperature */
 #define THERMAL_TEMP_INVALID	-274000
 
-/* Default Thermal Governor */
-#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
-#define DEFAULT_THERMAL_GOVERNOR       "step_wise"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
-#define DEFAULT_THERMAL_GOVERNOR       "fair_share"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
-#define DEFAULT_THERMAL_GOVERNOR       "user_space"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
-#define DEFAULT_THERMAL_GOVERNOR       "power_allocator"
-#endif
-
 struct thermal_zone_device;
 struct thermal_cooling_device;
 struct thermal_instance;
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/9 thermal: Move struct thermal_attr to the private header

The structure belongs to the thermal core internals but it is exported in the include/linux/thermal.h

For better self-encapsulation and less impact for the compilation if a change is made on it. Move the structure in the thermal core internal header file.

---
 drivers/thermal/thermal_core.h | 5 +++++
 include/linux/thermal.h        | 6 +-----
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/thermal/thermal_core.h +5 -0
index 828305508556..5d08ad60d9df 100644
@@ -41,6 +41,11 @@ extern struct thermal_governor *__governor_thermal_table_end[];
 	     __governor < __governor_thermal_table_end;	\
 	     __governor++)
 
+struct thermal_attr {
+	struct device_attribute attr;
+	char name[THERMAL_NAME_LENGTH];
+};
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +1 -5
index 71cff87dcb46..5aa80fb2fb61 100644
@@ -35,6 +35,7 @@
 struct thermal_zone_device;
 struct thermal_cooling_device;
 struct thermal_instance;
+struct thermal_attr;
 
 enum thermal_device_mode {
 	THERMAL_DEVICE_DISABLED = 0,
@@ -119,11 +120,6 @@ struct thermal_cooling_device {
 	struct list_head node;
 };
 
-struct thermal_attr {
-	struct device_attribute attr;
-	char name[THERMAL_NAME_LENGTH];
-};
-
 /**
  * struct thermal_zone_device - structure for a thermal zone
  * @id:		unique id number for each thermal zone
Signature · 1 line
2.17.1
Reviewed-by on v2 2/9
#2 lore raw

Re: [PATCH V2 2/9] thermal: Move struct thermal_attr to the private header

Quoted 9 lines · Daniel Lezcano

The structure belongs to the thermal core internals but it is exported in the include/linux/thermal.h

For better self-encapsulation and less impact for the compilation if a change is made on it. Move the structure in the thermal core internal header file.

Quoted 48 lines
---
 drivers/thermal/thermal_core.h | 5 +++++
 include/linux/thermal.h        | 6 +-----
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/thermal/thermal_core.h +5 -0
index 828305508556..5d08ad60d9df 100644
@@ -41,6 +41,11 @@ extern struct thermal_governor *__governor_thermal_table_end[];
             __governor < __governor_thermal_table_end; \
             __governor++)
 
+struct thermal_attr {
+       struct device_attribute attr;
+       char name[THERMAL_NAME_LENGTH];
+};
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +1 -6
index 71cff87dcb46..5aa80fb2fb61 100644
@@ -35,6 +35,7 @@
 struct thermal_zone_device;
 struct thermal_cooling_device;
 struct thermal_instance;
+struct thermal_attr;
 
 enum thermal_device_mode {
        THERMAL_DEVICE_DISABLED = 0,
@@ -119,11 +120,6 @@ struct thermal_cooling_device {
        struct list_head node;
 };
 
-struct thermal_attr {
-       struct device_attribute attr;
-       char name[THERMAL_NAME_LENGTH];
-};
-
 /**
  * struct thermal_zone_device - structure for a thermal zone
  * @id:                unique id number for each thermal zone
--

2.17.1

#3 lore raw

PATCH v2 3/9 thermal: Move internal IPA functions

In reply to Daniel Lezcano

The exported IPA functions are used by the IPA. It is pointless to declare the functions in the thermal.h file.

For better self-encapsulation and less impact for the compilation if a change is made on it. Move the code in the thermal core internal header file.

As the users depends on THERMAL then it is pointless to have the stub, remove them.

Take also the opportunity to fix checkpatch warnings/errors when moving the code around.

---
 drivers/thermal/thermal_core.h | 13 +++++++++++++
 include/linux/thermal.h        | 24 ------------------------
 2 files changed, 13 insertions(+), 24 deletions(-)
drivers/thermal/thermal_core.h +13 -0
index 5d08ad60d9df..f99551ce9838 100644
@@ -46,6 +46,19 @@ struct thermal_attr {
 	char name[THERMAL_NAME_LENGTH];
 };
 
+static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
+{
+	return cdev->ops->get_requested_power && cdev->ops->state2power &&
+		cdev->ops->power2state;
+}
+
+int power_actor_get_max_power(struct thermal_cooling_device *cdev,
+			      struct thermal_zone_device *tz, u32 *max_power);
+int power_actor_get_min_power(struct thermal_cooling_device *cdev,
+			      struct thermal_zone_device *tz, u32 *min_power);
+int power_actor_set_power(struct thermal_cooling_device *cdev,
+			  struct thermal_instance *ti, u32 power);
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +0 -24
index 5aa80fb2fb61..e0279f7b43f4 100644
@@ -399,18 +399,6 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev,
 #endif
 
 #if IS_ENABLED(CONFIG_THERMAL)
-static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
-{
-	return cdev->ops->get_requested_power && cdev->ops->state2power &&
-		cdev->ops->power2state;
-}
-
-int power_actor_get_max_power(struct thermal_cooling_device *,
-			      struct thermal_zone_device *tz, u32 *max_power);
-int power_actor_get_min_power(struct thermal_cooling_device *,
-			      struct thermal_zone_device *tz, u32 *min_power);
-int power_actor_set_power(struct thermal_cooling_device *,
-			  struct thermal_instance *, u32);
 struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
 		void *, struct thermal_zone_device_ops *,
 		struct thermal_zone_params *, int, int);
@@ -447,18 +435,6 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
 void thermal_cdev_update(struct thermal_cooling_device *);
 void thermal_notify_framework(struct thermal_zone_device *, int);
 #else
-static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
-{ return false; }
-static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev,
-			      struct thermal_zone_device *tz, u32 *max_power)
-{ return 0; }
-static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev,
-					    struct thermal_zone_device *tz,
-					    u32 *min_power)
-{ return -ENODEV; }
-static inline int power_actor_set_power(struct thermal_cooling_device *cdev,
-			  struct thermal_instance *tz, u32 power)
-{ return 0; }
 static inline struct thermal_zone_device *thermal_zone_device_register(
 	const char *type, int trips, int mask, void *devdata,
 	struct thermal_zone_device_ops *ops,
Signature · 1 line
2.17.1
Reviewed-by on v2 3/9
#4 lore raw

Re: [PATCH V2 3/9] thermal: Move internal IPA functions

Quoted 8 lines · Daniel Lezcano

The exported IPA functions are used by the IPA. It is pointless to declare the functions in the thermal.h file.

For better self-encapsulation and less impact for the compilation if a change is made on it. Move the code in the thermal core internal header file.

Quoted 7 lines

As the users depends on THERMAL then it is pointless to have the stub, remove them.

Take also the opportunity to fix checkpatch warnings/errors when moving the code around.

Quoted 74 lines
---
 drivers/thermal/thermal_core.h | 13 +++++++++++++
 include/linux/thermal.h        | 24 ------------------------
 2 files changed, 13 insertions(+), 24 deletions(-)
drivers/thermal/thermal_core.h +13 -0
index 5d08ad60d9df..f99551ce9838 100644
@@ -46,6 +46,19 @@ struct thermal_attr {
        char name[THERMAL_NAME_LENGTH];
 };
 
+static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
+{
+       return cdev->ops->get_requested_power && cdev->ops->state2power &&
+               cdev->ops->power2state;
+}
+
+int power_actor_get_max_power(struct thermal_cooling_device *cdev,
+                             struct thermal_zone_device *tz, u32 *max_power);
+int power_actor_get_min_power(struct thermal_cooling_device *cdev,
+                             struct thermal_zone_device *tz, u32 *min_power);
+int power_actor_set_power(struct thermal_cooling_device *cdev,
+                         struct thermal_instance *ti, u32 power);
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +0 -25
index 5aa80fb2fb61..e0279f7b43f4 100644
@@ -399,18 +399,6 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev,
 #endif
 
 #if IS_ENABLED(CONFIG_THERMAL)
-static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
-{
-       return cdev->ops->get_requested_power && cdev->ops->state2power &&
-               cdev->ops->power2state;
-}
-
-int power_actor_get_max_power(struct thermal_cooling_device *,
-                             struct thermal_zone_device *tz, u32 *max_power);
-int power_actor_get_min_power(struct thermal_cooling_device *,
-                             struct thermal_zone_device *tz, u32 *min_power);
-int power_actor_set_power(struct thermal_cooling_device *,
-                         struct thermal_instance *, u32);
 struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
                void *, struct thermal_zone_device_ops *,
                struct thermal_zone_params *, int, int);
@@ -447,18 +435,6 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
 void thermal_cdev_update(struct thermal_cooling_device *);
 void thermal_notify_framework(struct thermal_zone_device *, int);
 #else
-static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
-{ return false; }
-static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev,
-                             struct thermal_zone_device *tz, u32 *max_power)
-{ return 0; }
-static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev,
-                                           struct thermal_zone_device *tz,
-                                           u32 *min_power)
-{ return -ENODEV; }
-static inline int power_actor_set_power(struct thermal_cooling_device *cdev,
-                         struct thermal_instance *tz, u32 power)
-{ return 0; }
 static inline struct thermal_zone_device *thermal_zone_device_register(
        const char *type, int trips, int mask, void *devdata,
        struct thermal_zone_device_ops *ops,
--

2.17.1

#5 lore raw

PATCH v2 4/9 thermal: Move trip point structure definition to private header

In reply to Daniel Lezcano

The struct thermal_trip is only used by the thermal internals, it is pointless to export the definition in the global header.

Move the structure to the thermal_core.h internal header.

---
 drivers/thermal/thermal_core.h | 13 +++++++++++++
 include/linux/thermal.h        | 15 ---------------
 2 files changed, 13 insertions(+), 15 deletions(-)
drivers/thermal/thermal_core.h +13 -0
index f99551ce9838..d37de708c28a 100644
@@ -58,6 +58,19 @@ int power_actor_get_min_power(struct thermal_cooling_device *cdev,
 			      struct thermal_zone_device *tz, u32 *min_power);
 int power_actor_set_power(struct thermal_cooling_device *cdev,
 			  struct thermal_instance *ti, u32 power);
+/**
+ * struct thermal_trip - representation of a point in temperature domain
+ * @np: pointer to struct device_node that this trip point was created from
+ * @temperature: temperature value in miliCelsius
+ * @hysteresis: relative hysteresis in miliCelsius
+ * @type: trip point type
+ */
+struct thermal_trip {
+	struct device_node *np;
+	int temperature;
+	int hysteresis;
+	enum thermal_trip_type type;
+};
 
 /*
  * This structure is used to describe the behavior of
include/linux/thermal.h +0 -15
index e0279f7b43f4..7adbfe092281 100644
@@ -332,21 +332,6 @@ struct thermal_zone_of_device_ops {
 	int (*set_trip_temp)(void *, int, int);
 };
 
-/**
- * struct thermal_trip - representation of a point in temperature domain
- * @np: pointer to struct device_node that this trip point was created from
- * @temperature: temperature value in miliCelsius
- * @hysteresis: relative hysteresis in miliCelsius
- * @type: trip point type
- */
-
-struct thermal_trip {
-	struct device_node *np;
-	int temperature;
-	int hysteresis;
-	enum thermal_trip_type type;
-};
-
 /* Function declarations */
 #ifdef CONFIG_THERMAL_OF
 int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
Signature · 1 line
2.17.1
Reviewed-by on v2 4/9
#6 lore raw

Re: [PATCH V2 4/9] thermal: Move trip point structure definition to private header

Quoted 7 lines · Daniel Lezcano

The struct thermal_trip is only used by the thermal internals, it is pointless to export the definition in the global header.

Move the structure to the thermal_core.h internal header.

Quoted 58 lines
---
 drivers/thermal/thermal_core.h | 13 +++++++++++++
 include/linux/thermal.h        | 15 ---------------
 2 files changed, 13 insertions(+), 15 deletions(-)
drivers/thermal/thermal_core.h +13 -0
index f99551ce9838..d37de708c28a 100644
@@ -58,6 +58,19 @@ int power_actor_get_min_power(struct thermal_cooling_device *cdev,
                              struct thermal_zone_device *tz, u32 *min_power);
 int power_actor_set_power(struct thermal_cooling_device *cdev,
                          struct thermal_instance *ti, u32 power);
+/**
+ * struct thermal_trip - representation of a point in temperature domain
+ * @np: pointer to struct device_node that this trip point was created from
+ * @temperature: temperature value in miliCelsius
+ * @hysteresis: relative hysteresis in miliCelsius
+ * @type: trip point type
+ */
+struct thermal_trip {
+       struct device_node *np;
+       int temperature;
+       int hysteresis;
+       enum thermal_trip_type type;
+};
 
 /*
  * This structure is used to describe the behavior of
include/linux/thermal.h +0 -16
index e0279f7b43f4..7adbfe092281 100644
@@ -332,21 +332,6 @@ struct thermal_zone_of_device_ops {
        int (*set_trip_temp)(void *, int, int);
 };
 
-/**
- * struct thermal_trip - representation of a point in temperature domain
- * @np: pointer to struct device_node that this trip point was created from
- * @temperature: temperature value in miliCelsius
- * @hysteresis: relative hysteresis in miliCelsius
- * @type: trip point type
- */
-
-struct thermal_trip {
-       struct device_node *np;
-       int temperature;
-       int hysteresis;
-       enum thermal_trip_type type;
-};
-
 /* Function declarations */
 #ifdef CONFIG_THERMAL_OF
 int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
--

2.17.1

#7 lore raw

PATCH v2 5/9 thermal: Move get_tz_trend to the internal header

In reply to Daniel Lezcano

The function is not used any place other than the thermal directory. It does not make sense to export its definition in the global header as there is no use of it.

Move the definition to the internal header and allow better self-encapsulation.

Take the opportunity to add the parameter names to make checkpatch happy and remove the pointless stubs.

---
 drivers/thermal/thermal_core.h | 2 ++
 include/linux/thermal.h        | 4 +---
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/thermal_core.h +2 -0
index d37de708c28a..5fb2bd9c7034 100644
@@ -72,6 +72,8 @@ struct thermal_trip {
 	enum thermal_trip_type type;
 };
 
+int get_tz_trend(struct thermal_zone_device *tz, int trip);
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +1 -3
index 7adbfe092281..8006ba5de855 100644
@@ -414,7 +414,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
 int thermal_zone_get_slope(struct thermal_zone_device *tz);
 int thermal_zone_get_offset(struct thermal_zone_device *tz);
 
-int get_tz_trend(struct thermal_zone_device *, int);
 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
 		struct thermal_cooling_device *, int);
 void thermal_cdev_update(struct thermal_cooling_device *);
@@ -473,8 +472,7 @@ static inline int thermal_zone_get_slope(
 static inline int thermal_zone_get_offset(
 		struct thermal_zone_device *tz)
 { return -ENODEV; }
-static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
-{ return -ENODEV; }
+
 static inline struct thermal_instance *
 get_thermal_instance(struct thermal_zone_device *tz,
 	struct thermal_cooling_device *cdev, int trip)
Signature · 1 line
2.17.1
Reviewed-by on v2 5/9
#8 lore raw

Re: [PATCH V2 5/9] thermal: Move get_tz_trend to the internal header

Quoted 5 lines · Daniel Lezcano

The function is not used any place other than the thermal directory. It does not make sense to export its definition in the global header as there is no use of it.

Quoted 7 lines

Move the definition to the internal header and allow better self-encapsulation.

Take the opportunity to add the parameter names to make checkpatch happy and remove the pointless stubs.

Quoted 43 lines
---
 drivers/thermal/thermal_core.h | 2 ++
 include/linux/thermal.h        | 4 +---
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/thermal_core.h +2 -0
index d37de708c28a..5fb2bd9c7034 100644
@@ -72,6 +72,8 @@ struct thermal_trip {
        enum thermal_trip_type type;
 };
 
+int get_tz_trend(struct thermal_zone_device *tz, int trip);
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +1 -4
index 7adbfe092281..8006ba5de855 100644
@@ -414,7 +414,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
 int thermal_zone_get_slope(struct thermal_zone_device *tz);
 int thermal_zone_get_offset(struct thermal_zone_device *tz);
 
-int get_tz_trend(struct thermal_zone_device *, int);
 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
                struct thermal_cooling_device *, int);
 void thermal_cdev_update(struct thermal_cooling_device *);
@@ -473,8 +472,7 @@ static inline int thermal_zone_get_slope(
 static inline int thermal_zone_get_offset(
                struct thermal_zone_device *tz)
 { return -ENODEV; }
-static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
-{ return -ENODEV; }
+
 static inline struct thermal_instance *
 get_thermal_instance(struct thermal_zone_device *tz,
        struct thermal_cooling_device *cdev, int trip)
--

2.17.1

#9 lore raw

PATCH v2 6/9 thermal: Move get_thermal_instance to the internal header

In reply to Daniel Lezcano

The function is not used any place other than the thermal directory. It does not make sense to export its definition in the global header as there is no use of it.

Move the definition to the internal header and allow better self-encapsulation.

Take the opportunity to add the parameter names to make checkpatch happy and remove the pointless stubs.

---
 drivers/thermal/thermal_core.h | 5 +++++
 include/linux/thermal.h        | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/thermal/thermal_core.h +5 -0
index 5fb2bd9c7034..c95689586e19 100644
@@ -74,6 +74,11 @@ struct thermal_trip {
 
 int get_tz_trend(struct thermal_zone_device *tz, int trip);
 
+struct thermal_instance *
+get_thermal_instance(struct thermal_zone_device *tz,
+		     struct thermal_cooling_device *cdev,
+		     int trip);
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +0 -6
index 8006ba5de855..47e745c5dfca 100644
@@ -414,8 +414,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
 int thermal_zone_get_slope(struct thermal_zone_device *tz);
 int thermal_zone_get_offset(struct thermal_zone_device *tz);
 
-struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
-		struct thermal_cooling_device *, int);
 void thermal_cdev_update(struct thermal_cooling_device *);
 void thermal_notify_framework(struct thermal_zone_device *, int);
 #else
@@ -473,10 +471,6 @@ static inline int thermal_zone_get_offset(
 		struct thermal_zone_device *tz)
 { return -ENODEV; }
 
-static inline struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
-	struct thermal_cooling_device *cdev, int trip)
-{ return ERR_PTR(-ENODEV); }
 static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
 { }
 static inline void thermal_notify_framework(struct thermal_zone_device *tz,
Signature · 1 line
2.17.1
Reviewed-by on v2 6/9
#10 lore raw

Re: [PATCH V2 6/9] thermal: Move get_thermal_instance to the internal header

Quoted 5 lines · Daniel Lezcano

The function is not used any place other than the thermal directory. It does not make sense to export its definition in the global header as there is no use of it.

Quoted 7 lines

Move the definition to the internal header and allow better self-encapsulation.

Take the opportunity to add the parameter names to make checkpatch happy and remove the pointless stubs.

Quoted 48 lines
---
 drivers/thermal/thermal_core.h | 5 +++++
 include/linux/thermal.h        | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/thermal/thermal_core.h +5 -0
index 5fb2bd9c7034..c95689586e19 100644
@@ -74,6 +74,11 @@ struct thermal_trip {
 
 int get_tz_trend(struct thermal_zone_device *tz, int trip);
 
+struct thermal_instance *
+get_thermal_instance(struct thermal_zone_device *tz,
+                    struct thermal_cooling_device *cdev,
+                    int trip);
+
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
include/linux/thermal.h +0 -7
index 8006ba5de855..47e745c5dfca 100644
@@ -414,8 +414,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
 int thermal_zone_get_slope(struct thermal_zone_device *tz);
 int thermal_zone_get_offset(struct thermal_zone_device *tz);
 
-struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
-               struct thermal_cooling_device *, int);
 void thermal_cdev_update(struct thermal_cooling_device *);
 void thermal_notify_framework(struct thermal_zone_device *, int);
 #else
@@ -473,10 +471,6 @@ static inline int thermal_zone_get_offset(
                struct thermal_zone_device *tz)
 { return -ENODEV; }
 
-static inline struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
-       struct thermal_cooling_device *cdev, int trip)
-{ return ERR_PTR(-ENODEV); }
 static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
 { }
 static inline void thermal_notify_framework(struct thermal_zone_device *tz,
--

2.17.1

#11 lore raw

PATCH v2 7/9 thermal: Change IS_ENABLED to IFDEF in the header file

In reply to Daniel Lezcano

The thermal framework can not be compiled as a module. The IS_ENABLED macro is useless here and can be replaced by an ifdef.

---
 include/linux/thermal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/thermal.h +1 -1
index 47e745c5dfca..12df9ff0182d 100644
@@ -383,7 +383,7 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev,
 
 #endif
 
-#if IS_ENABLED(CONFIG_THERMAL)
+#ifdef CONFIG_THERMAL
 struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
 		void *, struct thermal_zone_device_ops *,
 		struct thermal_zone_params *, int, int);
Signature · 1 line
2.17.1
Reviewed-by on v2 7/9
#12 lore raw

Re: [PATCH V2 7/9] thermal: Change IS_ENABLED to IFDEF in the header file

Quoted 5 lines · Daniel Lezcano

The thermal framework can not be compiled as a module. The IS_ENABLED macro is useless here and can be replaced by an ifdef.

Quoted 20 lines
---
 include/linux/thermal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/thermal.h +1 -2
index 47e745c5dfca..12df9ff0182d 100644
@@ -383,7 +383,7 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev,
 
 #endif
 
-#if IS_ENABLED(CONFIG_THERMAL)
+#ifdef CONFIG_THERMAL
 struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
                void *, struct thermal_zone_device_ops *,
                struct thermal_zone_params *, int, int);
--

2.17.1

#13 lore raw

PATCH v2 8/9 thermal: Remove stubs for thermal_zone_[un]bind_cooling_device

In reply to Daniel Lezcano

All callers of the functions depends on THERMAL, it is pointless to define stubs. Remove them.

---
 include/linux/thermal.h | 10 ----------
 1 file changed, 10 deletions(-)
include/linux/thermal.h +0 -10
index 12df9ff0182d..7b3dbfe15b59 100644
@@ -426,16 +426,6 @@ static inline struct thermal_zone_device *thermal_zone_device_register(
 static inline void thermal_zone_device_unregister(
 	struct thermal_zone_device *tz)
 { }
-static inline int thermal_zone_bind_cooling_device(
-	struct thermal_zone_device *tz, int trip,
-	struct thermal_cooling_device *cdev,
-	unsigned long upper, unsigned long lower,
-	unsigned int weight)
-{ return -ENODEV; }
-static inline int thermal_zone_unbind_cooling_device(
-	struct thermal_zone_device *tz, int trip,
-	struct thermal_cooling_device *cdev)
-{ return -ENODEV; }
 static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
 					      enum thermal_notify_event event)
 { }
Signature · 1 line
2.17.1
Reviewed-by on v2 8/9
#14 lore raw

Re: [PATCH V2 8/9] thermal: Remove stubs for thermal_zone_[un]bind_cooling_device

Quoted 5 lines · Daniel Lezcano

All callers of the functions depends on THERMAL, it is pointless to define stubs. Remove them.

Quoted 28 lines
---
 include/linux/thermal.h | 10 ----------
 1 file changed, 10 deletions(-)
include/linux/thermal.h +0 -11
index 12df9ff0182d..7b3dbfe15b59 100644
@@ -426,16 +426,6 @@ static inline struct thermal_zone_device *thermal_zone_device_register(
 static inline void thermal_zone_device_unregister(
        struct thermal_zone_device *tz)
 { }
-static inline int thermal_zone_bind_cooling_device(
-       struct thermal_zone_device *tz, int trip,
-       struct thermal_cooling_device *cdev,
-       unsigned long upper, unsigned long lower,
-       unsigned int weight)
-{ return -ENODEV; }
-static inline int thermal_zone_unbind_cooling_device(
-       struct thermal_zone_device *tz, int trip,
-       struct thermal_cooling_device *cdev)
-{ return -ENODEV; }
 static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
                                              enum thermal_notify_event event)
 { }
--

2.17.1

#15 lore raw

PATCH v2 9/9 thermal: Remove thermal_zone_device_update() stub

In reply to Daniel Lezcano

All users of the function depends on THERMAL, no stub is needed. Remove it.

---
 include/linux/thermal.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/thermal.h +0 -3
index 7b3dbfe15b59..216185bb3014 100644
@@ -426,9 +426,6 @@ static inline struct thermal_zone_device *thermal_zone_device_register(
 static inline void thermal_zone_device_unregister(
 	struct thermal_zone_device *tz)
 { }
-static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
-					      enum thermal_notify_event event)
-{ }
 static inline struct thermal_cooling_device *
 thermal_cooling_device_register(char *type, void *devdata,
 	const struct thermal_cooling_device_ops *ops)
Signature · 1 line
2.17.1
Reviewed-by on v2 9/9
#16 lore raw

Re: [PATCH V2 9/9] thermal: Remove thermal_zone_device_update() stub

Quoted 5 lines · Daniel Lezcano

All users of the function depends on THERMAL, no stub is needed. Remove it.

Quoted 21 lines
---
 include/linux/thermal.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/thermal.h +0 -4
index 7b3dbfe15b59..216185bb3014 100644
@@ -426,9 +426,6 @@ static inline struct thermal_zone_device *thermal_zone_device_register(
 static inline void thermal_zone_device_unregister(
        struct thermal_zone_device *tz)
 { }
-static inline void thermal_zone_device_update(struct thermal_zone_device *tz,
-                                             enum thermal_notify_event event)
-{ }
 static inline struct thermal_cooling_device *
 thermal_cooling_device_register(char *type, void *devdata,
        const struct thermal_cooling_device_ops *ops)
--

2.17.1

Reviewed-by on v2 1/9
#17 lore raw
In reply to Daniel Lezcano
Quoted 7 lines · Daniel Lezcano

The default governor set at compilation time is a thermal internal business, no need to export to the global thermal header.

Move the config options to the internal header.

Quoted 52 lines
---
 drivers/thermal/thermal_core.h | 11 +++++++++++
 include/linux/thermal.h        | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/thermal/thermal_core.h +11 -0
index 37cd4e2bead2..828305508556 100644
@@ -12,6 +12,17 @@
 #include <linux/device.h>
 #include <linux/thermal.h>
 
+/* Default Thermal Governor */
+#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
+#define DEFAULT_THERMAL_GOVERNOR       "step_wise"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
+#define DEFAULT_THERMAL_GOVERNOR       "fair_share"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
+#define DEFAULT_THERMAL_GOVERNOR       "user_space"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
+#define DEFAULT_THERMAL_GOVERNOR       "power_allocator"
+#endif
+
 /* Initial state of a cooling device during binding */
 #define THERMAL_NO_TARGET -1UL
 
include/linux/thermal.h +0 -12
index 448841ab0dca..71cff87dcb46 100644
@@ -32,17 +32,6 @@
 /* use value, which < 0K, to indicate an invalid/uninitialized temperature */
 #define THERMAL_TEMP_INVALID   -274000
 
-/* Default Thermal Governor */
-#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
-#define DEFAULT_THERMAL_GOVERNOR       "step_wise"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
-#define DEFAULT_THERMAL_GOVERNOR       "fair_share"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
-#define DEFAULT_THERMAL_GOVERNOR       "user_space"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
-#define DEFAULT_THERMAL_GOVERNOR       "power_allocator"
-#endif
-
 struct thermal_zone_device;
 struct thermal_cooling_device;
 struct thermal_instance;
--

2.17.1

reviewer
#18 lore raw
In reply to Daniel Lezcano

Hi, Daniel,

please feel free to add my Acked-by for the whole patch set.

thanks,
rui

Quoted 57 lines · Daniel Lezcano

The default governor set at compilation time is a thermal internal business, no need to export to the global thermal header.

Move the config options to the internal header.

---
 drivers/thermal/thermal_core.h | 11 +++++++++++
 include/linux/thermal.h        | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/thermal/thermal_core.h +11 -0
index 37cd4e2bead2..828305508556 100644
@@ -12,6 +12,17 @@
 #include <linux/device.h>
 #include <linux/thermal.h>
 
+/* Default Thermal Governor */
+#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
+#define DEFAULT_THERMAL_GOVERNOR       "step_wise"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
+#define DEFAULT_THERMAL_GOVERNOR       "fair_share"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
+#define DEFAULT_THERMAL_GOVERNOR       "user_space"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
+#define DEFAULT_THERMAL_GOVERNOR       "power_allocator"
+#endif
+
 /* Initial state of a cooling device during binding */
 #define THERMAL_NO_TARGET -1UL
 
include/linux/thermal.h +0 -0
index 448841ab0dca..71cff87dcb46 100644
@@ -32,17 +32,6 @@
 /* use value, which < 0K, to indicate an invalid/uninitialized

temperature */
#define THERMAL_TEMP_INVALID -274000

include/linux/thermal.h +0 -11
-/* Default Thermal Governor */
-#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
-#define DEFAULT_THERMAL_GOVERNOR       "step_wise"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
-#define DEFAULT_THERMAL_GOVERNOR       "fair_share"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
-#define DEFAULT_THERMAL_GOVERNOR       "user_space"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
-#define DEFAULT_THERMAL_GOVERNOR       "power_allocator"
-#endif
-
 struct thermal_zone_device;
 struct thermal_cooling_device;
 struct thermal_instance;
#19 lore raw
Quoted 3 lines · Zhang Rui

Hi, Daniel,

please feel free to add my Acked-by for the whole patch set.

Great, thanks!

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