From patchwork Thu Jul 30 07:10:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51678 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 650BD22DB5 for ; Thu, 30 Jul 2015 07:11:22 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf11029541lbv.3 for ; Thu, 30 Jul 2015 00:11:21 -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 :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=B2kIS6HoTFziHHiCJrPM8xNBt/Daf1P4YswcW0br05w=; b=Al5lXVT4SlZ84rhQycmaDBbQDDYQVhdaAjjOPf8T2T6wwejJsNfIZnL1Bqgi9byD7L OnXMXlCj5INrau3EvlP48+i2z1jos5ChFmvcy0SuZvvXHS5JfvGCAZ3vYd2FPK5eeoVS GkgQJlGnJUpL5WcZECmFRyuv23VlyQf6wjoQq/KtdLLbKIIL0/1T1b/RsyxL81m0BAoX i2rufcu4btspf93+sLUldMBvshXlbMte7atQMYtk4cpwmoPkZWcDfa/xrMG4CnTeH/l7 uAYtQmtYUnZqN+i1Qpt7bIKMgstXElPhqdrEsW2jjigFW9v/V8IhuW1Fq5egTck/aWOq wMEg== X-Gm-Message-State: ALoCoQnpexoY2IXoBr0oHvE9nMWVxnZZVhgJzFszfwjJiLqjgO9PeDh+9RQJoFEy24iqzpeGqDrf X-Received: by 10.112.51.177 with SMTP id l17mr17379797lbo.1.1438240281372; Thu, 30 Jul 2015 00:11:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.135 with SMTP id ky7ls153379lac.20.gmail; Thu, 30 Jul 2015 00:11:21 -0700 (PDT) X-Received: by 10.112.78.105 with SMTP id a9mr42619185lbx.70.1438240281197; Thu, 30 Jul 2015 00:11:21 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id h8si120285laa.5.2015.07.30.00.11.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 00:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laah7 with SMTP id h7so19590389laa.0 for ; Thu, 30 Jul 2015 00:11:20 -0700 (PDT) X-Received: by 10.112.158.4 with SMTP id wq4mr3873037lbb.106.1438240280775; Thu, 30 Jul 2015 00:11:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp361754lba; Thu, 30 Jul 2015 00:11:19 -0700 (PDT) X-Received: by 10.70.55.67 with SMTP id q3mr101544597pdp.7.1438240276779; Thu, 30 Jul 2015 00:11:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si212934pdl.254.2015.07.30.00.11.14; Thu, 30 Jul 2015 00:11:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754174AbbG3HLI (ORCPT + 25 others); Thu, 30 Jul 2015 03:11:08 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33708 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753898AbbG3HLD (ORCPT ); Thu, 30 Jul 2015 03:11:03 -0400 Received: by padck2 with SMTP id ck2so18885076pad.0 for ; Thu, 30 Jul 2015 00:11:02 -0700 (PDT) X-Received: by 10.66.55.66 with SMTP id q2mr102565474pap.94.1438240262587; Thu, 30 Jul 2015 00:11:02 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id ex1sm295433pdb.57.2015.07.30.00.11.01 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 Jul 2015 00:11:02 -0700 (PDT) From: Viresh Kumar To: edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, linux-pm@vger.kernel.org, radivoje.jovanovic@linux.intel.com, punit.agrawal@arm.com, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/6] thermal/cpu_cooling: convert 'switch' block to 'if' block in notifier Date: Thu, 30 Jul 2015 12:40:32 +0530 Message-Id: <46d2492a9e665e05ec03124ffcebbe663846ff37.1438239727.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We just need to take care of single event here and there is no need to increase indentation level of most of the code (which causes lines longer that 80 columns to break). Kill the switch block. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 276cec5a1fb7..bf2673bb3cf5 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -218,27 +218,21 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, unsigned long max_freq; struct cpufreq_cooling_device *cpufreq_dev; - switch (event) { + if (event != CPUFREQ_ADJUST) + return NOTIFY_DONE; - case CPUFREQ_ADJUST: - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { - if (!cpumask_test_cpu(policy->cpu, - &cpufreq_dev->allowed_cpus)) - continue; + mutex_lock(&cooling_cpufreq_lock); + list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { + if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) + continue; - max_freq = cpufreq_dev->cpufreq_val; + max_freq = cpufreq_dev->cpufreq_val; - if (policy->max != max_freq) - cpufreq_verify_within_limits(policy, 0, - max_freq); - break; - } - mutex_unlock(&cooling_cpufreq_lock); + if (policy->max != max_freq) + cpufreq_verify_within_limits(policy, 0, max_freq); break; - default: - return NOTIFY_DONE; } + mutex_unlock(&cooling_cpufreq_lock); return NOTIFY_OK; }