From f1242cd1469bde79e27d8cb3c30c3fe635c96797 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 15 Feb 2023 14:56:51 +0000 Subject: [PATCH] Revert "PM/devfreq: governor: Add a private governor_data for governor" This reverts commit cea018aaf7218a50bdbf17540b311e6b2982d883 which is commit 5fdded8448924e3631d466eea499b11606c43640 upstream. It breaks the Android kernel api and is not needed for Android systems as they do not support this type of functionality. If it is needed to be brought back in the future, it can be done so in a way that does not break the ABI. Bug: 161946584 Fixes: cea018aaf721 ("PM/devfreq: governor: Add a private governor_data for governor") Signed-off-by: Greg Kroah-Hartman Change-Id: I0107d52a8f445548f7de462315dbe99ec4ab3d98 --- drivers/devfreq/devfreq.c | 6 ++++-- drivers/devfreq/governor_userspace.c | 12 ++++++------ include/linux/devfreq.h | 7 +++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index c6f460550f5e..829128c0cc68 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -740,7 +740,8 @@ static void devfreq_dev_release(struct device *dev) * @dev: the device to add devfreq feature. * @profile: device-specific profile to run devfreq. * @governor_name: name of the policy to choose frequency. - * @data: devfreq driver pass to governors, governor should not change it. + * @data: private data for the governor. The devfreq framework does not + * touch this value. */ struct devfreq *devfreq_add_device(struct device *dev, struct devfreq_dev_profile *profile, @@ -952,7 +953,8 @@ static void devm_devfreq_dev_release(struct device *dev, void *res) * @dev: the device to add devfreq feature. * @profile: device-specific profile to run devfreq. * @governor_name: name of the policy to choose frequency. - * @data: devfreq driver pass to governors, governor should not change it. + * @data: private data for the governor. The devfreq framework does not + * touch this value. * * This function manages automatically the memory of devfreq device using device * resource management and simplify the free operation for memory of devfreq diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c index 8a9cf8220808..0fd6c4851071 100644 --- a/drivers/devfreq/governor_userspace.c +++ b/drivers/devfreq/governor_userspace.c @@ -21,7 +21,7 @@ struct userspace_data { static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq) { - struct userspace_data *data = df->governor_data; + struct userspace_data *data = df->data; if (data->valid) *freq = data->user_frequency; @@ -40,7 +40,7 @@ static ssize_t store_freq(struct device *dev, struct device_attribute *attr, int err = 0; mutex_lock(&devfreq->lock); - data = devfreq->governor_data; + data = devfreq->data; sscanf(buf, "%lu", &wanted); data->user_frequency = wanted; @@ -60,7 +60,7 @@ static ssize_t show_freq(struct device *dev, struct device_attribute *attr, int err = 0; mutex_lock(&devfreq->lock); - data = devfreq->governor_data; + data = devfreq->data; if (data->valid) err = sprintf(buf, "%lu\n", data->user_frequency); @@ -91,7 +91,7 @@ static int userspace_init(struct devfreq *devfreq) goto out; } data->valid = false; - devfreq->governor_data = data; + devfreq->data = data; err = sysfs_create_group(&devfreq->dev.kobj, &dev_attr_group); out: @@ -107,8 +107,8 @@ static void userspace_exit(struct devfreq *devfreq) if (devfreq->dev.kobj.sd) sysfs_remove_group(&devfreq->dev.kobj, &dev_attr_group); - kfree(devfreq->governor_data); - devfreq->governor_data = NULL; + kfree(devfreq->data); + devfreq->data = NULL; } static int devfreq_userspace_handler(struct devfreq *devfreq, diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index fc4c7ad49cee..121a2430d7f7 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -146,8 +146,8 @@ struct devfreq_stats { * @work: delayed work for load monitoring. * @previous_freq: previously configured frequency value. * @last_status: devfreq user device info, performance statistics - * @data: devfreq driver pass to governors, governor should not change it. - * @governor_data: private data for governors, devfreq core doesn't touch it. + * @data: Private data of the governor. The devfreq framework does not + * touch this. * @user_min_freq_req: PM QoS minimum frequency request from user (via sysfs) * @user_max_freq_req: PM QoS maximum frequency request from user (via sysfs) * @scaling_min_freq: Limit minimum frequency requested by OPP interface @@ -183,8 +183,7 @@ struct devfreq { unsigned long previous_freq; struct devfreq_dev_status last_status; - void *data; - void *governor_data; + void *data; /* private data for governors */ struct dev_pm_qos_request user_min_freq_req; struct dev_pm_qos_request user_max_freq_req;