]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
remoteproc: Do not use of_irq_count in xilinx drivers
authorMichal Simek <michal.simek@xilinx.com>
Fri, 31 May 2013 14:05:38 +0000 (16:05 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 5 Jun 2013 10:20:27 +0000 (12:20 +0200)
Driver resources are already filled and driver can use them.
The reason is that of_irq_count() is not exported
for modules in the mainline.
The next patch which revert this patch which we have in our tree.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/remoteproc/mb_remoteproc.c
drivers/remoteproc/zynq_remoteproc.c

index e147aeeda22bdfabafa6911d67c56c650c70e472..4c16183f543e9c76c1bf3f7759e8da65b9e21d87 100644 (file)
@@ -135,7 +135,7 @@ static int mb_remoteproc_probe(struct platform_device *pdev)
        struct resource *res; /* IO mem resources */
        int ret = 0;
        struct irq_list *tmp;
-       int count;
+       int count = 0;
        struct mb_rproc_pdata *local;
 
 
@@ -175,9 +175,12 @@ static int mb_remoteproc_probe(struct platform_device *pdev)
        /* Init list for IRQs - it can be long list */
        INIT_LIST_HEAD(&local->mylist.list);
 
-       count = of_irq_count(pdev->dev.of_node);
        /* Alloc IRQ based on DTS to be sure that no other driver will use it */
-       while (count--) {
+       do {
+               res = platform_get_resource(pdev, IORESOURCE_IRQ, count++);
+               if (!res)
+                       break;
+
                tmp = kzalloc(sizeof(struct irq_list), GFP_KERNEL);
                if (!tmp) {
                        dev_err(&pdev->dev, "Unable to alloc irq list\n");
@@ -185,7 +188,7 @@ static int mb_remoteproc_probe(struct platform_device *pdev)
                        goto irq_fault;
                }
 
-               tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count);
+               tmp->irq = res->start;
 
                dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq);
 
@@ -200,8 +203,7 @@ static int mb_remoteproc_probe(struct platform_device *pdev)
                }
 
                list_add(&(tmp->list), &(local->mylist.list));
-       }
-
+       } while (res);
 
        of_prop = of_get_property(pdev->dev.of_node, "reset-gpio", NULL);
        if (!of_prop) {
index 7a99b3ea60db417edeb2c010bd15ecadb0b46d8f..8f14411128c308491c3dc0e1a6ca23f0b6cafdbb 100644 (file)
@@ -176,7 +176,7 @@ static int zynq_remoteproc_probe(struct platform_device *pdev)
        struct resource *res; /* IO mem resources */
        int ret = 0;
        struct irq_list *tmp;
-       int count;
+       int count = 0;
        struct zynq_rproc_pdata *local;
 
        ret = cpu_down(1);
@@ -222,9 +222,12 @@ static int zynq_remoteproc_probe(struct platform_device *pdev)
        /* Init list for IRQs - it can be long list */
        INIT_LIST_HEAD(&local->mylist.list);
 
-       count = of_irq_count(pdev->dev.of_node);
        /* Alloc IRQ based on DTS to be sure that no other driver will use it */
-       while (count--) {
+       do {
+               res = platform_get_resource(pdev, IORESOURCE_IRQ, count++);
+               if (!res)
+                       break;
+
                tmp = kzalloc(sizeof(struct irq_list), GFP_KERNEL);
                if (!tmp) {
                        dev_err(&pdev->dev, "Unable to alloc irq list\n");
@@ -232,7 +235,7 @@ static int zynq_remoteproc_probe(struct platform_device *pdev)
                        goto irq_fault;
                }
 
-               tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count);
+               tmp->irq = res->start;
 
                dev_dbg(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq);
 
@@ -254,7 +257,7 @@ static int zynq_remoteproc_probe(struct platform_device *pdev)
                 */
                gic_set_cpu(1, tmp->irq);
                list_add(&(tmp->list), &(local->mylist.list));
-       }
+       } while (res);
 
        /* Allocate free IPI number */
        of_prop = of_get_property(pdev->dev.of_node, "ipino", NULL);