From patchwork Wed May 13 08:19:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 48420 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4446E214A1 for ; Wed, 13 May 2015 08:20:13 +0000 (UTC) Received: by wiz9 with SMTP id 9sf9020537wiz.3 for ; Wed, 13 May 2015 01:20:12 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=h1dDwtY4wtU6JR9SWd8lJ926mdJmu4yA+g2YWzj8ukQ=; b=K4p8ex9P6aOhsz2rSmu1aK6uK5NTPc7LQcwvriIAv6DRER3QrB4pDY89NArqrLLMKB HmpJN5Qfko9+h1SIgrx+lL3+9+yziHWd+n4VXkLi7+uxXtvxXTkDXT+h2oLTnhwBauAe jiwGCggqeIbqPUhL5mxYh3Wm9NL+J9sfPqVMlqz/4zlJj2/Zn2HG2Qs/bGFNkrd2MLBv WoKyYUfQ5ZHUvBi0toVgrZEMHMesyKtMif+BHf5wUaOtpAnm/DO6iOgCwlNbwOUM/Gg4 2Sr5IMBSn4fdNEXJNkN/sLV1BL6tPp/Nl8s3KpCLDht6jLUTSBg5hl5e+cZS0fV2gRbY pEtg== X-Gm-Message-State: ALoCoQnCLhbH74xKog6xbLNESHyGXF+s3vhPjAB2lj5hTFAbH3PVmRotCy3sQDju9EM82bVy9a89 X-Received: by 10.112.28.111 with SMTP id a15mr13538546lbh.21.1431505212481; Wed, 13 May 2015 01:20:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.193 with SMTP id 1ls123621law.41.gmail; Wed, 13 May 2015 01:20:12 -0700 (PDT) X-Received: by 10.112.119.163 with SMTP id kv3mr15272994lbb.101.1431505212238; Wed, 13 May 2015 01:20:12 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id pj6si11917407lbb.17.2015.05.13.01.20.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 01:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbcga7 with SMTP id ga7so23908541lbc.1 for ; Wed, 13 May 2015 01:20:12 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr15471811lad.56.1431505212089; Wed, 13 May 2015 01:20:12 -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 hn6csp379070lbb; Wed, 13 May 2015 01:20:10 -0700 (PDT) X-Received: by 10.70.129.202 with SMTP id ny10mr35216249pdb.107.1431505210094; Wed, 13 May 2015 01:20:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rj10si26096255pdb.132.2015.05.13.01.20.08; Wed, 13 May 2015 01:20:10 -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 S933232AbbEMIUD (ORCPT + 28 others); Wed, 13 May 2015 04:20:03 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36010 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbbEMIT6 (ORCPT ); Wed, 13 May 2015 04:19:58 -0400 Received: by pdea3 with SMTP id a3so44041209pde.3 for ; Wed, 13 May 2015 01:19:58 -0700 (PDT) X-Received: by 10.70.131.193 with SMTP id oo1mr35719035pdb.63.1431505197942; Wed, 13 May 2015 01:19:57 -0700 (PDT) Received: from localhost ([180.150.148.224]) by mx.google.com with ESMTPSA id cl11sm18490258pdb.36.2015.05.13.01.19.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 13 May 2015 01:19:56 -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: [update][PATCH v3 7/7] ACPI / processor: Introduce invalid_phys_cpuid() Date: Wed, 13 May 2015 16:19:30 +0800 Message-Id: <1431505170-12798-1-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 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.179 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 --- Hi Rafael, This is replacement of patch 7/7 of patch set "[PATCH v3 0/7] minor cleanups for ACPI processor driver", which suggested by Sudeep and Lorenzo to replace "(int)phys_id" < 0 with "phys_id == PHYS_CPUID_INVALID" in invalid_phys_cpuid(). Thanks Hanjun 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..90e4ed1e 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 phys_id == PHYS_CPUID_INVALID; +} + #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);