From patchwork Mon Nov 21 17:12:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Gondois X-Patchwork-Id: 23960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1719239wrr; Mon, 21 Nov 2022 09:16:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf6QUIATrr+UnUcehWXu7dGP8WnTTK+Pm0U9AHffQksaOSO25MWWCZ6OJZJI8O9n9tnzS8uw X-Received: by 2002:a05:6402:5021:b0:460:5340:d522 with SMTP id p33-20020a056402502100b004605340d522mr6364587eda.87.1669050977265; Mon, 21 Nov 2022 09:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669050977; cv=none; d=google.com; s=arc-20160816; b=kMIlW2hHhD4ko1YyJTQ0O/uEEohe2RFAEbz7VVbIwuFkOrfjn55tAFnLaNrWgUS/A2 E50UXC4VTzpor59ANKgLsO6Ja6b2dTyg7EJ1PyaPFudzaUWdzCh2yUtEzoiTyneIwIEv PxPcN45/C47y+f5eGJ8bvJQpus0XvP4/J4C6RcodFVeKWRKTYPAa/y80BDIc1CBiflH4 Pn3OPo1zuhz7WFYEF6DUWMGoCe4Dac6bpPDetth10wh52zPJpOO6MtZt5yykMGIHXrTz 9eudKR51cxyV+y7GXhiY47OjiNulnYFhk6tS7DWiPwjLp3LkMzQmNVdoN0JZi7gDJaY3 bf6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r9jrTs87DEpDTyggfJ1mrACzlURd67TKKBH9SB5zWz8=; b=Id8T2lduM47fvjcRacYOgNOokR+Luz8rEDGVzsugCxUrhX+kLzOZkz3GUwxyxWx34w GDH28hfwxvgFUxbUNm9bHXxPJxqneMueAQBmOk+6flcpgsyNfPshJ2i8nxerrB6YXV2f Kro3eWdRDAXnyqzulJg904eV4S4NAax9PckpykvPOMTF+iS/shj8JinFpdrPeX+bAqOv g8OvYD93e4vTsfZD2EnQjiH3ZFPFtVn/qingNUWQOTh40G688u8BM5KUQUsLehH6ugUl Qlbjk/0KZRgBpmTIKyc6Afe6MqPlXHEMI30Wi5UIcbuDOpsWHxhHAtcYX7k/0H8Jau0k 0bjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a170906974f00b00782a5657512si10658076ejy.416.2022.11.21.09.15.49; Mon, 21 Nov 2022 09:16:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbiKURP1 (ORCPT + 99 others); Mon, 21 Nov 2022 12:15:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbiKUROy (ORCPT ); Mon, 21 Nov 2022 12:14:54 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6AA63D5A24; Mon, 21 Nov 2022 09:13:16 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EDA7D1FB; Mon, 21 Nov 2022 09:13:17 -0800 (PST) Received: from pierre123.arm.com (unknown [10.57.7.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A8B753F587; Mon, 21 Nov 2022 09:13:06 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Ionela.Voinescu@arm.com, Rob.Herring@arm.com, Pierre Gondois , Sudeep Holla , Jeremy Linton , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Conor Dooley , Gavin Shan , SeongJae Park , Peter Chen , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v2 3/5] ACPI: PPTT: Remove acpi_find_cache_levels() Date: Mon, 21 Nov 2022 18:12:11 +0100 Message-Id: <20221121171217.3581004-4-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221121171217.3581004-1-pierre.gondois@arm.com> References: <20221121171217.3581004-1-pierre.gondois@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750126797198883196?= X-GMAIL-MSGID: =?utf-8?q?1750126797198883196?= acpi_find_cache_levels() is used at a single place and is short enough to be merged into the calling function. The removal allows an easier renaming of the calling function in the next patch. Also reorder the local variables in the 'reversed Christmas tree' order. Signed-off-by: Pierre Gondois Reviewed-by: Sudeep Holla Reviewed-by: Jeremy Linton --- drivers/acpi/pptt.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index c91342dcbcd6..97c1d33822d1 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -281,19 +281,6 @@ static struct acpi_pptt_processor *acpi_find_processor_node(struct acpi_table_he return NULL; } -static int acpi_find_cache_levels(struct acpi_table_header *table_hdr, - u32 acpi_cpu_id) -{ - int number_of_levels = 0; - struct acpi_pptt_processor *cpu; - - cpu = acpi_find_processor_node(table_hdr, acpi_cpu_id); - if (cpu) - number_of_levels = acpi_count_levels(table_hdr, cpu); - - return number_of_levels; -} - static u8 acpi_cache_type(enum cache_type type) { switch (type) { @@ -613,9 +600,10 @@ static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) */ int acpi_find_last_cache_level(unsigned int cpu) { - u32 acpi_cpu_id; + struct acpi_pptt_processor *cpu_node; struct acpi_table_header *table; int number_of_levels = 0; + u32 acpi_cpu_id; table = acpi_get_pptt(); if (!table) @@ -624,7 +612,10 @@ int acpi_find_last_cache_level(unsigned int cpu) pr_debug("Cache Setup find last level CPU=%d\n", cpu); acpi_cpu_id = get_acpi_id_for_cpu(cpu); - number_of_levels = acpi_find_cache_levels(table, acpi_cpu_id); + cpu_node = acpi_find_processor_node(table, acpi_cpu_id); + if (cpu_node) + number_of_levels = acpi_count_levels(table, cpu_node); + pr_debug("Cache Setup find last level level=%d\n", number_of_levels); return number_of_levels;