From patchwork Mon Sep 16 15:10:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20347 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4800C2486B for ; Mon, 16 Sep 2013 15:10:38 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lf12sf967419vcb.10 for ; Mon, 16 Sep 2013 08:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=D0ZLWaKBhxO/+w6qcOgsDL0WNBccI7pjlAAquIKQLGI=; b=IyGOIVh86uvO0jizOXxjwXzIRXOaiu7AJhSNirr26WAE/t5QjdYCNRVGsxzhbhUWB5 turbVwwPcFBNgKxwnsz5bGS7uxRJCM+sqUdz/IdDDCfWbXBtLTaYQ+g0hExnu8n5daSw h0LpqFGq+YGyMxSGMvPzWYBpwHG5xHt76cD1YsVZWxZqa7GY9PZ4LLb4qnFQnv0CUSGi Z47E2X9As3qpd93rxMqQBeKzgUXXY3IETYGtouKAMICwVJl1nSgHPsENs+Pw3d9V2+pc TNvShn60u6TkIuixanws7DlnukMW6YI8VSeFH3t5rLChlKUiJOwAzZ9Tq6m5QD9vXX1F F54g== X-Gm-Message-State: ALoCoQkfKYQTrZGiaVnPmVT1Z8Fv/Nek6aic7fS2QSBpJ9pCu5VAdrWKHvMUq0tiHMbOqX6IOl69 X-Received: by 10.58.201.66 with SMTP id jy2mr1658200vec.5.1379344238149; Mon, 16 Sep 2013 08:10:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.200 with SMTP id j8ls2259090qez.6.gmail; Mon, 16 Sep 2013 08:10:38 -0700 (PDT) X-Received: by 10.52.166.200 with SMTP id zi8mr529519vdb.38.1379344238073; Mon, 16 Sep 2013 08:10:38 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id mj10si7204151vcb.87.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 08:10:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lf11so2926810vcb.7 for ; Mon, 16 Sep 2013 08:10:38 -0700 (PDT) X-Received: by 10.220.11.7 with SMTP id r7mr27526226vcr.12.1379344237951; Mon, 16 Sep 2013 08:10:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp102169vcz; Mon, 16 Sep 2013 08:10:37 -0700 (PDT) X-Received: by 10.66.121.68 with SMTP id li4mr31007155pab.33.1379344236950; Mon, 16 Sep 2013 08:10:36 -0700 (PDT) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx.google.com with ESMTPS id hk5si22155232pac.96.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 08:10:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.41; Received: by mail-pa0-f41.google.com with SMTP id bj1so5487741pad.14 for ; Mon, 16 Sep 2013 08:10:36 -0700 (PDT) X-Received: by 10.68.106.99 with SMTP id gt3mr8216781pbb.116.1379344236537; Mon, 16 Sep 2013 08:10:36 -0700 (PDT) Received: from localhost ([122.167.152.64]) by mx.google.com with ESMTPSA id ys4sm31835826pbb.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 16 Sep 2013 08:10:36 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl, tixy@linaro.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com, Viresh Kumar Subject: [PATCH 2/2] cpufreq: make return type of lock_policy_rwsem_{read|write}() as void Date: Mon, 16 Sep 2013 20:40:17 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <075032be4fd288074b8f699d4f4ba0179518df6f.1379344038.git.viresh.kumar@linaro.org> References: <075032be4fd288074b8f699d4f4ba0179518df6f.1379344038.git.viresh.kumar@linaro.org> In-Reply-To: <075032be4fd288074b8f699d4f4ba0179518df6f.1379344038.git.viresh.kumar@linaro.org> References: <075032be4fd288074b8f699d4f4ba0179518df6f.1379344038.git.viresh.kumar@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , lock_policy_rwsem_{read|write}() currently has return type of int but it always return zero and hence its return type must be void instead. This patch makes its return type void and fixes all users of it as well. Reported-by: Jon Medhurst Signed-off-by: Viresh Kumar Tested-by: Jon Medhurst --- drivers/cpufreq/cpufreq.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index c18bf7b..598af5c 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -67,13 +67,11 @@ static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); 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 void lock_policy_rwsem_##mode(int cpu) \ { \ struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); \ BUG_ON(!policy); \ down_##mode(&per_cpu(cpu_policy_rwsem, policy->cpu)); \ - \ - return 0; \ } lock_policy_rwsem(read, cpu); @@ -653,13 +651,12 @@ static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf) { struct cpufreq_policy *policy = to_policy(kobj); struct freq_attr *fattr = to_attr(attr); - ssize_t ret = -EINVAL; + ssize_t ret; if (!down_read_trylock(&cpufreq_rwsem)) - goto exit; + return -EINVAL; - if (lock_policy_rwsem_read(policy->cpu) < 0) - goto up_read; + lock_policy_rwsem_read(policy->cpu); if (fattr->show) ret = fattr->show(policy, buf); @@ -667,10 +664,8 @@ static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf) ret = -EIO; unlock_policy_rwsem_read(policy->cpu); - -up_read: up_read(&cpufreq_rwsem); -exit: + return ret; } @@ -689,8 +684,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, if (!down_read_trylock(&cpufreq_rwsem)) goto unlock; - if (lock_policy_rwsem_write(policy->cpu) < 0) - goto up_read; + lock_policy_rwsem_write(policy->cpu); if (fattr->store) ret = fattr->store(policy, buf, count); @@ -699,7 +693,6 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, unlock_policy_rwsem_write(policy->cpu); -up_read: up_read(&cpufreq_rwsem); unlock: put_online_cpus(); @@ -1143,7 +1136,7 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, if (ret) { pr_err("%s: Failed to move kobj: %d", __func__, ret); - WARN_ON(lock_policy_rwsem_write(old_cpu)); + lock_policy_rwsem_write(old_cpu); cpumask_set_cpu(old_cpu, policy->cpus); unlock_policy_rwsem_write(old_cpu); @@ -1196,7 +1189,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, policy->governor->name, CPUFREQ_NAME_LEN); #endif - WARN_ON(lock_policy_rwsem_write(cpu)); + lock_policy_rwsem_write(cpu); cpus = cpumask_weight(policy->cpus); if (cpus > 1) @@ -1459,14 +1452,11 @@ unsigned int cpufreq_get(unsigned int cpu) if (!down_read_trylock(&cpufreq_rwsem)) return 0; - if (unlikely(lock_policy_rwsem_read(cpu))) - goto out_policy; + lock_policy_rwsem_read(cpu); ret_freq = __cpufreq_get(cpu); unlock_policy_rwsem_read(cpu); - -out_policy: up_read(&cpufreq_rwsem); return ret_freq; @@ -1690,14 +1680,12 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, { int ret = -EINVAL; - if (unlikely(lock_policy_rwsem_write(policy->cpu))) - goto fail; + lock_policy_rwsem_write(policy->cpu); ret = __cpufreq_driver_target(policy, target_freq, relation); unlock_policy_rwsem_write(policy->cpu); -fail: return ret; } EXPORT_SYMBOL_GPL(cpufreq_driver_target); @@ -1988,10 +1976,7 @@ int cpufreq_update_policy(unsigned int cpu) goto no_policy; } - if (unlikely(lock_policy_rwsem_write(cpu))) { - ret = -EINVAL; - goto fail; - } + lock_policy_rwsem_write(cpu); pr_debug("updating policy for CPU %u\n", cpu); memcpy(&new_policy, policy, sizeof(*policy)); @@ -2020,7 +2005,6 @@ int cpufreq_update_policy(unsigned int cpu) unlock_policy_rwsem_write(cpu); -fail: cpufreq_cpu_put(policy); no_policy: return ret;