From patchwork Tue Nov 8 11:04:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Gondois X-Patchwork-Id: 16987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2633282wru; Tue, 8 Nov 2022 03:07:44 -0800 (PST) X-Google-Smtp-Source: AMsMyM6U4C3vfOe5xmeM2csihncI9GSi9lUyXaPr/242xAn0llF4gt00xlBVoISrqy+lt23kMKCA X-Received: by 2002:a17:907:d04:b0:76e:e208:27ba with SMTP id gn4-20020a1709070d0400b0076ee20827bamr53556259ejc.652.1667905664388; Tue, 08 Nov 2022 03:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667905664; cv=none; d=google.com; s=arc-20160816; b=gVB3Npfhqpk5ThFTe7YMB1TKpBEreGrautHe5ys65ujei+2+U1pH0RyvrpIqwKzwGK RB5rTg6F4fC7Glai3EpCqZRM7sSmvukqtLFXj3s0/p/i5zIHzCLk0jHmqQY4bZezxUS5 F3pilfxNlzvCwTcjm4k+CjDHvpebW6GeAtZSz8XFLOnqHW+B9cbsF8SPJ3SVnlbkORmN s2Dqu0ixt16n3IKLLmRCH1Vxx3P55jxlu28X3T4hepq9tj0PhXCnxyL4ka5+0vlS8GW6 fyEyKOJ1IiXah7Fiwc1YY1GoQwveAv5HtuAnO0d8pX3cjskmnxvEFb6i1tpCpyEUP81f H8ig== 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=lP4ElUpvNxlp/qBhz/XlNpxalkSifb9PBGa0VefAixE=; b=seoQ9AGSmHoU8LgfxwURDwDT0bejmroz6LOtGhZmj96GdCm0h+BO8GrvVMqhW9Cewh Vtwh+IVwZcZJJLwX05b9rXksMPiz9AaLTuA3q/yZrZ5U8JDHMs0GS7hCCTX18J9sS4x9 RKNb0Hn0Y0m7VG9uNGpJYdBRPFYHDzNeYk3gREh2OzondQ2A0+SNbtDLh6IIZUUDvJ/Q ZWnAr2gpiIlbOy5YJcD8YuLlrxFb+1mLtPWxfGFEusB6obh4B4s3Jo7olHbOpQD/MXZV YAzTIcXgTb/5JDtrrKhSnPQ6JDexSpEYDAFzjHfqv0zgr164m7VcOnYBOyKEXyLMNjgh MMCQ== 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 o10-20020a170906600a00b00781c1645926si8699956ejj.524.2022.11.08.03.07.19; Tue, 08 Nov 2022 03:07:44 -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 S233997AbiKHLGl (ORCPT + 99 others); Tue, 8 Nov 2022 06:06:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbiKHLGY (ORCPT ); Tue, 8 Nov 2022 06:06:24 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F236D47323; Tue, 8 Nov 2022 03:06:20 -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 77B41113E; Tue, 8 Nov 2022 03:06:26 -0800 (PST) Received: from pierre123.arm.com (unknown [10.57.5.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9FE8E3F534; Tue, 8 Nov 2022 03:06:17 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , Greg Kroah-Hartman , Gavin Shan , Peter Chen , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH 3/5] ACPI: PPTT: Remove acpi_find_cache_levels() Date: Tue, 8 Nov 2022 12:04:19 +0100 Message-Id: <20221108110424.166896-4-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221108110424.166896-1-pierre.gondois@arm.com> References: <20221108110424.166896-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?1748925849760564779?= X-GMAIL-MSGID: =?utf-8?q?1748925849760564779?= 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 parameters 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;