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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'devfreq-next-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux

Pull devfreq changes for v6.19 from Chanwoo Choi:

"- Move governor.h under include/linux/ and rename to devfreq-governor.h
in order to allow devfreq governor definitions in out of drivers/devfreq/.

- Fix potential use-after-free issue of OPP handling on hisi_uncore_freq.c

- Use min() to improve the readability on tegra30-devfreq.c

- Fix typo in DFSO_DOWNDIFFERENTIAL macro name on governor_simpleondemand.c"

* tag 'devfreq-next-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux:
PM / devfreq: Fix typo in DFSO_DOWNDIFFERENTIAL macro name
PM / devfreq: tegra30: use min to simplify actmon_cpu_to_emc_rate
PM / devfreq: hisi: Fix potential UAF in OPP handling
PM / devfreq: Move governor.h to a public header location

+45 -50
+1 -1
drivers/devfreq/devfreq.c
··· 20 20 #include <linux/stat.h> 21 21 #include <linux/pm_opp.h> 22 22 #include <linux/devfreq.h> 23 + #include <linux/devfreq-governor.h> 23 24 #include <linux/workqueue.h> 24 25 #include <linux/platform_device.h> 25 26 #include <linux/list.h> ··· 29 28 #include <linux/of.h> 30 29 #include <linux/pm_qos.h> 31 30 #include <linux/units.h> 32 - #include "governor.h" 33 31 34 32 #define CREATE_TRACE_POINTS 35 33 #include <trace/events/devfreq.h>
+4 -29
drivers/devfreq/governor.h include/linux/devfreq-governor.h
··· 5 5 * Copyright (C) 2011 Samsung Electronics 6 6 * MyungJoo Ham <myungjoo.ham@samsung.com> 7 7 * 8 - * This header is for devfreq governors in drivers/devfreq/ 8 + * This header is for devfreq governors 9 9 */ 10 10 11 - #ifndef _GOVERNOR_H 12 - #define _GOVERNOR_H 11 + #ifndef __LINUX_DEVFREQ_DEVFREQ_H__ 12 + #define __LINUX_DEVFREQ_DEVFREQ_H__ 13 13 14 14 #include <linux/devfreq.h> 15 15 ··· 46 46 */ 47 47 #define DEVFREQ_GOV_ATTR_POLLING_INTERVAL BIT(0) 48 48 #define DEVFREQ_GOV_ATTR_TIMER BIT(1) 49 - 50 - /** 51 - * struct devfreq_cpu_data - Hold the per-cpu data 52 - * @node: list node 53 - * @dev: reference to cpu device. 54 - * @first_cpu: the cpumask of the first cpu of a policy. 55 - * @opp_table: reference to cpu opp table. 56 - * @cur_freq: the current frequency of the cpu. 57 - * @min_freq: the min frequency of the cpu. 58 - * @max_freq: the max frequency of the cpu. 59 - * 60 - * This structure stores the required cpu_data of a cpu. 61 - * This is auto-populated by the governor. 62 - */ 63 - struct devfreq_cpu_data { 64 - struct list_head node; 65 - 66 - struct device *dev; 67 - unsigned int first_cpu; 68 - 69 - struct opp_table *opp_table; 70 - unsigned int cur_freq; 71 - unsigned int min_freq; 72 - unsigned int max_freq; 73 - }; 74 49 75 50 /** 76 51 * struct devfreq_governor - Devfreq policy governor ··· 99 124 100 125 return df->profile->get_dev_status(df->dev.parent, &df->last_status); 101 126 } 102 - #endif /* _GOVERNOR_H */ 127 + #endif /* __LINUX_DEVFREQ_DEVFREQ_H__ */
+26 -1
drivers/devfreq/governor_passive.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/device.h> 16 16 #include <linux/devfreq.h> 17 + #include <linux/devfreq-governor.h> 17 18 #include <linux/units.h> 18 - #include "governor.h" 19 + 20 + /** 21 + * struct devfreq_cpu_data - Hold the per-cpu data 22 + * @node: list node 23 + * @dev: reference to cpu device. 24 + * @first_cpu: the cpumask of the first cpu of a policy. 25 + * @opp_table: reference to cpu opp table. 26 + * @cur_freq: the current frequency of the cpu. 27 + * @min_freq: the min frequency of the cpu. 28 + * @max_freq: the max frequency of the cpu. 29 + * 30 + * This structure stores the required cpu_data of a cpu. 31 + * This is auto-populated by the governor. 32 + */ 33 + struct devfreq_cpu_data { 34 + struct list_head node; 35 + 36 + struct device *dev; 37 + unsigned int first_cpu; 38 + 39 + struct opp_table *opp_table; 40 + unsigned int cur_freq; 41 + unsigned int min_freq; 42 + unsigned int max_freq; 43 + }; 19 44 20 45 static struct devfreq_cpu_data * 21 46 get_parent_cpu_data(struct devfreq_passive_data *p_data,
+1 -1
drivers/devfreq/governor_performance.c
··· 7 7 */ 8 8 9 9 #include <linux/devfreq.h> 10 + #include <linux/devfreq-governor.h> 10 11 #include <linux/module.h> 11 - #include "governor.h" 12 12 13 13 static int devfreq_performance_func(struct devfreq *df, 14 14 unsigned long *freq)
+1 -1
drivers/devfreq/governor_powersave.c
··· 7 7 */ 8 8 9 9 #include <linux/devfreq.h> 10 + #include <linux/devfreq-governor.h> 10 11 #include <linux/module.h> 11 - #include "governor.h" 12 12 13 13 static int devfreq_powersave_func(struct devfreq *df, 14 14 unsigned long *freq)
+3 -3
drivers/devfreq/governor_simpleondemand.c
··· 9 9 #include <linux/errno.h> 10 10 #include <linux/module.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/math64.h> 13 - #include "governor.h" 14 14 15 15 /* Default constants for DevFreq-Simple-Ondemand (DFSO) */ 16 16 #define DFSO_UPTHRESHOLD (90) 17 - #define DFSO_DOWNDIFFERENCTIAL (5) 17 + #define DFSO_DOWNDIFFERENTIAL (5) 18 18 static int devfreq_simple_ondemand_func(struct devfreq *df, 19 19 unsigned long *freq) 20 20 { ··· 22 22 struct devfreq_dev_status *stat; 23 23 unsigned long long a, b; 24 24 unsigned int dfso_upthreshold = DFSO_UPTHRESHOLD; 25 - unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENCTIAL; 25 + unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENTIAL; 26 26 struct devfreq_simple_ondemand_data *data = df->data; 27 27 28 28 err = devfreq_update_stats(df);
+1 -1
drivers/devfreq/governor_userspace.c
··· 9 9 #include <linux/slab.h> 10 10 #include <linux/device.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/kstrtox.h> 13 14 #include <linux/pm.h> 14 15 #include <linux/mutex.h> 15 16 #include <linux/module.h> 16 - #include "governor.h" 17 17 18 18 struct userspace_data { 19 19 unsigned long user_frequency;
+3 -3
drivers/devfreq/hisi_uncore_freq.c
··· 9 9 #include <linux/bits.h> 10 10 #include <linux/cleanup.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/device.h> 13 14 #include <linux/dev_printk.h> 14 15 #include <linux/errno.h> ··· 26 25 #include <linux/topology.h> 27 26 #include <linux/units.h> 28 27 #include <acpi/pcc.h> 29 - 30 - #include "governor.h" 31 28 32 29 struct hisi_uncore_pcc_data { 33 30 u16 status; ··· 264 265 dev_err(dev, "Failed to get opp for freq %lu hz\n", *freq); 265 266 return PTR_ERR(opp); 266 267 } 267 - dev_pm_opp_put(opp); 268 268 269 269 data = (u32)(dev_pm_opp_get_freq(opp) / HZ_PER_MHZ); 270 + 271 + dev_pm_opp_put(opp); 270 272 271 273 return hisi_uncore_cmd_send(uncore, HUCF_PCC_CMD_SET_FREQ, &data); 272 274 }
+5 -10
drivers/devfreq/tegra30-devfreq.c
··· 9 9 #include <linux/clk.h> 10 10 #include <linux/cpufreq.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/interrupt.h> 13 14 #include <linux/io.h> 14 15 #include <linux/irq.h> 16 + #include <linux/minmax.h> 15 17 #include <linux/module.h> 16 18 #include <linux/of.h> 17 19 #include <linux/platform_device.h> ··· 22 20 #include <linux/workqueue.h> 23 21 24 22 #include <soc/tegra/fuse.h> 25 - 26 - #include "governor.h" 27 23 28 24 #define ACTMON_GLB_STATUS 0x0 29 25 #define ACTMON_GLB_PERIOD_CTRL 0x4 ··· 326 326 unsigned int i; 327 327 const struct tegra_actmon_emc_ratio *ratio = actmon_emc_ratios; 328 328 329 - for (i = 0; i < ARRAY_SIZE(actmon_emc_ratios); i++, ratio++) { 330 - if (cpu_freq >= ratio->cpu_freq) { 331 - if (ratio->emc_freq >= tegra->max_freq) 332 - return tegra->max_freq; 333 - else 334 - return ratio->emc_freq; 335 - } 336 - } 329 + for (i = 0; i < ARRAY_SIZE(actmon_emc_ratios); i++, ratio++) 330 + if (cpu_freq >= ratio->cpu_freq) 331 + return min(ratio->emc_freq, tegra->max_freq); 337 332 338 333 return 0; 339 334 }