summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-12-06 14:50:27 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2023-12-18 11:26:13 +0100
commitb9cfd1d271ab51d677cd16b02b74267b5bac6508 (patch)
tree788c626817ceabd5e018d6138a595e99bb1c80a4
parentfbdev/efifb: Replace references to global screen_info by local pointer (diff)
downloadlinux-b9cfd1d271ab51d677cd16b02b74267b5bac6508.tar.xz
linux-b9cfd1d271ab51d677cd16b02b74267b5bac6508.zip
fbdev/efifb: Use screen_info pointer from device
Use the screen_info instance from the device instead of dereferencing the global screen_info state. Decouples the driver from per-architecture code. Duplicated the screen_info data, so that efifb can modify it at will. v2: * comment on devm_kmemdup() usage (Javier) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Sui Jingfeng <sui.jingfeng@linux.dev> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231206135153.2599-3-tzimmermann@suse.de
-rw-r--r--drivers/video/fbdev/efifb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 6b3b5cca1d41..10fc14ad5d12 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -359,7 +359,7 @@ static u64 bar_offset;
static int efifb_probe(struct platform_device *dev)
{
- struct screen_info *si = &screen_info;
+ struct screen_info *si;
struct fb_info *info;
struct efifb_par *par;
int err, orientation;
@@ -369,6 +369,18 @@ static int efifb_probe(struct platform_device *dev)
char *option = NULL;
efi_memory_desc_t md;
+ /*
+ * If we fail probing the device, the kernel might try a different
+ * driver. We get a copy of the attached screen_info, so that we can
+ * modify its values without affecting later drivers.
+ */
+ si = dev_get_platdata(&dev->dev);
+ if (!si)
+ return -ENODEV;
+ si = devm_kmemdup(&dev->dev, si, sizeof(*si), GFP_KERNEL);
+ if (!si)
+ return -ENOMEM;
+
if (si->orig_video_isVGA != VIDEO_TYPE_EFI || pci_dev_disabled)
return -ENODEV;