From patchwork Mon May 11 04:17:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 48198 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8ED5221550 for ; Mon, 11 May 2015 04:18:55 +0000 (UTC) Received: by wiun10 with SMTP id n10sf22335724wiu.1 for ; Sun, 10 May 2015 21:18:54 -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=Y0xrjZAtj8b6IxvExGs48OeallbHWgrcGEHIekHUfPxKF9JHNSaFBZx8I/w8AB6zST 5sU9cJMlyhuvLStamwPQXgLDBTmM+BLIBcJZ2hD83L3wqy2FsBGGLVaZ43WapQXHs5hm mJc2rCPe+Ov4lAdJhvMh9qn64hsCp1ADmG2Q5l6YSfUPDzJPHCQjnKUCfAYFDVhLa+ng COFJzaVyYKHw/Yj8rzSY7c9rnubefZ9dLLdhsg/R1qwKmtZYD+RdYa2NrJsawEpjIvWD 3EIBGbZHXeXACWD/xs750VOMxqxpHz8VNiZ3KWs1HDhe9pV+N/R17Dm3i+FGf60Aj4ig ongg== X-Gm-Message-State: ALoCoQlpQWGRiXcGnaHjvq/qU6QtHsTxKaDjcJBKF3LafFc7M3qBGBIqgL4hYpLbVhtGGDuE9KQa X-Received: by 10.112.166.137 with SMTP id zg9mr6233141lbb.11.1431317934871; Sun, 10 May 2015 21:18:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.102 with SMTP id s6ls591084lag.73.gmail; Sun, 10 May 2015 21:18:54 -0700 (PDT) X-Received: by 10.152.179.39 with SMTP id dd7mr6381940lac.118.1431317934596; Sun, 10 May 2015 21:18:54 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id zl2si7658800lbb.55.2015.05.10.21.18.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 May 2015 21:18:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by laat2 with SMTP id t2so84951678laa.1 for ; Sun, 10 May 2015 21:18:54 -0700 (PDT) X-Received: by 10.152.4.72 with SMTP id i8mr6845775lai.32.1431317934512; Sun, 10 May 2015 21:18:54 -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.108.230 with SMTP id hn6csp1290418lbb; Sun, 10 May 2015 21:18:53 -0700 (PDT) X-Received: by 10.68.163.3 with SMTP id ye3mr16062787pbb.13.1431317932450; Sun, 10 May 2015 21:18:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yw2si7695385pbc.95.2015.05.10.21.18.51; Sun, 10 May 2015 21:18:52 -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 S1752439AbbEKESt (ORCPT + 7 others); Mon, 11 May 2015 00:18:49 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33189 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbbEKESr (ORCPT ); Mon, 11 May 2015 00:18:47 -0400 Received: by pacwv17 with SMTP id wv17so99876619pac.0 for ; Sun, 10 May 2015 21:18:47 -0700 (PDT) X-Received: by 10.68.130.42 with SMTP id ob10mr15991972pbb.151.1431317927063; Sun, 10 May 2015 21:18:47 -0700 (PDT) Received: from localhost ([180.150.153.56]) by mx.google.com with ESMTPSA id b10sm11539358pdj.0.2015.05.10.21.18.45 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 10 May 2015 21:18:46 -0700 (PDT) From: Hanjun Guo To: "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Cc: Will Deacon , Catalin Marinas , Boris Ostrovsky , Stefano Stabellini , Lorenzo Pieralisi , Sudeep Holla , Konrad Rzeszutek Wilk , linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH v3 7/7] ACPI / processor: Introduce invalid_phys_cpuid() Date: Mon, 11 May 2015 12:17:19 +0800 Message-Id: <1431317839-4584-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431317839-4584-1-git-send-email-hanjun.guo@linaro.org> References: <1431317839-4584-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.215.44 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);