Skip to content

Commit e0bf12a

Browse files
Giovanni Di Santihdeller
authored andcommitted
fbdev: kyro: Use devm_ioremap() for mmio registers
Replace the manual ioremap() call for the MMIO registers with the device-managed devm_ioremap() 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 b56f93f commit e0bf12a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/video/fbdev/kyro/fbdev.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,14 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
701701
kyro_fix.mmio_len = pci_resource_len(pdev, 1);
702702

703703
currentpar->regbase = deviceInfo.pSTGReg =
704-
ioremap(kyro_fix.mmio_start, kyro_fix.mmio_len);
704+
devm_ioremap(&pdev->dev, kyro_fix.mmio_start,
705+
kyro_fix.mmio_len);
705706
if (!currentpar->regbase)
706707
goto out_free_fb;
707708

708709
info->screen_base = pci_ioremap_wc_bar(pdev, 0);
709710
if (!info->screen_base)
710-
goto out_unmap_regs;
711+
goto out_free_fb;
711712

712713
if (!nomtrr)
713714
currentpar->wc_cookie = arch_phys_wc_add(kyro_fix.smem_start,
@@ -755,8 +756,6 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
755756

756757
out_unmap:
757758
iounmap(info->screen_base);
758-
out_unmap_regs:
759-
iounmap(currentpar->regbase);
760759
out_free_fb:
761760
framebuffer_release(info);
762761

@@ -779,7 +778,6 @@ static void kyrofb_remove(struct pci_dev *pdev)
779778
deviceInfo.ulOverlayOffset = 0;
780779

781780
iounmap(info->screen_base);
782-
iounmap(par->regbase);
783781

784782
arch_phys_wc_del(par->wc_cookie);
785783

0 commit comments

Comments
 (0)