/* Added device is not attached to its DMAR domain here yet. That will happen when mapping the device to iova.  */
static int device_notifier(struct notifier_block *nb, unsigned long action, void *data)
/* Added device is not attached to its DMAR domain here yet. That will happen when mapping the device to iova.  */
static int device_notifier(struct notifier_block *nb, unsigned long action, void *data)
{
	struct device *dev = data;
	struct pci_dev *pdev = to_pci_dev(dev);
	struct dmar_domain *domain;
	if (iommu_no_mapping(dev))
		return 0;
	domain = find_domain(pdev);
	if (!domain)
		return 0;
	if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through)
		domain_remove_one_dev_info(domain, pdev);
	return 0;
}