Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758433AbcCVIjg (ORCPT ); Tue, 22 Mar 2016 04:39:36 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:9899 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1758287AbcCVIjW (ORCPT ); Tue, 22 Mar 2016 04:39:22 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4840130" From: Zhao Lei To: , Tejun Heo , Peter Zijlstra CC: Yang Dongsheng , Zhao Lei Subject: [PATCH v4 1/4] cpuacct: rename parameter in cpuusage_write for readability Date: Tue, 22 Mar 2016 16:37:05 +0800 Message-ID: <778412ba2feaa95bb0f1663bc139e3a8829d729d.1458635566.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-yoursite-MailScanner-ID: 9BD0A408D262.A6988 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhaolei@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1114 Lines: 43 From: Yang Dongsheng The name of 'reset' makes a little confusion in reading, we would say, if we want to reset usage, return -EINVAL. That's not true. Actually, we want to say, we only allow user to do a reset. This patch rename reset to val and add a comment here, making the code more readable. From: Dongsheng Yang Acked-by: Tejun Heo Signed-off-by: Zhao Lei --- kernel/sched/cpuacct.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index dd7cbb5..9c2bbf7 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -145,13 +145,16 @@ static u64 cpuusage_read(struct cgroup_subsys_state *css, struct cftype *cft) } static int cpuusage_write(struct cgroup_subsys_state *css, struct cftype *cft, - u64 reset) + u64 val) { struct cpuacct *ca = css_ca(css); int err = 0; int i; - if (reset) { + /* + * Only allow '0' here to do a reset. + */ + if (val) { err = -EINVAL; goto out; } -- 1.8.5.1