From patchwork Tue Jan 6 15:39:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42772 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 62C082055F for ; Tue, 6 Jan 2015 15:39:40 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id k14sf5701031wgh.6 for ; Tue, 06 Jan 2015 07:39:39 -0800 (PST) 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=/y25MunTPUDRKmpXfbwnar7lvhR07IJyOlNiWMBKTwk=; b=IrigSHHCjFe1J7HXDhoe7zBsRuN5xct2t1FknhvdtMATXYKZwbCo6RblTa/piV7gRU bDtOp/OgzPwEtbx7VnDexn+Ofp9/I6tZfyPUEiX+LqOi12sdctP4bhFNyFguHqsW3bI5 PH2vEFnK5vp33paZ3YDbWMjGKMV9HJNstwAj2hBpXGLbpl3ZMmJEy0zU0vwBrzFSuFo6 BmzqnyCtv6uB6ETUgN9+cp8PHctpjsMJ5PfJ8sXB4slx2wv+sDPbDZ3toCH28kZfJgSt Pih+2tpGth0ZF+Ablt55MiXMp+wa+97g2q3br1SF2cNcwvy7xwOSjJSQ1EwWxc/mIz0u zcIw== X-Gm-Message-State: ALoCoQlPZrz8hjWFeTn41uhneQGIgDFdk1XgGZmBjCQiCOAY4k26WCuUC6QXxIewHr3i8+NoIr/f X-Received: by 10.152.44.225 with SMTP id h1mr11166532lam.2.1420558779646; Tue, 06 Jan 2015 07:39:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.202 with SMTP id v10ls49157lag.77.gmail; Tue, 06 Jan 2015 07:39:39 -0800 (PST) X-Received: by 10.152.36.37 with SMTP id n5mr97990010laj.27.1420558779500; Tue, 06 Jan 2015 07:39:39 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id n3si64648831lah.45.2015.01.06.07.39.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 07:39:39 -0800 (PST) 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 mail-la0-f47.google.com with SMTP id hz20so19571730lab.20 for ; Tue, 06 Jan 2015 07:39:39 -0800 (PST) X-Received: by 10.112.84.225 with SMTP id c1mr78530556lbz.22.1420558779409; Tue, 06 Jan 2015 07:39:39 -0800 (PST) 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.9.200 with SMTP id c8csp1209478lbb; Tue, 6 Jan 2015 07:39:38 -0800 (PST) X-Received: by 10.66.222.227 with SMTP id qp3mr7336014pac.47.1420558777331; Tue, 06 Jan 2015 07:39:37 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hz4si17325227pbb.8.2015.01.06.07.39.36; Tue, 06 Jan 2015 07:39:37 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754398AbbAFPjg (ORCPT + 12 others); Tue, 6 Jan 2015 10:39:36 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:58637 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754083AbbAFPjf (ORCPT ); Tue, 6 Jan 2015 10:39:35 -0500 Received: by mail-pd0-f178.google.com with SMTP id r10so30592669pdi.37 for ; Tue, 06 Jan 2015 07:39:34 -0800 (PST) X-Received: by 10.70.129.48 with SMTP id nt16mr154310373pdb.113.1420558774885; Tue, 06 Jan 2015 07:39:34 -0800 (PST) Received: from localhost ([122.167.212.196]) by mx.google.com with ESMTPSA id qb10sm32457615pbb.9.2015.01.06.07.39.33 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 06 Jan 2015 07:39:34 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar Subject: [PATCH V3 02/16] cpufreq: stats: return -EEXIST when stats are already allocated Date: Tue, 6 Jan 2015 21:09:01 +0530 Message-Id: <4612a6b926f3e1064093e4f79eaabd48fe4dcdf1.1420558386.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.2.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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: , __cpufreq_stats_create_table() is called from: - cpufreq notifier on creation of a new policy. Stats will always be NULL here. - cpufreq_stats_init() for all CPUs as cpufreq-stats might have been initialized after cpufreq driver. For any policy, 'stats' will be NULL for the first cpu only and will be valid for all other CPUs managed by the same policy. While we return for other CPUs, we don't return the right error value. Its not that we would fail with -EBUSY. But generally, this is what these return values mean: - EBUSY: we are busy right now, try again. And the retry attempt might be immediate. - EEXIST: We already have what you are trying to create and there is no need to create it again, and so no more tries are required. Reviewed-by: Prarit Bhargava Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_stats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 80801f880dd8..d2299ca2fc2c 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -192,8 +192,10 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) if (unlikely(!table)) return 0; + /* stats already initialized */ if (per_cpu(cpufreq_stats_table, cpu)) - return -EBUSY; + return -EEXIST; + stat = kzalloc(sizeof(*stat), GFP_KERNEL); if ((stat) == NULL) return -ENOMEM;