Skip to content

Commit 2e70ea7

Browse files
committed
Merge branches 'thermal-intel' and 'thermal-drivers'
Merge thermal control driver changes for 6.1-rc1: - Use module_pci_driver() macro in the int340x processor_thermal driver (Shang XiaoJing). - Use get_cpu() instead of smp_processor_id() in the intel_powerclamp thermal driver to prevent it from crashing and remove unused accounting for IRQ wakes from it (Srinivas Pandruvada). - Consolidate priv->data_vault checks in int340x_thermal (Rafael Wysocki). - Check the policy first in cpufreq_cooling_register() (Xuewen Yan). - Drop redundant error message from da9062-thermal (zhaoxiao). - Drop of_match_ptr() from thermal_mmio (Jean Delvare). * thermal-intel: thermal: int340x: processor_thermal: Use module_pci_driver() macro thermal: intel_powerclamp: Remove accounting for IRQ wakes thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash thermal: int340x_thermal: Consolidate priv->data_vault checks * thermal-drivers: thermal: cpufreq_cooling: Check the policy first in cpufreq_cooling_register() thermal: da9062-thermal: Drop redundant error message thermal/drivers/thermal_mmio: Drop of_match_ptr()
3 parents a7ae50f + 53e41b8 + cff8952 commit 2e70ea7

File tree

7 files changed

+19
-56
lines changed

7 files changed

+19
-56
lines changed

drivers/thermal/cpufreq_cooling.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,17 +501,17 @@ __cpufreq_cooling_register(struct device_node *np,
501501
struct thermal_cooling_device_ops *cooling_ops;
502502
char *name;
503503

504+
if (IS_ERR_OR_NULL(policy)) {
505+
pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
506+
return ERR_PTR(-EINVAL);
507+
}
508+
504509
dev = get_cpu_device(policy->cpu);
505510
if (unlikely(!dev)) {
506511
pr_warn("No cpu device for cpu %d\n", policy->cpu);
507512
return ERR_PTR(-ENODEV);
508513
}
509514

510-
if (IS_ERR_OR_NULL(policy)) {
511-
pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
512-
return ERR_PTR(-EINVAL);
513-
}
514-
515515
i = cpufreq_table_count_valid_entries(policy);
516516
if (!i) {
517517
pr_debug("%s: CPUFreq table not found or has no valid entries\n",

drivers/thermal/da9062-thermal.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,9 @@ static int da9062_thermal_probe(struct platform_device *pdev)
248248
jiffies_to_msecs(thermal->zone->passive_delay_jiffies));
249249

250250
ret = platform_get_irq_byname(pdev, "THERMAL");
251-
if (ret < 0) {
252-
dev_err(&pdev->dev, "Failed to get platform IRQ.\n");
251+
if (ret < 0)
253252
goto err_zone;
254-
}
253+
255254
thermal->irq = ret;
256255

257256
ret = request_threaded_irq(thermal->irq, NULL,

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,8 @@ static int int3400_thermal_probe(struct platform_device *pdev)
614614

615615
free_sysfs:
616616
cleanup_odvp(priv);
617-
if (priv->data_vault) {
618-
if (!ZERO_OR_NULL_PTR(priv->data_vault))
619-
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
617+
if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
618+
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
620619
kfree(priv->data_vault);
621620
}
622621
free_uuid:

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,7 @@ static struct pci_driver proc_thermal_pci_driver = {
373373
.driver.pm = &proc_thermal_pci_pm,
374374
};
375375

376-
static int __init proc_thermal_init(void)
377-
{
378-
return pci_register_driver(&proc_thermal_pci_driver);
379-
}
380-
381-
static void __exit proc_thermal_exit(void)
382-
{
383-
pci_unregister_driver(&proc_thermal_pci_driver);
384-
}
385-
386-
module_init(proc_thermal_init);
387-
module_exit(proc_thermal_exit);
376+
module_pci_driver(proc_thermal_pci_driver);
388377

389378
MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
390379
MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,7 @@ static struct pci_driver proc_thermal_pci_driver = {
151151
.driver.pm = &proc_thermal_pci_pm,
152152
};
153153

154-
static int __init proc_thermal_init(void)
155-
{
156-
return pci_register_driver(&proc_thermal_pci_driver);
157-
}
158-
159-
static void __exit proc_thermal_exit(void)
160-
{
161-
pci_unregister_driver(&proc_thermal_pci_driver);
162-
}
163-
164-
module_init(proc_thermal_init);
165-
module_exit(proc_thermal_exit);
154+
module_pci_driver(proc_thermal_pci_driver);
166155

167156
MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
168157
MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");

drivers/thermal/intel/intel_powerclamp.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ static struct dentry *debug_dir;
6262
static unsigned int set_target_ratio;
6363
static unsigned int current_ratio;
6464
static bool should_skip;
65-
static bool reduce_irq;
66-
static atomic_t idle_wakeup_counter;
65+
6766
static unsigned int control_cpu; /* The cpu assigned to collect stat and update
6867
* control parameters. default to BSP but BSP
6968
* can be offlined.
@@ -285,9 +284,6 @@ static unsigned int get_compensation(int ratio)
285284
cal_data[ratio + 1].steady_comp) / 3;
286285
}
287286

288-
/* REVISIT: simple penalty of double idle injection */
289-
if (reduce_irq)
290-
comp = ratio;
291287
/* do not exceed limit */
292288
if (comp + ratio >= MAX_TARGET_RATIO)
293289
comp = MAX_TARGET_RATIO - ratio - 1;
@@ -301,13 +297,9 @@ static void adjust_compensation(int target_ratio, unsigned int win)
301297
struct powerclamp_calibration_data *d = &cal_data[target_ratio];
302298

303299
/*
304-
* adjust compensations if confidence level has not been reached or
305-
* there are too many wakeups during the last idle injection period, we
306-
* cannot trust the data for compensation.
300+
* adjust compensations if confidence level has not been reached.
307301
*/
308-
if (d->confidence >= CONFIDENCE_OK ||
309-
atomic_read(&idle_wakeup_counter) >
310-
win * num_online_cpus())
302+
if (d->confidence >= CONFIDENCE_OK)
311303
return;
312304

313305
delta = set_target_ratio - current_ratio;
@@ -347,14 +339,7 @@ static bool powerclamp_adjust_controls(unsigned int target_ratio,
347339
tsc_last = tsc_now;
348340

349341
adjust_compensation(target_ratio, win);
350-
/*
351-
* too many external interrupts, set flag such
352-
* that we can take measure later.
353-
*/
354-
reduce_irq = atomic_read(&idle_wakeup_counter) >=
355-
2 * win * num_online_cpus();
356342

357-
atomic_set(&idle_wakeup_counter, 0);
358343
/* if we are above target+guard, skip */
359344
return set_target_ratio + guard <= current_ratio;
360345
}
@@ -532,8 +517,10 @@ static int start_power_clamp(void)
532517

533518
/* prefer BSP */
534519
control_cpu = 0;
535-
if (!cpu_online(control_cpu))
536-
control_cpu = smp_processor_id();
520+
if (!cpu_online(control_cpu)) {
521+
control_cpu = get_cpu();
522+
put_cpu();
523+
}
537524

538525
clamping = true;
539526
schedule_delayed_work(&poll_pkg_cstate_work, 0);

drivers/thermal/thermal_mmio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static struct platform_driver thermal_mmio_driver = {
106106
.probe = thermal_mmio_probe,
107107
.driver = {
108108
.name = "thermal-mmio",
109-
.of_match_table = of_match_ptr(thermal_mmio_id_table),
109+
.of_match_table = thermal_mmio_id_table,
110110
},
111111
};
112112

0 commit comments

Comments
 (0)