@@ -358,8 +358,8 @@ static void mtk_iommu_domain_free(struct iommu_domain *domain)
358
358
static int mtk_iommu_attach_device (struct iommu_domain * domain ,
359
359
struct device * dev )
360
360
{
361
+ struct mtk_iommu_data * data = dev_iommu_priv_get (dev );
361
362
struct mtk_iommu_domain * dom = to_mtk_domain (domain );
362
- struct mtk_iommu_data * data = dev_iommu_fwspec_get (dev )-> iommu_priv ;
363
363
364
364
if (!data )
365
365
return - ENODEV ;
@@ -378,7 +378,7 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain,
378
378
static void mtk_iommu_detach_device (struct iommu_domain * domain ,
379
379
struct device * dev )
380
380
{
381
- struct mtk_iommu_data * data = dev_iommu_fwspec_get (dev )-> iommu_priv ;
381
+ struct mtk_iommu_data * data = dev_iommu_priv_get (dev );
382
382
383
383
if (!data )
384
384
return ;
@@ -450,7 +450,7 @@ static int mtk_iommu_add_device(struct device *dev)
450
450
if (!fwspec || fwspec -> ops != & mtk_iommu_ops )
451
451
return - ENODEV ; /* Not a iommu client device */
452
452
453
- data = fwspec -> iommu_priv ;
453
+ data = dev_iommu_priv_get ( dev ) ;
454
454
iommu_device_link (& data -> iommu , dev );
455
455
456
456
group = iommu_group_get_for_dev (dev );
@@ -469,7 +469,7 @@ static void mtk_iommu_remove_device(struct device *dev)
469
469
if (!fwspec || fwspec -> ops != & mtk_iommu_ops )
470
470
return ;
471
471
472
- data = fwspec -> iommu_priv ;
472
+ data = dev_iommu_priv_get ( dev ) ;
473
473
iommu_device_unlink (& data -> iommu , dev );
474
474
475
475
iommu_group_remove_device (dev );
@@ -496,7 +496,6 @@ static struct iommu_group *mtk_iommu_device_group(struct device *dev)
496
496
497
497
static int mtk_iommu_of_xlate (struct device * dev , struct of_phandle_args * args )
498
498
{
499
- struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
500
499
struct platform_device * m4updev ;
501
500
502
501
if (args -> args_count != 1 ) {
@@ -505,13 +504,13 @@ static int mtk_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
505
504
return - EINVAL ;
506
505
}
507
506
508
- if (!fwspec -> iommu_priv ) {
507
+ if (!dev_iommu_priv_get ( dev ) ) {
509
508
/* Get the m4u device */
510
509
m4updev = of_find_device_by_node (args -> np );
511
510
if (WARN_ON (!m4updev ))
512
511
return - EINVAL ;
513
512
514
- fwspec -> iommu_priv = platform_get_drvdata (m4updev );
513
+ dev_iommu_priv_set ( dev , platform_get_drvdata (m4updev ) );
515
514
}
516
515
517
516
return iommu_fwspec_add_ids (dev , args -> args , 1 );
0 commit comments