Skip to content

Commit 08e583a

Browse files
tdzardbiesheuvel
authored andcommitted
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 <tzimmermann@suse.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Richard Lyu <richard.lyu@suse.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent a41e0ab commit 08e583a

6 files changed

Lines changed: 32 additions & 19 deletions

File tree

drivers/firmware/sysfb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ static struct device *sysfb_parent_dev(const struct screen_info *si)
141141

142142
static __init int sysfb_init(void)
143143
{
144-
struct screen_info *si = &sysfb_primary_display.screen;
144+
struct sysfb_display_info *dpy = &sysfb_primary_display;
145+
struct screen_info *si = &dpy->screen;
145146
struct device *parent;
146147
unsigned int type;
147148
struct simplefb_platform_data mode;
@@ -202,7 +203,7 @@ static __init int sysfb_init(void)
202203

203204
sysfb_set_efifb_fwnode(si, pd);
204205

205-
ret = platform_device_add_data(pd, si, sizeof(*si));
206+
ret = platform_device_add_data(pd, dpy, sizeof(*dpy));
206207
if (ret)
207208
goto err;
208209

drivers/gpu/drm/sysfb/efidrm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <linux/efi.h>
55
#include <linux/limits.h>
66
#include <linux/platform_device.h>
7-
#include <linux/screen_info.h>
7+
#include <linux/sysfb.h>
88

99
#include <drm/clients/drm_client_setup.h>
1010
#include <drm/drm_atomic.h>
@@ -141,6 +141,7 @@ static const struct drm_mode_config_funcs efidrm_mode_config_funcs = {
141141
static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,
142142
struct platform_device *pdev)
143143
{
144+
const struct sysfb_display_info *dpy;
144145
const struct screen_info *si;
145146
const struct drm_format_info *format;
146147
int width, height, stride;
@@ -160,9 +161,11 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,
160161
size_t nformats;
161162
int ret;
162163

163-
si = dev_get_platdata(&pdev->dev);
164-
if (!si)
164+
dpy = dev_get_platdata(&pdev->dev);
165+
if (!dpy)
165166
return ERR_PTR(-ENODEV);
167+
si = &dpy->screen;
168+
166169
if (screen_info_video_type(si) != VIDEO_TYPE_EFI)
167170
return ERR_PTR(-ENODEV);
168171

drivers/gpu/drm/sysfb/vesadrm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <linux/ioport.h>
55
#include <linux/limits.h>
66
#include <linux/platform_device.h>
7-
#include <linux/screen_info.h>
7+
#include <linux/sysfb.h>
88

99
#include <drm/clients/drm_client_setup.h>
1010
#include <drm/drm_atomic.h>
@@ -391,6 +391,7 @@ static const struct drm_mode_config_funcs vesadrm_mode_config_funcs = {
391391
static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,
392392
struct platform_device *pdev)
393393
{
394+
const struct sysfb_display_info *dpy;
394395
const struct screen_info *si;
395396
const struct drm_format_info *format;
396397
int width, height, stride;
@@ -410,9 +411,11 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,
410411
size_t nformats;
411412
int ret;
412413

413-
si = dev_get_platdata(&pdev->dev);
414-
if (!si)
414+
dpy = dev_get_platdata(&pdev->dev);
415+
if (!dpy)
415416
return ERR_PTR(-ENODEV);
417+
si = &dpy->screen;
418+
416419
if (screen_info_video_type(si) != VIDEO_TYPE_VLFB)
417420
return ERR_PTR(-ENODEV);
418421

drivers/video/fbdev/efifb.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/fb.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/printk.h>
18-
#include <linux/screen_info.h>
18+
#include <linux/sysfb.h>
1919
#include <video/vga.h>
2020
#include <asm/efi.h>
2121
#include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
@@ -345,6 +345,7 @@ ATTRIBUTE_GROUPS(efifb);
345345

346346
static int efifb_probe(struct platform_device *dev)
347347
{
348+
struct sysfb_display_info *dpy;
348349
struct screen_info *si;
349350
struct fb_info *info;
350351
struct efifb_par *par;
@@ -360,10 +361,11 @@ static int efifb_probe(struct platform_device *dev)
360361
* driver. We get a copy of the attached screen_info, so that we can
361362
* modify its values without affecting later drivers.
362363
*/
363-
si = dev_get_platdata(&dev->dev);
364-
if (!si)
364+
dpy = dev_get_platdata(&dev->dev);
365+
if (!dpy)
365366
return -ENODEV;
366-
si = devm_kmemdup(&dev->dev, si, sizeof(*si), GFP_KERNEL);
367+
368+
si = devm_kmemdup(&dev->dev, &dpy->screen, sizeof(*si), GFP_KERNEL);
367369
if (!si)
368370
return -ENOMEM;
369371

drivers/video/fbdev/vesafb.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <linux/ioport.h>
2121
#include <linux/init.h>
2222
#include <linux/platform_device.h>
23-
#include <linux/screen_info.h>
23+
#include <linux/sysfb.h>
2424
#include <linux/io.h>
2525

2626
#include <video/vga.h>
@@ -243,6 +243,7 @@ static int vesafb_setup(char *options)
243243

244244
static int vesafb_probe(struct platform_device *dev)
245245
{
246+
struct sysfb_display_info *dpy;
246247
struct screen_info *si;
247248
struct fb_info *info;
248249
struct vesafb_par *par;
@@ -257,10 +258,11 @@ static int vesafb_probe(struct platform_device *dev)
257258
* driver. We get a copy of the attached screen_info, so that we can
258259
* modify its values without affecting later drivers.
259260
*/
260-
si = dev_get_platdata(&dev->dev);
261-
if (!si)
261+
dpy = dev_get_platdata(&dev->dev);
262+
if (!dpy)
262263
return -ENODEV;
263-
si = devm_kmemdup(&dev->dev, si, sizeof(*si), GFP_KERNEL);
264+
265+
si = devm_kmemdup(&dev->dev, &dpy->screen, sizeof(*si), GFP_KERNEL);
264266
if (!si)
265267
return -ENOMEM;
266268

drivers/video/fbdev/vga16fb.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <linux/ioport.h>
2222
#include <linux/init.h>
2323
#include <linux/platform_device.h>
24-
#include <linux/screen_info.h>
24+
#include <linux/sysfb.h>
2525

2626
#include <asm/io.h>
2727
#include <video/vga.h>
@@ -1305,15 +1305,17 @@ static const struct fb_ops vga16fb_ops = {
13051305

13061306
static int vga16fb_probe(struct platform_device *dev)
13071307
{
1308+
struct sysfb_display_info *dpy;
13081309
struct screen_info *si;
13091310
struct fb_info *info;
13101311
struct vga16fb_par *par;
13111312
int i;
13121313
int ret = 0;
13131314

1314-
si = dev_get_platdata(&dev->dev);
1315-
if (!si)
1315+
dpy = dev_get_platdata(&dev->dev);
1316+
if (!dpy)
13161317
return -ENODEV;
1318+
si = &dpy->screen;
13171319

13181320
ret = check_mode_supported(si);
13191321
if (ret)

0 commit comments

Comments
 (0)