From b1330360dbd20bc70bdf790b229b9fa74dab40e0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 19 Jan 2023 09:14:13 +0000 Subject: [PATCH] Revert "PM/devfreq: governor: Add a private governor_data for governor" This reverts commit b9275d8a927f9a6c431754fa771001e83a058946 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: b9275d8a927f ("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 | 11 +++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index f5ad9b9986549..c79652ee94be6 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -603,7 +603,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, @@ -787,7 +788,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 a3ae4dc4668ba..af94942fcf955 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 7535f860d45df..2bae9ed3c7831 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -121,10 +121,10 @@ struct devfreq_dev_profile { * devfreq.nb to the corresponding register notifier call chain. * @work: delayed work for load monitoring. * @previous_freq: previously configured frequency value. - * @data: devfreq driver pass to governors, governor should not change it. - * @governor_data: private data for governors, devfreq core doesn't touch it. - * @min_freq: Limit minimum frequency requested by user (0: none) - * @max_freq: Limit maximum frequency requested by user (0: none) + * @data: Private data of the governor. The devfreq framework does not + * touch this. + * @min_freq: Limit minimum frequency requested by user (0: none) + * @max_freq: Limit maximum frequency requested by user (0: none) * @scaling_min_freq: Limit minimum frequency requested by OPP interface * @scaling_max_freq: Limit maximum frequency requested by OPP interface * @stop_polling: devfreq polling status of a device. @@ -159,8 +159,7 @@ struct devfreq { unsigned long previous_freq; struct devfreq_dev_status last_status; - void *data; - void *governor_data; + void *data; /* private data for governors */ unsigned long min_freq; unsigned long max_freq;