diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2023-12-06 14:50:29 +0100 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2023-12-18 11:26:34 +0100 |
commit | 0f7c246235a0639d90b5380277a43c853ba73681 (patch) | |
tree | 8011a84472d4f7f95ad324f33242e309fe3e39ac /drivers/video | |
parent | 3218286bbb78cac3dde713514529e0480d678173 (diff) | |
download | linux-0f7c246235a0639d90b5380277a43c853ba73681.tar.gz |
fbdev/vesafb: 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 vesafb can modify it at
will.
v2:
* comment on devm_kmemdup() usage (Javier)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231206135153.2599-5-tzimmermann@suse.de
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/vesafb.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index ea89accbec385..8ab64ae4cad3e 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c @@ -243,7 +243,7 @@ static int vesafb_setup(char *options) static int vesafb_probe(struct platform_device *dev) { - struct screen_info *si = &screen_info; + struct screen_info *si; struct fb_info *info; struct vesafb_par *par; int i, err; @@ -252,6 +252,18 @@ static int vesafb_probe(struct platform_device *dev) unsigned int size_total; char *option = NULL; + /* + * 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; + /* ignore error return of fb_get_options */ fb_get_options("vesafb", &option); vesafb_setup(option); |