summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-08-21 10:13:30 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-08-21 11:34:32 +1000
commit896b7cc556610f62264925682fee71c7f310ea0f (patch)
tree4cafebfb9f75b2a18d8e4c5dc5e31df0244c2f23
parent9b56aac82e06d9e4b563bd06af99d5e6c9df1633 (diff)
mc: fix race condition between constructor and request_irq()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--nvkm/include/subdev/mc.h7
-rw-r--r--nvkm/subdev/mc/base.c6
-rw-r--r--nvkm/subdev/mc/nv04.c3
-rw-r--r--nvkm/subdev/mc/nv44.c3
-rw-r--r--nvkm/subdev/mc/nv50.c3
-rw-r--r--nvkm/subdev/mc/nv98.c3
-rw-r--r--nvkm/subdev/mc/nvc0.c3
7 files changed, 14 insertions, 14 deletions
diff --git a/nvkm/include/subdev/mc.h b/nvkm/include/subdev/mc.h
index d5502267..9d2cd200 100644
--- a/nvkm/include/subdev/mc.h
+++ b/nvkm/include/subdev/mc.h
@@ -20,8 +20,8 @@ nouveau_mc(void *obj)
return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_MC];
}
-#define nouveau_mc_create(p,e,o,d) \
- nouveau_mc_create_((p), (e), (o), sizeof(**d), (void **)d)
+#define nouveau_mc_create(p,e,o,m,d) \
+ nouveau_mc_create_((p), (e), (o), (m), sizeof(**d), (void **)d)
#define nouveau_mc_destroy(p) ({ \
struct nouveau_mc *pmc = (p); _nouveau_mc_dtor(nv_object(pmc)); \
})
@@ -33,7 +33,8 @@ nouveau_mc(void *obj)
})
int nouveau_mc_create_(struct nouveau_object *, struct nouveau_object *,
- struct nouveau_oclass *, int, void **);
+ struct nouveau_oclass *, const struct nouveau_mc_intr *,
+ int, void **);
void _nouveau_mc_dtor(struct nouveau_object *);
int _nouveau_mc_init(struct nouveau_object *);
int _nouveau_mc_fini(struct nouveau_object *, bool);
diff --git a/nvkm/subdev/mc/base.c b/nvkm/subdev/mc/base.c
index 1c0330b8..ec9cd6f1 100644
--- a/nvkm/subdev/mc/base.c
+++ b/nvkm/subdev/mc/base.c
@@ -80,7 +80,9 @@ _nouveau_mc_dtor(struct nouveau_object *object)
int
nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
- struct nouveau_oclass *oclass, int length, void **pobject)
+ struct nouveau_oclass *oclass,
+ const struct nouveau_mc_intr *intr_map,
+ int length, void **pobject)
{
struct nouveau_device *device = nv_device(parent);
struct nouveau_mc *pmc;
@@ -92,6 +94,8 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
if (ret)
return ret;
+ pmc->intr_map = intr_map;
+
ret = request_irq(device->pdev->irq, nouveau_mc_intr,
IRQF_SHARED, "nouveau", pmc);
if (ret < 0)
diff --git a/nvkm/subdev/mc/nv04.c b/nvkm/subdev/mc/nv04.c
index 8c769715..64aa4edb 100644
--- a/nvkm/subdev/mc/nv04.c
+++ b/nvkm/subdev/mc/nv04.c
@@ -50,12 +50,11 @@ nv04_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv04_mc_priv *priv;
int ret;
- ret = nouveau_mc_create(parent, engine, oclass, &priv);
+ ret = nouveau_mc_create(parent, engine, oclass, nv04_mc_intr, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
- priv->base.intr_map = nv04_mc_intr;
return 0;
}
diff --git a/nvkm/subdev/mc/nv44.c b/nvkm/subdev/mc/nv44.c
index 51919371..d9891782 100644
--- a/nvkm/subdev/mc/nv44.c
+++ b/nvkm/subdev/mc/nv44.c
@@ -36,12 +36,11 @@ nv44_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv44_mc_priv *priv;
int ret;
- ret = nouveau_mc_create(parent, engine, oclass, &priv);
+ ret = nouveau_mc_create(parent, engine, oclass, nv04_mc_intr, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
- priv->base.intr_map = nv04_mc_intr;
return 0;
}
diff --git a/nvkm/subdev/mc/nv50.c b/nvkm/subdev/mc/nv50.c
index f25fc5fc..2b1afe22 100644
--- a/nvkm/subdev/mc/nv50.c
+++ b/nvkm/subdev/mc/nv50.c
@@ -53,12 +53,11 @@ nv50_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv50_mc_priv *priv;
int ret;
- ret = nouveau_mc_create(parent, engine, oclass, &priv);
+ ret = nouveau_mc_create(parent, engine, oclass, nv50_mc_intr, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
- priv->base.intr_map = nv50_mc_intr;
return 0;
}
diff --git a/nvkm/subdev/mc/nv98.c b/nvkm/subdev/mc/nv98.c
index e82fd21b..0d57b4d3 100644
--- a/nvkm/subdev/mc/nv98.c
+++ b/nvkm/subdev/mc/nv98.c
@@ -54,12 +54,11 @@ nv98_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nv98_mc_priv *priv;
int ret;
- ret = nouveau_mc_create(parent, engine, oclass, &priv);
+ ret = nouveau_mc_create(parent, engine, oclass, nv98_mc_intr, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
- priv->base.intr_map = nv98_mc_intr;
return 0;
}
diff --git a/nvkm/subdev/mc/nvc0.c b/nvkm/subdev/mc/nvc0.c
index c5da3bab..104175c5 100644
--- a/nvkm/subdev/mc/nvc0.c
+++ b/nvkm/subdev/mc/nvc0.c
@@ -57,12 +57,11 @@ nvc0_mc_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nvc0_mc_priv *priv;
int ret;
- ret = nouveau_mc_create(parent, engine, oclass, &priv);
+ ret = nouveau_mc_create(parent, engine, oclass, nvc0_mc_intr, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
- priv->base.intr_map = nvc0_mc_intr;
return 0;
}