Skip to content

Commit b1ae92d

Browse files
committed
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 <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent daeeb03 commit b1ae92d

File tree

4 files changed

+91
-85
lines changed

4 files changed

+91
-85
lines changed

drivers/thermal/thermal_core.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,91 @@
1515
#include "thermal_netlink.h"
1616
#include "thermal_debugfs.h"
1717

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+
18103
/* Default Thermal Governor */
19104
#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
20105
#define DEFAULT_THERMAL_GOVERNOR "step_wise"

drivers/thermal/thermal_trace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <linux/thermal.h>
1010
#include <linux/tracepoint.h>
1111

12+
#include "thermal_core.h"
13+
1214
TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL);
1315
TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT);
1416
TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE);

drivers/thermal/thermal_trace_ipa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <linux/tracepoint.h>
99

10+
#include "thermal_core.h"
11+
1012
TRACE_EVENT(thermal_power_allocator,
1113
TP_PROTO(struct thermal_zone_device *tz, u32 total_req_power,
1214
u32 total_granted_power, int num_actors, u32 power_range,

include/linux/thermal.h

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,14 @@ struct thermal_trip {
7373
void *priv;
7474
};
7575

76-
struct thermal_trip_desc {
77-
struct thermal_trip trip;
78-
int threshold;
79-
};
80-
8176
#define THERMAL_TRIP_FLAG_RW_TEMP BIT(0)
8277
#define THERMAL_TRIP_FLAG_RW_HYST BIT(1)
8378

8479
#define THERMAL_TRIP_FLAG_RW (THERMAL_TRIP_FLAG_RW_TEMP | \
8580
THERMAL_TRIP_FLAG_RW_HYST)
8681

82+
struct thermal_zone_device;
83+
8784
struct thermal_zone_device_ops {
8885
int (*bind) (struct thermal_zone_device *,
8986
struct thermal_cooling_device *);
@@ -129,86 +126,6 @@ struct thermal_cooling_device {
129126
#endif
130127
};
131128

132-
/**
133-
* struct thermal_zone_device - structure for a thermal zone
134-
* @id: unique id number for each thermal zone
135-
* @type: the thermal zone device type
136-
* @device: &struct device for this thermal zone
137-
* @removal: removal completion
138-
* @trip_temp_attrs: attributes for trip points for sysfs: trip temperature
139-
* @trip_type_attrs: attributes for trip points for sysfs: trip type
140-
* @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
141-
* @mode: current mode of this thermal zone
142-
* @devdata: private pointer for device private data
143-
* @num_trips: number of trip points the thermal zone supports
144-
* @passive_delay_jiffies: number of jiffies to wait between polls when
145-
* performing passive cooling.
146-
* @polling_delay_jiffies: number of jiffies to wait between polls when
147-
* checking whether trip points have been crossed (0 for
148-
* interrupt driven systems)
149-
* @temperature: current temperature. This is only for core code,
150-
* drivers should use thermal_zone_get_temp() to get the
151-
* current temperature
152-
* @last_temperature: previous temperature read
153-
* @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION
154-
* @passive: 1 if you've crossed a passive trip point, 0 otherwise.
155-
* @prev_low_trip: the low current temperature if you've crossed a passive
156-
trip point.
157-
* @prev_high_trip: the above current temperature if you've crossed a
158-
passive trip point.
159-
* @need_update: if equals 1, thermal_zone_device_update needs to be invoked.
160-
* @ops: operations this &thermal_zone_device supports
161-
* @tzp: thermal zone parameters
162-
* @governor: pointer to the governor for this thermal zone
163-
* @governor_data: private pointer for governor data
164-
* @thermal_instances: list of &struct thermal_instance of this thermal zone
165-
* @ida: &struct ida to generate unique id for this zone's cooling
166-
* devices
167-
* @lock: lock to protect thermal_instances list
168-
* @node: node in thermal_tz_list (in thermal_core.c)
169-
* @poll_queue: delayed work for polling
170-
* @notify_event: Last notification event
171-
* @suspended: thermal zone suspend indicator
172-
* @trips: array of struct thermal_trip objects
173-
*/
174-
struct thermal_zone_device {
175-
int id;
176-
char type[THERMAL_NAME_LENGTH];
177-
struct device device;
178-
struct completion removal;
179-
struct attribute_group trips_attribute_group;
180-
struct thermal_attr *trip_temp_attrs;
181-
struct thermal_attr *trip_type_attrs;
182-
struct thermal_attr *trip_hyst_attrs;
183-
enum thermal_device_mode mode;
184-
void *devdata;
185-
int num_trips;
186-
unsigned long passive_delay_jiffies;
187-
unsigned long polling_delay_jiffies;
188-
int temperature;
189-
int last_temperature;
190-
int emul_temperature;
191-
int passive;
192-
int prev_low_trip;
193-
int prev_high_trip;
194-
atomic_t need_update;
195-
struct thermal_zone_device_ops ops;
196-
struct thermal_zone_params *tzp;
197-
struct thermal_governor *governor;
198-
void *governor_data;
199-
struct list_head thermal_instances;
200-
struct ida ida;
201-
struct mutex lock;
202-
struct list_head node;
203-
struct delayed_work poll_queue;
204-
enum thermal_notify_event notify_event;
205-
bool suspended;
206-
#ifdef CONFIG_THERMAL_DEBUGFS
207-
struct thermal_debugfs *debugfs;
208-
#endif
209-
struct thermal_trip_desc trips[] __counted_by(num_trips);
210-
};
211-
212129
/**
213130
* struct thermal_governor - structure that holds thermal governor information
214131
* @name: name of the governor

0 commit comments

Comments
 (0)