drm/bochs: Replace deprecated PCI implicit devres
Subsystems (4)
PATCH 1/1 drm/bochs: Replace deprecated PCI implicit devres
bochs uses pcim_enable_device(), which causes pci_request_region() to implicitly set up devres callbacks which will release the region on driver detach. Despite this, the driver calls pci_release_regions() manually on driver teardown.
Implicit devres has been deprecated in PCI in commit 81fcf28e74a3 ("PCI:
Document hybrid devres hazards").
Replace the calls to pci_request_region() with ones to always-managed pcim_request_region(). Remove the unnecessary call to pci_release_regions().
--- drivers/gpu/drm/tiny/bochs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/tiny/bochs.c +3 -3
@@ -217,7 +217,7 @@ static int bochs_hw_init(struct drm_device *dev)if (pdev->resource[2 ].flags &IORESOURCE_MEM ) {/* mmio bar with vga and bochs registers present */ -if (pci_request_region (pdev,2 ,"bochs-drm" ) !=0 ) { +if (pcim_request_region (pdev,2 ,"bochs-drm" ) !=0 ) {DRM_ERROR ("Cannot request mmio region\n" );return -EBUSY ; }
@@ -258,7 +258,7 @@ static int bochs_hw_init(struct drm_device *dev) size =min (size, mem); } -if (pci_request_region (pdev,0 ,"bochs-drm" ) !=0 ) +if (pcim_request_region (pdev,0 ,"bochs-drm" ) !=0 )DRM_WARN ("Cannot request framebuffer, boot fb still active?\n" ); bochs->fb_map =ioremap (addr, size);
@@ -302,7 +302,7 @@ static void bochs_hw_fini(struct drm_device *dev)release_region (VBE_DISPI_IOPORT_INDEX ,2 );if (bochs->fb_map)iounmap (bochs->fb_map); -pci_release_regions (to_pci_dev (dev->dev)); +drm_edid_free (bochs->drm_edid); }
Signature · 1 line
2.47.0
Quoted 5 lines · Philipp Stanner
bochs uses
pcim_enable_device(), which causespci_request_region()to implicitly set up devres callbacks which will release the region on driver detach. Despite this, the driver callspci_release_regions()manually on driver teardown.
Quoted 7 lines
Implicit devres has been deprecated in PCI in commit
81fcf28e74a3("PCI:
Document hybrid devres hazards").Replace the calls to
pci_request_region()with ones to always-managedpcim_request_region(). Remove the unnecessary call topci_release_regions().
Just saw that this patch is still floating around. Anyone feeling responsible for bochs who could review this?
P.
Quoted 40 lines
Signed-off-by Philipp Stanner <[email protected]>---
drivers/gpu/drm/tiny/bochs.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/tiny/bochs.c +0
-0@@ -217,7 +217,7 @@ static int bochs_hw_init(struct drm_device *dev)
if (pdev->resource[2].flags &IORESOURCE_MEM) { /* mmio bar with vga and bochs registers present */drivers/gpu/drm/tiny/bochs.c +1
-1-if (pci_request_region (pdev,2 ,"bochs-drm" ) !=0 ) { +if (pcim_request_region (pdev,2 ,"bochs-drm" ) !=0 ){
DRM_ERROR("Cannot request mmio region\n"); return-EBUSY;
}drivers/gpu/drm/tiny/bochs.c +0
-0@@ -258,7 +258,7 @@ static int bochs_hw_init(struct drm_device *dev) size = min(size, mem); }drivers/gpu/drm/tiny/bochs.c +1
-1-if (pci_request_region (pdev,0 ,"bochs-drm" ) !=0 ) +if (pcim_request_region (pdev,0 ,"bochs-drm" ) !=0 )
DRM_WARN("Cannot request framebuffer, boot fb still active?\n");
bochs->fb_map=ioremap(addr, size);drivers/gpu/drm/tiny/bochs.c +1
-1@@ -302,7 +302,7 @@ static void bochs_hw_fini(struct drm_device *dev) release_region(VBE_DISPI_IOPORT_INDEX, 2); if (bochs->fb_map) iounmap(bochs->fb_map); -pci_release_regions (to_pci_dev (dev->dev)); + drm_edid_free(bochs->drm_edid); }
Thomas Zimmermann
maintainerHi
Am 20.11.24 um 15:30 schrieb Philipp Stanner:
Quoted 10 lines · Philipp Stanner
Quoted 9 lines
bochs uses
pcim_enable_device(), which causespci_request_region()to implicitly set up devres callbacks which will release the region on driver detach. Despite this, the driver callspci_release_regions()manually on driver teardown.Implicit devres has been deprecated in PCI in commit
81fcf28e74a3("PCI:
Document hybrid devres hazards").
Quoted 5 lines
Quoted 3 lines
Replace the calls to
pci_request_region()with ones to always-managedpcim_request_region(). Remove the unnecessary call topci_release_regions().Just saw that this patch is still floating around. Anyone feeling responsible for bochs who could review this?
It looks like this patch is already outdated. There's been
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/58e980c16815ce4ff8a5e036a126358afceca538
in drm-misc-next for some time.
Best regards
Thomas
Quoted 44 lines
P.
Quoted 39 lines
Signed-off-by Philipp Stanner <[email protected]>--- drivers/gpu/drm/tiny/bochs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/tiny/bochs.c +1
-1@@ -217,7 +217,7 @@ static int bochs_hw_init(struct drm_device *dev) if (pdev->resource[2].flags & IORESOURCE_MEM) { /* mmio bar with vga and bochs registers present */ -if (pci_request_region (pdev,2 ,"bochs-drm" ) !=0 ) { +if (pcim_request_region (pdev,2 ,"bochs-drm" ) !=0 ) { DRM_ERROR("Cannot request mmio region\n"); return -EBUSY;}
drivers/gpu/drm/tiny/bochs.c +1
-1@@ -258,7 +258,7 @@ static int bochs_hw_init(struct drm_device *dev) size = min(size, mem); } - if (pci_request_region(pdev, 0, "bochs-drm") != 0) + if (pcim_request_region(pdev, 0, "bochs-drm") != 0) DRM_WARN("Cannot request framebuffer, boot fb still active?\n");
bochs->fb_map=ioremap(addr, size);drivers/gpu/drm/tiny/bochs.c +1
-1@@ -302,7 +302,7 @@ static void bochs_hw_fini(struct drm_device *dev) release_region(VBE_DISPI_IOPORT_INDEX, 2); if (bochs->fb_map) iounmap(bochs->fb_map); -pci_release_regions (to_pci_dev (dev->dev)); + drm_edid_free(bochs->drm_edid); }
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)