From patchwork Fri Mar 27 14:02:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 46426 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CB4821597 for ; Fri, 27 Mar 2015 14:04:46 +0000 (UTC) Received: by wibfv9 with SMTP id fv9sf4940756wib.1 for ; Fri, 27 Mar 2015 07:04:45 -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=VHgmy9Us69DzlMc8VEa9ZfWUUUHcF8L6W9pMsaGXtYk=; b=YKzuSjDoo0xmPSRTSFkBhqGVBX0dVd3pIy2FRSarNikE3SQiR4EF76QFGXRK0AWcq1 9YciyZJ9QxZnmkVaCNAmR90iXHUiPLEhrqY1P3Ru7UPqEg30A597qcCaEsG7BxCS0OCY 8aM9D71+MUcg4oRWa9ksGtpuGY7dY/l4wF8EVsuS6FJ1yQiALdCQjaa1e9BVVCFHUAX1 eLg8LJL/GLFVwATyFqmG4VDOwSywTivN8T/iGamM6T4iESAZcYbAjT+wskjP46lBO+5k iZE5PjeeZDQ9i8SplwcRkiUMV+shoEKrU3FUv0aLm4DMacx4YNyx3Ncad/CZmlL0sIkS 1b9w== X-Gm-Message-State: ALoCoQmK7wTAxvRtFDVYEua/nQUaYdWMvfLctCjS3FK2iOV9u3pQpj4AcGV+EjFuW6RtHnlvQ8l1 X-Received: by 10.112.142.1 with SMTP id rs1mr4642247lbb.19.1427465085696; Fri, 27 Mar 2015 07:04:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.199 with SMTP id x7ls397025lae.0.gmail; Fri, 27 Mar 2015 07:04:45 -0700 (PDT) X-Received: by 10.152.5.134 with SMTP id s6mr8812263las.6.1427465085450; Fri, 27 Mar 2015 07:04:45 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id t4si1462770lbp.105.2015.03.27.07.04.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 07:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagg8 with SMTP id g8so71147376lag.1 for ; Fri, 27 Mar 2015 07:04:45 -0700 (PDT) X-Received: by 10.152.5.72 with SMTP id q8mr651027laq.73.1427465085328; Fri, 27 Mar 2015 07:04:45 -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.57.201 with SMTP id k9csp1281065lbq; Fri, 27 Mar 2015 07:04:44 -0700 (PDT) X-Received: by 10.66.55.42 with SMTP id o10mr35608964pap.148.1427465067944; Fri, 27 Mar 2015 07:04:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ze3si2974986pbc.209.2015.03.27.07.04.26; Fri, 27 Mar 2015 07:04:27 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S932209AbbC0OEM (ORCPT + 27 others); Fri, 27 Mar 2015 10:04:12 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:35286 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932192AbbC0OEJ (ORCPT ); Fri, 27 Mar 2015 10:04:09 -0400 Received: by pdbop1 with SMTP id op1so97466752pdb.2 for ; Fri, 27 Mar 2015 07:04:08 -0700 (PDT) X-Received: by 10.70.14.226 with SMTP id s2mr35605877pdc.145.1427465048709; Fri, 27 Mar 2015 07:04:08 -0700 (PDT) Received: from localhost ([104.207.83.1]) by mx.google.com with ESMTPSA id ks7sm2331156pdb.20.2015.03.27.07.04.06 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 27 Mar 2015 07:04:07 -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 7/7] ACPI / processor: Introduce invalid_phys_cpuid() Date: Fri, 27 Mar 2015 22:02:28 +0800 Message-Id: <1427464948-14564-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427464948-14564-1-git-send-email-hanjun.guo@linaro.org> References: <1427464948-14564-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.215.47 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 fd8a2a4..9a1f467 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -157,6 +157,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);