perf record: Add a dummy event on hybrid systems to collect metadata records
[linux-2.6-microblaze.git] / drivers / uio / uio_pdrv_genirq.c
index b60173b..63258b6 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/stringify.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+#include <linux/irq.h>
 
 #include <linux/of.h>
 #include <linux/of_platform.h>
@@ -171,6 +172,23 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
                }
        }
 
+       if (uioinfo->irq) {
+               struct irq_data *irq_data = irq_get_irq_data(uioinfo->irq);
+
+               /*
+                * If a level interrupt, dont do lazy disable. Otherwise the
+                * irq will fire again since clearing of the actual cause, on
+                * device level, is done in userspace
+                * irqd_is_level_type() isn't used since isn't valid until
+                * irq is configured.
+                */
+               if (irq_data &&
+                   irqd_get_trigger_type(irq_data) & IRQ_TYPE_LEVEL_MASK) {
+                       dev_dbg(&pdev->dev, "disable lazy unmask\n");
+                       irq_set_status_flags(uioinfo->irq, IRQ_DISABLE_UNLAZY);
+               }
+       }
+
        uiomem = &uioinfo->mem[0];
 
        for (i = 0; i < pdev->num_resources; ++i) {
@@ -187,8 +205,10 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
                }
 
                uiomem->memtype = UIO_MEM_PHYS;
-               uiomem->addr = r->start;
-               uiomem->size = resource_size(r);
+               uiomem->addr = r->start & PAGE_MASK;
+               uiomem->offs = r->start & ~PAGE_MASK;
+               uiomem->size = (uiomem->offs + resource_size(r)
+                               + PAGE_SIZE - 1) & PAGE_MASK;
                uiomem->name = r->name;
                ++uiomem;
        }