Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <giovanni.disanti.lkl@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Giovanni Di Santi and committed by
Helge Deller
32dfb611 e0bf12a4

+3 -6
+3 -6
drivers/video/fbdev/kyro/fbdev.c
··· 706 706 if (!currentpar->regbase) 707 707 goto out_free_fb; 708 708 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); 710 711 if (!info->screen_base) 711 712 goto out_free_fb; 712 713 ··· 744 743 fb_memset_io(info->screen_base, 0, size); 745 744 746 745 if (register_framebuffer(info) < 0) 747 - goto out_unmap; 746 + goto out_free_fb; 748 747 749 748 fb_info(info, "%s frame buffer device, at %dx%d@%d using %ldk/%ldk of VRAM\n", 750 749 info->fix.id, ··· 755 754 756 755 return 0; 757 756 758 - out_unmap: 759 - iounmap(info->screen_base); 760 757 out_free_fb: 761 758 framebuffer_release(info); 762 759 ··· 775 776 776 777 deviceInfo.ulNextFreeVidMem = 0; 777 778 deviceInfo.ulOverlayOffset = 0; 778 - 779 - iounmap(info->screen_base); 780 779 781 780 arch_phys_wc_del(par->wc_cookie); 782 781