Commit b321a2fb authored by Robin Murphy's avatar Robin Murphy Committed by Joerg Roedel
Browse files

iommu: Make .release_device optional



Many drivers do nothing meaningful for .release_device, and it's neatly
abstracted to just two callsites in the core code, so let's make it
optional to implement.

Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/bda9d3eb4527eac8f6544a15067e2529cca54a2e.1655822151.git.robin.murphy@arm.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent e63cfb5f
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -447,15 +447,10 @@ static struct iommu_device *fsl_pamu_probe_device(struct device *dev)
	return &pamu_iommu;
}

static void fsl_pamu_release_device(struct device *dev)
{
}

static const struct iommu_ops fsl_pamu_ops = {
	.capable	= fsl_pamu_capable,
	.domain_alloc	= fsl_pamu_domain_alloc,
	.probe_device	= fsl_pamu_probe_device,
	.release_device	= fsl_pamu_release_device,
	.device_group   = fsl_pamu_device_group,
	.default_domain_ops = &(const struct iommu_domain_ops) {
		.attach_dev	= fsl_pamu_attach_device,
+4 −2
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
	return 0;

out_release:
	if (ops->release_device)
		ops->release_device(dev);

out_module_put:
@@ -337,6 +338,7 @@ void iommu_release_device(struct device *dev)
	iommu_device_unlink(dev->iommu->iommu_dev, dev);

	ops = dev_iommu_ops(dev);
	if (ops->release_device)
		ops->release_device(dev);

	iommu_group_remove_device(dev);
+0 −5
Original line number Diff line number Diff line
@@ -394,10 +394,6 @@ static struct iommu_device *msm_iommu_probe_device(struct device *dev)
	return &iommu->iommu;
}

static void msm_iommu_release_device(struct device *dev)
{
}

static int msm_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
{
	int ret = 0;
@@ -677,7 +673,6 @@ irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id)
static struct iommu_ops msm_iommu_ops = {
	.domain_alloc = msm_iommu_domain_alloc,
	.probe_device = msm_iommu_probe_device,
	.release_device = msm_iommu_release_device,
	.device_group = generic_device_group,
	.pgsize_bitmap = MSM_IOMMU_PGSIZES,
	.of_xlate = qcom_iommu_of_xlate,
+0 −3
Original line number Diff line number Diff line
@@ -738,8 +738,6 @@ static struct iommu_device *sun50i_iommu_probe_device(struct device *dev)
	return &iommu->iommu;
}

static void sun50i_iommu_release_device(struct device *dev) {}

static struct iommu_group *sun50i_iommu_device_group(struct device *dev)
{
	struct sun50i_iommu *iommu = sun50i_iommu_from_dev(dev);
@@ -764,7 +762,6 @@ static const struct iommu_ops sun50i_iommu_ops = {
	.domain_alloc	= sun50i_iommu_domain_alloc,
	.of_xlate	= sun50i_iommu_of_xlate,
	.probe_device	= sun50i_iommu_probe_device,
	.release_device	= sun50i_iommu_release_device,
	.default_domain_ops = &(const struct iommu_domain_ops) {
		.attach_dev	= sun50i_iommu_attach_device,
		.detach_dev	= sun50i_iommu_detach_device,
+0 −5
Original line number Diff line number Diff line
@@ -246,10 +246,6 @@ static struct iommu_device *gart_iommu_probe_device(struct device *dev)
	return &gart_handle->iommu;
}

static void gart_iommu_release_device(struct device *dev)
{
}

static int gart_iommu_of_xlate(struct device *dev,
			       struct of_phandle_args *args)
{
@@ -273,7 +269,6 @@ static void gart_iommu_sync(struct iommu_domain *domain,
static const struct iommu_ops gart_iommu_ops = {
	.domain_alloc	= gart_iommu_domain_alloc,
	.probe_device	= gart_iommu_probe_device,
	.release_device	= gart_iommu_release_device,
	.device_group	= generic_device_group,
	.pgsize_bitmap	= GART_IOMMU_PGSIZES,
	.of_xlate	= gart_iommu_of_xlate,
Loading