fbdev: q40fb: request memory region
PATCH 1/1 fbdev: q40fb: request memory region
The q40fb driver uses a fixed physical address but never reserves the corresponding I/O region. Reserve the range as suggested in Documentation/gpu/todo.rst ("Request memory regions in all fbdev drivers").
If the memory cannot be reserved, fail probe with -EBUSY to avoid conflicting with another user of the same address.
---
Testing: This patch is sent as RFT since Q40 hardware is unavilable and QEMU does not emulated a Q40 platform. The change is therefore compile-tested only.
drivers/video/fbdev/q40fb.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/video/fbdev/q40fb.c +7 -0
@@ -101,6 +101,13 @@ static int q40fb_probe(struct platform_device *dev) info->par =NULL ; info->screen_base = (char *) q40fb_fix.smem_start; +if (!request_mem_region (q40fb_fix.smem_start, q40fb_fix.smem_len, +"q40fb" )) { +dev_err (&dev->dev,"cannot reserve video memory at 0x%lx\n" , + q40fb_fix.smem_start); +return -EBUSY ; + } +if (fb_alloc_cmap (&info->cmap,256 ,0 ) <0 ) {framebuffer_release (info);return -ENOMEM ;
Signature · 1 line
2.43.0
Hi Sukrut,
CC linux-m68k
Quoted 8 lines · Sukrut Heroorkar
The q40fb driver uses a fixed physical address but never reserves the corresponding I/O region. Reserve the range as suggested in
Documentation/gpu/todo.rst("Request memory regions in all fbdev drivers").If the memory cannot be reserved, fail probe with
-EBUSYto avoid conflicting with another user of the same address.Signed-off-by Sukrut Heroorkar <[email protected]>
Thanks for your patch!
Quoted 4 lines
---
Testing: This patch is sent as RFT since Q40 hardware is unavilable and QEMU does not emulated a Q40 platform. The change is therefore compile-tested only.
I would suggest not to apply this, unless it is tested on real hardware. It wouldn't be the first time an innocent-looking change like this breaks a system. See e.g.
https://lore.kernel.org/all/[email protected]
Quoted 6 lines
drivers/video/fbdev/q40fb.c +0
-0@@ -101,6 +101,13 @@ static int q40fb_probe(struct platform_device *dev) info->par =NULL ; info->screen_base = (char *) q40fb_fix.smem_start;
drivers/video/fbdev/q40fb.c static int q40fb_probe(struct platform_device *dev) · line 113
Quoted 10 lines
drivers/video/fbdev/q40fb.c +7
-0+if (!request_mem_region (q40fb_fix.smem_start, q40fb_fix.smem_len, +"q40fb" )) { +dev_err (&dev->dev,"cannot reserve video memory at 0x%lx\n" , + q40fb_fix.smem_start); +return -EBUSY ; + } +if (fb_alloc_cmap (&info->cmap,256 ,0 ) <0 ) {framebuffer_release (info);return -ENOMEM ;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Helge Deller
maintainerHi Geert & Sukrut,
Quoted 17 lines · Geert Uytterhoeven
Quoted 8 lines · Sukrut Heroorkar
The q40fb driver uses a fixed physical address but never reserves the corresponding I/O region. Reserve the range as suggested in
Documentation/gpu/todo.rst("Request memory regions in all fbdev drivers").If the memory cannot be reserved, fail probe with
-EBUSYto avoid conflicting with another user of the same address.Signed-off-by Sukrut Heroorkar <[email protected]>Thanks for your patch!
Quoted 4 lines
---
Testing: This patch is sent as RFT since Q40 hardware is unavilable and QEMU does not emulated a Q40 platform. The change is therefore compile-tested only.
Quoted 4 lines
I would suggest not to apply this, unless it is tested on real hardware. It wouldn't be the first time an innocent-looking change like this breaks a system. See e.g.
https://lore.kernel.org/all/[email protected]
Geert, that's actually my thought as well, so I'm happy you wrote down your opinion here!
By any chance, do you (or someone on this list) know of someone who has that card and might be able to test it?
Helge
Quoted 16 lines
Quoted 16 lines
drivers/video/fbdev/q40fb.c +7
-0@@ -101,6 +101,13 @@ static int q40fb_probe(struct platform_device *dev) info->par =NULL ; info->screen_base = (char *) q40fb_fix.smem_start; +if (!request_mem_region (q40fb_fix.smem_start, q40fb_fix.smem_len, +"q40fb" )) { +dev_err (&dev->dev,"cannot reserve video memory at 0x%lx\n" , + q40fb_fix.smem_start); +return -EBUSY ; + } +if (fb_alloc_cmap (&info->cmap,256 ,0 ) <0 ) {framebuffer_release (info);return -ENOMEM ;