Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3355270ybd; Tue, 25 Jun 2019 00:52:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2QAbN1CLx07ay2WnYk/fa0C+MQSGOXnt4Wbi5ohfOzMuGHC+GENvJO8HALziz1F6a+Y72 X-Received: by 2002:a17:90a:28e4:: with SMTP id f91mr29301671pjd.99.1561449166056; Tue, 25 Jun 2019 00:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561449166; cv=none; d=google.com; s=arc-20160816; b=Z25uUys4azGjlFxEZFl06dNFr7xMZxxZq4H9tEpODkvcHleaIelRHuixD8IyFmSw1y CPYR08cFoRkhZZYbhC1BzIiUVRP06Mk6oPrekIt0Typ2TaWLJS5EaecKVfl6yxOQ5VfA TD74r1/Pwrx/dFzrTMXOl3OvOVAJfgUS0XQbasGSQyLzR9ZBh5hzTwjvEZ9iAGJUCL6j pcGTejdeEBfC2Dyr5DQz63vQUFOyYsZrF8q+MabQj8PD/I52VddI4zqseBatbRC+kZ5V 9ny2IP//qCypUWTd9f4B29JhMhor2qZ0VqAS0Cz/Sm9JEzVQCCHOwLgUw22cWc/lau8T Suwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=qsRzFhXGzqGyiZcGkpMIJ06dTufLonxZWOOU0344IVE=; b=NPMNNkipG9cZWbnXdzaUgguhMMxX0e7Ba1UEcQIHtCZupqdlXaN8G/QYvmKnmQmtcd 8LrskRRSXC3Kodw7vuK7A32u3J3WuEZNz1RNgksn2zUvPH0UQYvw4lJ+piyQjNUOqmX/ UVSEdDafQrCrmOfR23g2+vS1MDszDw7DgDz9X9rB4uejKPIcpvk72FBqGkbZxg5HPTWq u/pL8dr6NER7j3OfOmp4BP3bg3dtBbTlPvaelz+H6HcptW0lG2o3ujhqMvt+S93fw6GA 9u5H97paxDTJ3X/0KiIN/vZAir0pHQZli/IvsP+JX+iAtJKPglo5E+JBcHBrAmhWXvoM K2zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=VSaRR2XF; 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=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc10si12004155plb.43.2019.06.25.00.52.30; Tue, 25 Jun 2019 00:52:46 -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=@zytor.com header.s=2019061801 header.b=VSaRR2XF; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730126AbfFYHbd (ORCPT + 99 others); Tue, 25 Jun 2019 03:31:33 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48533 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727311AbfFYHbc (ORCPT ); Tue, 25 Jun 2019 03:31:32 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5P7V4LS3509722 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 25 Jun 2019 00:31:04 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5P7V4LS3509722 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019061801; t=1561447864; bh=qsRzFhXGzqGyiZcGkpMIJ06dTufLonxZWOOU0344IVE=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=VSaRR2XFcCAowqHupC583ICXjmmSO6B6imnyFnFWIUxjwLeNSz9Ct3//v9LaT5CWg UaMjiL56S+OLpZwx0gCTmA2wK+VHOdnKDWAwEdrV82tiH22nyHcr12mteAkP007TiS 1z5dOQbeNb21182nOjHUAZ1tuLBywYj3K0GWINguRFkOfvESYysEI5k/S6bX3fwTzm cKVyr1sX0ds55cADl/Ipy/946w1Lh5L2b9nV6PqBBfXEtl0/nOTCxprq9opVATWfRY BFxmZAQu9oP5CZYp+cocsownVbq4+qg6bczNXgmlaa2XTbWrDA8nganFqSirsjExGN LAJjjWtkxj47w== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5P7V3mf3509719; Tue, 25 Jun 2019 00:31:03 -0700 Date: Tue, 25 Jun 2019 00:31:03 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Reinette Chatre Message-ID: Cc: hpa@zytor.com, bp@alien8.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, reinette.chatre@intel.com Reply-To: reinette.chatre@intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de, tglx@linutronix.de, hpa@zytor.com In-Reply-To: <15ba03856f1d944468ee6f44e3fd7aa548293ede.1561408280.git.reinette.chatre@intel.com> References: <15ba03856f1d944468ee6f44e3fd7aa548293ede.1561408280.git.reinette.chatre@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cache] x86/resctrl: Cleanup cbm_ensure_valid() Git-Commit-ID: 2ef085bd110c5723ca08a522608ac3468dc304bd X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2ef085bd110c5723ca08a522608ac3468dc304bd Gitweb: https://git.kernel.org/tip/2ef085bd110c5723ca08a522608ac3468dc304bd Author: Reinette Chatre AuthorDate: Mon, 24 Jun 2019 13:34:27 -0700 Committer: Thomas Gleixner CommitDate: Tue, 25 Jun 2019 09:26:11 +0200 x86/resctrl: Cleanup cbm_ensure_valid() A recent fix to the cbm_ensure_valid() function left some coding style issues that are now addressed: - Return a value instead of using a function parameter as input and output - Use if (!val) instead of if (val == 0) - Follow reverse fir tree ordering of variable declarations Suggested-by: Borislav Petkov Signed-off-by: Reinette Chatre Signed-off-by: Thomas Gleixner Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/15ba03856f1d944468ee6f44e3fd7aa548293ede.1561408280.git.reinette.chatre@intel.com --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 2f4824793798..bf3034994754 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2488,21 +2488,21 @@ out_destroy: * modification to the CBM if the default does not satisfy the * requirements. */ -static void cbm_ensure_valid(u32 *_val, struct rdt_resource *r) +static u32 cbm_ensure_valid(u32 _val, struct rdt_resource *r) { - unsigned long val = *_val; unsigned int cbm_len = r->cache.cbm_len; unsigned long first_bit, zero_bit; + unsigned long val = _val; - if (val == 0) - return; + if (!val) + return 0; first_bit = find_first_bit(&val, cbm_len); zero_bit = find_next_zero_bit(&val, cbm_len, first_bit); /* Clear any remaining bits to ensure contiguous region */ bitmap_clear(&val, zero_bit, cbm_len - zero_bit); - *_val = (u32)val; + return (u32)val; } /* @@ -2560,7 +2560,7 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct rdt_resource *r, * Force the initial CBM to be valid, user can * modify the CBM based on system availability. */ - cbm_ensure_valid(&d->new_ctrl, r); + d->new_ctrl = cbm_ensure_valid(d->new_ctrl, r); /* * Assign the u32 CBM to an unsigned long to ensure that * bitmap_weight() does not access out-of-bound memory.