vgaarb: provide a vga_client_unregister wrapper
Add a trivial wrapper for the unregister case that sets all fields to NULL. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210716061634.2446357-6-hch@lst.de Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
6609176f56
commit
b877947586
|
@ -3802,7 +3802,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
|||
vga_switcheroo_fini_domain_pm_ops(adev->dev);
|
||||
}
|
||||
if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
|
||||
vga_client_register(adev->pdev, NULL, NULL, NULL);
|
||||
vga_client_unregister(adev->pdev);
|
||||
|
||||
if (IS_ENABLED(CONFIG_PERF_EVENTS))
|
||||
amdgpu_pmu_fini(adev);
|
||||
|
|
|
@ -136,7 +136,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
|
|||
if (ret < 0) {
|
||||
dev->irq_enabled = false;
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
vga_client_register(to_pci_dev(dev->dev), NULL, NULL, NULL);
|
||||
vga_client_unregister(to_pci_dev(dev->dev));
|
||||
free_irq(irq, dev);
|
||||
} else {
|
||||
dev->irq = irq;
|
||||
|
@ -198,7 +198,7 @@ int drm_irq_uninstall(struct drm_device *dev)
|
|||
DRM_DEBUG("irq=%d\n", dev->irq);
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
vga_client_register(to_pci_dev(dev->dev), NULL, NULL, NULL);
|
||||
vga_client_unregister(to_pci_dev(dev->dev));
|
||||
|
||||
if (dev->driver->irq_uninstall)
|
||||
dev->driver->irq_uninstall(dev);
|
||||
|
|
|
@ -158,5 +158,5 @@ void intel_vga_unregister(struct drm_i915_private *i915)
|
|||
{
|
||||
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
|
||||
|
||||
vga_client_register(pdev, NULL, NULL, NULL);
|
||||
vga_client_unregister(pdev);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ nouveau_vga_fini(struct nouveau_drm *drm)
|
|||
return;
|
||||
pdev = to_pci_dev(dev->dev);
|
||||
|
||||
vga_client_register(pdev, NULL, NULL, NULL);
|
||||
vga_client_unregister(pdev);
|
||||
|
||||
if (pci_is_thunderbolt_attached(pdev))
|
||||
return;
|
||||
|
|
|
@ -1530,7 +1530,7 @@ void radeon_device_fini(struct radeon_device *rdev)
|
|||
vga_switcheroo_unregister_client(rdev->pdev);
|
||||
if (rdev->flags & RADEON_IS_PX)
|
||||
vga_switcheroo_fini_domain_pm_ops(rdev->dev);
|
||||
vga_client_register(rdev->pdev, NULL, NULL, NULL);
|
||||
vga_client_unregister(rdev->pdev);
|
||||
if (rdev->rio_mem)
|
||||
pci_iounmap(rdev->pdev, rdev->rio_mem);
|
||||
rdev->rio_mem = NULL;
|
||||
|
|
|
@ -877,8 +877,7 @@ EXPORT_SYMBOL(vga_set_legacy_decoding);
|
|||
* This function does not check whether a client for @pdev has been registered
|
||||
* already.
|
||||
*
|
||||
* To unregister just call this function with @irq_set_state and @set_vga_decode
|
||||
* both set to NULL for the same @pdev as originally used to register them.
|
||||
* To unregister just call vga_client_unregister().
|
||||
*
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
|
|
|
@ -1964,7 +1964,7 @@ static void vfio_pci_vga_uninit(struct vfio_pci_device *vdev)
|
|||
|
||||
if (!vfio_pci_is_vga(pdev))
|
||||
return;
|
||||
vga_client_register(pdev, NULL, NULL, NULL);
|
||||
vga_client_unregister(pdev);
|
||||
vga_set_legacy_decoding(pdev, VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM |
|
||||
VGA_RSRC_LEGACY_IO |
|
||||
VGA_RSRC_LEGACY_MEM);
|
||||
|
|
|
@ -116,4 +116,9 @@ static inline int vga_get_uninterruptible(struct pci_dev *pdev,
|
|||
return vga_get(pdev, rsrc, 0);
|
||||
}
|
||||
|
||||
static inline void vga_client_unregister(struct pci_dev *pdev)
|
||||
{
|
||||
vga_client_register(pdev, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
#endif /* LINUX_VGA_H */
|
||||
|
|
Loading…
Reference in New Issue