Skip to content

Commit 32dfb61

Browse files
Giovanni Di Santihdeller
authored andcommitted
fbdev: kyro: Use devm_ioremap_wc() for screen mem
Replace the manual pci_ioremap_wc() call for mapping screen memory with the device-managed devm_ioremap_wc() variant. This simplifies the driver's resource management by ensuring the memory is automatically unmapped when the driver detaches from the device. Signed-off-by: Giovanni Di Santi <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent e0bf12a commit 32dfb61

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/video/fbdev/kyro/fbdev.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,8 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
706706
if (!currentpar->regbase)
707707
goto out_free_fb;
708708

709-
info->screen_base = pci_ioremap_wc_bar(pdev, 0);
709+
info->screen_base = devm_ioremap_wc(&pdev->dev, kyro_fix.smem_start,
710+
kyro_fix.smem_len);
710711
if (!info->screen_base)
711712
goto out_free_fb;
712713

@@ -743,7 +744,7 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
743744
fb_memset_io(info->screen_base, 0, size);
744745

745746
if (register_framebuffer(info) < 0)
746-
goto out_unmap;
747+
goto out_free_fb;
747748

748749
fb_info(info, "%s frame buffer device, at %dx%d@%d using %ldk/%ldk of VRAM\n",
749750
info->fix.id,
@@ -754,8 +755,6 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
754755

755756
return 0;
756757

757-
out_unmap:
758-
iounmap(info->screen_base);
759758
out_free_fb:
760759
framebuffer_release(info);
761760

@@ -777,8 +776,6 @@ static void kyrofb_remove(struct pci_dev *pdev)
777776
deviceInfo.ulNextFreeVidMem = 0;
778777
deviceInfo.ulOverlayOffset = 0;
779778

780-
iounmap(info->screen_base);
781-
782779
arch_phys_wc_del(par->wc_cookie);
783780

784781
unregister_framebuffer(info);

0 commit comments

Comments
 (0)