Skip to content

Commit 92e61c2

Browse files
committed
Merge tag 'devfreq-next-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux
Pull devfreq updates for 6.2 from Chanwoo Choi: "- Add a private governor_data for governor. The private governor_data is allocated and handled by governor regardless of passing the data from devfreq driver via devfreq_add_device. The added private governor data keeps the governor own data when switching from userspace governor and other governors. - Replace code by using defined functions of device_match_of_node() and devm_platform_get_and_ioremap_resource()." * tag 'devfreq-next-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux: PM / devfreq: event: use devm_platform_get_and_ioremap_resource() PM / devfreq: event: Use device_match_of_node() PM / devfreq: Use device_match_of_node() PM/devfreq: governor: Add a private governor_data for governor
2 parents 76dcd73 + 7fc7f25 commit 92e61c2

5 files changed

Lines changed: 15 additions & 17 deletions

File tree

drivers/devfreq/devfreq-event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(struct device *dev,
233233

234234
mutex_lock(&devfreq_event_list_lock);
235235
list_for_each_entry(edev, &devfreq_event_list, node) {
236-
if (edev->dev.parent && edev->dev.parent->of_node == node)
236+
if (edev->dev.parent && device_match_of_node(edev->dev.parent, node))
237237
goto out;
238238
}
239239

drivers/devfreq/devfreq.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,7 @@ static void remove_sysfs_files(struct devfreq *devfreq,
776776
* @dev: the device to add devfreq feature.
777777
* @profile: device-specific profile to run devfreq.
778778
* @governor_name: name of the policy to choose frequency.
779-
* @data: private data for the governor. The devfreq framework does not
780-
* touch this value.
779+
* @data: devfreq driver pass to governors, governor should not change it.
781780
*/
782781
struct devfreq *devfreq_add_device(struct device *dev,
783782
struct devfreq_dev_profile *profile,
@@ -1011,8 +1010,7 @@ static void devm_devfreq_dev_release(struct device *dev, void *res)
10111010
* @dev: the device to add devfreq feature.
10121011
* @profile: device-specific profile to run devfreq.
10131012
* @governor_name: name of the policy to choose frequency.
1014-
* @data: private data for the governor. The devfreq framework does not
1015-
* touch this value.
1013+
* @data: devfreq driver pass to governors, governor should not change it.
10161014
*
10171015
* This function manages automatically the memory of devfreq device using device
10181016
* resource management and simplify the free operation for memory of devfreq
@@ -1059,7 +1057,7 @@ struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
10591057
mutex_lock(&devfreq_list_lock);
10601058
list_for_each_entry(devfreq, &devfreq_list, node) {
10611059
if (devfreq->dev.parent
1062-
&& devfreq->dev.parent->of_node == node) {
1060+
&& device_match_of_node(devfreq->dev.parent, node)) {
10631061
mutex_unlock(&devfreq_list_lock);
10641062
return devfreq;
10651063
}

drivers/devfreq/event/exynos-nocp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ static int exynos_nocp_parse_dt(struct platform_device *pdev,
214214
nocp->clk = NULL;
215215

216216
/* Maps the memory mapped IO to control nocp register */
217-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
218-
base = devm_ioremap_resource(dev, res);
217+
base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
219218
if (IS_ERR(base))
220219
return PTR_ERR(base);
221220

drivers/devfreq/governor_userspace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct userspace_data {
2121

2222
static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
2323
{
24-
struct userspace_data *data = df->data;
24+
struct userspace_data *data = df->governor_data;
2525

2626
if (data->valid)
2727
*freq = data->user_frequency;
@@ -40,7 +40,7 @@ static ssize_t set_freq_store(struct device *dev, struct device_attribute *attr,
4040
int err = 0;
4141

4242
mutex_lock(&devfreq->lock);
43-
data = devfreq->data;
43+
data = devfreq->governor_data;
4444

4545
sscanf(buf, "%lu", &wanted);
4646
data->user_frequency = wanted;
@@ -60,7 +60,7 @@ static ssize_t set_freq_show(struct device *dev,
6060
int err = 0;
6161

6262
mutex_lock(&devfreq->lock);
63-
data = devfreq->data;
63+
data = devfreq->governor_data;
6464

6565
if (data->valid)
6666
err = sprintf(buf, "%lu\n", data->user_frequency);
@@ -91,7 +91,7 @@ static int userspace_init(struct devfreq *devfreq)
9191
goto out;
9292
}
9393
data->valid = false;
94-
devfreq->data = data;
94+
devfreq->governor_data = data;
9595

9696
err = sysfs_create_group(&devfreq->dev.kobj, &dev_attr_group);
9797
out:
@@ -107,8 +107,8 @@ static void userspace_exit(struct devfreq *devfreq)
107107
if (devfreq->dev.kobj.sd)
108108
sysfs_remove_group(&devfreq->dev.kobj, &dev_attr_group);
109109

110-
kfree(devfreq->data);
111-
devfreq->data = NULL;
110+
kfree(devfreq->governor_data);
111+
devfreq->governor_data = NULL;
112112
}
113113

114114
static int devfreq_userspace_handler(struct devfreq *devfreq,

include/linux/devfreq.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ struct devfreq_stats {
152152
* @max_state: count of entry present in the frequency table.
153153
* @previous_freq: previously configured frequency value.
154154
* @last_status: devfreq user device info, performance statistics
155-
* @data: Private data of the governor. The devfreq framework does not
156-
* touch this.
155+
* @data: devfreq driver pass to governors, governor should not change it.
156+
* @governor_data: private data for governors, devfreq core doesn't touch it.
157157
* @user_min_freq_req: PM QoS minimum frequency request from user (via sysfs)
158158
* @user_max_freq_req: PM QoS maximum frequency request from user (via sysfs)
159159
* @scaling_min_freq: Limit minimum frequency requested by OPP interface
@@ -193,7 +193,8 @@ struct devfreq {
193193
unsigned long previous_freq;
194194
struct devfreq_dev_status last_status;
195195

196-
void *data; /* private data for governors */
196+
void *data;
197+
void *governor_data;
197198

198199
struct dev_pm_qos_request user_min_freq_req;
199200
struct dev_pm_qos_request user_max_freq_req;

0 commit comments

Comments
 (0)