From patchwork Wed Apr 8 16:59:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 459516 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 105171401E7 for ; Thu, 9 Apr 2015 07:49:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=yandex-team.ru header.i=@yandex-team.ru header.b=dz0eLg/N; dkim-adsp=unknown (unprotected policy); dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id DE7EE1A0ACC for ; Thu, 9 Apr 2015 07:49:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=yandex-team.ru header.i=@yandex-team.ru header.b=dz0eLg/N; dkim-adsp=unknown (unprotected policy); dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org X-Greylist: delayed 304 seconds by postgrey-1.35 at bilbo; Thu, 09 Apr 2015 03:04:38 AEST Authentication-Results: lists.ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=yandex-team.ru header.i=@yandex-team.ru header.b=dz0eLg/N; dkim-adsp=pass; dkim-atps=neutral Received: from forward-corp1g.mail.yandex.net (forward-corp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 0B0EB1A09F3 for ; Thu, 9 Apr 2015 03:04:38 +1000 (AEST) Received: from smtpcorp1m.mail.yandex.net (smtpcorp1m.mail.yandex.net [77.88.61.150]) by forward-corp1g.mail.yandex.net (Yandex) with ESMTP id DD57436602E9; Wed, 8 Apr 2015 19:59:23 +0300 (MSK) Received: from smtpcorp1m.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp1m.mail.yandex.net (Yandex) with ESMTP id 9B8A82CA04C2; Wed, 8 Apr 2015 19:59:23 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:408:e5f3:4ae:e5b8:aba9]) by smtpcorp1m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yKpKe0MAFB-xNiWimoG; Wed, 8 Apr 2015 19:59:23 +0300 (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1428512363; bh=kHwfpfyRJvxv+EkSr8sf/aDEdKNAHyUk3onmL9CAQdk=; h=Subject:From:To:Cc:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding; b=dz0eLg/N3kPPwYVSF7hRDCcRgSIM4mAfasoB8Ubb4KimSJqj64bcsrcAEEgT2OWM2 ZUXT9YYRDlCvbCr85x94RhM4UvngNS5Fp34KW/ZjkQnWhX4hlU2TzLWywY4nOqRa1i 6vbz2Ria62l46sFS4CddLpDORHo9jLqPTuzWBQnQ= Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH] of: return NUMA_NO_NODE from fallback of_node_to_nid() From: Konstantin Khlebnikov To: Grant Likely , devicetree@vger.kernel.org, Rob Herring , linux-kernel@vger.kernel.org Date: Wed, 08 Apr 2015 19:59:20 +0300 Message-ID: <20150408165920.25007.6869.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 09 Apr 2015 07:48:11 +1000 Cc: sparclinux@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Node 0 might be offline as well as any other numa node, in this case kernel cannot handle memory allocation and crashes. Signed-off-by: Konstantin Khlebnikov Fixes: 0c3f061c195c ("of: implement of_node_to_nid as a weak function") --- drivers/of/base.c | 2 +- include/linux/of.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 8f165b112e03..51f4bd16e613 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -89,7 +89,7 @@ EXPORT_SYMBOL(of_n_size_cells); #ifdef CONFIG_NUMA int __weak of_node_to_nid(struct device_node *np) { - return numa_node_id(); + return NUMA_NO_NODE; } #endif diff --git a/include/linux/of.h b/include/linux/of.h index dfde07e77a63..78a04ee85a9c 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -623,7 +623,10 @@ static inline const char *of_prop_next_string(struct property *prop, #if defined(CONFIG_OF) && defined(CONFIG_NUMA) extern int of_node_to_nid(struct device_node *np); #else -static inline int of_node_to_nid(struct device_node *device) { return 0; } +static inline int of_node_to_nid(struct device_node *device) +{ + return NUMA_NO_NODE; +} #endif static inline struct device_node *of_find_matching_node(