fbcon: Maintain a private array of fb_info
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 5 Apr 2022 21:03:35 +0000 (23:03 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 7 Apr 2022 14:52:14 +0000 (16:52 +0200)
commitefc3acbc105af79bce2ccf97a6159255b7cf6b38
tree2fb68ffea5bce5f6f7fa19987ea4322414c2ce23
parentc75300b5c64b013a6a04c8385094eeff849595ba
fbcon: Maintain a private array of fb_info

Accessing the one in fbmem.c without taking the right locks is a bad
idea. Instead maintain our own private copy, which is fully protected
by console_lock() (like everything else in fbcon.c). That copy is
serialized through fbcon_fb_registered/unregistered() calls.

Also this means we do not need to hold a full fb_info reference, which
is nice because doing so would mean a refcount loop between the
console and the fb_info. But it's also not nice since it means
console_lock() must be held absolutely everywhere. Well strictly
speaking we could still try to do some refcounting games again by
calling get_fb_info before we drop the console_lock. But things will
get tricky.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Claudio Suarez <cssk@net-c.es>
Cc: Du Cheng <ducheng2@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220405210335.3434130-18-daniel.vetter@ffwll.ch
drivers/video/fbdev/core/fbcon.c