From patchwork Wed Jun 21 04:46:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106034 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1744148qgd; Tue, 20 Jun 2017 21:47:20 -0700 (PDT) X-Received: by 10.98.66.147 with SMTP id h19mr30997775pfd.178.1498020440175; Tue, 20 Jun 2017 21:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498020440; cv=none; d=google.com; s=arc-20160816; b=ps7JmsjmrZlNeRiLsyKSEWbjUR9/40tX2NO5+Ic0QYLgmTMaD3FuhTln/fw7TKuWKM pKeSrL6ldOw+n/OTmSWQoNlSGFxJiJyUbLovLkBGZJg3fwdHhQ/hMIvpG42uMeUTga89 WfLb6ZuJ+WBkK17lnqksTosiRW9zUNMHeDjEunPy0Z2LbyrcvJCLQmMtAbaw+0cwivpH LR64oq9LI+k63sPyTFB73o9FrgvcF2rWh/7A5UjPExYnySRWfPhcwU+UvD/YB0o0FSUE XZNv/7FWvbqfy0CIS1o4p7YaWCCaZoMVrLj2weOHMmWtomNouGcuofqxT58sZj6zsEKF EwKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=A0lgjK/YTuNOaH7sDzI13Mug96FMgLrhg0pT7cwxgkM=; b=eC11qTzlhpblp7d4FoRZbkj6jT4IiQN+v49TXKMY1eqFz0yrhSYDljvQ2GEJv3/ngo KcejPab4Stv2mt3lnG7yq0FsJvGuIZRcZ2T4Y1YpuOU8XZkcGOSSwr3sNRMLhPLeH5kw nA1WXBAkuGWrF4ff16dnPM1gel3IMragfk0WRGpkkA17TXT0BIAzmzB6kRjt5bZiWEBl +eKYyRSAFNnOK0QFEBJlbv1Oqm8e7IpZAMTgjFMeU0iGi9hacsQFlg8Fkcx3HsrfHMKd U5sMI3WhysucyM1RNs5djLcVSUzXE2PsB4fxoVCNCShhgmXJUfQyva66ZgWvWA7/KNKp bjvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Nzw88cyd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si12534085pgk.501.2017.06.20.21.47.19; Tue, 20 Jun 2017 21:47:20 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Nzw88cyd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752668AbdFUEq7 (ORCPT + 25 others); Wed, 21 Jun 2017 00:46:59 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36726 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbdFUEq4 (ORCPT ); Wed, 21 Jun 2017 00:46:56 -0400 Received: by mail-pf0-f179.google.com with SMTP id x63so79540489pff.3 for ; Tue, 20 Jun 2017 21:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=A0lgjK/YTuNOaH7sDzI13Mug96FMgLrhg0pT7cwxgkM=; b=Nzw88cydmIbeDnr6QqbzH0gKYSCX6CXfuBemhmPEDr22TFN2YMZkdcDTY86Ey7ihW9 5LdgkYkvZi8RBkL/TAmhtz94zn+cOPEkDd1ZV+MnoFQpHTlkdqh6M91YRLpfJfuFdMuw oFgWXrf+urpnblRlDpcsIeMIYGkfsD40e8pqQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=A0lgjK/YTuNOaH7sDzI13Mug96FMgLrhg0pT7cwxgkM=; b=FbzPjdaGvUGbztRMnshXo52WcKXxQ0E0Mnkp1qMRNylBSuVhEtY8uJFPmVLb9anEiV o+tyV0h4fmpJt2JEpZbhhNk1IbU2R+1wCmG1u1/UKsEUR7elck0kAwLfiaWDKOyxPoJC syiHJqurJo6SG+/+tuUalWZLTYYC2yKEmG1bD/qy0F9fMYEvjSIA22Xlz6I/8fZioQGz 0mEffeR78CQYiwpbbQ1OShYkO7jOzsWwRmqV5hnkzwdf0DBuwgq/0Hl/oCPSrw1SiiVL 096E8K+IGbz8by/iWmi2IjUvGMxF9ijrgElRgcFNQ7hfg+V87E7F4UcMPHHrMwhqMFJs Ttgg== X-Gm-Message-State: AKS2vOyIBJFfexj/8YeRg/2Kn1nnZPHyTuAnlE55ZEwbZfNa+17N6aUF PIkwMM6vEDv6bGCT X-Received: by 10.99.125.2 with SMTP id y2mr35401257pgc.10.1498020415826; Tue, 20 Jun 2017 21:46:55 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id o12sm30759765pfi.9.2017.06.20.21.46.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 21:46:55 -0700 (PDT) From: Viresh Kumar To: Juri Lelli , Greg Kroah-Hartman Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux@arm.linux.org.uk, Will Deacon , Vincent Guittot , arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 1/5] arch_topology: Get rid of "cap_parsing_done" Date: Wed, 21 Jun 2017 10:16:40 +0530 Message-Id: <3cb2fa07035f9333eeaaee3eab37d090777abb99.1498019799.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We can reuse "cap_parsing_failed" instead of keeping an additional variable here. Signed-off-by: Viresh Kumar --- drivers/base/arch_topology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index d1c33a85059e..8239a6232808 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -161,7 +161,6 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) #ifdef CONFIG_CPU_FREQ static cpumask_var_t cpus_to_visit; -static bool cap_parsing_done; static void parsing_done_workfn(struct work_struct *work); static DECLARE_WORK(parsing_done_work, parsing_done_workfn); @@ -173,7 +172,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, struct cpufreq_policy *policy = data; int cpu; - if (cap_parsing_failed || cap_parsing_done) + if (cap_parsing_failed) return 0; switch (val) { @@ -193,7 +192,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, topology_normalize_cpu_scale(); kfree(raw_capacity); pr_debug("cpu_capacity: parsing done\n"); - cap_parsing_done = true; + cap_parsing_failed = true; schedule_work(&parsing_done_work); } } From patchwork Wed Jun 21 04:46:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106035 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1744151qgd; Tue, 20 Jun 2017 21:47:20 -0700 (PDT) X-Received: by 10.84.191.164 with SMTP id a33mr5180822pld.119.1498020440659; Tue, 20 Jun 2017 21:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498020440; cv=none; d=google.com; s=arc-20160816; b=aOxsxH/ObZhfHReeIewfAyTkedsCccMdq2PwX/I7CtjmS+JHITM1vFg9/+Zq8XG6Ib KJbxZFx+LgzrFmzMkfqWLyGklGm1O43SPJoNz+tAvZl1E7B+PnalfUh5vFSfiHQu55ES KMViyVjRwKXtgzFvsHnCZXsjTImBt72sNH/Hnbps5LaibjG2cbc59rI80X4r7Rhqncc5 TPYgywvFmtZyBRPPs46VxKj1E3JsD4zYCehn+XyhnNHGK1IDkjdqKZLks6WbERvJUuah n5BJ8OIH7AXrKMbk7b1DRuDwFJk4mIvvzaG4AtODY/AioldzKQymwEgnIk4r1jy+fjV7 mIcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=X8HxVuNUfil0DQndY1CVkypm0tTw/muEhHMJjZI1bLw=; b=bE7QCwxfDX/CaRm6ZeioK8J8pb1+IdXGv5cdG4fT07F1RXn1WdvnzBp49ByptcelSr ysXIHB4Rv4I0zjYy489BAqy1xoq1nbP6XOfOu/9qHg8zFlSe5ztfYSGtUj1MJDlu7umc L+YBX0X2HKePhz2B+exzrLWhwT34ZoOUqXJb0aHQE+4CgcNtSYdxsNe0KPSFBQxcWWHG jEq49LUg8DDxAV27C9wRpfiGuow6f9symRL7WK6IvXbzc9G0gbHN/s4e3b8E5C2Mfy4y +CipbhkiYO8rbzpVFGEe1l82WuE1xhslYMkYpj30s936/LVc7vBJD9TBruFe9SPKlXmi rLfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Hy7J9RMD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si12534085pgk.501.2017.06.20.21.47.20; Tue, 20 Jun 2017 21:47:20 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Hy7J9RMD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbdFUErC (ORCPT + 25 others); Wed, 21 Jun 2017 00:47:02 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:35723 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669AbdFUEq7 (ORCPT ); Wed, 21 Jun 2017 00:46:59 -0400 Received: by mail-pg0-f52.google.com with SMTP id 132so38638798pgb.2 for ; Tue, 20 Jun 2017 21:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=X8HxVuNUfil0DQndY1CVkypm0tTw/muEhHMJjZI1bLw=; b=Hy7J9RMDtyTGBsrRwSOMrZANEvn2Ata4Hg6sxPJ5ffzwFcktBB3jBzxI7J6Yac6mLy aWc3idgPUM8nWW4wTe2s8Xop+l/JCPkQqPgDMBRsiUf4/ec7sATaaf1KepuX2aIjIzVT MIGzC6YenAo8UUT3CChuHKBYt0DSGPbYz1lGs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=X8HxVuNUfil0DQndY1CVkypm0tTw/muEhHMJjZI1bLw=; b=hUzai9E9nAn7Icaznr021/e3lAe0via02uwz1H55iNsilxrieyFv39mcPCnG8Yf/CG ncZbkqnkxLF838BofExxV6M3Wse0u44dOeC7OoNPWS4deqNKbk4yQDbGQ2VzQy67gE09 PcoI2+TlY32z2Ox+EQFG//XpDXM0oe9NEHIvamQWGtVAIeI8lnUaDq9n9f4fXPVcGi2t bhOqPjFt15a3cZ3TsfRWHVS1dcwYJ+kdQP3njkCDI/7Dw7Ip5MsFNYTXjSMSJLCtgHmu 5oDOwJTt8gYwrS/TEdurebX+r+qOQ3N0WwuRc8RK/ApkTywMGBGlHqxmJL4w4nQPzPE5 RRzA== X-Gm-Message-State: AKS2vOxiQfTkosfi+R5IKrAAe6Fcusin6Ouieb1gc8p9MwXXE623T2Up uNgnmz8qGJGahyvP X-Received: by 10.98.66.77 with SMTP id p74mr15718567pfa.240.1498020418808; Tue, 20 Jun 2017 21:46:58 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id b3sm29173652pfg.47.2017.06.20.21.46.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 21:46:58 -0700 (PDT) From: Viresh Kumar To: Juri Lelli , Greg Kroah-Hartman Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux@arm.linux.org.uk, Will Deacon , Vincent Guittot , arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 2/5] arch_topology: Don't break lines unnecessarily Date: Wed, 21 Jun 2017 10:16:41 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no need of line break at few places, avoid them. Signed-off-by: Viresh Kumar --- drivers/base/arch_topology.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 8239a6232808..2f1d9921ee54 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -41,8 +41,7 @@ static ssize_t cpu_capacity_show(struct device *dev, { struct cpu *cpu = container_of(dev, struct cpu, dev); - return sprintf(buf, "%lu\n", - topology_get_cpu_scale(NULL, cpu->dev.id)); + return sprintf(buf, "%lu\n", topology_get_cpu_scale(NULL, cpu->dev.id)); } static ssize_t cpu_capacity_store(struct device *dev, @@ -128,8 +127,7 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) if (cap_parsing_failed) return !ret; - ret = of_property_read_u32(cpu_node, - "capacity-dmips-mhz", + ret = of_property_read_u32(cpu_node, "capacity-dmips-mhz", &cpu_capacity); if (!ret) { if (!raw_capacity) { @@ -180,8 +178,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", cpumask_pr_args(policy->related_cpus), cpumask_pr_args(cpus_to_visit)); - cpumask_andnot(cpus_to_visit, - cpus_to_visit, + cpumask_andnot(cpus_to_visit, cpus_to_visit, policy->related_cpus); for_each_cpu(cpu, policy->related_cpus) { raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * From patchwork Wed Jun 21 04:46:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106036 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1744154qgd; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) X-Received: by 10.98.66.77 with SMTP id p74mr15719759pfa.240.1498020441055; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498020441; cv=none; d=google.com; s=arc-20160816; b=oKGe5rXixbIYJRfIQ2Oak6EjB3Nfmw547PVpflDf6o1cfCeiU0UDGm+RVZyS9yZcSU Q/m9JTsk/MnuwJHE1w4He4m74kY1AoOpAfVHvUiCI4XCH0f9cu8re9R3G5Gy9PhNHBP0 uUp9e6iZj7lOUA8mtBT4FPRZ+8FEPr5MeOrKp7jDLpOOf79+tXSTVEj1qSEpJh5qWghJ +TgrM8GPWpexNa/+OvxlbIgnCMfkHBxh1+SPKQQ2sWr49mf/OImP8dxl3UU/p5sXzKQc Gcmcbg/KalTJQPE/dDgN2STfoBC77SfnJWKxEXQui+Q79IgSycfcWEkQS7k+A5gB/wyS s2hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=oIQICQeabtHayL+S/p0jPe0N5tkFj3ylN34KK/YLpRI=; b=B7+1lBc3NciXW4OX3hzn3LQrsd37GRRoHTE3BUWGxUt2cpczD4lCBmQP/fMEX2tE89 WsJLkX2ILIF5HCc3zk1Qzs0u2Je4ew2eQ4gHgysJ58TU1gYysyiV3P9l/OtFhknGwZNo J5g6HCqqfrZy6WiLZW29McxoeVATIGQCTwqfy8mx9V8OjI8kUmY3OafrdEazD2BvqClK l0CYmz5lE5JTkTdB/g15P7bg7Bixgt5Y4WEnTdfNcCP5+2zX9shklU+cUZK7uDgqw7Ba 8tDLVlmE6pp7zOpoqij6zkFXuLGJTrTaaWCt6Y/jShzWyfe8CaZVVnw5bMZS6F2rEgvU Fb2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=QoDg2QMK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si12534085pgk.501.2017.06.20.21.47.20; Tue, 20 Jun 2017 21:47:21 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=QoDg2QMK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752914AbdFUErF (ORCPT + 25 others); Wed, 21 Jun 2017 00:47:05 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33626 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669AbdFUErC (ORCPT ); Wed, 21 Jun 2017 00:47:02 -0400 Received: by mail-pf0-f182.google.com with SMTP id 83so79707516pfr.0 for ; Tue, 20 Jun 2017 21:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oIQICQeabtHayL+S/p0jPe0N5tkFj3ylN34KK/YLpRI=; b=QoDg2QMKn1B+4bV4Psxq7YchLVIxlXbxIzHx4kBP82F58PblrrizLqWoAkCKeNNuCC scxpsshj/NG1r5ErJpS+jm1FSzfhFbp2491hQEuIWT126D1Bf7gVK7adzo+NwRby7d5S UFAxsmQWkQtDrvJDW3devHXbnB0jtAAAqOkR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=oIQICQeabtHayL+S/p0jPe0N5tkFj3ylN34KK/YLpRI=; b=UMrNc6uongMKwkR7EBWWUyW2sv9DYeZI2LlMRuIvDiJfETgZS2Pdxu4fI/3n8wi9Ca FFVbpH+OXisq6tTvg2rxfNqU7ySbHmYAWx3HdSgrwUbaZ+SHnPSmaXRxAbSfhZkZiGr/ 0I64HhYNm3SimFGo0jfJ/ukbr9Umd1aOqGQ28gyJ1oi60JX+i563ohVVB6bYRyC0Zc8v DlHNPujYGrcKbqcayvekGZPsPb5BND8j51fMpzrhn7xED8SzuHawcawqN8lmXqZ7gyvJ Wz0WFjEP7HQRWB9pRJH0ESfN82NkZxOrugQNQEcJS7dE4Wuo9BBHBygtZX1D46VVGLXo w/wA== X-Gm-Message-State: AKS2vOxulpqDeltrwrASdRC0PpX6P527hNiqzDWd3u9dnYWSSRvTTEth FIcpHPyZo0MeQzuq X-Received: by 10.98.152.25 with SMTP id q25mr7073482pfd.47.1498020421723; Tue, 20 Jun 2017 21:47:01 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id m132sm8280232pfc.76.2017.06.20.21.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 21:47:01 -0700 (PDT) From: Viresh Kumar To: Juri Lelli , Greg Kroah-Hartman Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux@arm.linux.org.uk, Will Deacon , Vincent Guittot , arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 3/5] arch_topology: Covert switch block to if block Date: Wed, 21 Jun 2017 10:16:42 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We only need to take care of one case here (CPUFREQ_NOTIFY) and there is no need to add an extra level of indentation to the case specific code by using a switch block. Use an if block instead. Also add some blank lines to make the code look better. Signed-off-by: Viresh Kumar --- drivers/base/arch_topology.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 2f1d9921ee54..07784ba666a7 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -173,26 +173,29 @@ init_cpu_capacity_callback(struct notifier_block *nb, if (cap_parsing_failed) return 0; - switch (val) { - case CPUFREQ_NOTIFY: - pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", - cpumask_pr_args(policy->related_cpus), - cpumask_pr_args(cpus_to_visit)); - cpumask_andnot(cpus_to_visit, cpus_to_visit, - policy->related_cpus); - for_each_cpu(cpu, policy->related_cpus) { - raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * - policy->cpuinfo.max_freq / 1000UL; - capacity_scale = max(raw_capacity[cpu], capacity_scale); - } - if (cpumask_empty(cpus_to_visit)) { - topology_normalize_cpu_scale(); - kfree(raw_capacity); - pr_debug("cpu_capacity: parsing done\n"); - cap_parsing_failed = true; - schedule_work(&parsing_done_work); - } + if (val != CPUFREQ_NOTIFY) + return 0; + + pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", + cpumask_pr_args(policy->related_cpus), + cpumask_pr_args(cpus_to_visit)); + + cpumask_andnot(cpus_to_visit, cpus_to_visit, policy->related_cpus); + + for_each_cpu(cpu, policy->related_cpus) { + raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * + policy->cpuinfo.max_freq / 1000UL; + capacity_scale = max(raw_capacity[cpu], capacity_scale); } + + if (cpumask_empty(cpus_to_visit)) { + topology_normalize_cpu_scale(); + kfree(raw_capacity); + pr_debug("cpu_capacity: parsing done\n"); + cap_parsing_failed = true; + schedule_work(&parsing_done_work); + } + return 0; } From patchwork Wed Jun 21 04:46:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106038 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1744161qgd; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) X-Received: by 10.99.39.194 with SMTP id n185mr35231811pgn.94.1498020441845; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498020441; cv=none; d=google.com; s=arc-20160816; b=i0e3VE0l8BJ5STn4BzY5KIznsLC2rkQu1xu+UJRoYbD8uypIAmtbAMAABiV4XEiwNA F/4aH7qWF6AzI77/5JvE2Gw2+YtfnqgOD2JWTSiIRk2vquBwiuYDLe3rpf8GShDEmlOt KGvdExrjSPicsOwaLPJkWND56xv3WZodt20XdoCeib9KqxehvJu5C9SY5iFubss8LSPx 5oqmGne60zBWFMzmZ/KrRrXOC3cy7BLujrs4NUeC396n8+97lJL7++SKiukxPyXwYDSU x8Fh43vaPccHyJ1x1mofaAz2P/tUwNTtMUwJvEiSusOfQK8QDG0FlEds1TeVblcQA9cp CK6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=c73WRyTByEI4Lk3G49BUjur3bjy6NdqEXRm+0XxIM78=; b=Qx6gSMwQLJQLYiRHRFotMHi65NctT9OUGSXrOKoHr2hR+bvikT7kEJS4J+lCfOQunA 7SqEVUUnQyy2WrxRagcngjxOmiHJhhyf1HHesO3HwNC8ySG3sbfTpgApamggoh++0LHB KbGpEm9Oqhj87iZEXGF/kCdQfjvQk1SzlVvw4MGf+YEHbuTDmK2jQvgstfWc/HvCliV6 p0UzmpNC9Q9mih/ensoK0w6qSzFprnRr9tMVEELLJeUE9t4r2Zjdu9lS9R13KsAQ2G9O a0Q9NbwUMNQcOk9RQK67iv2Pj20cI26dIs3dIcO5d4ob3DdwCh4Uq5b8HZYGXK9kbdyS 3Jpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=BfRW8W1O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si12534085pgk.501.2017.06.20.21.47.21; Tue, 20 Jun 2017 21:47:21 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=BfRW8W1O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094AbdFUErS (ORCPT + 25 others); Wed, 21 Jun 2017 00:47:18 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34846 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753039AbdFUErP (ORCPT ); Wed, 21 Jun 2017 00:47:15 -0400 Received: by mail-pf0-f169.google.com with SMTP id c73so19479433pfk.2 for ; Tue, 20 Jun 2017 21:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=c73WRyTByEI4Lk3G49BUjur3bjy6NdqEXRm+0XxIM78=; b=BfRW8W1O4JZDVJIntgkb8Pk2azkzBHqOOonkZaqd9jRD2ov3KpJkZJlyK+vpz5J/EN AkmE45ImFB/Le5sjVBkM6CEJQq0l0hovenShe0++C/Hr2K4VotKUJZoS09aHZ3pJZbnY FtQ/JHU2Rgwsm2utKYguQAoR6uA+7iVpKEBsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=c73WRyTByEI4Lk3G49BUjur3bjy6NdqEXRm+0XxIM78=; b=unPxPGO0lxiM7ke1FQHbgSgy/9/axlFvsbhqM8RdvZZz+Mx3ffUUtMlOTviOkDxp6l +XseBrwZZSmHqn3wn3C/fokIee3EdPYIESL/unRlS+07DI0x8oPe7r6hv4NmkatYBK5d fFN0XMxakq9EI11uQs/+SVqXwsGK//xYHez1jiy+A612SsWzvLXO0VwtcE705wU2aOwp /aeN0v/KV5CzjNbnlqkH2lGT92xufqZ2AqL2dy1GfVH7ngZ1di4SfkxnWyKzEc/wpcxj RqfFBmQEren8kvVQ7efSydAghGUkOLctbC7GXyZ+JvT+k1A+Bb0/PZEHhdUnmFZ3Dgdr gkVg== X-Gm-Message-State: AKS2vOy2oUmD2K2RurxOX7mX2T5tnSs3bkyzNe6P2zTWV9Xw3bR22ENv dD40CgKXaUdODaGt X-Received: by 10.98.80.140 with SMTP id g12mr34874566pfj.146.1498020424773; Tue, 20 Jun 2017 21:47:04 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id m73sm27369304pfi.12.2017.06.20.21.47.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 21:47:04 -0700 (PDT) From: Viresh Kumar To: Juri Lelli , Greg Kroah-Hartman Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux@arm.linux.org.uk, Will Deacon , Vincent Guittot , arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/5] arch_topology: Return 0 or -ve errors from topology_parse_cpu_capacity() Date: Wed, 21 Jun 2017 10:16:43 +0530 Message-Id: <2213a1f0657ef057dd775085943b362dc3e9757d.1498019799.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the standard way of returning errors instead of returning 0(failure) OR 1(success) and making it hard to read. Signed-off-by: Viresh Kumar --- arch/arm/kernel/topology.c | 2 +- drivers/base/arch_topology.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index bf949a763dbe..a7ef4c35855e 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -111,7 +111,7 @@ static void __init parse_dt_topology(void) continue; } - if (topology_parse_cpu_capacity(cn, cpu)) { + if (!topology_parse_cpu_capacity(cn, cpu)) { of_node_put(cn); continue; } diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 07784ba666a7..ff8713b83090 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -121,11 +121,11 @@ void topology_normalize_cpu_scale(void) int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) { - int ret = 1; + int ret; u32 cpu_capacity; if (cap_parsing_failed) - return !ret; + return -EINVAL; ret = of_property_read_u32(cpu_node, "capacity-dmips-mhz", &cpu_capacity); @@ -137,7 +137,7 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) if (!raw_capacity) { pr_err("cpu_capacity: failed to allocate memory for raw capacities\n"); cap_parsing_failed = true; - return 0; + return -ENOMEM; } } capacity_scale = max(cpu_capacity, capacity_scale); @@ -154,7 +154,7 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) kfree(raw_capacity); } - return !ret; + return ret; } #ifdef CONFIG_CPU_FREQ From patchwork Wed Jun 21 04:46:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106037 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1744156qgd; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) X-Received: by 10.101.85.199 with SMTP id k7mr35694089pgs.172.1498020441451; Tue, 20 Jun 2017 21:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498020441; cv=none; d=google.com; s=arc-20160816; b=b2zeeOixkcDzyRib6VscDZzn8n5rJBCbZ7GEEQ/GWN348D6ttTBIy5VlV5rtMI1W6Y kKl/0Z0wVETmgwXBD8+23DwQ0gyx6argY0rK0D71ihWl9K/KO5Fi3h+ipyRaREOKmKZu j2sq3OTU8BoZYFxBEGcXELp/D+zLU3m+z9dSU4519sV5f5iPv2+8O151JTmvvR+JX+cg 0TmjsmFH3msMoRRt6WSWSqiS0O+sETIFrbYDfVAiZkQ6/tr83auEDSO/KuFByk5GTM/z w3fMb9gYJLcuxEwn72mUYQuY2crt+hBy05NWKZ6zq9aMxkdPTfsCIhh9unUONmg3hp/R QVxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=miVYgfFmF0t57Jw1a+CkapQkG1UMfTn9mvAECtEECAI=; b=brleEQPFhFddIYOR/+BAbmmYpUhjtbHgB6KLib14P6G8m9XzRgXx3sC39cf6uYBEm7 b7zsZkQNcLxHQ/PVY6X+ws43udN/neE0eECzSNk8yEf7rf4lnBIWddpnHdDlXFGbKZVx 5Kuu6fdXb2nCRCxlY4mza5cHA3cMKoG5u3+ZpLOEtyVk9IXbFX+YMsAjt5YdP5t2rxY8 sAthYQ5cQc+OYxbKXOooB8f140m+M90NFxL1FTTIOQqy21xcy3JBDbh26GIlNOKP+3CE mzMsgGf80Pdq0HYlimMCeQyY16vee1U1ckjYcDA5N74LXhJEToz402HPFws5RB8kWR4I 68QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=KCgXGlrF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si12534085pgk.501.2017.06.20.21.47.21; Tue, 20 Jun 2017 21:47:21 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=KCgXGlrF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753033AbdFUErL (ORCPT + 25 others); Wed, 21 Jun 2017 00:47:11 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34794 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752917AbdFUErI (ORCPT ); Wed, 21 Jun 2017 00:47:08 -0400 Received: by mail-pf0-f169.google.com with SMTP id s66so79587880pfs.1 for ; Tue, 20 Jun 2017 21:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=miVYgfFmF0t57Jw1a+CkapQkG1UMfTn9mvAECtEECAI=; b=KCgXGlrFiMbXu1QHf8NvYV5JTufTnR+vCZDh+txiVvEfaGz9GEDWs5SCsGG6UwP0VH OwijC8CPfS21l9mE1cbR+2ldPUnO/8DoCmdZlppLR/mHpd7oQVj+jIpvIJdcrByoZ+AG R7zNMP7mD7c80A+FivINJyq5bhzejOtemHStY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=miVYgfFmF0t57Jw1a+CkapQkG1UMfTn9mvAECtEECAI=; b=Am6KcPma0of7s/vT0kutKkRizMxnNKrDpWr4Qk9MJc+PI/opAAtxMqZ+yfmPRncmQo 6sDp56EzDS8eoJnwEMRk5dtdFmFP1oXEPucXl7eY9qIhH77JRYSFGPfKGKNHLRnBLq/B IW8PmQbsZoj8gzwE0yjqkSPusxuAq//Dlsf6QSYPKWI8XFAShNnTswQC9hciDuTxzsNO Srr/2UIpZrgTdC+NDwPTgy3emFp14awBOzIaVM+0ENPAXBQ44NwBZcrcNFJtcKvRKWCC aIYuTcyV6RY8tvBqj+q5vpqpZGCZhIsqUYhiYuUC6h5UmWuB0o7dVRdQ6o63sc4DYPSF MsgA== X-Gm-Message-State: AKS2vOwhRtFjRXHAkI9emRWy8nnr+Gps0nxi7B8GzZtpt5Lea6TtfLAE 6OM845ZP+BZTisA1 X-Received: by 10.84.224.206 with SMTP id k14mr10073740pln.72.1498020427847; Tue, 20 Jun 2017 21:47:07 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id 66sm35409662pgh.59.2017.06.20.21.47.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 21:47:07 -0700 (PDT) From: Viresh Kumar To: Juri Lelli , Greg Kroah-Hartman Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux@arm.linux.org.uk, Will Deacon , Vincent Guittot , arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 5/5] arch_topology: Localize cap_parsing_failed to topology_parse_cpu_capacity() Date: Wed, 21 Jun 2017 10:16:44 +0530 Message-Id: <49121c2925a65bc5a0f2be2542abf9a4be9becef.1498019799.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cap_parsing_failed is only required in topology_parse_cpu_capacity() to know if we have already tried to allocate raw_capacity and failed, or if at least one of the cpu_node didn't had the required "capacity-dmips-mhz" property. All other users can use raw_capacity instead of cap_parsing_failed. Make sure we set raw_capacity to NULL after we free it. Signed-off-by: Viresh Kumar --- drivers/base/arch_topology.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index ff8713b83090..d8923f89724f 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -95,14 +95,21 @@ subsys_initcall(register_cpu_capacity_sysctl); static u32 capacity_scale; static u32 *raw_capacity; -static bool cap_parsing_failed; + +static int __init free_raw_capacity(void) +{ + kfree(raw_capacity); + raw_capacity = NULL; + + return 0; +} void topology_normalize_cpu_scale(void) { u64 capacity; int cpu; - if (!raw_capacity || cap_parsing_failed) + if (!raw_capacity) return; pr_debug("cpu_capacity: capacity_scale=%u\n", capacity_scale); @@ -121,6 +128,7 @@ void topology_normalize_cpu_scale(void) int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) { + static bool cap_parsing_failed; int ret; u32 cpu_capacity; @@ -151,7 +159,7 @@ int __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) pr_err("cpu_capacity: partial information: fallback to 1024 for all CPUs\n"); } cap_parsing_failed = true; - kfree(raw_capacity); + free_raw_capacity(); } return ret; @@ -170,7 +178,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, struct cpufreq_policy *policy = data; int cpu; - if (cap_parsing_failed) + if (!raw_capacity) return 0; if (val != CPUFREQ_NOTIFY) @@ -190,9 +198,8 @@ init_cpu_capacity_callback(struct notifier_block *nb, if (cpumask_empty(cpus_to_visit)) { topology_normalize_cpu_scale(); - kfree(raw_capacity); + free_raw_capacity(); pr_debug("cpu_capacity: parsing done\n"); - cap_parsing_failed = true; schedule_work(&parsing_done_work); } @@ -232,11 +239,5 @@ static void parsing_done_workfn(struct work_struct *work) } #else -static int __init free_raw_capacity(void) -{ - kfree(raw_capacity); - - return 0; -} core_initcall(free_raw_capacity); #endif