diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2015-11-13 05:25:28 -0500 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2016-01-13 03:30:32 -0500 |
commit | 3104fa3081126c9bda35793af5f335d0ee0d5818 (patch) | |
tree | 365c8b01f65010f05439ff9b3a56425504b6bd0b | |
parent | e54916c6e1d0b939999eb38011202dd9064d5788 (diff) |
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>
-rw-r--r-- | drivers/devfreq/devfreq.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index ca848cc6a8fd..49fc7dcf664c 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -921,12 +921,6 @@ unlock: | |||
921 | return ret; | 921 | return ret; |
922 | } | 922 | } |
923 | 923 | ||
924 | static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr, | ||
925 | char *buf) | ||
926 | { | ||
927 | return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq); | ||
928 | } | ||
929 | |||
930 | static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr, | 924 | static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr, |
931 | const char *buf, size_t count) | 925 | const char *buf, size_t count) |
932 | { | 926 | { |
@@ -953,13 +947,17 @@ unlock: | |||
953 | mutex_unlock(&df->lock); | 947 | mutex_unlock(&df->lock); |
954 | return ret; | 948 | return ret; |
955 | } | 949 | } |
956 | static DEVICE_ATTR_RW(min_freq); | ||
957 | 950 | ||
958 | static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr, | 951 | #define show_one(name) \ |
959 | char *buf) | 952 | static ssize_t name##_show \ |
960 | { | 953 | (struct device *dev, struct device_attribute *attr, char *buf) \ |
961 | return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); | 954 | { \ |
955 | return sprintf(buf, "%lu\n", to_devfreq(dev)->name); \ | ||
962 | } | 956 | } |
957 | show_one(min_freq); | ||
958 | show_one(max_freq); | ||
959 | |||
960 | static DEVICE_ATTR_RW(min_freq); | ||
963 | static DEVICE_ATTR_RW(max_freq); | 961 | static DEVICE_ATTR_RW(max_freq); |
964 | 962 | ||
965 | static ssize_t available_frequencies_show(struct device *d, | 963 | static ssize_t available_frequencies_show(struct device *d, |