Commit bfa7f6a6 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/disp: use private spinlock to control exclusive access to disp

nvkm_subdev.mutex is going away.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 5a479d45
......@@ -17,7 +17,10 @@ struct nvkm_disp {
struct nvkm_event hpd;
struct nvkm_event vblank;
struct nvkm_oproxy *client;
struct {
spinlock_t lock;
struct nvkm_oproxy *object;
} client;
};
int nv04_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
......
......@@ -149,10 +149,10 @@ static void
nvkm_disp_class_del(struct nvkm_oproxy *oproxy)
{
struct nvkm_disp *disp = nvkm_disp(oproxy->base.engine);
mutex_lock(&disp->engine.subdev.mutex);
if (disp->client == oproxy)
disp->client = NULL;
mutex_unlock(&disp->engine.subdev.mutex);
spin_lock(&disp->client.lock);
if (disp->client.object == oproxy)
disp->client.object = NULL;
spin_unlock(&disp->client.lock);
}
static const struct nvkm_oproxy_func
......@@ -175,13 +175,13 @@ nvkm_disp_class_new(struct nvkm_device *device,
return ret;
*pobject = &oproxy->base;
mutex_lock(&disp->engine.subdev.mutex);
if (disp->client) {
mutex_unlock(&disp->engine.subdev.mutex);
spin_lock(&disp->client.lock);
if (disp->client.object) {
spin_unlock(&disp->client.lock);
return -EBUSY;
}
disp->client = oproxy;
mutex_unlock(&disp->engine.subdev.mutex);
disp->client.object = oproxy;
spin_unlock(&disp->client.lock);
return sclass->ctor(disp, oclass, data, size, &oproxy->object);
}
......@@ -480,6 +480,7 @@ nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device,
INIT_LIST_HEAD(&disp->ior);
INIT_LIST_HEAD(&disp->outp);
INIT_LIST_HEAD(&disp->conn);
spin_lock_init(&disp->client.lock);
return nvkm_engine_ctor(&nvkm_disp, device, index, true, &disp->engine);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment