#include <linux/device.h>
#include <linux/devfreq.h>
#include <linux/module.h>
unsigned long user_frequency;
static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
struct userspace_data *data = df->data;
*freq = data->user_frequency;
*freq = df->previous_freq;
static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
struct devfreq *devfreq = to_devfreq(dev);
struct userspace_data *data;
mutex_lock(&devfreq->lock);
sscanf(buf, "%lu", &wanted);
data->user_frequency = wanted;
err = update_devfreq(devfreq);
mutex_unlock(&devfreq->lock);
static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
struct devfreq *devfreq = to_devfreq(dev);
struct userspace_data *data;