From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Fleming Subject: Re: [Xen-devel] efi_enabled(EFI_PARAVIRT) use Date: Wed, 4 May 2016 12:36:13 +0100 Message-ID: <20160504113613.GG2839@codeblueprint.co.uk> References: <20160429143931.GG2839@codeblueprint.co.uk> <5724BDD2.5020600@linaro.org> <20160430204420.GM2839@codeblueprint.co.uk> <572576E2.7060508@linaro.org> <20160501132620.GT2839@codeblueprint.co.uk> <57261483.10500@linaro.org> <20160502104530.GV2839@codeblueprint.co.uk> <572802B2.4020204@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <572802B2.4020204@huawei.com> Sender: linux-next-owner@vger.kernel.org To: Shannon Zhao Cc: Shannon Zhao , Stephen Rothwell , Jeremy Fitzhardinge , Stefano Stabellini , Ard Biesheuvel , Peter Zijlstra , "linux-kernel@vger.kernel.org" , "Luis R. Rodriguez" , Xen Devel , Borislav Petkov , linux-next@vger.kernel.org, Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Tue, 03 May, at 09:45:22AM, Shannon Zhao wrote: > > +static int __init fdt_find_uefi_params(unsigned long node, const char *uname, > > + int depth, void *data) > > +{ > > + struct param_info *info = data; > > + int i; > > + > > + for (i = 0; i < ARRAY_SIZE(dt_params); i++) { > > + > > + if (depth != 1 || strcmp(uname, dt_params[i].uname) != 0) { > > + info->missing = dt_params[i].params[0].name; > > + continue; > > + } > > + > So here it needs to check whether the node is /hypervisor. If so, get > the subnode "uefi". Like below: > if (strcmp(uname, "hypervisor") == 0) { > offset = of_get_flat_dt_subnode_by_name(node, "uefi"); > if (offset < 0) > return 0; > node = offset; > } Urgh, right. How about giving dt_params a const char *subnode field and doing, for (i = 0; i < ARRAY_SIZE(dt_params); i++) { const char *subnode = dt_params[i].sub_node; if (depth != 1 || strcmp(uname, dt_params[i].uname) != 0) { info->missing = dt_params[i].params[0].name; continue; } if (subnode) { offset = of_get_flat_dt_subnode_by_name(node, subnode); if (offset < 0) return 0; node = offset; } ...