* [PATCH] fbdev: goldfishfb: use devm_platform_ioremap_resource()
@ 2026-03-03 12:22 Amin GATTOUT
2026-03-03 12:51 ` Thomas Zimmermann
0 siblings, 1 reply; 3+ messages in thread
From: Amin GATTOUT @ 2026-03-03 12:22 UTC (permalink / raw)
To: Helge Deller; +Cc: linux-fbdev, dri-devel, linux-kernel, Amin GATTOUT
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 <amin.gattout@gmail.com>
---
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 @@ 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,
--
Amin GATTOUT <amin.gattout@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] fbdev: goldfishfb: use devm_platform_ioremap_resource()
2026-03-03 12:22 [PATCH] fbdev: goldfishfb: use devm_platform_ioremap_resource() Amin GATTOUT
@ 2026-03-03 12:51 ` Thomas Zimmermann
2026-03-03 14:07 ` Helge Deller
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2026-03-03 12:51 UTC (permalink / raw)
To: Amin GATTOUT, Helge Deller; +Cc: linux-fbdev, dri-devel, linux-kernel
Am 03.03.26 um 13:22 schrieb Amin GATTOUT:
> 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 <amin.gattout@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> 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 @@ 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,
--
--
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)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fbdev: goldfishfb: use devm_platform_ioremap_resource()
2026-03-03 12:51 ` Thomas Zimmermann
@ 2026-03-03 14:07 ` Helge Deller
0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2026-03-03 14:07 UTC (permalink / raw)
To: Thomas Zimmermann, Amin GATTOUT; +Cc: linux-fbdev, dri-devel, linux-kernel
On 3/3/26 13:51, Thomas Zimmermann wrote:
> Am 03.03.26 um 13:22 schrieb Amin GATTOUT:
>> 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 <amin.gattout@gmail.com>
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>
>> ---
>> drivers/video/fbdev/goldfishfb.c | 14 +++-----------
>> 1 file changed, 3 insertions(+), 11 deletions(-)
applied to fbdev git tree.
Thanks!
Helge
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-03 14:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 12:22 [PATCH] fbdev: goldfishfb: use devm_platform_ioremap_resource() Amin GATTOUT
2026-03-03 12:51 ` Thomas Zimmermann
2026-03-03 14:07 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox