From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E197C33CB3 for ; Tue, 28 Jan 2020 09:44:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EC5420CC7 for ; Tue, 28 Jan 2020 09:44:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726010AbgA1JoT (ORCPT ); Tue, 28 Jan 2020 04:44:19 -0500 Received: from mga14.intel.com ([192.55.52.115]:49545 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbgA1JoT (ORCPT ); Tue, 28 Jan 2020 04:44:19 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 01:44:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,373,1574150400"; d="scan'208";a="217568281" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga007.jf.intel.com with ESMTP; 28 Jan 2020 01:44:16 -0800 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1iwNPu-0007Jz-3K; Tue, 28 Jan 2020 11:44:18 +0200 Date: Tue, 28 Jan 2020 11:44:18 +0200 From: Andy Shevchenko To: Sergey Senozhatsky Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 5/5] console: Introduce ->exit() callback Message-ID: <20200128094418.GY32742@smile.fi.intel.com> References: <20200127114719.69114-1-andriy.shevchenko@linux.intel.com> <20200127114719.69114-5-andriy.shevchenko@linux.intel.com> <20200128051711.GB115889@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128051711.GB115889@google.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 28, 2020 at 02:17:11PM +0900, Sergey Senozhatsky wrote: > On (20/01/27 13:47), Andy Shevchenko wrote: ... > > @@ -2853,6 +2853,10 @@ int unregister_console(struct console *console) > > console->flags &= ~CON_ENABLED; > > console_unlock(); > > console_sysfs_notify(); > > + > > + if (console->exit) > > + console->exit(console); > > + > > If the console was not registered (hence not enabled) is it still required > to call ->exit()? Is there a requirement that ->exit() should handle such > cases? This is a good point. The ->exit() purpose is to keep balance for whatever happened at ->setup(). But ->setup() is being called either when we have has_preferred == false or when we got no matching we call it for all such consoles, till it returns an error (can you elaborate the logic behind it?). In both cases we will get the console to have CON_ENABLED flag set. -- With Best Regards, Andy Shevchenko