drm/nouveau/core: pass related object into notify constructor
authorBen Skeggs <bskeggs@redhat.com>
Mon, 11 Aug 2014 03:56:56 +0000 (13:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 15 Sep 2014 12:22:12 +0000 (22:22 +1000)
The event source types/index might need to be derived from it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
18 files changed:
drivers/gpu/drm/nouveau/core/core/client.c
drivers/gpu/drm/nouveau/core/core/event.c
drivers/gpu/drm/nouveau/core/core/ioctl.c
drivers/gpu/drm/nouveau/core/core/notify.c
drivers/gpu/drm/nouveau/core/engine/device/base.c
drivers/gpu/drm/nouveau/core/engine/disp/base.c
drivers/gpu/drm/nouveau/core/engine/disp/conn.c
drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c
drivers/gpu/drm/nouveau/core/engine/disp/priv.h
drivers/gpu/drm/nouveau/core/engine/fifo/base.c
drivers/gpu/drm/nouveau/core/engine/software/nv50.c
drivers/gpu/drm/nouveau/core/include/core/client.h
drivers/gpu/drm/nouveau/core/include/core/event.h
drivers/gpu/drm/nouveau/core/include/core/notify.h
drivers/gpu/drm/nouveau/core/include/engine/fifo.h
drivers/gpu/drm/nouveau/core/subdev/clock/base.c
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c

index 68bf067..e962433 100644 (file)
@@ -91,9 +91,10 @@ nvkm_client_notify_del(struct nouveau_client *client, int index)
 }
 
 int
-nvkm_client_notify_new(struct nouveau_client *client,
+nvkm_client_notify_new(struct nouveau_object *object,
                       struct nvkm_event *event, void *data, u32 size)
 {
+       struct nouveau_client *client = nouveau_client(object);
        struct nvkm_client_notify *notify;
        union {
                struct nvif_notify_req_v0 v0;
@@ -127,8 +128,8 @@ nvkm_client_notify_new(struct nouveau_client *client,
        }
 
        if (ret == 0) {
-               ret = nvkm_notify_init(event, nvkm_client_notify, false,
-                                      data, size, reply, &notify->n);
+               ret = nvkm_notify_init(object, event, nvkm_client_notify,
+                                      false, data, size, reply, &notify->n);
                if (ret == 0) {
                        client->notify[index] = notify;
                        notify->client = client;
index 0540a48..ff2b434 100644 (file)
@@ -20,7 +20,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include <core/os.h>
+#include <core/object.h>
 #include <core/event.h>
 
 void
index f7e19bf..692aa92 100644 (file)
@@ -349,7 +349,6 @@ nvkm_ioctl_unmap(struct nouveau_handle *handle, void *data, u32 size)
 static int
 nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
 {
-       struct nouveau_client *client = nouveau_client(handle->object);
        struct nouveau_object *object = handle->object;
        struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs;
        union {
@@ -365,7 +364,7 @@ nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
                if (ret = -ENODEV, ofuncs->ntfy)
                        ret = ofuncs->ntfy(object, args->v0.event, &event);
                if (ret == 0) {
-                       ret = nvkm_client_notify_new(client, event, data, size);
+                       ret = nvkm_client_notify_new(object, event, data, size);
                        if (ret >= 0) {
                                args->v0.index = ret;
                                ret = 0;
index 76adb81..d1bcde5 100644 (file)
@@ -134,14 +134,15 @@ nvkm_notify_fini(struct nvkm_notify *notify)
 }
 
 int
-nvkm_notify_init(struct nvkm_event *event, int (*func)(struct nvkm_notify *),
-                bool work, void *data, u32 size, u32 reply,
+nvkm_notify_init(struct nouveau_object *object, struct nvkm_event *event,
+                int (*func)(struct nvkm_notify *), bool work,
+                void *data, u32 size, u32 reply,
                 struct nvkm_notify *notify)
 {
        unsigned long flags;
        int ret = -ENODEV;
        if ((notify->event = event), event->refs) {
-               ret = event->func->ctor(data, size, notify);
+               ret = event->func->ctor(object, data, size, notify);
                if (ret == 0 && (ret = -EINVAL, notify->size == reply)) {
                        notify->flags = 0;
                        notify->block = 1;
index 8928f79..0ef5a57 100644 (file)
@@ -505,7 +505,8 @@ nouveau_device_sclass[] = {
 };
 
 static int
-nouveau_device_event_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_device_event_ctor(struct nouveau_object *object, void *data, u32 size,
+                         struct nvkm_notify *notify)
 {
        if (!WARN_ON(size != 0)) {
                notify->size  = 0;
index 22d55f6..64b8466 100644 (file)
@@ -32,7 +32,8 @@
 #include "conn.h"
 
 int
-nouveau_disp_vblank_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_disp_vblank_ctor(struct nouveau_object *object, void *data, u32 size,
+                        struct nvkm_notify *notify)
 {
        struct nouveau_disp *disp =
                container_of(notify->event, typeof(*disp), vblank);
@@ -61,7 +62,8 @@ nouveau_disp_vblank(struct nouveau_disp *disp, int head)
 }
 
 static int
-nouveau_disp_hpd_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_disp_hpd_ctor(struct nouveau_object *object, void *data, u32 size,
+                     struct nvkm_notify *notify)
 {
        struct nouveau_disp *disp =
                container_of(notify->event, typeof(*disp), hpd);
index 3d10702..1496b56 100644 (file)
@@ -126,8 +126,8 @@ nvkm_connector_create_(struct nouveau_object *parent,
                        return 0;
                }
 
-               ret = nvkm_notify_init(&gpio->event, nvkm_connector_hpd, true,
-                                      &(struct nvkm_gpio_ntfy_req) {
+               ret = nvkm_notify_init(NULL, &gpio->event, nvkm_connector_hpd,
+                                      true, &(struct nvkm_gpio_ntfy_req) {
                                        .mask = NVKM_GPIO_TOGGLED,
                                        .line = func.line,
                                       },
index 6f6e2a8..667a907 100644 (file)
@@ -254,7 +254,7 @@ nvkm_output_dp_create_(struct nouveau_object *parent,
        atomic_set(&outp->lt.done, 0);
 
        /* link maintenance */
-       ret = nvkm_notify_init(&i2c->event, nvkm_output_dp_irq, true,
+       ret = nvkm_notify_init(NULL, &i2c->event, nvkm_output_dp_irq, true,
                               &(struct nvkm_i2c_ntfy_req) {
                                .mask = NVKM_I2C_IRQ,
                                .port = outp->base.edid->index,
@@ -268,7 +268,7 @@ nvkm_output_dp_create_(struct nouveau_object *parent,
        }
 
        /* hotplug detect, replaces gpio-based mechanism with aux events */
-       ret = nvkm_notify_init(&i2c->event, nvkm_output_dp_hpd, true,
+       ret = nvkm_notify_init(NULL, &i2c->event, nvkm_output_dp_hpd, true,
                               &(struct nvkm_i2c_ntfy_req) {
                                .mask = NVKM_I2C_PLUG | NVKM_I2C_UNPLUG,
                                .port = outp->base.edid->index,
index dbd43ae..6a0511d 100644 (file)
@@ -40,7 +40,8 @@ int  _nouveau_disp_fini(struct nouveau_object *, bool);
 extern struct nouveau_oclass *nvkm_output_oclass;
 extern struct nouveau_oclass *nvkm_connector_oclass;
 
-int  nouveau_disp_vblank_ctor(void *data, u32 size, struct nvkm_notify *);
+int  nouveau_disp_vblank_ctor(struct nouveau_object *, void *data, u32 size,
+                             struct nvkm_notify *);
 void nouveau_disp_vblank(struct nouveau_disp *, int head);
 int  nouveau_disp_ntfy(struct nouveau_object *, u32, struct nvkm_event **);
 
index 0f999fc..ac8375c 100644 (file)
@@ -34,7 +34,8 @@
 #include <engine/fifo.h>
 
 static int
-nouveau_fifo_event_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_fifo_event_ctor(struct nouveau_object *object, void *data, u32 size,
+                       struct nvkm_notify *notify)
 {
        if (size == 0) {
                notify->size  = 0;
@@ -170,7 +171,8 @@ _nouveau_fifo_channel_wr32(struct nouveau_object *object, u64 addr, u32 data)
 }
 
 int
-nouveau_fifo_uevent_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_fifo_uevent_ctor(struct nouveau_object *object, void *data, u32 size,
+                        struct nvkm_notify *notify)
 {
        union {
                struct nvif_notify_uevent_req none;
index 4d2994d..a0fec20 100644 (file)
@@ -175,7 +175,8 @@ nv50_software_context_ctor(struct nouveau_object *parent,
                return ret;
 
        for (i = 0; pdisp && i < pdisp->vblank.index_nr; i++) {
-               ret = nvkm_notify_init(&pdisp->vblank, pclass->vblank, false,
+               ret = nvkm_notify_init(NULL, &pdisp->vblank, pclass->vblank,
+                                      false,
                                       &(struct nvif_notify_head_req_v0) {
                                        .head = i,
                                       },
index 1794a05..b0ce9f6 100644 (file)
@@ -48,7 +48,7 @@ int  nouveau_client_init(struct nouveau_client *);
 int  nouveau_client_fini(struct nouveau_client *, bool suspend);
 const char *nouveau_client_name(void *obj);
 
-int nvkm_client_notify_new(struct nouveau_client *, struct nvkm_event *,
+int nvkm_client_notify_new(struct nouveau_object *, struct nvkm_event *,
                           void *data, u32 size);
 int nvkm_client_notify_del(struct nouveau_client *, int index);
 int nvkm_client_notify_get(struct nouveau_client *, int index);
index 51e55d0..9287652 100644 (file)
@@ -4,7 +4,8 @@
 #include <core/notify.h>
 
 struct nvkm_event_func {
-       int  (*ctor)(void *data, u32 size, struct nvkm_notify *);
+       int  (*ctor)(struct nouveau_object *, void *data, u32 size,
+                    struct nvkm_notify *);
        void (*send)(void *data, u32 size, struct nvkm_notify *);
        void (*init)(struct nvkm_event *, int type, int index);
        void (*fini)(struct nvkm_event *, int type, int index);
index 1262d8f..a7c3c5f 100644 (file)
@@ -25,8 +25,9 @@ struct nvkm_notify {
        const void *data;
 };
 
-int  nvkm_notify_init(struct nvkm_event *, int (*func)(struct nvkm_notify *),
-                     bool work, void *data, u32 size, u32 reply,
+int  nvkm_notify_init(struct nouveau_object *, struct nvkm_event *,
+                     int (*func)(struct nvkm_notify *), bool work,
+                     void *data, u32 size, u32 reply,
                      struct nvkm_notify *);
 void nvkm_notify_fini(struct nvkm_notify *);
 void nvkm_notify_get(struct nvkm_notify *);
index e5e4d93..2007453 100644 (file)
@@ -116,7 +116,8 @@ extern struct nouveau_oclass *nve0_fifo_oclass;
 extern struct nouveau_oclass *gk20a_fifo_oclass;
 extern struct nouveau_oclass *nv108_fifo_oclass;
 
-int  nouveau_fifo_uevent_ctor(void *, u32, struct nvkm_notify *);
+int  nouveau_fifo_uevent_ctor(struct nouveau_object *, void *, u32,
+                             struct nvkm_notify *);
 void nouveau_fifo_uevent(struct nouveau_fifo *);
 
 void nv04_fifo_intr(struct nouveau_subdev *);
index a276a71..e51b72d 100644 (file)
@@ -573,7 +573,7 @@ nouveau_clock_create_(struct nouveau_object *parent,
 
        clk->allow_reclock = allow_reclock;
 
-       ret = nvkm_notify_init(&device->event, nouveau_clock_pwrsrc, true,
+       ret = nvkm_notify_init(NULL, &device->event, nouveau_clock_pwrsrc, true,
                               NULL, 0, 0, &clk->pwrsrc_ntfy);
        if (ret)
                return ret;
index b1e3ed7..7ad99b7 100644 (file)
@@ -122,7 +122,8 @@ nouveau_gpio_intr_init(struct nvkm_event *event, int type, int index)
 }
 
 static int
-nouveau_gpio_intr_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_gpio_intr_ctor(struct nouveau_object *object, void *data, u32 size,
+                      struct nvkm_notify *notify)
 {
        struct nvkm_gpio_ntfy_req *req = data;
        if (!WARN_ON(size != sizeof(*req))) {
index a652caf..2b1bf54 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <core/option.h>
+#include <core/object.h>
 #include <core/event.h>
 
 #include <subdev/bios.h>
@@ -346,7 +347,8 @@ nouveau_i2c_intr_init(struct nvkm_event *event, int type, int index)
 }
 
 static int
-nouveau_i2c_intr_ctor(void *data, u32 size, struct nvkm_notify *notify)
+nouveau_i2c_intr_ctor(struct nouveau_object *object, void *data, u32 size,
+                     struct nvkm_notify *notify)
 {
        struct nvkm_i2c_ntfy_req *req = data;
        if (!WARN_ON(size != sizeof(*req))) {