drm/nouveau/mc: fix (incorrect) reporting of unknown pending intr bits
authorBen Skeggs <bskeggs@redhat.com>
Mon, 4 Nov 2013 23:09:30 +0000 (09:09 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 8 Nov 2013 05:39:57 +0000 (15:39 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/mc/base.c

index fb3837c027da1340e2d2543904fcd35dd8a1c47d..bc19aa497d5bfb9f0b05b3f422ffcd71ff9a9176 100644 (file)
 #include <subdev/mc.h>
 #include <core/option.h>
 
+static inline u32
+nouveau_mc_intr_mask(struct nouveau_mc *pmc)
+{
+       u32 intr = nv_rd32(pmc, 0x000100);
+       if (intr == 0xffffffff) /* likely fallen off the bus */
+               intr = 0x00000000;
+       return intr;
+}
+
 static irqreturn_t
 nouveau_mc_intr(int irq, void *arg)
 {
@@ -37,16 +46,12 @@ nouveau_mc_intr(int irq, void *arg)
 
        nv_wr32(pmc, 0x000140, 0x00000000);
        nv_rd32(pmc, 0x000140);
-
-       intr = nv_rd32(pmc, 0x000100);
-       if (intr == 0xffffffff) /* likely fallen off the bus */
-               intr = 0x00000000;
-
+       intr = nouveau_mc_intr_mask(pmc);
        if (pmc->use_msi)
                oclass->msi_rearm(pmc);
 
        if (intr) {
-               u32 stat = nv_rd32(pmc, 0x000100);
+               u32 stat = intr = nouveau_mc_intr_mask(pmc);
                while (map->stat) {
                        if (intr & map->stat) {
                                unit = nouveau_subdev(pmc, map->unit);