From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752265AbdLMKN2 (ORCPT ); Wed, 13 Dec 2017 05:13:28 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:38693 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751121AbdLMKNW (ORCPT ); Wed, 13 Dec 2017 05:13:22 -0500 X-Google-Smtp-Source: ACJfBov5Bne/4ugVVUwCZhy4318RM4uGCeBMawZJVrK9/D8vLcbra0K86TE1TNcGeXgH4dEOzlQjJg== Date: Wed, 13 Dec 2017 15:43:19 +0530 From: Viresh Kumar To: Greg Kroah-Hartman Cc: Vincent Guittot , Stephen Boyd , Rajendra Nayak , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, s.hauer@pengutronix.de, l.stach@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, nm@ti.com, xuwei5@hisilicon.com, robh+dt@kernel.org Subject: Re: [PATCH V4 10/12] boot_constraint: Add support for Hisilicon platforms Message-ID: <20171213101319.GC3322@vireshk-i7> References: <20171213094718.GE13194@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171213094718.GE13194@kroah.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13-12-17, 10:47, Greg Kroah-Hartman wrote: > On Sun, Oct 29, 2017 at 07:18:58PM +0530, Viresh Kumar wrote: > > +static const struct of_device_id machines[] __initconst = { > > + { .compatible = "hisilicon,hi3660", .data = &hikey3660_constraints }, > > + { .compatible = "hisilicon,hi3798cv200", .data = &hikey3798cv200_constraints }, > > + { .compatible = "hisilicon,hi6220", .data = &hikey6220_constraints }, > > + { } > > +}; > > + > > +static int __init hikey_constraints_init(void) > > +{ > > + const struct hikey_machine_constraints *constraints; > > + const struct of_device_id *match; > > + struct device_node *np; > > + > > + if (!boot_constraint_earlycon_enabled()) > > + return 0; > > + > > + np = of_find_node_by_path("/"); > > What is this for? We need to match the above list of "machines" with the root node and "np" here points to the root node.. and ... > > + if (!np) > > + return -ENODEV; > > + > > + match = of_match_node(machines, np); Its used here. > > + of_node_put(np); > > +/* > > + * The amba-pl011 driver registers itself from arch_initcall level. Setup the > > + * serial boot constraints before that in order not to miss any boot messages. > > + */ > > +postcore_initcall_sync(hikey_constraints_init); > > Now you have to worry about the bootconstraints earlycon being called > before/after your code. For boot-constraints to work for any device, it is extremely important to add the constraint before the device is probed by its driver, otherwise the driver would end up re-configuring the resources. There is no other way then having this order dependency here. > That's another linking order dependancy you > just created. It feels more complex for something so "simple" as > looking for the earlycon flag... -- viresh