From patchwork Fri Jan 17 04:37:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 23284 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DDF7D20555 for ; Fri, 17 Jan 2014 04:38:17 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id j1sf913281iga.0 for ; Thu, 16 Jan 2014 20:38:16 -0800 (PST) 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=qP47htJmB/b/zjaWfOE+jzlOKnYs2L1Sl1E94jRjK1M=; b=IMp1UyRxkrO45VpE4wxYRRKyV/3zQmm72LJLsEIVbEhdMiujDEXU3aUrGHCxNEpgIK UyRmkqN3MsVQojja/05y7HJ1XcJFynpX/5FWa1PJ5h8PwgEdE5ir+YUEKq9GKxQIV6Bl PYMc5BSDnWfv/Zk2Z/3CtT14maoozaIubkRduZHr5DtvNzgSN7d6P+TAEs932UkzE5Wq 5vKcO/wPocKspxiDOaCK/sPxNXDfIw6CdnF+6t3hAjaaZbDQ06o+lb3mu7Cru4ke7fUN 7V+bSrlzNKVrfXbQT5l6vWm1/fIt2A4gebhklpVvFnGYlfpYHv303wbCOq37fub4RTXJ +UTg== X-Gm-Message-State: ALoCoQkX9Zqo1CnbCnU5FkY0bq+BwnEbbrk9B9NtHzinQg36V0FqIjfP6/2Lv/vs8XsHsSn6zIwH X-Received: by 10.42.235.132 with SMTP id kg4mr4435426icb.32.1389933496939; Thu, 16 Jan 2014 20:38:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.73 with SMTP id i67ls412150qgf.3.gmail; Thu, 16 Jan 2014 20:38:16 -0800 (PST) X-Received: by 10.220.191.134 with SMTP id dm6mr8753083vcb.16.1389933496829; Thu, 16 Jan 2014 20:38:16 -0800 (PST) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id d1si4312639vck.50.2014.01.16.20.38.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 20:38:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.44; Received: by mail-vb0-f44.google.com with SMTP id f12so309804vbg.3 for ; Thu, 16 Jan 2014 20:38:16 -0800 (PST) X-Received: by 10.58.119.161 with SMTP id kv1mr4504417veb.21.1389933496743; Thu, 16 Jan 2014 20:38:16 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp397032ved; Thu, 16 Jan 2014 20:38:16 -0800 (PST) X-Received: by 10.66.221.199 with SMTP id qg7mr14571417pac.13.1389933495887; Thu, 16 Jan 2014 20:38:15 -0800 (PST) Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by mx.google.com with ESMTPS id j5si9046139pbs.31.2014.01.16.20.38.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 20:38:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.52 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.160.52; Received: by mail-pb0-f52.google.com with SMTP id jt11so1540905pbb.39 for ; Thu, 16 Jan 2014 20:38:15 -0800 (PST) X-Received: by 10.66.187.11 with SMTP id fo11mr14485233pac.47.1389933495510; Thu, 16 Jan 2014 20:38:15 -0800 (PST) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id q7sm19100173pbc.20.2014.01.16.20.38.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jan 2014 20:38:14 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, patches@linaro.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH] ACPI / processor: Return specific error value when mapping lapic id Date: Fri, 17 Jan 2014 12:37:02 +0800 Message-Id: <1389933422-10016-1-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , we usually return 0 for success in int returned function, and negative value when failed, but in processor_core.c, some function return 1 for success and 0 for failure which leads confusion sometimes, replace with specific error values to fix that. Signed-off-by: Hanjun Guo --- drivers/acpi/processor_core.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index b3171f3..24c87ef 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -45,13 +45,13 @@ static int map_lapic_id(struct acpi_subtable_header *entry, (struct acpi_madt_local_apic *)entry; if (!(lapic->lapic_flags & ACPI_MADT_ENABLED)) - return 0; + return -ENODEV; if (lapic->processor_id != acpi_id) - return 0; + return -EINVAL; *apic_id = lapic->id; - return 1; + return 0; } static int map_x2apic_id(struct acpi_subtable_header *entry, @@ -61,14 +61,14 @@ static int map_x2apic_id(struct acpi_subtable_header *entry, (struct acpi_madt_local_x2apic *)entry; if (!(apic->lapic_flags & ACPI_MADT_ENABLED)) - return 0; + return -ENODEV; if (device_declaration && (apic->uid == acpi_id)) { *apic_id = apic->local_apic_id; - return 1; + return 0; } - return 0; + return -EINVAL; } static int map_lsapic_id(struct acpi_subtable_header *entry, @@ -78,16 +78,16 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, (struct acpi_madt_local_sapic *)entry; if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) - return 0; + return -ENODEV; if (device_declaration) { if ((entry->length < 16) || (lsapic->uid != acpi_id)) - return 0; + return -EINVAL; } else if (lsapic->processor_id != acpi_id) - return 0; + return -EINVAL; *apic_id = (lsapic->id << 8) | lsapic->eid; - return 1; + return 0; } static int map_madt_entry(int type, u32 acpi_id) @@ -117,13 +117,13 @@ static int map_madt_entry(int type, u32 acpi_id) struct acpi_subtable_header *header = (struct acpi_subtable_header *)entry; if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { - if (map_lapic_id(header, acpi_id, &apic_id)) + if (!map_lapic_id(header, acpi_id, &apic_id)) break; } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { - if (map_x2apic_id(header, type, acpi_id, &apic_id)) + if (!map_x2apic_id(header, type, acpi_id, &apic_id)) break; } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { - if (map_lsapic_id(header, type, acpi_id, &apic_id)) + if (!map_lsapic_id(header, type, acpi_id, &apic_id)) break; } entry += header->length;