Skip to content

Commit 97ea120

Browse files
committed
iommu/omap: Use dev_iommu_priv_get/set()
Remove the use of dev->archdata.iommu and use the private per-device pointer provided by IOMMU core code instead. Signed-off-by: Joerg Roedel <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4bbe0c7 commit 97ea120

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/iommu/omap-iommu.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static struct omap_iommu_domain *to_omap_domain(struct iommu_domain *dom)
7171
**/
7272
void omap_iommu_save_ctx(struct device *dev)
7373
{
74-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
74+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
7575
struct omap_iommu *obj;
7676
u32 *p;
7777
int i;
@@ -101,7 +101,7 @@ EXPORT_SYMBOL_GPL(omap_iommu_save_ctx);
101101
**/
102102
void omap_iommu_restore_ctx(struct device *dev)
103103
{
104-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
104+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
105105
struct omap_iommu *obj;
106106
u32 *p;
107107
int i;
@@ -1398,7 +1398,7 @@ static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
13981398

13991399
static int omap_iommu_count(struct device *dev)
14001400
{
1401-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
1401+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
14021402
int count = 0;
14031403

14041404
while (arch_data->iommu_dev) {
@@ -1459,8 +1459,8 @@ static void omap_iommu_detach_fini(struct omap_iommu_domain *odomain)
14591459
static int
14601460
omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
14611461
{
1462+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
14621463
struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
1463-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
14641464
struct omap_iommu_device *iommu;
14651465
struct omap_iommu *oiommu;
14661466
int ret = 0;
@@ -1524,7 +1524,7 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
15241524
static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain,
15251525
struct device *dev)
15261526
{
1527-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
1527+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
15281528
struct omap_iommu_device *iommu = omap_domain->iommus;
15291529
struct omap_iommu *oiommu;
15301530
int i;
@@ -1650,7 +1650,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
16501650
int num_iommus, i;
16511651

16521652
/*
1653-
* Allocate the archdata iommu structure for DT-based devices.
1653+
* Allocate the per-device iommu structure for DT-based devices.
16541654
*
16551655
* TODO: Simplify this when removing non-DT support completely from the
16561656
* IOMMU users.
@@ -1698,7 +1698,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
16981698
of_node_put(np);
16991699
}
17001700

1701-
dev->archdata.iommu = arch_data;
1701+
dev_iommu_priv_set(dev, arch_data);
17021702

17031703
/*
17041704
* use the first IOMMU alone for the sysfs device linking.
@@ -1712,19 +1712,19 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
17121712

17131713
static void omap_iommu_release_device(struct device *dev)
17141714
{
1715-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
1715+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
17161716

17171717
if (!dev->of_node || !arch_data)
17181718
return;
17191719

1720-
dev->archdata.iommu = NULL;
1720+
dev_iommu_priv_set(dev, NULL);
17211721
kfree(arch_data);
17221722

17231723
}
17241724

17251725
static struct iommu_group *omap_iommu_device_group(struct device *dev)
17261726
{
1727-
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
1727+
struct omap_iommu_arch_data *arch_data = dev_iommu_priv_get(dev);
17281728
struct iommu_group *group = ERR_PTR(-EINVAL);
17291729

17301730
if (!arch_data)

0 commit comments

Comments
 (0)