[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3ebac271-1276-8132-6175-ca95a26cfcbb@suse.de>
Date: Thu, 9 Jun 2022 13:49:45 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Javier Martinez Canillas <javierm@...hat.com>,
linux-kernel@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org, Laszlo Ersek <lersek@...hat.com>,
Alex Williamson <alex.williamson@...hat.com>,
Gerd Hoffmann <kraxel@...hat.com>, kvm@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Daniel Vetter <daniel.vetter@...ll.ch>,
kernel test robot <lkp@...el.com>,
Jens Frederich <jfrederich@...il.com>,
Jon Nettleton <jon.nettleton@...il.com>,
linux-staging@...ts.linux.dev,
Daniel Vetter <daniel.vetter@...el.com>,
Daniel Vetter <daniel@...ll.ch>, Helge Deller <deller@....de>,
Matthew Wilcox <willy@...radead.org>,
Sam Ravnborg <sam@...nborg.org>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Zhen Lei <thunder.leizhen@...wei.com>,
Alex Deucher <alexander.deucher@....com>,
Xiyu Yang <xiyuyang19@...an.edu.cn>,
linux-fbdev@...r.kernel.org, Zheyu Ma <zheyuma97@...il.com>,
Guenter Roeck <linux@...ck-us.net>
Subject: Re: [PATCH v6 5/5] fbdev: Make registered_fb[] private to fbmem.c
Hi Javier
Am 07.06.22 um 20:23 schrieb Javier Martinez Canillas:
> From: Daniel Vetter <daniel.vetter@...ll.ch>
>
> Well except when the olpc dcon fbdev driver is enabled, that thing
> digs around in there in rather unfixable ways.
There is fb_client_register() to set up a 'client' on top of an fbdev.
The client would then get messages about modesetting, blanks, removals,
etc. But you'd probably need an OLPC to convert dcon, and the mechanism
itself is somewhat unloved these days.
Your patch complicates the fbdev code AFAICT. So I'd either drop it or,
even better, build a nicer interface for dcon.
The dcon driver appears to look only at the first entry. Maybe add
fb_info_get_by_index() and fb_info_put() and export those. They would be
trivial wrappers somewhere in fbmem.c:
#if IS_ENABLED(CONFIG_FB_OLPC_DCON)
struct fb_info *fb_info_get_by_index(unsigned int index)
{
return get_fb_info(index);
}
EXPORT_SYMBOL()
void fb_info_put(struct fb_info *fb_info)
{
put_fb_info(fb_info);
}
EXPORT_SYMBOL()
#endif
In dcon itself, using the new interfaces will actually acquire a
reference to keep the display alive. The code at [1] could be replaced.
And a call to fb_info_put() needs to go into dcon_remove(). [2]
Best regards
Thomas
[1]
https://elixir.bootlin.com/linux/v5.18.2/source/drivers/staging/olpc_dcon/olpc_dcon.c#L605
[2]
https://elixir.bootlin.com/linux/v5.18.2/source/drivers/staging/olpc_dcon/olpc_dcon.c#L688
>
> Cc oldc_dcon maintainers as fyi.
>
> v2: I typoed the config name (0day)
>
> Cc: kernel test robot <lkp@...el.com>
> Cc: Jens Frederich <jfrederich@...il.com>
> Cc: Jon Nettleton <jon.nettleton@...il.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: linux-staging@...ts.linux.dev
> Signed-off-by: Daniel Vetter <daniel.vetter@...el.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@...ll.ch>
> Reviewed-by: Javier Martinez Canillas <javierm@...hat.com>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: Helge Deller <deller@....de>
> Cc: Matthew Wilcox <willy@...radead.org>
> Cc: Sam Ravnborg <sam@...nborg.org>
> Cc: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
> Cc: Zhen Lei <thunder.leizhen@...wei.com>
> Cc: Alex Deucher <alexander.deucher@....com>
> Cc: Xiyu Yang <xiyuyang19@...an.edu.cn>
> Cc: linux-fbdev@...r.kernel.org
> Cc: Zheyu Ma <zheyuma97@...il.com>
> Cc: Guenter Roeck <linux@...ck-us.net>
> Signed-off-by: Javier Martinez Canillas <javierm@...hat.com>
> ---
>
> (no changes since v1)
>
> drivers/video/fbdev/core/fbmem.c | 8 ++++++--
> include/linux/fb.h | 7 +++----
> 2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index e0720fef0ee6..bdb08b665b43 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -50,10 +50,14 @@
> static DEFINE_MUTEX(registration_lock);
>
> struct fb_info *registered_fb[FB_MAX] __read_mostly;
> -EXPORT_SYMBOL(registered_fb);
> -
> int num_registered_fb __read_mostly;
> +#if IS_ENABLED(CONFIG_FB_OLPC_DCON)
> +EXPORT_SYMBOL(registered_fb);
> EXPORT_SYMBOL(num_registered_fb);
> +#endif
> +#define for_each_registered_fb(i) \
> + for (i = 0; i < FB_MAX; i++) \
> + if (!registered_fb[i]) {} else
>
> bool fb_center_logo __read_mostly;
>
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index bbe1e4571899..c563e24b6293 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -632,16 +632,15 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
> extern int fb_get_options(const char *name, char **option);
> extern int fb_new_modelist(struct fb_info *info);
>
> +#if IS_ENABLED(CONFIG_FB_OLPC_DCON)
> extern struct fb_info *registered_fb[FB_MAX];
> +
> extern int num_registered_fb;
> +#endif
> extern bool fb_center_logo;
> extern int fb_logo_count;
> extern struct class *fb_class;
>
> -#define for_each_registered_fb(i) \
> - for (i = 0; i < FB_MAX; i++) \
> - if (!registered_fb[i]) {} else
> -
> static inline void lock_fb_info(struct fb_info *info)
> {
> mutex_lock(&info->lock);
--
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
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists