From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754524AbcDYKxo (ORCPT ); Mon, 25 Apr 2016 06:53:44 -0400 Received: from foss.arm.com ([217.140.101.70]:44976 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754413AbcDYKxm (ORCPT ); Mon, 25 Apr 2016 06:53:42 -0400 Date: Mon, 25 Apr 2016 11:53:40 +0100 From: Will Deacon To: Stefano Stabellini Cc: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, catalin.marinas@arm.com, shannon.zhao@linaro.org, linux-kernel@vger.kernel.org, peter.huangpeng@huawei.com Subject: Re: [PATCH] make dt_scan_depth1_nodes more readable Message-ID: <20160425105340.GE16065@arm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 25, 2016 at 11:25:11AM +0100, Stefano Stabellini wrote: > From: Mark Rutland > > Improve the readability of dt_scan_depth1_nodes by removing the nested > conditionals. > > Signed-off-by: Mark Rutland > Signed-off-by: Stefano Stabellini > > --- > > Note: this patch is based on xentip/for-linus-4.7 So how should I merge it? :/ Will > > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c > index 57ee317..6884c76 100644 > --- a/arch/arm64/kernel/acpi.c > +++ b/arch/arm64/kernel/acpi.c > @@ -66,17 +66,24 @@ static int __init dt_scan_depth1_nodes(unsigned long node, > void *data) > { > /* > - * Return 1 as soon as we encounter a node at depth 1 that is > - * not the /chosen node, or /hypervisor node with compatible > - * string "xen,xen". > + * Ignore anything not directly under the root node; we'll > + * catch its parent instead. > */ > - if (depth == 1 && (strcmp(uname, "chosen") != 0)) { > - if (strcmp(uname, "hypervisor") != 0 || > - !of_flat_dt_is_compatible(node, "xen,xen")) > - return 1; > - } > + if (depth != 1) > + return 0; > > - return 0; > + if (strcmp(uname, "chosen") == 0) > + return 0; > + > + if (strcmp(uname, "hypervisor") == 0 && > + of_flat_dt_is_compatible(node, "xen,xen")) > + return 0; > + > + /* > + * This node at depth 1 is neither a chosen node nor a xen node, > + * which we do not expect. > + */ > + return 1; > } > > /* >