drm/nouveau/core/client: pass notification callback to nvkm_client_new
authorBen Skeggs <bskeggs@redhat.com>
Wed, 25 May 2016 07:08:21 +0000 (17:08 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 17 Feb 2017 05:15:00 +0000 (15:15 +1000)
Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
drivers/gpu/drm/nouveau/nouveau_nvif.c
drivers/gpu/drm/nouveau/nvkm/core/client.c

index 28f1078a42ac3b002d55294bd182bcf9b2d58408..e3b96e3df7da798e6cf2ac2ec3c11a7992cc47be 100644 (file)
@@ -20,7 +20,9 @@ struct nvkm_client {
 };
 
 int  nvkm_client_new(const char *name, u64 device, const char *cfg,
-                    const char *dbg, struct nvkm_client **);
+                    const char *dbg,
+                    int (*)(const void *, u32, const void *, u32),
+                    struct nvkm_client **);
 
 int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
                           void *data, u32 size);
index 69341a65dc42bd5667cb4f13071f3ecf1be7b723..b3f29b1ce9eab3bd414097d2f325e25e87f47809 100644 (file)
@@ -103,16 +103,8 @@ static int
 nvkm_client_driver_init(const char *name, u64 device, const char *cfg,
                        const char *dbg, void **ppriv)
 {
-       struct nvkm_client *client;
-       int ret;
-
-       ret = nvkm_client_new(name, device, cfg, dbg, &client);
-       *ppriv = client;
-       if (ret)
-               return ret;
-
-       client->ntfy = nvkm_client_ntfy;
-       return 0;
+       return nvkm_client_new(name, device, cfg, dbg, nvkm_client_ntfy,
+                              (struct nvkm_client **)ppriv);
 }
 
 const struct nvif_driver
index 3cde975816f3391094306d85d5dfbf5d1b6f5733..4e2730cb1feccc54e454449daf433e2c9439f72f 100644 (file)
@@ -238,7 +238,9 @@ nvkm_client = {
 
 int
 nvkm_client_new(const char *name, u64 device, const char *cfg,
-               const char *dbg, struct nvkm_client **pclient)
+               const char *dbg,
+               int (*ntfy)(const void *, u32, const void *, u32),
+               struct nvkm_client **pclient)
 {
        struct nvkm_oclass oclass = { .base = nvkm_uclient_sclass };
        struct nvkm_client *client;
@@ -252,5 +254,6 @@ nvkm_client_new(const char *name, u64 device, const char *cfg,
        client->device = device;
        client->debug = nvkm_dbgopt(dbg, "CLIENT");
        client->objroot = RB_ROOT;
+       client->ntfy = ntfy;
        return 0;
 }