Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: core: Make struct thermal_zone_device definition internal

Move the definitions of struct thermal_trip_desc and struct
thermal_zone_device to an internal header file in the thermal core,
as they don't need to be accessible to any code other than the thermal
core and so they don't need to be present in a global header.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

+91 -85
+85
drivers/thermal/thermal_core.h
··· 15 15 #include "thermal_netlink.h" 16 16 #include "thermal_debugfs.h" 17 17 18 + struct thermal_trip_desc { 19 + struct thermal_trip trip; 20 + int threshold; 21 + }; 22 + 23 + /** 24 + * struct thermal_zone_device - structure for a thermal zone 25 + * @id: unique id number for each thermal zone 26 + * @type: the thermal zone device type 27 + * @device: &struct device for this thermal zone 28 + * @removal: removal completion 29 + * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature 30 + * @trip_type_attrs: attributes for trip points for sysfs: trip type 31 + * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis 32 + * @mode: current mode of this thermal zone 33 + * @devdata: private pointer for device private data 34 + * @num_trips: number of trip points the thermal zone supports 35 + * @passive_delay_jiffies: number of jiffies to wait between polls when 36 + * performing passive cooling. 37 + * @polling_delay_jiffies: number of jiffies to wait between polls when 38 + * checking whether trip points have been crossed (0 for 39 + * interrupt driven systems) 40 + * @temperature: current temperature. This is only for core code, 41 + * drivers should use thermal_zone_get_temp() to get the 42 + * current temperature 43 + * @last_temperature: previous temperature read 44 + * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION 45 + * @passive: 1 if you've crossed a passive trip point, 0 otherwise. 46 + * @prev_low_trip: the low current temperature if you've crossed a passive 47 + trip point. 48 + * @prev_high_trip: the above current temperature if you've crossed a 49 + passive trip point. 50 + * @need_update: if equals 1, thermal_zone_device_update needs to be invoked. 51 + * @ops: operations this &thermal_zone_device supports 52 + * @tzp: thermal zone parameters 53 + * @governor: pointer to the governor for this thermal zone 54 + * @governor_data: private pointer for governor data 55 + * @thermal_instances: list of &struct thermal_instance of this thermal zone 56 + * @ida: &struct ida to generate unique id for this zone's cooling 57 + * devices 58 + * @lock: lock to protect thermal_instances list 59 + * @node: node in thermal_tz_list (in thermal_core.c) 60 + * @poll_queue: delayed work for polling 61 + * @notify_event: Last notification event 62 + * @suspended: thermal zone suspend indicator 63 + * @trips: array of struct thermal_trip objects 64 + */ 65 + struct thermal_zone_device { 66 + int id; 67 + char type[THERMAL_NAME_LENGTH]; 68 + struct device device; 69 + struct completion removal; 70 + struct attribute_group trips_attribute_group; 71 + struct thermal_attr *trip_temp_attrs; 72 + struct thermal_attr *trip_type_attrs; 73 + struct thermal_attr *trip_hyst_attrs; 74 + enum thermal_device_mode mode; 75 + void *devdata; 76 + int num_trips; 77 + unsigned long passive_delay_jiffies; 78 + unsigned long polling_delay_jiffies; 79 + int temperature; 80 + int last_temperature; 81 + int emul_temperature; 82 + int passive; 83 + int prev_low_trip; 84 + int prev_high_trip; 85 + atomic_t need_update; 86 + struct thermal_zone_device_ops ops; 87 + struct thermal_zone_params *tzp; 88 + struct thermal_governor *governor; 89 + void *governor_data; 90 + struct list_head thermal_instances; 91 + struct ida ida; 92 + struct mutex lock; 93 + struct list_head node; 94 + struct delayed_work poll_queue; 95 + enum thermal_notify_event notify_event; 96 + bool suspended; 97 + #ifdef CONFIG_THERMAL_DEBUGFS 98 + struct thermal_debugfs *debugfs; 99 + #endif 100 + struct thermal_trip_desc trips[] __counted_by(num_trips); 101 + }; 102 + 18 103 /* Default Thermal Governor */ 19 104 #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) 20 105 #define DEFAULT_THERMAL_GOVERNOR "step_wise"
+2
drivers/thermal/thermal_trace.h
··· 9 9 #include <linux/thermal.h> 10 10 #include <linux/tracepoint.h> 11 11 12 + #include "thermal_core.h" 13 + 12 14 TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL); 13 15 TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT); 14 16 TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE);
+2
drivers/thermal/thermal_trace_ipa.h
··· 7 7 8 8 #include <linux/tracepoint.h> 9 9 10 + #include "thermal_core.h" 11 + 10 12 TRACE_EVENT(thermal_power_allocator, 11 13 TP_PROTO(struct thermal_zone_device *tz, u32 total_req_power, 12 14 u32 total_granted_power, int num_actors, u32 power_range,
+2 -85
include/linux/thermal.h
··· 73 73 void *priv; 74 74 }; 75 75 76 - struct thermal_trip_desc { 77 - struct thermal_trip trip; 78 - int threshold; 79 - }; 80 - 81 76 #define THERMAL_TRIP_FLAG_RW_TEMP BIT(0) 82 77 #define THERMAL_TRIP_FLAG_RW_HYST BIT(1) 83 78 84 79 #define THERMAL_TRIP_FLAG_RW (THERMAL_TRIP_FLAG_RW_TEMP | \ 85 80 THERMAL_TRIP_FLAG_RW_HYST) 81 + 82 + struct thermal_zone_device; 86 83 87 84 struct thermal_zone_device_ops { 88 85 int (*bind) (struct thermal_zone_device *, ··· 124 127 #ifdef CONFIG_THERMAL_DEBUGFS 125 128 struct thermal_debugfs *debugfs; 126 129 #endif 127 - }; 128 - 129 - /** 130 - * struct thermal_zone_device - structure for a thermal zone 131 - * @id: unique id number for each thermal zone 132 - * @type: the thermal zone device type 133 - * @device: &struct device for this thermal zone 134 - * @removal: removal completion 135 - * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature 136 - * @trip_type_attrs: attributes for trip points for sysfs: trip type 137 - * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis 138 - * @mode: current mode of this thermal zone 139 - * @devdata: private pointer for device private data 140 - * @num_trips: number of trip points the thermal zone supports 141 - * @passive_delay_jiffies: number of jiffies to wait between polls when 142 - * performing passive cooling. 143 - * @polling_delay_jiffies: number of jiffies to wait between polls when 144 - * checking whether trip points have been crossed (0 for 145 - * interrupt driven systems) 146 - * @temperature: current temperature. This is only for core code, 147 - * drivers should use thermal_zone_get_temp() to get the 148 - * current temperature 149 - * @last_temperature: previous temperature read 150 - * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION 151 - * @passive: 1 if you've crossed a passive trip point, 0 otherwise. 152 - * @prev_low_trip: the low current temperature if you've crossed a passive 153 - trip point. 154 - * @prev_high_trip: the above current temperature if you've crossed a 155 - passive trip point. 156 - * @need_update: if equals 1, thermal_zone_device_update needs to be invoked. 157 - * @ops: operations this &thermal_zone_device supports 158 - * @tzp: thermal zone parameters 159 - * @governor: pointer to the governor for this thermal zone 160 - * @governor_data: private pointer for governor data 161 - * @thermal_instances: list of &struct thermal_instance of this thermal zone 162 - * @ida: &struct ida to generate unique id for this zone's cooling 163 - * devices 164 - * @lock: lock to protect thermal_instances list 165 - * @node: node in thermal_tz_list (in thermal_core.c) 166 - * @poll_queue: delayed work for polling 167 - * @notify_event: Last notification event 168 - * @suspended: thermal zone suspend indicator 169 - * @trips: array of struct thermal_trip objects 170 - */ 171 - struct thermal_zone_device { 172 - int id; 173 - char type[THERMAL_NAME_LENGTH]; 174 - struct device device; 175 - struct completion removal; 176 - struct attribute_group trips_attribute_group; 177 - struct thermal_attr *trip_temp_attrs; 178 - struct thermal_attr *trip_type_attrs; 179 - struct thermal_attr *trip_hyst_attrs; 180 - enum thermal_device_mode mode; 181 - void *devdata; 182 - int num_trips; 183 - unsigned long passive_delay_jiffies; 184 - unsigned long polling_delay_jiffies; 185 - int temperature; 186 - int last_temperature; 187 - int emul_temperature; 188 - int passive; 189 - int prev_low_trip; 190 - int prev_high_trip; 191 - atomic_t need_update; 192 - struct thermal_zone_device_ops ops; 193 - struct thermal_zone_params *tzp; 194 - struct thermal_governor *governor; 195 - void *governor_data; 196 - struct list_head thermal_instances; 197 - struct ida ida; 198 - struct mutex lock; 199 - struct list_head node; 200 - struct delayed_work poll_queue; 201 - enum thermal_notify_event notify_event; 202 - bool suspended; 203 - #ifdef CONFIG_THERMAL_DEBUGFS 204 - struct thermal_debugfs *debugfs; 205 - #endif 206 - struct thermal_trip_desc trips[] __counted_by(num_trips); 207 130 }; 208 131 209 132 /**