[lkml]   [2020]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v3 5/5] console: Introduce ->exit() callback
On Wed, Jan 29, 2020 at 10:41:41PM +0900, Sergey Senozhatsky wrote:
> On (20/01/28 11:44), Andy Shevchenko wrote:
> > > 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?).
> ->match() does alias matching and ->setup(). If alias matching failed,
> exact name match takes place. We don't call ->setup() for all consoles,
> but only for those that have exact name match:
> if (strcmp(c->name, newcon->name) != 0)
> continue;
> As to why we don't stop sooner in that loop - I need to to do some
> archaeology. We need to have CON_CONSDEV at proper place, which is
> IIRC the last matching console.
> Pretty much every time we tried to change the logic we ended up
> reverting the changes.

I understand. Seems the ->setup() has to be idempotent. We can tell the same
for ->exit() in some comment.

Can you describe, btw, struct console in kernel doc format?
It will be very helpful!

> > In both cases we will get the console to have CON_ENABLED flag set.
> And there are sneaky consoles that have CON_ENABLED before we even
> register them.

So, taking into consideration my comment to the previous patch, what would be
suggested guard here?

For a starter something like this?

if ((console->flags & CON_ENABLED) && console->exit)

With Best Regards,
Andy Shevchenko

 \ /
  Last update: 2020-01-29 15:27    [W:0.229 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site