From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751107AbdAWJJB (ORCPT ); Mon, 23 Jan 2017 04:09:01 -0500 Received: from terminus.zytor.com ([65.50.211.136]:34378 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbdAWJI7 (ORCPT ); Mon, 23 Jan 2017 04:08:59 -0500 Date: Mon, 23 Jan 2017 01:08:50 -0800 From: tip-bot for Borislav Petkov Message-ID: Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, bp@suse.de, hpa@zytor.com Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, bp@suse.de In-Reply-To: <20170120202955.4091-5-bp@alien8.de> References: <20170120202955.4091-5-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mce] x86/microcode/AMD: Clean up find_equiv_id() Git-Commit-ID: 1f02ac0682055418753fe30e6433dcb11fd03e1c 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1f02ac0682055418753fe30e6433dcb11fd03e1c Gitweb: http://git.kernel.org/tip/1f02ac0682055418753fe30e6433dcb11fd03e1c Author: Borislav Petkov AuthorDate: Fri, 20 Jan 2017 21:29:43 +0100 Committer: Thomas Gleixner CommitDate: Mon, 23 Jan 2017 10:02:46 +0100 x86/microcode/AMD: Clean up find_equiv_id() No need to have it marked "inline" - let gcc decide. Also, shorten the argument name and simplify while-test. While at it, make it into a proper for-loop and simplify it even more, as tglx suggests. No functionality change. Signed-off-by: Borislav Petkov Link: http://lkml.kernel.org/r/20170120202955.4091-5-bp@alien8.de Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/microcode/amd.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 6a31e26..5c1509a3 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -97,20 +97,13 @@ static size_t compute_container_size(u8 *data, u32 total_size) return size; } -static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table, - unsigned int sig) +static u16 find_equiv_id(struct equiv_cpu_entry *equiv_table, u32 sig) { - int i = 0; - - if (!equiv_cpu_table) - return 0; - - while (equiv_cpu_table[i].installed_cpu != 0) { - if (sig == equiv_cpu_table[i].installed_cpu) - return equiv_cpu_table[i].equiv_cpu; - - i++; + for (; equiv_table && equiv_table->installed_cpu; equiv_table++) { + if (sig == equiv_table->installed_cpu) + return equiv_table->equiv_cpu; } + return 0; }