Skip to content

Commit b42a905

Browse files
krzkjoergroedel
authored andcommitted
iommu: constify of_phandle_args in xlate
The xlate callbacks are supposed to translate of_phandle_args to proper provider without modifying the of_phandle_args. Make the argument pointer to const for code safety and readability. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent e70e9ec commit b42a905

File tree

16 files changed

+28
-20
lines changed

16 files changed

+28
-20
lines changed

drivers/iommu/apple-dart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,8 @@ static void apple_dart_domain_free(struct iommu_domain *domain)
779779
kfree(dart_domain);
780780
}
781781

782-
static int apple_dart_of_xlate(struct device *dev, struct of_phandle_args *args)
782+
static int apple_dart_of_xlate(struct device *dev,
783+
const struct of_phandle_args *args)
783784
{
784785
struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
785786
struct platform_device *iommu_pdev = of_find_device_by_node(args->np);

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2704,7 +2704,8 @@ static int arm_smmu_enable_nesting(struct iommu_domain *domain)
27042704
return ret;
27052705
}
27062706

2707-
static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
2707+
static int arm_smmu_of_xlate(struct device *dev,
2708+
const struct of_phandle_args *args)
27082709
{
27092710
return iommu_fwspec_add_ids(dev, args->args, 1);
27102711
}

drivers/iommu/arm/arm-smmu/arm-smmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,8 @@ static int arm_smmu_set_pgtable_quirks(struct iommu_domain *domain,
15511551
return ret;
15521552
}
15531553

1554-
static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
1554+
static int arm_smmu_of_xlate(struct device *dev,
1555+
const struct of_phandle_args *args)
15551556
{
15561557
u32 mask, fwid = 0;
15571558

drivers/iommu/arm/arm-smmu/qcom_iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ static struct iommu_device *qcom_iommu_probe_device(struct device *dev)
546546
return &qcom_iommu->iommu;
547547
}
548548

549-
static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
549+
static int qcom_iommu_of_xlate(struct device *dev,
550+
const struct of_phandle_args *args)
550551
{
551552
struct qcom_iommu_dev *qcom_iommu;
552553
struct platform_device *iommu_pdev;

drivers/iommu/exynos-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ static void exynos_iommu_release_device(struct device *dev)
14311431
}
14321432

14331433
static int exynos_iommu_of_xlate(struct device *dev,
1434-
struct of_phandle_args *spec)
1434+
const struct of_phandle_args *spec)
14351435
{
14361436
struct platform_device *sysmmu = of_find_device_by_node(spec->np);
14371437
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);

drivers/iommu/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2825,7 +2825,7 @@ void iommu_fwspec_free(struct device *dev)
28252825
}
28262826
EXPORT_SYMBOL_GPL(iommu_fwspec_free);
28272827

2828-
int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids)
2828+
int iommu_fwspec_add_ids(struct device *dev, const u32 *ids, int num_ids)
28292829
{
28302830
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
28312831
int i, new_num;

drivers/iommu/ipmmu-vmsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ static phys_addr_t ipmmu_iova_to_phys(struct iommu_domain *io_domain,
709709
}
710710

711711
static int ipmmu_init_platform_device(struct device *dev,
712-
struct of_phandle_args *args)
712+
const struct of_phandle_args *args)
713713
{
714714
struct platform_device *ipmmu_pdev;
715715

@@ -773,7 +773,7 @@ static bool ipmmu_device_is_allowed(struct device *dev)
773773
}
774774

775775
static int ipmmu_of_xlate(struct device *dev,
776-
struct of_phandle_args *spec)
776+
const struct of_phandle_args *spec)
777777
{
778778
if (!ipmmu_device_is_allowed(dev))
779779
return -ENODEV;

drivers/iommu/msm_iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static void print_ctx_regs(void __iomem *base, int ctx)
598598

599599
static int insert_iommu_master(struct device *dev,
600600
struct msm_iommu_dev **iommu,
601-
struct of_phandle_args *spec)
601+
const struct of_phandle_args *spec)
602602
{
603603
struct msm_iommu_ctx_dev *master = dev_iommu_priv_get(dev);
604604
int sid;
@@ -626,7 +626,7 @@ static int insert_iommu_master(struct device *dev,
626626
}
627627

628628
static int qcom_iommu_of_xlate(struct device *dev,
629-
struct of_phandle_args *spec)
629+
const struct of_phandle_args *spec)
630630
{
631631
struct msm_iommu_dev *iommu = NULL, *iter;
632632
unsigned long flags;

drivers/iommu/mtk_iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ static struct iommu_group *mtk_iommu_device_group(struct device *dev)
957957
return group;
958958
}
959959

960-
static int mtk_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
960+
static int mtk_iommu_of_xlate(struct device *dev,
961+
const struct of_phandle_args *args)
961962
{
962963
struct platform_device *m4updev;
963964

drivers/iommu/mtk_iommu_v1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ static const struct iommu_ops mtk_iommu_v1_ops;
398398
* MTK generation one iommu HW only support one iommu domain, and all the client
399399
* sharing the same iova address space.
400400
*/
401-
static int mtk_iommu_v1_create_mapping(struct device *dev, struct of_phandle_args *args)
401+
static int mtk_iommu_v1_create_mapping(struct device *dev,
402+
const struct of_phandle_args *args)
402403
{
403404
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
404405
struct mtk_iommu_v1_data *data;

0 commit comments

Comments
 (0)