From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752049AbdLMJov (ORCPT ); Wed, 13 Dec 2017 04:44:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54664 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbdLMJor (ORCPT ); Wed, 13 Dec 2017 04:44:47 -0500 Date: Wed, 13 Dec 2017 10:44:50 +0100 From: Greg Kroah-Hartman To: Viresh Kumar 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 09/12] boot_constraint: Add earlycon helper Message-ID: <20171213094450.GD13194@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 29, 2017 at 07:18:57PM +0530, Viresh Kumar wrote: > Getting boot messages during initial kernel boot is a common problem, > which (almost) everyone wants to solve. Considering that this would be > required by multiple platforms, provide a helper to check if "earlycon" > or "earlyprintk" boot arguments are passed to kernel or not. The > platforms can use this helper to add serial constraints only if earlycon > if required. > > Signed-off-by: Viresh Kumar > --- > drivers/boot_constraints/Makefile | 2 +- > drivers/boot_constraints/serial.c | 28 ++++++++++++++++++++++++++++ > include/linux/boot_constraint.h | 2 ++ > 3 files changed, 31 insertions(+), 1 deletion(-) > create mode 100644 drivers/boot_constraints/serial.c > > diff --git a/drivers/boot_constraints/Makefile b/drivers/boot_constraints/Makefile > index a765094623a3..0d4f88bb767c 100644 > --- a/drivers/boot_constraints/Makefile > +++ b/drivers/boot_constraints/Makefile > @@ -1,3 +1,3 @@ > # Makefile for device boot constraints > > -obj-y := clk.o deferrable_dev.o core.o pm.o supply.o > +obj-y := clk.o deferrable_dev.o core.o pm.o serial.o supply.o > diff --git a/drivers/boot_constraints/serial.c b/drivers/boot_constraints/serial.c > new file mode 100644 > index 000000000000..d0d07d4aa6af > --- /dev/null > +++ b/drivers/boot_constraints/serial.c > @@ -0,0 +1,28 @@ > +/* > + * This contains helpers related to serial boot constraints. > + * > + * Copyright (C) 2017 Linaro. > + * Viresh Kumar > + * > + * This file is released under the GPLv2. > + */ > + > +#include > + > +static bool earlycon_boot_constraints_enabled __initdata; > + > +bool __init boot_constraint_earlycon_enabled(void) > +{ > + return earlycon_boot_constraints_enabled; > +} > + > +static int __init enable_earlycon_boot_constraints(char *str) > +{ > + earlycon_boot_constraints_enabled = true; > + > + return 0; > +} > +__setup_param("earlycon", boot_constraint_earlycon, > + enable_earlycon_boot_constraints, 0); > +__setup_param("earlyprintk", boot_constraint_earlyprintk, > + enable_earlycon_boot_constraints, 0); > diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h > index c110b36e490f..aeada69b87e6 100644 > --- a/include/linux/boot_constraint.h > +++ b/include/linux/boot_constraint.h > @@ -10,6 +10,7 @@ > #define _LINUX_BOOT_CONSTRAINT_H > > #include > +#include > #include > > struct device; > @@ -58,6 +59,7 @@ int dev_boot_constraint_add(struct device *dev, > void dev_boot_constraints_remove(struct device *dev); > void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst, > int count); > +bool __init boot_constraint_earlycon_enabled(void); > #else > static inline > int dev_boot_constraint_add(struct device *dev, No need for this function if it's not enabled? And this feels really odd, does it really save any work for the individual "constraint" to check for this option? I'm all for helper functions, but this feels like more work than it's worth... thanks, greg k-h