Skip to content

Commit 7977a08

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/fsl: Move ENODEV to fsl_pamu_probe_device()
The expectation is for the probe op to return ENODEV if the iommu is not able to support the device. Move the check for fsl,liodn to fsl_pamu_probe_device() simplify fsl_pamu_device_group() Signed-off-by: Jason Gunthorpe <[email protected]> Tested-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 5f64897 commit 7977a08

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/iommu/fsl_pamu_domain.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -427,23 +427,28 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev)
427427

428428
static struct iommu_group *fsl_pamu_device_group(struct device *dev)
429429
{
430-
struct iommu_group *group = ERR_PTR(-ENODEV);
431-
int len;
432-
433430
/*
434431
* For platform devices we allocate a separate group for
435432
* each of the devices.
436433
*/
437-
if (dev_is_pci(dev))
438-
group = get_pci_device_group(to_pci_dev(dev));
439-
else if (of_get_property(dev->of_node, "fsl,liodn", &len))
434+
if (!dev_is_pci(dev))
440435
return generic_device_group(dev);
441436

442-
return group;
437+
return get_pci_device_group(to_pci_dev(dev));
443438
}
444439

445440
static struct iommu_device *fsl_pamu_probe_device(struct device *dev)
446441
{
442+
int len;
443+
444+
/*
445+
* uboot must fill the fsl,liodn for platform devices to be supported by
446+
* the iommu.
447+
*/
448+
if (!dev_is_pci(dev) &&
449+
!of_get_property(dev->of_node, "fsl,liodn", &len))
450+
return ERR_PTR(-ENODEV);
451+
447452
return &pamu_iommu;
448453
}
449454

0 commit comments

Comments
 (0)