PM / devfreq: Add show_one macro to delete the duplicate code
This patch adds the 'show_one' macro to simplify the duplicate code of both max_freq_show() and min_freq_show(). Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
This commit is contained in:
parent
e54916c6e1
commit
3104fa3081
|
@ -921,12 +921,6 @@ unlock:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr,
|
|
||||||
char *buf)
|
|
||||||
{
|
|
||||||
return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
|
static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
|
@ -953,13 +947,17 @@ unlock:
|
||||||
mutex_unlock(&df->lock);
|
mutex_unlock(&df->lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RW(min_freq);
|
|
||||||
|
|
||||||
static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr,
|
#define show_one(name) \
|
||||||
char *buf)
|
static ssize_t name##_show \
|
||||||
{
|
(struct device *dev, struct device_attribute *attr, char *buf) \
|
||||||
return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq);
|
{ \
|
||||||
|
return sprintf(buf, "%lu\n", to_devfreq(dev)->name); \
|
||||||
}
|
}
|
||||||
|
show_one(min_freq);
|
||||||
|
show_one(max_freq);
|
||||||
|
|
||||||
|
static DEVICE_ATTR_RW(min_freq);
|
||||||
static DEVICE_ATTR_RW(max_freq);
|
static DEVICE_ATTR_RW(max_freq);
|
||||||
|
|
||||||
static ssize_t available_frequencies_show(struct device *d,
|
static ssize_t available_frequencies_show(struct device *d,
|
||||||
|
|
Loading…
Reference in New Issue