Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13623716rwl; Wed, 4 Jan 2023 10:35:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXuqnkKNqr03IP0F5rn8JpgkB4tX4ruqoy2XxQ8ZLJBmrXCzlozrTo5P85h0tTU5CDTxNrxN X-Received: by 2002:a17:907:8748:b0:7c1:ad6:7331 with SMTP id qo8-20020a170907874800b007c10ad67331mr46578778ejc.27.1672857320820; Wed, 04 Jan 2023 10:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672857320; cv=none; d=google.com; s=arc-20160816; b=uX6MXtLdBns9aOxhcYkR/a5XFMH1qZkpeCe2q5dPOad3BALMhkn+hn7uD3LvPWxh4Q PoK5UMKwNXbycQLt/Tr1JOySaBOZdmeG6ghu1/wu4XXR/ufq3hiuE9ZGpxbnUhm9snO9 zV1pvwtaSUhT/3FWesuv6f9SeUu6TeYwLwJnmg2aqyJk4nF+tXSqQAKfdy0oWZk6jGOH pQ3mBvtSb9PzcJc4tMNhEKhxoZ8Skwl+vIJPcsFIm5JjCziR0q5ittMRwTfYS5PjbY05 gocqlteFQoCdAGLXq79NXN8m2EL0GSX4XFpXfj3v3w2Ndxa0vYqpVfZq+1/WAwS7bPKY vFnQ== 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=9gDHa7xlaiZpWN9P8dt+/FadlQqTc7UcFYeHedf+gyI=; b=0fjSjhH8JCvZF6YSuPKcoyO1cMM974yFh78M2Sx+w9VtahKHKExtrsIt5fByO2ccBZ H8Ca7QAmGZAlLR7PeKY8+w49580utami2m6HmwLQ9BYBc8oMeqGt3u2uZX79rWjD/1Ep sfQCqfgsHcvV/lkj/nhMVwksB+msUPAmhya7YUpy25SIhc8OXnpZCLtbHIpgBzbacKte f4JGx1PoaR+9+qmjaX0rQaxyAKOAX2DY8sfHn3+Pmq3JIod/ClFtvCFdTmTJLAMy9w+2 v32FREW4/LVqFYsLHXtvoevvgV+7p6yvtRotHUMYHECThHZ4kI3h9uUhfodB2ZjJpAQ/ d0+Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a170906975600b007c4f75345e1si33038136ejy.443.2023.01.04.10.35.06; Wed, 04 Jan 2023 10:35:20 -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 S239949AbjADScX (ORCPT + 56 others); Wed, 4 Jan 2023 13:32:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239938AbjADSbs (ORCPT ); Wed, 4 Jan 2023 13:31:48 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DCBF6D2D5; Wed, 4 Jan 2023 10:31:46 -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 5D2281063; Wed, 4 Jan 2023 10:32:28 -0800 (PST) Received: from pierre123.arm.com (unknown [10.57.44.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9E47F3F663; Wed, 4 Jan 2023 10:31:42 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Sudeep Holla , Jeremy Linton , "Rafael J . Wysocki" , Palmer Dabbelt , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Conor Dooley , Gavin Shan , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 4/6] ACPI: PPTT: Remove acpi_find_cache_levels() Date: Wed, 4 Jan 2023 19:30:27 +0100 Message-Id: <20230104183033.755668-5-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230104183033.755668-1-pierre.gondois@arm.com> References: <20230104183033.755668-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 Acked-by: Rafael J. Wysocki Acked-by: Palmer Dabbelt --- 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; -- 2.25.1