From patchwork Fri Mar 27 13:55:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 46413 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 609CE21597 for ; Fri, 27 Mar 2015 13:56:53 +0000 (UTC) Received: by wghr3 with SMTP id r3sf11124209wgh.0 for ; Fri, 27 Mar 2015 06:56:52 -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=VYYwHtHkPsIhUh/3ybH48VTXpasS8jUCyyIuK4CCt+31wtw8KOmjhm6PlOKcK6WrH2 7C0LfmN6UC4ZWzYlL9FfcR4LMQp+LWjuROn1voX8ZeVElog5vjsCDVz9xNpWit5Anl3V Lgu8XcvE05rNolk+v3n1CBCVUm7LXRjMjdbFv711GUxl1ty2SIw5EacVAX/d0LAdhGPo iQDSl8UI9BpEMdX47pd8EmsIeZFHY+K8/ccLhJ6nEk0Gih2Hh7qGGxs660k9LT+KfJZd +v3/7imUwEmiU93LNMW6U8D7DScOa+OPu9iuEMKkgAOyF27mI5KRYJVcGjOoD/LZuEe0 r1Jg== X-Gm-Message-State: ALoCoQnY1DKFG1jO9tKwXJdq3oxBkSCJ6l1hzIInPJNiHWTzOOGdz9M1ciRXUhDWSiYEhcVteTfx X-Received: by 10.152.3.70 with SMTP id a6mr4691175laa.0.1427464612662; Fri, 27 Mar 2015 06:56:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.65 with SMTP id i1ls102271lai.44.gmail; Fri, 27 Mar 2015 06:56:52 -0700 (PDT) X-Received: by 10.152.120.202 with SMTP id le10mr17602584lab.115.1427464612478; Fri, 27 Mar 2015 06:56:52 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id os2si1438115lbb.177.2015.03.27.06.56.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 06:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbcmq2 with SMTP id mq2so64151364lbc.0 for ; Fri, 27 Mar 2015 06:56:52 -0700 (PDT) X-Received: by 10.112.8.76 with SMTP id p12mr14539066lba.29.1427464612385; Fri, 27 Mar 2015 06:56:52 -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 k9csp1276150lbq; Fri, 27 Mar 2015 06:56:51 -0700 (PDT) X-Received: by 10.68.129.170 with SMTP id nx10mr3363208pbb.16.1427464610545; Fri, 27 Mar 2015 06:56:50 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fw4si2980537pbb.58.2015.03.27.06.56.49; Fri, 27 Mar 2015 06:56:50 -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 S964857AbbC0N4o (ORCPT + 27 others); Fri, 27 Mar 2015 09:56:44 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:35184 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964822AbbC0N41 (ORCPT ); Fri, 27 Mar 2015 09:56:27 -0400 Received: by pdbop1 with SMTP id op1so97273022pdb.2 for ; Fri, 27 Mar 2015 06:56:26 -0700 (PDT) X-Received: by 10.70.38.195 with SMTP id i3mr19634242pdk.82.1427464586851; Fri, 27 Mar 2015 06:56:26 -0700 (PDT) Received: from localhost ([104.207.83.1]) by mx.google.com with ESMTPSA id b12sm2301690pdl.62.2015.03.27.06.56.25 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 27 Mar 2015 06:56:26 -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 21:55:13 +0800 Message-Id: <1427464513-14414-10-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427464513-14414-1-git-send-email-hanjun.guo@linaro.org> References: <1427464513-14414-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.217.170 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);