drm/nouveau/core: Add priv field for event handlers
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 27 Aug 2013 20:12:54 +0000 (16:12 -0400)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 8 Nov 2013 05:36:02 +0000 (15:36 +1000)
Provide private field for event handlers exclusive use.
Convert nouveau_fence_wait_uevent() and
nouveau_fence_wait_uevent_handler(); drop struct nouveau_fence_uevent.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/include/core/event.h
drivers/gpu/drm/nouveau/nouveau_fence.c

index 9e094408f14e1f6b87600efaccb6cf434124abdc..ad4d8c283d5fe330b137af7b30c5e274ba054636 100644 (file)
@@ -7,6 +7,7 @@
 
 struct nouveau_eventh {
        struct list_head head;
+       void *priv;
        int (*func)(struct nouveau_eventh *, int index);
 };
 
index be3149932c2d4c3035a36cf40e68f04af8ffd808..c2e31677d039d6187d511d3d0e5290d04498f41f 100644 (file)
@@ -165,17 +165,11 @@ nouveau_fence_done(struct nouveau_fence *fence)
        return !fence->channel;
 }
 
-struct nouveau_fence_uevent {
-       struct nouveau_eventh handler;
-       struct nouveau_fence_priv *priv;
-};
-
 static int
-nouveau_fence_wait_uevent_handler(struct nouveau_eventh *event, int index)
+nouveau_fence_wait_uevent_handler(struct nouveau_eventh *handler, int index)
 {
-       struct nouveau_fence_uevent *uevent =
-               container_of(event, struct nouveau_fence_uevent, handler);
-       wake_up_all(&uevent->priv->waiting);
+       struct nouveau_fence_priv *priv = handler->priv;
+       wake_up_all(&priv->waiting);
        return NVKM_EVENT_KEEP;
 }
 
@@ -186,13 +180,13 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr)
        struct nouveau_channel *chan = fence->channel;
        struct nouveau_fifo *pfifo = nouveau_fifo(chan->drm->device);
        struct nouveau_fence_priv *priv = chan->drm->fence;
-       struct nouveau_fence_uevent uevent = {
-               .handler.func = nouveau_fence_wait_uevent_handler,
+       struct nouveau_eventh handler = {
+               .func = nouveau_fence_wait_uevent_handler,
                .priv = priv,
        };
        int ret = 0;
 
-       nouveau_event_get(pfifo->uevent, 0, &uevent.handler);
+       nouveau_event_get(pfifo->uevent, 0, &handler);
 
        if (fence->timeout) {
                unsigned long timeout = fence->timeout - jiffies;
@@ -224,7 +218,7 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr)
                }
        }
 
-       nouveau_event_put(pfifo->uevent, 0, &uevent.handler);
+       nouveau_event_put(pfifo->uevent, 0, &handler);
        if (unlikely(ret < 0))
                return ret;