From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yk9dl-0006Kl-Cs for barebox@lists.infradead.org; Mon, 20 Apr 2015 11:13:26 +0000 Date: Mon, 20 Apr 2015 13:13:02 +0200 From: Sascha Hauer Message-ID: <20150420111302.GN6325@pengutronix.de> References: <1429519419-20325-1-git-send-email-mkl@pengutronix.de> <1429519419-20325-3-git-send-email-mkl@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1429519419-20325-3-git-send-email-mkl@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 3/5] timeout: factor out wait-for-key-press loop into separate file To: Marc Kleine-Budde Cc: barebox@lists.infradead.org On Mon, Apr 20, 2015 at 10:43:37AM +0200, Marc Kleine-Budde wrote: > This patch factors out the wait-for-key-press loop from the shell command > "timeout" into a sparate file, so that it can be used from C, too. > > Signed-off-by: Marc Kleine-Budde > --- > commands/Kconfig | 1 + > commands/timeout.c | 62 ++++++++++----------------------------------- > common/Kconfig | 3 +++ > common/Makefile | 1 + > common/simple_timeout.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ > include/simple_timeout.h | 11 ++++++++ > 6 files changed, 95 insertions(+), 49 deletions(-) > create mode 100644 common/simple_timeout.c > create mode 100644 include/simple_timeout.h > > diff --git a/commands/Kconfig b/commands/Kconfig > index 847ff76d1d8b..1c9083381fac 100644 > --- a/commands/Kconfig > +++ b/commands/Kconfig > @@ -1487,6 +1487,7 @@ config CMD_READLINE > config CMD_TIMEOUT > tristate > prompt "timeout" > + select SIMPLE_TIMEOUT Since the linker throws away unused functions anyway I think we don't need an option for this. > +#include > +#include > +#include > +#include > +#include > + > +int is_simple_timeout(int timeout_s, unsigned flags, char *out_key) I don't like the name very much since we already have a is_timeout function which does something completely different. Also is_xxx_timeout seems to imply that this function doesn't wait but only returns a status. How about console_countdown() or similar? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox