From patchwork Wed Aug 21 08:46:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 19363 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2145248E6 for ; Wed, 21 Aug 2013 08:53:08 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id z20sf117804yhz.1 for ; Wed, 21 Aug 2013 01:53:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=JXWNANpqldLw2ZWYbxCCMWs0Z+C2CokrtX+Q44uHErc=; b=RaiwtH5Y7eL3l2+iNNPyS3Id2x3aY9cOfsKqVp+BVIQpZXRtdBhDm1EO5gGWs2TL8A 9NEGqUcB08we4iExMEWtxYMjSyyCJJDavgX94Dvp+ET4Ah+CWGoRlBLPxUyWaY0Q/hyy n8HwAYwrWjzNT7aRI3hU/xn2bGQyALgPcPP+bxebuPfV7i9WVAY3+jI1dfgsUxaI+8x2 teWv7qXwAA3d/8SE/KeO4WfKF2EofKilQkmYHVtWp5ytMaRBAbHC2eF20V5pLoXSC6yV WUZM2WsBb2iMkpYkU1c98t5biE1tFCPS9/GiMjcuNswYupOH9FjSI53O4ErktTqt2D+z hO7A== X-Received: by 10.236.132.163 with SMTP id o23mr2324116yhi.31.1377075188581; Wed, 21 Aug 2013 01:53:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.102 with SMTP id 6ls554754qed.34.gmail; Wed, 21 Aug 2013 01:53:08 -0700 (PDT) X-Received: by 10.58.208.130 with SMTP id me2mr5450521vec.13.1377075188475; Wed, 21 Aug 2013 01:53:08 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id f10si1806569vck.20.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 01:53:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hf12so90377vcb.41 for ; Wed, 21 Aug 2013 01:53:08 -0700 (PDT) X-Gm-Message-State: ALoCoQmpz9AjaDP6n2Vub+Cnv/miZ2TUdlrUrNMMEEutRQT0kwmZwhRVgSW7alDX/pKh7/9FWMBG X-Received: by 10.52.180.229 with SMTP id dr5mr4575737vdc.20.1377075188367; Wed, 21 Aug 2013 01:53:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp207050vcz; Wed, 21 Aug 2013 01:53:07 -0700 (PDT) X-Received: by 10.66.228.38 with SMTP id sf6mr8561993pac.21.1377075187448; Wed, 21 Aug 2013 01:53:07 -0700 (PDT) Received: from hanjun-Latitude-D630 ([218.17.215.175]) by mx.google.com with ESMTPS id yt8si408138pab.148.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 01:53:07 -0700 (PDT) Received-SPF: neutral (google.com: 218.17.215.175 is neither permitted nor denied by best guess record for domain of hanjun@hanjun-latitude-d630) client-ip=218.17.215.175; Received: from hanjun-Latitude-D630 (localhost [127.0.0.1]) by hanjun-Latitude-D630 (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id r7L8nxer010690; Wed, 21 Aug 2013 16:49:59 +0800 Received: (from hanjun@localhost) by hanjun-Latitude-D630 (8.14.4/8.14.4/Submit) id r7L8nwTZ010689; Wed, 21 Aug 2013 16:49:58 +0800 From: Hanjun Guo To: "Rafael J. Wysocki" , Thomas Gleixner Cc: Ingo Molnar , x86@kernel.org, linux-pm@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH 3/3] x86 / ACPI: introduce a helper function acpi_parse_madt_lapic_addr_ovr() Date: Wed, 21 Aug 2013 16:46:17 +0800 Message-Id: <1377074777-10639-3-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1377074777-10639-1-git-send-email-hanjun.guo@linaro.org> References: <1377074777-10639-1-git-send-email-hanjun.guo@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , No functional change. There are some copy code both in function early_acpi_parse_madt_lapic_addr_ovr() and acpi_parse_madt_lapic_entries(), introduce a helper function and use it to simplify the code. Signed-off-by: Hanjun Guo --- arch/x86/kernel/acpi/boot.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index eb1d67d..743d1c51 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -865,12 +865,7 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table) } #ifdef CONFIG_X86_LOCAL_APIC -/* - * Parse LAPIC entries in MADT - * returns 0 on success, < 0 on error - */ - -static int __init early_acpi_parse_madt_lapic_addr_ovr(void) +static int __init acpi_parse_madt_lapic_addr_ovr(void) { int count; @@ -896,29 +891,23 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void) return count; } +static int __init early_acpi_parse_madt_lapic_addr_ovr(void) +{ + return acpi_parse_madt_lapic_addr_ovr(); +} + +/* + * Parse LAPIC entries in MADT + * returns 0 on success, < 0 on error + */ static int __init acpi_parse_madt_lapic_entries(void) { int count; int x2count = 0; - if (!cpu_has_apic) - return -ENODEV; - - /* - * Note that the LAPIC address is obtained from the MADT (32-bit value) - * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). - */ - - count = - acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, - acpi_parse_lapic_addr_ovr, 0); - if (count < 0) { - printk(KERN_ERR PREFIX - "Error parsing LAPIC address override entry\n"); + count = acpi_parse_madt_lapic_addr_ovr(); + if (count < 0) return count; - } - - register_lapic_address(acpi_lapic_addr); count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, acpi_parse_sapic, MAX_LOCAL_APIC);