From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753556AbdDDLMW (ORCPT ); Tue, 4 Apr 2017 07:12:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:44279 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbdDDLMT (ORCPT ); Tue, 4 Apr 2017 07:12:19 -0400 Date: Tue, 4 Apr 2017 13:12:02 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Aleksey Makarov , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , Greg Kroah-Hartman , Peter Hurley , Jiri Slaby , Robin Murphy , Steven Rostedt , "Nair, Jayachandran" , Sergey Senozhatsky Subject: Re: [PATCH v8 3/3] printk: fix double printing with earlycon Message-ID: <20170404111202.GK29537@pathway.suse.cz> References: <20170315102854.1763-1-aleksey.makarov@linaro.org> <20170320100302.8656-1-aleksey.makarov@linaro.org> <20170327141432.GH2846@pathway.suse.cz> <4b561f81-67af-f6a3-76c9-d0d8499c52bd@linaro.org> <20170328020404.GA10573@jagdpanzerIV.localdomain> <20170328125657.GJ2846@pathway.suse.cz> <20170330055546.GD513@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170330055546.GD513@jagdpanzerIV.localdomain> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2017-03-30 14:55:46, Sergey Senozhatsky wrote: > On (03/28/17 14:56), Petr Mladek wrote: > [..] > > > > Is it better? If not, I will send a version with console_cmdline_last. > > > > > > personally I'm fine with the nested loop. the latest version > > > "for (last = MAX_CMDLINECONSOLES - 1; last >= 0;..." > > > > > > is even easier to read. > > > > The number of elements is bumped on a single location, so there > > is not much to synchronize. The old approach was fine because > > the for cycles were needed anyway, they started on the 0th element, > > and NULL ended arrays are rather common practice. > > > > But we are searching the array from the end now. Also we use the > > for cycle just to get the number here. This is not a common > > practice and it makes the code more complicated and strange from > > my point of view. > > I'm fine with either way :) Alekesey, any chance to use the global variable to count used or point to the last element? I know that you have already spent a lot of time with it. It was great work. But the current solution of the cycle looks weird to me. Best Regards, Petr