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: 6899061 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC09DC05AC for ; Thu, 30 Jul 2015 07:12:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0286F2057F for ; Thu, 30 Jul 2015 07:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 135BD20574 for ; Thu, 30 Jul 2015 07:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbbG3HLH (ORCPT ); Thu, 30 Jul 2015 03:11:07 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33962 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbbG3HLD (ORCPT ); Thu, 30 Jul 2015 03:11:03 -0400 Received: by pacan13 with SMTP id an13so19151641pac.1 for ; Thu, 30 Jul 2015 00:11:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=h2UI7ZZYjiyWbFGWTZowTDXKXBAQunur9HX6B/gB08I=; b=UY2NhL1DRPfrnGbOrZVvR/h9EEXvaEdIyVGpo/bdha0z77GKx8MMS73g1hWnU31AGS CdtRoB2PnDnmqLlksqcFVSRP3bV2v6stGlyiI2gcr+7B6BzQMen0vSm9bSy/Nq8CZb5A x1rd0dqzttOXSVnlwvjvzkrrTk7jCSf9ZvpGWd18j0OQ6e01SysdD0phUr90SzHmN1D7 UxKDU1xDtKvkD1hl32AJR24VmPQPVLKdf6bkDFDRpSigEvfBkSVT/ne3Z3EKppakN4BH Xlp5aCf6x00NIQoj6hhR2IUAD3g/bOZcWTI5byJO7udT0ENenuLc1uZXTw6+yaj5nJGs oThA== X-Gm-Message-State: ALoCoQlQhqiFubsvbfflVdo1qO3ftsrWJMLv71VJJkyqGVIgGRspbL3cJEK6aM+OYDsj6PM5PS1V 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }