Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers

can be unloaded.

This patch is a part of D19565.

Reviewed by:	hps
Approved by:	imp (mentor), hps
MFC after:	1 week
This commit is contained in:
Johannes Lundberg 2019-05-10 23:10:22 +00:00
parent 4ab18ea23a
commit 5098ed5f3b
2 changed files with 17 additions and 0 deletions

View File

@ -532,6 +532,7 @@ pci_write_config_dword(struct pci_dev *pdev, int where, u32 val)
int linux_pci_register_driver(struct pci_driver *pdrv);
int linux_pci_register_drm_driver(struct pci_driver *pdrv);
void linux_pci_unregister_driver(struct pci_driver *pdrv);
void linux_pci_unregister_drm_driver(struct pci_driver *pdrv);
#define pci_register_driver(pdrv) linux_pci_register_driver(pdrv)
#define pci_unregister_driver(pdrv) linux_pci_unregister_driver(pdrv)

View File

@ -417,6 +417,22 @@ linux_pci_unregister_driver(struct pci_driver *pdrv)
mtx_unlock(&Giant);
}
void
linux_pci_unregister_drm_driver(struct pci_driver *pdrv)
{
devclass_t bus;
bus = devclass_find("vgapci");
spin_lock(&pci_lock);
list_del(&pdrv->links);
spin_unlock(&pci_lock);
mtx_lock(&Giant);
if (bus != NULL)
devclass_delete_driver(bus, &pdrv->bsddriver);
mtx_unlock(&Giant);
}
CTASSERT(sizeof(dma_addr_t) <= sizeof(uint64_t));
struct linux_dma_obj {