drm/vmwgfx: Use non-hybrid PCI devres API
Subsystems (3)
PATCH v3 1/1 drm/vmwgfx: Use non-hybrid PCI devres API
vmwgfx enables its PCI device with pcim_enable_device(). This, implicitly, switches the function pci_request_regions() into managed mode, where it becomes a devres function.
The PCI subsystem wants to remove this hybrid nature from its interfaces. To do so, users of the aforementioned combination of functions must be ported to non-hybrid functions.
Moreover, since both functions are already managed in this driver, the calls to pci_release_regions() are unnecessary.
Remove the calls to pci_release_regions().
Replace the call to sometimes-managed pci_request_regions() with one to always-managed pcim_request_all_regions().
---
Changes in v3:
- Use the correct driver name in the commit message. (Zack)
Changes in v2:
- Fix unused variable error.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +3 -11
@@ -713,7 +713,7 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,pci_set_master (pdev); - ret =pci_request_regions (pdev,"vmwgfx probe" ); + ret =pcim_request_all_regions (pdev,"vmwgfx probe" );if (ret)return ret;
@@ -733,7 +733,6 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,if (!dev->rmmio) {drm_err (&dev->drm,"Failed mapping registers mmio memory.\n" ); -pci_release_regions (pdev);return -ENOMEM ; } }else if (pci_id ==VMWGFX_PCI_ID_SVGA2 ) {
@@ -754,11 +753,9 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,if (IS_ERR (dev->fifo_mem)) {drm_err (&dev->drm,"Failed mapping FIFO memory.\n" ); -pci_release_regions (pdev);return PTR_ERR (dev->fifo_mem); } }else { -pci_release_regions (pdev);return -EINVAL ; }
@@ -836,7 +833,6 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)int ret;enum vmw_res_type i;bool refuse_dma = false; -struct pci_dev *pdev =to_pci_dev (dev_priv->drm.dev);vmw_sw_context_init (dev_priv);
@@ -852,7 +848,7 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)return ret; ret =vmw_detect_version (dev_priv);if (ret) - goto out_no_pci_or_version; +return ret;for (i = vmw_res_context; i < vmw_res_max; ++i) {
@@ -1152,15 +1148,13 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)if (dev_priv->ctx.staged_bindings)vmw_binding_state_free (dev_priv->ctx.staged_bindings); -out_no_pci_or_version: -pci_release_regions (pdev); +return ret; }static void vmw_driver_unload (struct drm_device *dev) {struct vmw_private *dev_priv =vmw_priv (dev); -struct pci_dev *pdev =to_pci_dev (dev->dev);enum vmw_res_type i;unregister_pm_notifier (&dev_priv->pm_nb);
@@ -1196,8 +1190,6 @@ static void vmw_driver_unload(struct drm_device *dev)idr_destroy (&dev_priv->res_idr[i]);vmw_mksstat_remove_all (dev_priv); - -pci_release_regions (pdev); } static void vmw_postclose(struct drm_device *dev,
Signature · 1 line
2.49.0
Zack Rusin
maintainerQuoted 17 lines · Philipp Stanner
vmwgfx enables its PCI device with
pcim_enable_device(). This, implicitly, switches the functionpci_request_regions()into managed mode, where it becomes a devres function.The PCI subsystem wants to remove this hybrid nature from its interfaces. To do so, users of the aforementioned combination of functions must be ported to non-hybrid functions.
Moreover, since both functions are already managed in this driver, the calls to
pci_release_regions()are unnecessary.Remove the calls to
pci_release_regions().Replace the call to sometimes-managed
pci_request_regions()with one to always-managedpcim_request_all_regions().
Quoted 8 lines
Signed-off-by Philipp Stanner <[email protected]>Reviewed-by Zack Rusin <[email protected]>---
Changes in v3:
- Use the correct driver name in the commit message. (Zack)Changes in v2:
- Fix unused variable error.
Thank you! I've pushed it to drm-misc-next.
z