From patchwork Tue May 5 02:46:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 48012 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED8F22121F for ; Tue, 5 May 2015 02:48:51 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf46788759lbb.3 for ; Mon, 04 May 2015 19:48:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=6vyo/HUqLUkiEwhonr2+YQafB5iEOYgZXc1falLH3no=; b=MdblObUA0bhUMl3Tq6dOrsXVdumEoeq2rj5k3NaLSGAdWAvjHm3c3gySsusz325lou elskpj1CFqKSEuTO8qg8jU5+SfHOz7TjP/hk1AiL4LEb8ztezJat0pEfwFLbOmLSMI36 Y2MYFf0cZ7hlA2OXmzUJ4AvQoCNUkleb/UeDxsnoM6YXGTTmKyXoS3agV0JFrnuozyra q+Kn0AwY3ZxIGwok6B9NFCQe9pDljp6kDmR8X1TqfrWZV+ubyA2l5FUqId+vaC6YG+xP IRdj6hgtOxR2gr3tnr1Cc0sISYPeVwafVs0BvEybiaUFGqVwUpcdGgIXX9mpczi+jicE pv8Q== X-Gm-Message-State: ALoCoQlD9s0fe5H69zSabdqMTtd1m7dTWuBWnpFUU+Mllp3R23afx6htapCw18Fu1b/+G/25tcOw X-Received: by 10.112.28.111 with SMTP id a15mr20537415lbh.21.1430794130872; Mon, 04 May 2015 19:48:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.198.229 with SMTP id jf5ls764988lac.56.gmail; Mon, 04 May 2015 19:48:50 -0700 (PDT) X-Received: by 10.112.154.198 with SMTP id vq6mr22015674lbb.110.1430794130732; Mon, 04 May 2015 19:48:50 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id p10si11309869laa.17.2015.05.04.19.48.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2015 19:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbqq2 with SMTP id qq2so118154214lbb.3 for ; Mon, 04 May 2015 19:48:50 -0700 (PDT) X-Received: by 10.113.10.134 with SMTP id ea6mr21755263lbd.29.1430794130618; Mon, 04 May 2015 19:48:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1987579lbt; Mon, 4 May 2015 19:48:49 -0700 (PDT) X-Received: by 10.70.131.132 with SMTP id om4mr47139969pdb.30.1430794128877; Mon, 04 May 2015 19:48:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oq4si22148378pbc.142.2015.05.04.19.48.48; Mon, 04 May 2015 19:48:48 -0700 (PDT) Received-SPF: none (google.com: linux-acpi-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965458AbbEECsW (ORCPT + 7 others); Mon, 4 May 2015 22:48:22 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33918 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965444AbbEECsB (ORCPT ); Mon, 4 May 2015 22:48:01 -0400 Received: by pacyx8 with SMTP id yx8so177889143pac.1 for ; Mon, 04 May 2015 19:48:00 -0700 (PDT) X-Received: by 10.68.57.237 with SMTP id l13mr47347617pbq.100.1430794080537; Mon, 04 May 2015 19:48:00 -0700 (PDT) Received: from localhost ([180.150.157.4]) by mx.google.com with ESMTPSA id b10sm14150823pdo.84.2015.05.04.19.47.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 May 2015 19:47:59 -0700 (PDT) From: Hanjun Guo To: "Rafael J. Wysocki" Cc: Will Deacon , Catalin Marinas , Boris Ostrovsky , Stefano Stabellini , Lorenzo Pieralisi , Sudeep Holla , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH v2 7/7] ACPI / processor: Introduce invalid_phys_cpuid() Date: Tue, 5 May 2015 10:46:38 +0800 Message-Id: <1430793998-21631-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430793998-21631-1-git-send-email-hanjun.guo@linaro.org> References: <1430793998-21631-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Introduce invalid_phys_cpuid() to identify cpu with invalid physical ID, then used it as replacement of the direct comparisons with PHYS_CPUID_INVALID. Signed-off-by: Hanjun Guo --- drivers/acpi/acpi_processor.c | 4 ++-- drivers/acpi/processor_core.c | 4 ++-- include/linux/acpi.h | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 62c846b..92a5f73 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) acpi_status status; int ret; - if (pr->phys_id == PHYS_CPUID_INVALID) + if (invalid_phys_cpuid(pr->phys_id)) return -ENODEV; status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); @@ -264,7 +264,7 @@ static int acpi_processor_get_info(struct acpi_device *device) pr->phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id); - if (pr->phys_id == PHYS_CPUID_INVALID) + if (invalid_phys_cpuid(pr->phys_id)) acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n"); pr->id = acpi_map_cpuid(pr->phys_id, pr->acpi_id); diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index fd4140d..33a38d6 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -184,7 +184,7 @@ phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) phys_cpuid_t phys_id; phys_id = map_mat_entry(handle, type, acpi_id); - if (phys_id == PHYS_CPUID_INVALID) + if (invalid_phys_cpuid(phys_id)) phys_id = map_madt_entry(type, acpi_id); return phys_id; @@ -196,7 +196,7 @@ int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id) int i; #endif - if (phys_id == PHYS_CPUID_INVALID) { + if (invalid_phys_cpuid(phys_id)) { /* * On UP processor, there is no _MAT or MADT table. * So above phys_id is always set to PHYS_CPUID_INVALID. diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 913b49f..cc82ff3 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -163,6 +163,11 @@ static inline bool invalid_logical_cpuid(u32 cpuid) return (int)cpuid < 0; } +static inline bool invalid_phys_cpuid(phys_cpuid_t phys_id) +{ + return (int)phys_id < 0; +} + #ifdef CONFIG_ACPI_HOTPLUG_CPU /* Arch dependent functions for cpu hotplug support */ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu);