Merge branch 'vmwgfx-next-3.13' of git://people.freedesktop.org/~thomash/linux into...
[cascardo/linux.git] / drivers / gpu / drm / nouveau / core / subdev / mc / base.c
index fb3837c..b4b9943 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)
 {
        struct nouveau_mc *pmc = arg;
        const struct nouveau_mc_oclass *oclass = (void *)nv_object(pmc)->oclass;
        const struct nouveau_mc_intr *map = oclass->intr;
-       struct nouveau_device *device = nv_device(pmc);
        struct nouveau_subdev *unit;
        u32 intr;
 
        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);