All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] drivers/firmware: Move sysfb_init() from device_initcall to subsys_initcall_sync
@ 2022-07-02  9:04 Huacai Chen
  2022-07-02 11:05 ` Javier Martinez Canillas
  0 siblings, 1 reply; 3+ messages in thread
From: Huacai Chen @ 2022-07-02  9:04 UTC (permalink / raw)
  To: Daniel Vetter, Thomas Zimmermann, Javier Martinez Canillas
  Cc: dri-devel, Huacai Chen

Consider a configuration like this:
1, efifb (or simpledrm) is built-in;
2, a native display driver (such as radeon) is also built-in.

As Javier said, this is not a common configuration (the native display
driver is usually built as a module), but it can happen and cause some
trouble.

In this case, since efifb, radeon and sysfb are all in device_initcall()
level, the order in practise is like this:

efifb registered at first, but no "efi-framebuffer" device yet. radeon
registered later, and /dev/fb0 created. sysfb_init() comes at last, it
registers "efi-framebuffer" and then causes an error message "efifb: a
framebuffer is already registered". Make sysfb_init() to be subsys_
initcall_sync() can avoid this. And Javier Martinez Canillas is trying
to make a more general solution [1].

However, this patch still makes sense because it can make the screen
display as early as possible (We cannot move to subsys_initcall, since
sysfb_init() should be executed after PCI enumeration).

[1] https://lore.kernel.org/all/20220607182338.344270-1-javierm@redhat.com/

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
V2: Update commit messages.

 drivers/firmware/sysfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
index 2bfbb05f7d89..aecf91517e54 100644
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -80,4 +80,4 @@ static __init int sysfb_init(void)
 }
 
 /* must execute after PCI subsystem for EFI quirks */
-device_initcall(sysfb_init);
+subsys_initcall_sync(sysfb_init);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] drivers/firmware: Move sysfb_init() from device_initcall to subsys_initcall_sync
  2022-07-02  9:04 [PATCH V2] drivers/firmware: Move sysfb_init() from device_initcall to subsys_initcall_sync Huacai Chen
@ 2022-07-02 11:05 ` Javier Martinez Canillas
  2022-07-04  1:09   ` Huacai Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Javier Martinez Canillas @ 2022-07-02 11:05 UTC (permalink / raw)
  To: Huacai Chen, Daniel Vetter, Thomas Zimmermann; +Cc: dri-devel

Hello Huacai,

Thanks a lot for your patch.

On 7/2/22 11:04, Huacai Chen wrote:
> Consider a configuration like this:
> 1, efifb (or simpledrm) is built-in;
> 2, a native display driver (such as radeon) is also built-in.
> 
> As Javier said, this is not a common configuration (the native display
> driver is usually built as a module), but it can happen and cause some
> trouble.
> 
> In this case, since efifb, radeon and sysfb are all in device_initcall()
> level, the order in practise is like this:
> 
> efifb registered at first, but no "efi-framebuffer" device yet. radeon
> registered later, and /dev/fb0 created. sysfb_init() comes at last, it
> registers "efi-framebuffer" and then causes an error message "efifb: a
> framebuffer is already registered". Make sysfb_init() to be subsys_
> initcall_sync() can avoid this. And Javier Martinez Canillas is trying
> to make a more general solution [1].
> 
> However, this patch still makes sense because it can make the screen
> display as early as possible (We cannot move to subsys_initcall, since
> sysfb_init() should be executed after PCI enumeration).
> 
> [1] https://lore.kernel.org/all/20220607182338.344270-1-javierm@redhat.com/
>

Note that this series already landed, so you might want to refer the
relevant commit sha-1 instead, i.e:

commit 873eb3b11860 ("fbdev: Disable sysfb device registration when
removing conflicting FBs").
 
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> V2: Update commit messages.
> 
>  drivers/firmware/sysfb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
> index 2bfbb05f7d89..aecf91517e54 100644
> --- a/drivers/firmware/sysfb.c
> +++ b/drivers/firmware/sysfb.c
> @@ -80,4 +80,4 @@ static __init int sysfb_init(void)
>  }
>  
>  /* must execute after PCI subsystem for EFI quirks */
> -device_initcall(sysfb_init);
> +subsys_initcall_sync(sysfb_init);

I agree with the change and makes sense to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] drivers/firmware: Move sysfb_init() from device_initcall to subsys_initcall_sync
  2022-07-02 11:05 ` Javier Martinez Canillas
@ 2022-07-04  1:09   ` Huacai Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Huacai Chen @ 2022-07-04  1:09 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Daniel Vetter, Maling list - DRI developers, Thomas Zimmermann,
	Huacai Chen

Hi, Javier,

On Sat, Jul 2, 2022 at 7:05 PM Javier Martinez Canillas
<javierm@redhat.com> wrote:
>
> Hello Huacai,
>
> Thanks a lot for your patch.
>
> On 7/2/22 11:04, Huacai Chen wrote:
> > Consider a configuration like this:
> > 1, efifb (or simpledrm) is built-in;
> > 2, a native display driver (such as radeon) is also built-in.
> >
> > As Javier said, this is not a common configuration (the native display
> > driver is usually built as a module), but it can happen and cause some
> > trouble.
> >
> > In this case, since efifb, radeon and sysfb are all in device_initcall()
> > level, the order in practise is like this:
> >
> > efifb registered at first, but no "efi-framebuffer" device yet. radeon
> > registered later, and /dev/fb0 created. sysfb_init() comes at last, it
> > registers "efi-framebuffer" and then causes an error message "efifb: a
> > framebuffer is already registered". Make sysfb_init() to be subsys_
> > initcall_sync() can avoid this. And Javier Martinez Canillas is trying
> > to make a more general solution [1].
> >
> > However, this patch still makes sense because it can make the screen
> > display as early as possible (We cannot move to subsys_initcall, since
> > sysfb_init() should be executed after PCI enumeration).
> >
> > [1] https://lore.kernel.org/all/20220607182338.344270-1-javierm@redhat.com/
> >
>
> Note that this series already landed, so you might want to refer the
> relevant commit sha-1 instead, i.e:
>
> commit 873eb3b11860 ("fbdev: Disable sysfb device registration when
> removing conflicting FBs").
OK, I'll update the commit message again and send V3.

Huacai
>
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> > V2: Update commit messages.
> >
> >  drivers/firmware/sysfb.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
> > index 2bfbb05f7d89..aecf91517e54 100644
> > --- a/drivers/firmware/sysfb.c
> > +++ b/drivers/firmware/sysfb.c
> > @@ -80,4 +80,4 @@ static __init int sysfb_init(void)
> >  }
> >
> >  /* must execute after PCI subsystem for EFI quirks */
> > -device_initcall(sysfb_init);
> > +subsys_initcall_sync(sysfb_init);
>
> I agree with the change and makes sense to me.
>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>
> --
> Best regards,
>
> Javier Martinez Canillas
> Linux Engineering
> Red Hat
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-04 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-02  9:04 [PATCH V2] drivers/firmware: Move sysfb_init() from device_initcall to subsys_initcall_sync Huacai Chen
2022-07-02 11:05 ` Javier Martinez Canillas
2022-07-04  1:09   ` Huacai Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.