From 08e583ad68577ff5135d2b6fad1d3b4b400074a5 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Nov 2025 17:03:22 +0100 Subject: [PATCH] sysfb: Pass sysfb_primary_display to devices Instead of screen_info, store a copy of sysfb_primary_display as device data. Pick it up in drivers. Later changes will add additional data to the display info, such as EDID information. Signed-off-by: Thomas Zimmermann Acked-by: Arnd Bergmann Acked-by: Ard Biesheuvel Reviewed-by: Richard Lyu Signed-off-by: Ard Biesheuvel --- drivers/firmware/sysfb.c | 5 +++-- drivers/gpu/drm/sysfb/efidrm.c | 9 ++++++--- drivers/gpu/drm/sysfb/vesadrm.c | 9 ++++++--- drivers/video/fbdev/efifb.c | 10 ++++++---- drivers/video/fbdev/vesafb.c | 10 ++++++---- drivers/video/fbdev/vga16fb.c | 8 +++++--- 6 files changed, 32 insertions(+), 19 deletions(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 1f671f9219b07..8833582c18830 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -141,7 +141,8 @@ static struct device *sysfb_parent_dev(const struct screen_info *si) static __init int sysfb_init(void) { - struct screen_info *si = &sysfb_primary_display.screen; + struct sysfb_display_info *dpy = &sysfb_primary_display; + struct screen_info *si = &dpy->screen; struct device *parent; unsigned int type; struct simplefb_platform_data mode; @@ -202,7 +203,7 @@ static __init int sysfb_init(void) sysfb_set_efifb_fwnode(si, pd); - ret = platform_device_add_data(pd, si, sizeof(*si)); + ret = platform_device_add_data(pd, dpy, sizeof(*dpy)); if (ret) goto err; diff --git a/drivers/gpu/drm/sysfb/efidrm.c b/drivers/gpu/drm/sysfb/efidrm.c index 1b683d55d6ea4..29533ae8fbbf2 100644 --- a/drivers/gpu/drm/sysfb/efidrm.c +++ b/drivers/gpu/drm/sysfb/efidrm.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -141,6 +141,7 @@ static const struct drm_mode_config_funcs efidrm_mode_config_funcs = { static struct efidrm_device *efidrm_device_create(struct drm_driver *drv, struct platform_device *pdev) { + const struct sysfb_display_info *dpy; const struct screen_info *si; const struct drm_format_info *format; int width, height, stride; @@ -160,9 +161,11 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv, size_t nformats; int ret; - si = dev_get_platdata(&pdev->dev); - if (!si) + dpy = dev_get_platdata(&pdev->dev); + if (!dpy) return ERR_PTR(-ENODEV); + si = &dpy->screen; + if (screen_info_video_type(si) != VIDEO_TYPE_EFI) return ERR_PTR(-ENODEV); diff --git a/drivers/gpu/drm/sysfb/vesadrm.c b/drivers/gpu/drm/sysfb/vesadrm.c index 7b7b5ba26317d..16fc223f8c5bc 100644 --- a/drivers/gpu/drm/sysfb/vesadrm.c +++ b/drivers/gpu/drm/sysfb/vesadrm.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -391,6 +391,7 @@ static const struct drm_mode_config_funcs vesadrm_mode_config_funcs = { static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv, struct platform_device *pdev) { + const struct sysfb_display_info *dpy; const struct screen_info *si; const struct drm_format_info *format; int width, height, stride; @@ -410,9 +411,11 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv, size_t nformats; int ret; - si = dev_get_platdata(&pdev->dev); - if (!si) + dpy = dev_get_platdata(&pdev->dev); + if (!dpy) return ERR_PTR(-ENODEV); + si = &dpy->screen; + if (screen_info_video_type(si) != VIDEO_TYPE_VLFB) return ERR_PTR(-ENODEV); diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 0e1bd3dba2554..47ebc0107209e 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include