Skip to content

Commit ecd1d2a

Browse files
zhuguangqingdlezcano
authored andcommitted
thermal: cooling: Remove unused variable *tz
1. devfreq_cooling.c: The variable *tz is not used in devfreq_cooling_get_requested_power(), devfreq_cooling_state2power() and devfreq_cooling_power2state(). 2. cpufreq_cooling.c: After 84fe2ca, the variable *tz is not used anymore in cpufreq_get_requested_power(), cpufreq_state2power() and cpufreq_power2state(). Remove the variable *tz. Signed-off-by: zhuguangqing <zhuguangqing@xiaomi.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200914071101.13575-1-zhuguangqing83@gmail.com
1 parent 94a3c35 commit ecd1d2a

6 files changed

Lines changed: 14 additions & 28 deletions

File tree

drivers/thermal/cpufreq_cooling.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_cdev,
182182
/**
183183
* cpufreq_get_requested_power() - get the current power
184184
* @cdev: &thermal_cooling_device pointer
185-
* @tz: a valid thermal zone device pointer
186185
* @power: pointer in which to store the resulting power
187186
*
188187
* Calculate the current power consumption of the cpus in milliwatts
@@ -203,7 +202,6 @@ static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_cdev,
203202
* Return: 0 on success, -E* if getting the static power failed.
204203
*/
205204
static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
206-
struct thermal_zone_device *tz,
207205
u32 *power)
208206
{
209207
unsigned long freq;
@@ -253,7 +251,6 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
253251
/**
254252
* cpufreq_state2power() - convert a cpu cdev state to power consumed
255253
* @cdev: &thermal_cooling_device pointer
256-
* @tz: a valid thermal zone device pointer
257254
* @state: cooling device state to be converted
258255
* @power: pointer in which to store the resulting power
259256
*
@@ -266,7 +263,6 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
266263
* when calculating the static power.
267264
*/
268265
static int cpufreq_state2power(struct thermal_cooling_device *cdev,
269-
struct thermal_zone_device *tz,
270266
unsigned long state, u32 *power)
271267
{
272268
unsigned int freq, num_cpus, idx;
@@ -288,7 +284,6 @@ static int cpufreq_state2power(struct thermal_cooling_device *cdev,
288284
/**
289285
* cpufreq_power2state() - convert power to a cooling device state
290286
* @cdev: &thermal_cooling_device pointer
291-
* @tz: a valid thermal zone device pointer
292287
* @power: power in milliwatts to be converted
293288
* @state: pointer in which to store the resulting state
294289
*
@@ -306,8 +301,7 @@ static int cpufreq_state2power(struct thermal_cooling_device *cdev,
306301
* device.
307302
*/
308303
static int cpufreq_power2state(struct thermal_cooling_device *cdev,
309-
struct thermal_zone_device *tz, u32 power,
310-
unsigned long *state)
304+
u32 power, unsigned long *state)
311305
{
312306
unsigned int target_freq;
313307
u32 last_load, normalised_power;

drivers/thermal/devfreq_cooling.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ static inline unsigned long get_total_power(struct devfreq_cooling_device *dfc,
229229

230230

231231
static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cdev,
232-
struct thermal_zone_device *tz,
233232
u32 *power)
234233
{
235234
struct devfreq_cooling_device *dfc = cdev->devdata;
@@ -289,7 +288,6 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
289288
}
290289

291290
static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
292-
struct thermal_zone_device *tz,
293291
unsigned long state,
294292
u32 *power)
295293
{
@@ -308,7 +306,6 @@ static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
308306
}
309307

310308
static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev,
311-
struct thermal_zone_device *tz,
312309
u32 power, unsigned long *state)
313310
{
314311
struct devfreq_cooling_device *dfc = cdev->devdata;

drivers/thermal/gov_power_allocator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static u32 estimate_sustainable_power(struct thermal_zone_device *tz)
9696
if (instance->trip != params->trip_max_desired_temperature)
9797
continue;
9898

99-
if (power_actor_get_min_power(cdev, tz, &min_power))
99+
if (power_actor_get_min_power(cdev, &min_power))
100100
continue;
101101

102102
sustainable_power += min_power;
@@ -388,7 +388,7 @@ static int allocate_power(struct thermal_zone_device *tz,
388388
if (!cdev_is_power_actor(cdev))
389389
continue;
390390

391-
if (cdev->ops->get_requested_power(cdev, tz, &req_power[i]))
391+
if (cdev->ops->get_requested_power(cdev, &req_power[i]))
392392
continue;
393393

394394
if (!total_weight)
@@ -398,7 +398,7 @@ static int allocate_power(struct thermal_zone_device *tz,
398398

399399
weighted_req_power[i] = frac_to_int(weight * req_power[i]);
400400

401-
if (power_actor_get_max_power(cdev, tz, &max_power[i]))
401+
if (power_actor_get_max_power(cdev, &max_power[i]))
402402
continue;
403403

404404
total_req_power += req_power[i];

drivers/thermal/thermal_core.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ static void thermal_zone_device_check(struct work_struct *work)
603603
/**
604604
* power_actor_get_max_power() - get the maximum power that a cdev can consume
605605
* @cdev: pointer to &thermal_cooling_device
606-
* @tz: a valid thermal zone device pointer
607606
* @max_power: pointer in which to store the maximum power
608607
*
609608
* Calculate the maximum power consumption in milliwats that the
@@ -613,18 +612,17 @@ static void thermal_zone_device_check(struct work_struct *work)
613612
* power_actor API or -E* on other error.
614613
*/
615614
int power_actor_get_max_power(struct thermal_cooling_device *cdev,
616-
struct thermal_zone_device *tz, u32 *max_power)
615+
u32 *max_power)
617616
{
618617
if (!cdev_is_power_actor(cdev))
619618
return -EINVAL;
620619

621-
return cdev->ops->state2power(cdev, tz, 0, max_power);
620+
return cdev->ops->state2power(cdev, 0, max_power);
622621
}
623622

624623
/**
625624
* power_actor_get_min_power() - get the mainimum power that a cdev can consume
626625
* @cdev: pointer to &thermal_cooling_device
627-
* @tz: a valid thermal zone device pointer
628626
* @min_power: pointer in which to store the minimum power
629627
*
630628
* Calculate the minimum power consumption in milliwatts that the
@@ -634,7 +632,7 @@ int power_actor_get_max_power(struct thermal_cooling_device *cdev,
634632
* power_actor API or -E* on other error.
635633
*/
636634
int power_actor_get_min_power(struct thermal_cooling_device *cdev,
637-
struct thermal_zone_device *tz, u32 *min_power)
635+
u32 *min_power)
638636
{
639637
unsigned long max_state;
640638
int ret;
@@ -646,7 +644,7 @@ int power_actor_get_min_power(struct thermal_cooling_device *cdev,
646644
if (ret)
647645
return ret;
648646

649-
return cdev->ops->state2power(cdev, tz, max_state, min_power);
647+
return cdev->ops->state2power(cdev, max_state, min_power);
650648
}
651649

652650
/**
@@ -670,7 +668,7 @@ int power_actor_set_power(struct thermal_cooling_device *cdev,
670668
if (!cdev_is_power_actor(cdev))
671669
return -EINVAL;
672670

673-
ret = cdev->ops->power2state(cdev, instance->tz, power, &state);
671+
ret = cdev->ops->power2state(cdev, power, &state);
674672
if (ret)
675673
return ret;
676674

drivers/thermal/thermal_core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
6666
}
6767

6868
int power_actor_get_max_power(struct thermal_cooling_device *cdev,
69-
struct thermal_zone_device *tz, u32 *max_power);
69+
u32 *max_power);
7070
int power_actor_get_min_power(struct thermal_cooling_device *cdev,
71-
struct thermal_zone_device *tz, u32 *min_power);
71+
u32 *min_power);
7272
int power_actor_set_power(struct thermal_cooling_device *cdev,
7373
struct thermal_instance *ti, u32 power);
7474
/**

include/linux/thermal.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,9 @@ struct thermal_cooling_device_ops {
8585
int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
8686
int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
8787
int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
88-
int (*get_requested_power)(struct thermal_cooling_device *,
89-
struct thermal_zone_device *, u32 *);
90-
int (*state2power)(struct thermal_cooling_device *,
91-
struct thermal_zone_device *, unsigned long, u32 *);
92-
int (*power2state)(struct thermal_cooling_device *,
93-
struct thermal_zone_device *, u32, unsigned long *);
88+
int (*get_requested_power)(struct thermal_cooling_device *, u32 *);
89+
int (*state2power)(struct thermal_cooling_device *, unsigned long, u32 *);
90+
int (*power2state)(struct thermal_cooling_device *, u32, unsigned long *);
9491
};
9592

9693
struct thermal_cooling_device {

0 commit comments

Comments
 (0)