From 8d10dd8907e1c0e619d5e785365875bb758d43ce Mon Sep 17 00:00:00 2001 From: Amin GATTOUT Date: Tue, 3 Mar 2026 13:22:24 +0100 Subject: [PATCH 01/40] fbdev: goldfishfb: use devm_platform_ioremap_resource() Replace the open-coded platform_get_resource() + ioremap() pair with devm_platform_ioremap_resource(), which requests the memory region and maps it in a single call, with automatic cleanup on device removal. Signed-off-by: Amin GATTOUT Reviewed-by: Thomas Zimmermann Signed-off-by: Helge Deller --- drivers/video/fbdev/goldfishfb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c index ffe33a36b944..c9871281bc1d 100644 --- a/drivers/video/fbdev/goldfishfb.c +++ b/drivers/video/fbdev/goldfishfb.c @@ -174,7 +174,6 @@ static const struct fb_ops goldfish_fb_ops = { static int goldfish_fb_probe(struct platform_device *pdev) { int ret; - struct resource *r; struct goldfish_fb *fb; size_t framesize; u32 width, height; @@ -189,14 +188,9 @@ static int goldfish_fb_probe(struct platform_device *pdev) init_waitqueue_head(&fb->wait); platform_set_drvdata(pdev, fb); - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (r == NULL) { - ret = -ENODEV; - goto err_no_io_base; - } - fb->reg_base = ioremap(r->start, PAGE_SIZE); - if (fb->reg_base == NULL) { - ret = -ENOMEM; + fb->reg_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(fb->reg_base)) { + ret = PTR_ERR(fb->reg_base); goto err_no_io_base; } @@ -273,7 +267,6 @@ err_fb_set_var_failed: fb->fb.fix.smem_start); err_alloc_screen_base_failed: err_no_irq: - iounmap(fb->reg_base); err_no_io_base: kfree(fb); err_fb_alloc_failed: @@ -291,7 +284,6 @@ static void goldfish_fb_remove(struct platform_device *pdev) dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base, fb->fb.fix.smem_start); - iounmap(fb->reg_base); kfree(fb); } From f630c79accf67ad3e0f74fdc7c705f5401bf8658 Mon Sep 17 00:00:00 2001 From: Amin GATTOUT Date: Wed, 4 Mar 2026 18:10:42 +0100 Subject: [PATCH 02/40] fbdev: wmt_ge_rops: use devm_platform_ioremap_resource() Replace the open-coded platform_get_resource() + ioremap() pair with devm_platform_ioremap_resource(), which requests the memory region and maps it in a single call, with automatic cleanup on device removal. Also reset regbase to NULL in remove() so that the single-instance guard in probe() works correctly if the device is re-probed. Signed-off-by: Amin GATTOUT Signed-off-by: Helge Deller --- drivers/video/fbdev/wmt_ge_rops.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/video/fbdev/wmt_ge_rops.c b/drivers/video/fbdev/wmt_ge_rops.c index 2bd26bfb2b46..0cf78bcadfa6 100644 --- a/drivers/video/fbdev/wmt_ge_rops.c +++ b/drivers/video/fbdev/wmt_ge_rops.c @@ -148,25 +148,15 @@ EXPORT_SYMBOL_GPL(wmt_ge_sync); static int wmt_ge_rops_probe(struct platform_device *pdev) { - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no I/O memory resource defined\n"); - return -ENODEV; - } - /* Only one ROP engine is presently supported. */ if (unlikely(regbase)) { WARN_ON(1); return -EBUSY; } - regbase = ioremap(res->start, resource_size(res)); - if (regbase == NULL) { - dev_err(&pdev->dev, "failed to map I/O memory\n"); - return -EBUSY; - } + regbase = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regbase)) + return PTR_ERR(regbase); writel(1, regbase + GE_ENABLE_OFF); printk(KERN_INFO "Enabled support for WMT GE raster acceleration\n"); @@ -176,7 +166,7 @@ static int wmt_ge_rops_probe(struct platform_device *pdev) static void wmt_ge_rops_remove(struct platform_device *pdev) { - iounmap(regbase); + regbase = NULL; } static const struct of_device_id wmt_dt_ids[] = { From d95beb0a373ae8b0b213a1f564c735e8ecfa54e2 Mon Sep 17 00:00:00 2001 From: Daniel Palmer Date: Fri, 27 Feb 2026 21:25:00 +0900 Subject: [PATCH 03/40] fbdev: tdfxfb: Make the VGA register initialisation a bit more obvious For a while I was trying to get this working on m68k, for some reason the card doesn't display anything if it's own video BIOS didn't run.. Anyhow, I spent a long time looking up what each of these offsets were to work out what the code is configuring and eventually replaced them with the human readable defines in video/vga.h. Functionally there is no change but maybe it makes it a bit easier to look at for the next person that finds themselves in here. Tested on a real voodoo 3 on x86_64. Signed-off-by: Daniel Palmer Signed-off-by: Helge Deller --- drivers/video/fbdev/tdfxfb.c | 103 ++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c index 51ebe78359ec..7606e024fa3f 100644 --- a/drivers/video/fbdev/tdfxfb.c +++ b/drivers/video/fbdev/tdfxfb.c @@ -77,6 +77,7 @@ #include #include