fbdev: goldfishfb: use devm_platform_ioremap_resource()
PATCH 1/1 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.
--- drivers/video/fbdev/goldfishfb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/video/fbdev/goldfishfb.c +3 -11
@@ -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 @@ static int goldfish_fb_probe(struct platform_device *pdev) 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); }
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260303-master-341e700a2699
Best regards,
Signature · 1 line
Amin GATTOUT <[email protected]>
Am 03.03.26 um 13:22 schrieb Amin GATTOUT:
Quoted 5 lines
Replace the open-coded
platform_get_resource()+ioremap()pair withdevm_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 <[email protected]>
Quoted 56 lines
--- drivers/video/fbdev/goldfishfb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)drivers/video/fbdev/goldfishfb.c +3
-12@@ -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 @@ static int goldfish_fb_probe(struct platform_device *pdev) 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); } ---base-commit:
11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260303-master-341e700a2699Best regards,
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
Quoted 12 lines · Thomas Zimmermann
Am 03.03.26 um 13:22 schrieb Amin GATTOUT:
Quoted 5 lines
Replace the open-coded
platform_get_resource()+ioremap()pair withdevm_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 <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>Quoted 3 lines
---
drivers/video/fbdev/goldfishfb.c| 14 +++-----------1 file changed, 3 insertions(+), 11 deletions(-)
applied to fbdev git tree.
Thanks!
Helge