Re: [PATCH v3 5/5] console: Introduce ->exit() callback

From: Andy Shevchenko
Date: Tue Jan 28 2020 - 04:44:20 EST


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