From: Thomas Zimmermann <tzimmermann@suse.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
DRI Development <dri-devel@lists.freedesktop.org>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
linux-fbdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Sam Ravnborg <sam@ravnborg.org>,
kernel test robot <lkp@intel.com>,
Daniel Vetter <daniel.vetter@intel.com>,
Daniel Vetter <daniel@ffwll.ch>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Claudio Suarez <cssk@net-c.es>, Du Cheng <ducheng2@gmail.com>
Subject: Re: [PATCH v2 11/19] fbcon: move more common code into fb_open()
Date: Thu, 10 Feb 2022 15:16:50 +0100 [thread overview]
Message-ID: <37c0fa2d-1dfa-62b2-ec06-9f9be492d7aa@suse.de> (raw)
In-Reply-To: <20220208210824.2238981-12-daniel.vetter@ffwll.ch>
[-- Attachment #1.1: Type: text/plain, Size: 5191 bytes --]
Am 08.02.22 um 22:08 schrieb Daniel Vetter:
> No idea why con2fb_acquire_newinfo() initializes much less than
> fbcon_startup(), but so be it. From a quick look most of the
> un-initialized stuff should be fairly harmless, but who knows.
>
> Note that the error handling for the con2fb_acquire_newinfo() failure
> case was very strange: Callers updated con2fb_map to the new value
> before calling this function, but upon error con2fb_acquire_newinfo
> reset it to the old value. Since I removed the call to fbcon_release
> anyway that strange error path was sticking out like a sore thumb,
> hence I removed it. Which also allows us to remove the oldidx
> parameter from that function.
>
> v2: Explain what's going on with oldidx and error paths (Sam)
>
> v3: Drop unused variable (0day)
>
> Acked-by: Sam Ravnborg <sam@ravnborg.org> (v2)
> Cc: kernel test robot <lkp@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Claudio Suarez <cssk@net-c.es>
> Cc: Du Cheng <ducheng2@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
That's the init function I was looking for, I guess.
> ---
> drivers/video/fbdev/core/fbcon.c | 75 +++++++++++++-------------------
> 1 file changed, 30 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index a60891005d44..f0213a0e3870 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -682,8 +682,18 @@ static int fbcon_invalid_charcount(struct fb_info *info, unsigned charcount)
>
> #endif /* CONFIG_MISC_TILEBLITTING */
>
> +static void fbcon_release(struct fb_info *info)
> +{
> + if (info->fbops->fb_release)
> + info->fbops->fb_release(info, 0);
> +
> + module_put(info->fbops->owner);
> +}
> +
> static int fbcon_open(struct fb_info *info)
> {
> + struct fbcon_ops *ops;
> +
> if (!try_module_get(info->fbops->owner))
> return -ENODEV;
>
> @@ -693,48 +703,31 @@ static int fbcon_open(struct fb_info *info)
> return -ENODEV;
> }
>
> - return 0;
> -}
> + ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
> + if (!ops) {
> + fbcon_release(info);
> + return -ENOMEM;
> + }
>
> -static void fbcon_release(struct fb_info *info)
> -{
> - if (info->fbops->fb_release)
> - info->fbops->fb_release(info, 0);
> + INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor);
> + ops->info = info;
> + info->fbcon_par = ops;
> + ops->cur_blink_jiffies = HZ / 5;
>
> - module_put(info->fbops->owner);
> + return 0;
> }
>
> static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info,
> - int unit, int oldidx)
> + int unit)
> {
> - struct fbcon_ops *ops = NULL;
> int err;
>
> err = fbcon_open(info);
> if (err)
> return err;
>
> - if (!err) {
> - ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
> - if (!ops)
> - err = -ENOMEM;
> -
> - INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor);
> - }
> -
> - if (!err) {
> - ops->cur_blink_jiffies = HZ / 5;
> - ops->info = info;
> - info->fbcon_par = ops;
> -
> - if (vc)
> - set_blitting_type(vc, info);
> - }
> -
> - if (err) {
> - con2fb_map[unit] = oldidx;
> - fbcon_release(info);
> - }
> + if (vc)
> + set_blitting_type(vc, info);
>
> return err;
> }
> @@ -842,9 +835,11 @@ static int set_con2fb_map(int unit, int newidx, int user)
>
> found = search_fb_in_map(newidx);
>
> - con2fb_map[unit] = newidx;
> - if (!err && !found)
> - err = con2fb_acquire_newinfo(vc, info, unit, oldidx);
> + if (!err && !found) {
> + err = con2fb_acquire_newinfo(vc, info, unit);
> + if (!err)
> + con2fb_map[unit] = newidx;
> + }
>
> /*
> * If old fb is not mapped to any of the consoles,
> @@ -941,20 +936,10 @@ static const char *fbcon_startup(void)
> if (fbcon_open(info))
> return NULL;
>
> - ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL);
> - if (!ops) {
> - fbcon_release(info);
> - return NULL;
> - }
> -
> - INIT_DELAYED_WORK(&ops->cursor_work, fb_flashcursor);
> -
> + ops = info->fbcon_par;
> ops->currcon = -1;
> ops->graphics = 1;
> ops->cur_rotate = -1;
> - ops->cur_blink_jiffies = HZ / 5;
> - ops->info = info;
> - info->fbcon_par = ops;
>
> p->con_rotate = initial_rotation;
> if (p->con_rotate == -1)
> @@ -1024,7 +1009,7 @@ static void fbcon_init(struct vc_data *vc, int init)
> return;
>
> if (!info->fbcon_par)
> - con2fb_acquire_newinfo(vc, info, vc->vc_num, -1);
> + con2fb_acquire_newinfo(vc, info, vc->vc_num);
>
> /* If we are not the first console on this
> fb, copy the font from that console */
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2022-02-10 14:16 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 21:08 [PATCH v2 00/19] fbcon patches, take two Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 01/19] fbcon: delete a few unneeded forward decl Daniel Vetter
2022-02-10 11:17 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 02/19] fbcon: Move fbcon_bmove(_rec) functions Daniel Vetter
2022-02-08 23:06 ` Javier Martinez Canillas
2022-02-10 11:17 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 03/19] fbcon: Introduce wrapper for console->fb_info lookup Daniel Vetter
2022-02-10 11:18 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 04/19] fbcon: delete delayed loading code Daniel Vetter
2022-02-10 11:20 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 05/19] fbdev/sysfs: Fix locking Daniel Vetter
2022-02-10 11:22 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 06/19] fbcon: Use delayed work for cursor Daniel Vetter
2022-02-08 23:59 ` Javier Martinez Canillas
2022-02-10 11:37 ` Thomas Zimmermann
2022-02-10 11:43 ` Tetsuo Handa
2022-04-05 20:54 ` Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 07/19] fbcon: Replace FBCON_FLAGS_INIT with a boolean Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 08/19] fb: Delete fb_info->queue Daniel Vetter
2022-02-10 11:38 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 09/19] fbcon: Extract fbcon_open/release helpers Daniel Vetter
2022-02-10 11:46 ` Thomas Zimmermann
2022-04-05 8:45 ` Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 10/19] fbcon: Ditch error handling for con2fb_release_oldinfo Daniel Vetter
2022-02-10 14:14 ` Thomas Zimmermann
2022-02-08 21:08 ` [PATCH v2 11/19] fbcon: move more common code into fb_open() Daniel Vetter
2022-02-10 14:16 ` Thomas Zimmermann [this message]
2022-02-08 21:08 ` [PATCH v2 12/19] fbcon: use lock_fb_info in fbcon_open/release Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 13/19] fbcon: Consistently protect deferred_takeover with console_lock() Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 14/19] fbcon: Move console_lock for register/unlink/unregister Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 15/19] fbcon: Move more code into fbcon_release Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 16/19] fbcon: untangle fbcon_exit Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 17/19] fbcon: Maintain a private array of fb_info Daniel Vetter
2022-02-08 21:08 ` [PATCH v2 18/19] Revert "fbdev: Prevent probing generic drivers if a FB is already registered" Daniel Vetter
2022-02-09 0:19 ` Javier Martinez Canillas
2022-04-05 8:36 ` Daniel Vetter
2022-04-05 8:40 ` Daniel Vetter
2022-04-05 9:19 ` Javier Martinez Canillas
2022-04-05 9:24 ` Daniel Vetter
2022-04-05 9:52 ` Javier Martinez Canillas
2022-04-05 10:34 ` Daniel Vetter
2022-04-05 13:24 ` Geert Uytterhoeven
2022-04-05 13:33 ` Greg KH
2022-04-05 16:12 ` Daniel Vetter
2022-04-05 16:44 ` Greg KH
2022-04-05 17:29 ` Daniel Vetter
2022-04-07 17:26 ` Greg KH
2022-04-05 13:25 ` Javier Martinez Canillas
2022-02-08 21:08 ` [PATCH v2 19/19] fbdev: Make registered_fb[] private to fbmem.c Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37c0fa2d-1dfa-62b2-ec06-9f9be492d7aa@suse.de \
--to=tzimmermann@suse.de \
--cc=cssk@net-c.es \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=ducheng2@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).