From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Date: Thu, 17 Dec 2020 11:48:22 +0200 Subject: [PATCH v2 2/7] console: Keep ->start() and ->stop() balanced In-Reply-To: <20201216231624.9724-2-andriy.shevchenko@linux.intel.com> References: <20201216231624.9724-1-andriy.shevchenko@linux.intel.com> <20201216231624.9724-2-andriy.shevchenko@linux.intel.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Dec 17, 2020 at 1:16 AM Andy Shevchenko wrote: > There is no need to call ->start() for already started device. All the same, an already > there is no need to call ->stop() for devices still in use. > > For now enforce this only for CONSOLE_MUX case. now, enforce the CONSOLE_MUX ... > +static bool console_needs_handle(int file, struct stdio_dev *dev) > +{ > + int i; > + > + for (i = 0; i < cd_count[file]; i++) > + if (console_devices[file][i] == dev) > + return false; Actually this is no-op. I realized it later on. It misses the iteration over all files. And file argument to exclude iteration over that specific file. I will update this, but will also wait a couple of days for other comments against the series. > + return true; > +} -- With Best Regards, Andy Shevchenko