From patchwork Mon Feb 22 19:11:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chiang X-Patchwork-Id: 81270 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1MJDYaR031179 for ; Mon, 22 Feb 2010 19:13:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754351Ab0BVTMj (ORCPT ); Mon, 22 Feb 2010 14:12:39 -0500 Received: from g4t0016.houston.hp.com ([15.201.24.19]:6790 "EHLO g4t0016.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754492Ab0BVTLz (ORCPT ); Mon, 22 Feb 2010 14:11:55 -0500 Received: from g4t0009.houston.hp.com (g4t0009.houston.hp.com [16.234.32.26]) by g4t0016.houston.hp.com (Postfix) with ESMTP id 793A414249; Mon, 22 Feb 2010 19:11:55 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g4t0009.houston.hp.com (Postfix) with ESMTP id 686D3C1C3; Mon, 22 Feb 2010 19:11:55 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 4AD00CF0047; Mon, 22 Feb 2010 12:11:55 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y2OuaAjQJeEs; Mon, 22 Feb 2010 12:11:55 -0700 (MST) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 36F00CF0040; Mon, 22 Feb 2010 12:11:55 -0700 (MST) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 29996261D1; Mon, 22 Feb 2010 12:11:55 -0700 (MST) Subject: [PATCH v2 10/12] ACPI: processor: refactor internal map_lsapic_id() To: lenb@kernel.org From: Alex Chiang Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Venkatesh Pallipadi Date: Mon, 22 Feb 2010 12:11:55 -0700 Message-ID: <20100222191155.19752.95091.stgit@bob.kio> In-Reply-To: <20100222190145.19752.20978.stgit@bob.kio> References: <20100222190145.19752.20978.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Feb 2010 19:13:36 +0000 (UTC) diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 18fa633..ee9bce1 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -83,27 +83,17 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, { struct acpi_madt_local_sapic *lsapic = (struct acpi_madt_local_sapic *)entry; - u32 tmp = (lsapic->id << 8) | lsapic->eid; - /* Only check enabled APICs*/ if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) return 0; - /* Device statement declaration type */ if (device_declaration) { - if (entry->length < 16) - printk(KERN_ERR PREFIX - "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n", - tmp); - else if (lsapic->uid == acpi_id) - goto found; - /* Processor statement declaration type */ - } else if (lsapic->processor_id == acpi_id) - goto found; + if ((entry->length < 16) || (lsapic->uid != acpi_id)) + return 0; + } else if (lsapic->processor_id != acpi_id) + return 0; - return 0; -found: - *apic_id = tmp; + *apic_id = (lsapic->id << 8) | lsapic->eid; return 1; }