From patchwork Thu Oct 3 15:56:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20796 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 93BB125CAB for ; Thu, 3 Oct 2013 15:57:49 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf5501363qec.4 for ; Thu, 03 Oct 2013 08:57:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state: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=6Ai+MtlDBoMQukBuI1arZbesFAtTfoiO9sLLCOqD17U=; b=UI2OdpsQIo54u6OXyZcDpGzZi9vfFVmBSGIs3segEXKsOHidkjq+7fPxImB4EmQ0rn vuQDTqItExX4KLeNoP7m3bdAGuOeu3wn3NrrtZLOZCCzmql0DeyLicOOqKT/PiQTIfW2 rLFxiUqWX/ScJdluwb4K/zD4uUw4ZFGzh2EKnER9QxztkMB+lyQ4iQ1zH5QEnsReEloh wo2u5fkLx0dF7ieqo6PgZua1az1oxScQHLJzTuK5KAWpyUjhalbtmM1thnf+sX8KgXSR kSq+Up0fN9uFgU8cuwnv+HSmocZ8ifI5eM1u8iFWhBghqv48TucVCzrDNG9yEZeYzliw DBSQ== X-Received: by 10.236.26.202 with SMTP id c50mr7587389yha.14.1380815869432; Thu, 03 Oct 2013 08:57:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.128.229 with SMTP id nr5ls1017154qeb.94.gmail; Thu, 03 Oct 2013 08:57:49 -0700 (PDT) X-Received: by 10.52.33.44 with SMTP id o12mr6757620vdi.7.1380815869314; Thu, 03 Oct 2013 08:57:49 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id uy8si1886244vcb.55.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 08:57:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id cz12so1788719veb.4 for ; Thu, 03 Oct 2013 08:57:49 -0700 (PDT) X-Gm-Message-State: ALoCoQl0JPYY/8g1WcBNxKCHMBaThZ5QZa/VSvaOCMr+GKNa/7adkWbDtxALUOnQ9Wf/sxYid7sp X-Received: by 10.220.94.206 with SMTP id a14mr7924847vcn.19.1380815869224; Thu, 03 Oct 2013 08:57:49 -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 u4csp189192vcz; Thu, 3 Oct 2013 08:57:48 -0700 (PDT) X-Received: by 10.68.217.129 with SMTP id oy1mr9267755pbc.23.1380815868262; Thu, 03 Oct 2013 08:57:48 -0700 (PDT) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by mx.google.com with ESMTPS id tp5si6795610pac.280.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 08:57:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.180 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.180; Received: by mail-pd0-f180.google.com with SMTP id y10so2712468pdj.11 for ; Thu, 03 Oct 2013 08:57:47 -0700 (PDT) X-Received: by 10.68.135.100 with SMTP id pr4mr9495354pbb.62.1380815867844; Thu, 03 Oct 2013 08:57:47 -0700 (PDT) Received: from localhost ([122.167.152.64]) by mx.google.com with ESMTPSA id sb9sm9092689pbb.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Oct 2013 08:57:47 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl, daniel.lezcano@linaro.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 07/16] cpuidle: rearrange __cpuidle_register_device() to keep minimal exit points Date: Thu, 3 Oct 2013 21:26:46 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: 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.128.173 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: , This patch rearranges __cpuidle_register_device() a bit in order to reduce the number of exit points of this function. Signed-off-by: Viresh Kumar --- drivers/cpuidle/cpuidle.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 211e504..8c91bad 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -383,13 +383,12 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) list_add(&dev->device_list, &cpuidle_detected_devices); ret = cpuidle_coupled_register_device(dev); - if (ret) { + if (ret) __cpuidle_unregister_device(dev); - return ret; - } + else + dev->registered = 1; - dev->registered = 1; - return 0; + return ret; } /**