From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933098AbbLOCdB (ORCPT ); Mon, 14 Dec 2015 21:33:01 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:12224 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753724AbbLOCdA (ORCPT ); Mon, 14 Dec 2015 21:33:00 -0500 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="1578736" From: Dongsheng Yang To: , CC: , Dongsheng Yang Subject: [PATCH 1/2] cpuacct: rename parameter in cpuusage_write for readability Date: Tue, 15 Dec 2015 10:25:13 +0800 Message-ID: <1450146314-4818-1-git-send-email-yangds.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.4.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.66] X-yoursite-MailScanner-Information: Please contact the ISP for more information X-yoursite-MailScanner-ID: 785BB4066D1A.A2450 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangds.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Dongsheng Yang --- 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.4.2