*参照元 [#wd72e50b] #backlinks *説明 [#k84a2a6a] -パス: [[linux-4.4.1/drivers/iommu/iommu.c]] -FIXME: これは何? --説明 **引数 [#x024b50c] -struct device *dev -- --[[linux-4.4.1/device]] **返り値 [#i63665af] -struct iommu_group * -- --[[linux-4.4.1/iommu_group]] **参考 [#o7eb3b21] *実装 [#v4c36a17] /** * iommu_group_get_for_dev - Find or create the IOMMU group for a device * @dev: target device * * This function is intended to be called by IOMMU drivers and extended to * support common, bus-defined algorithms when determining or creating the * IOMMU group for a device. On success, the caller will hold a reference * to the returned IOMMU group, which will already include the provided * device. The reference should be released with iommu_group_put(). */ struct iommu_group *iommu_group_get_for_dev(struct device *dev) { const struct iommu_ops *ops = dev->bus->iommu_ops; struct iommu_group *group; int ret; - --dev->bus は 型 --[[linux-4.4.1/]] --dev->bus は struct bus_type * 型 --[[linux-4.4.1/bus_type]] --[[linux-4.4.1/iommu_ops]] group = iommu_group_get(dev); if (group) return group; - --[[linux-4.4.1/iommu_group_get()]] group = ERR_PTR(-EINVAL); - --[[linux-4.4.1/ERR_PTR()]] if (ops && ops->device_group) group = ops->device_group(dev); if (IS_ERR(group)) return group; - --[[linux-4.4.1/IS_ERR()]] /* * Try to allocate a default domain - needs support from the * IOMMU driver. */ if (!group->default_domain) { group->default_domain = __iommu_domain_alloc(dev->bus, IOMMU_DOMAIN_DMA); group->domain = group->default_domain; } - --[[linux-4.4.1/__iommu_domain_alloc()]] ret = iommu_group_add_device(group, dev); if (ret) { iommu_group_put(group); return ERR_PTR(ret); } - --[[linux-4.4.1/iommu_group_add_device()]] return group; } *コメント [#tbc0f5cd]