diff mbox series

[Xen-devel,RFC,v4,4/8] passthrough/arm: Modify SMMU driver to use generic device definition

Message ID 20171219031703.23420-5-sameer.goel@linaro.org
State Superseded
Headers show
Series SMMUv3 driver | expand

Commit Message

Sameer Goel Dec. 19, 2017, 3:16 a.m. UTC
Modify the SMMU code to use generic device instead of dt_device_node for
functions that can be used for ACPI based systems too.

Signed-off-by: Sameer Goel <sameer.goel@linaro.org>
---
 xen/drivers/passthrough/arm/smmu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Julien Grall Jan. 23, 2018, 11:41 a.m. UTC | #1
Hi Sameer,

On 19/12/17 03:16, Sameer Goel wrote:
> Modify the SMMU code to use generic device instead of dt_device_node for
> functions that can be used for ACPI based systems too.
> 
> Signed-off-by: Sameer Goel <sameer.goel@linaro.org>

Acked-by: Julien Grall <julien.grall@linaro.org>

Cheers,

> ---
>   xen/drivers/passthrough/arm/smmu.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
> index 45acb89380..ad956d5b8d 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -76,7 +76,7 @@ struct resource
>   
>   #define resource_size(res) (res)->size;
>   
> -#define platform_device dt_device_node
> +#define platform_device device
>   
>   #define IORESOURCE_MEM 0
>   #define IORESOURCE_IRQ 1
> @@ -97,12 +97,12 @@ static struct resource *platform_get_resource(struct platform_device *pdev,
>   
>   	switch (type) {
>   	case IORESOURCE_MEM:
> -		ret = dt_device_get_address(pdev, num, &res.addr, &res.size);
> +		ret = dt_device_get_address(dev_to_dt(pdev), num, &res.addr, &res.size);
>   
>   		return ((ret) ? NULL : &res);
>   
>   	case IORESOURCE_IRQ:
> -		ret = platform_get_irq(pdev, num);
> +		ret = platform_get_irq(dev_to_dt(pdev), num);
>   		if (ret < 0)
>   			return NULL;
>   
> @@ -2286,7 +2286,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>   	const struct of_device_id *of_id;
>   	struct resource *res;
>   	struct arm_smmu_device *smmu;
> -	struct device *dev = &pdev->dev;
> +	struct device *dev = pdev;
>   	struct rb_node *node;
>   	struct of_phandle_args masterspec;
>   	int num_irqs, i, err;
> @@ -2339,7 +2339,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>   	}
>   
>   	for (i = 0; i < num_irqs; ++i) {
> -		int irq = platform_get_irq(pdev, i);
> +		int irq = platform_get_irq(dev_to_dt(pdev), i);
>   
>   		if (irq < 0) {
>   			dev_err(dev, "failed to get irq index %d\n", i);
> @@ -2820,7 +2820,7 @@ static __init int arm_smmu_dt_init(struct dt_device_node *dev,
>   	 */
>   	dt_device_set_used_by(dev, DOMID_XEN);
>   
> -	rc = arm_smmu_device_dt_probe(dev);
> +	rc = arm_smmu_device_dt_probe(dt_to_dev(dev));
>   	if (rc)
>   		return rc;
>   
>
diff mbox series

Patch

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 45acb89380..ad956d5b8d 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -76,7 +76,7 @@  struct resource
 
 #define resource_size(res) (res)->size;
 
-#define platform_device dt_device_node
+#define platform_device device
 
 #define IORESOURCE_MEM 0
 #define IORESOURCE_IRQ 1
@@ -97,12 +97,12 @@  static struct resource *platform_get_resource(struct platform_device *pdev,
 
 	switch (type) {
 	case IORESOURCE_MEM:
-		ret = dt_device_get_address(pdev, num, &res.addr, &res.size);
+		ret = dt_device_get_address(dev_to_dt(pdev), num, &res.addr, &res.size);
 
 		return ((ret) ? NULL : &res);
 
 	case IORESOURCE_IRQ:
-		ret = platform_get_irq(pdev, num);
+		ret = platform_get_irq(dev_to_dt(pdev), num);
 		if (ret < 0)
 			return NULL;
 
@@ -2286,7 +2286,7 @@  static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 	const struct of_device_id *of_id;
 	struct resource *res;
 	struct arm_smmu_device *smmu;
-	struct device *dev = &pdev->dev;
+	struct device *dev = pdev;
 	struct rb_node *node;
 	struct of_phandle_args masterspec;
 	int num_irqs, i, err;
@@ -2339,7 +2339,7 @@  static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 	}
 
 	for (i = 0; i < num_irqs; ++i) {
-		int irq = platform_get_irq(pdev, i);
+		int irq = platform_get_irq(dev_to_dt(pdev), i);
 
 		if (irq < 0) {
 			dev_err(dev, "failed to get irq index %d\n", i);
@@ -2820,7 +2820,7 @@  static __init int arm_smmu_dt_init(struct dt_device_node *dev,
 	 */
 	dt_device_set_used_by(dev, DOMID_XEN);
 
-	rc = arm_smmu_device_dt_probe(dev);
+	rc = arm_smmu_device_dt_probe(dt_to_dev(dev));
 	if (rc)
 		return rc;