]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
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 68bf06768123bb2d2fa92b0bf7777a28ad08f9c8..e962433294c317efb1e27f678d705092708c7e65 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 0540a48c5678e450f1fc6397948d17db59ccd560..ff2b434b3db480a47aa5b94515476714b2819693 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 f7e19bfb489c6920ae6ea6d4231b1affc8fab86c..692aa92dd850edabb7c53d1002e02e2b5cd1265d 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 76adb81bdea21d2fc2c6f22fd30686a8395bfd03..d1bcde55e9d734df7573366a21f87e8b40a5f18b 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 8928f7981d4ada8eb4a7758878504e61b5a668ca..0ef5a5713182bc5e8d05a45ad8670672286d945b 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 22d55f6cde5011f34c19bc938066d1306fcbd7e7..64b84667f3a5e9ebbf9f57ae2b1c6c4f76997d5f 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 3d1070228977eb86d3434a7282f7800452e0b6cb..1496b567dd4aab9e1978bda882b1bf3ab3802da0 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 6f6e2a898270943f4de09e88ec2307bb701d8e44..667a9070e006fdb3715e1785d3fedc1a689de8f3 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 dbd43ae9df81af3e3978f798793334349027f631..6a0511d54ce641829796bb20a529cf16f2da214f 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 0f999fc45ab9e7842ece2dc7d0f06f64568343fe..ac8375cf4eef556cba4b8b1f2b90ac541a2c51e1 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 4d2994d8cc32209800977e3008c482897b92fb4f..a0fec205f9dbe2b8c737177ccd93b5b9a75875ee 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 1794a05205d8cc5f6e9064e7e790c605ba9327f0..b0ce9f6680b5ea2f67c160a2cd64180a28324ce4 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 51e55d03330a406e2329edad0c42bc04be49f2e5..92876528972fd5712d9589ae843c55dabc20520f 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 1262d8f020f377920e260e7c3b25c4dd4334a0e2..a7c3c5f578cc19e6a31795aaeacf817f4107d1b6 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 e5e4d930b2c2cee0ee1dd1c063cd17301fd8f651..2007453f6fce075e3f7deceb47f654510d861e11 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 a276a711294a21e3bc6be1bbe102444df26e2ad6..e51b72d471293e304053c46eb4890c892f6a94a0 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 b1e3ed7c8beb51a555b78be072a79faf39e369c7..7ad99b763f4c463334f7642a910e9f79fe8a9777 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 a652cafde3d6d01ddc4d5173927a3c6a5d6c78d2..2b1bf545e488df2b6b6ff99253e2cb38895de48f 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))) {