]> git.karo-electronics.de Git - linux-beck.git/commitdiff
cpufreq: Create a macro for unlock_policy_rwsem{read,write}
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 7 Feb 2013 10:08:42 +0000 (15:38 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 9 Feb 2013 00:22:06 +0000 (01:22 +0100)
On the lines of macro: lock_policy_rwsem, we can create another macro for
unlock_policy_rwsem. Lets do it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c

index 41d72c3aa2b26c5a86cf82b9d460571a6fbdc893..7cbf1d53804fda38153315e8dd3cc24b68e57561 100644 (file)
@@ -70,8 +70,7 @@ static DEFINE_PER_CPU(int, cpufreq_policy_cpu);
 static DEFINE_PER_CPU(struct rw_semaphore, cpu_policy_rwsem);
 
 #define lock_policy_rwsem(mode, cpu)                                   \
-static int lock_policy_rwsem_##mode                                    \
-(int cpu)                                                              \
+static int lock_policy_rwsem_##mode(int cpu)                           \
 {                                                                      \
        int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);              \
        BUG_ON(policy_cpu == -1);                                       \
@@ -81,23 +80,18 @@ static int lock_policy_rwsem_##mode                                 \
 }
 
 lock_policy_rwsem(read, cpu);
-
 lock_policy_rwsem(write, cpu);
 
-static void unlock_policy_rwsem_read(int cpu)
-{
-       int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);
-       BUG_ON(policy_cpu == -1);
-       up_read(&per_cpu(cpu_policy_rwsem, policy_cpu));
-}
-
-static void unlock_policy_rwsem_write(int cpu)
-{
-       int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);
-       BUG_ON(policy_cpu == -1);
-       up_write(&per_cpu(cpu_policy_rwsem, policy_cpu));
+#define unlock_policy_rwsem(mode, cpu)                                 \
+static void unlock_policy_rwsem_##mode(int cpu)                                \
+{                                                                      \
+       int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);              \
+       BUG_ON(policy_cpu == -1);                                       \
+       up_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu));              \
 }
 
+unlock_policy_rwsem(read, cpu);
+unlock_policy_rwsem(write, cpu);
 
 /* internal prototypes */
 static int __cpufreq_governor(struct cpufreq_policy *policy,