drm/nouveau/core: have client-id be a string, rather than an integer
authorBen Skeggs <bskeggs@redhat.com>
Wed, 12 Sep 2012 03:09:23 +0000 (13:09 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 3 Oct 2012 03:13:10 +0000 (13:13 +1000)
Can be somewhat more informative that way...

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

index e190f18..c617f04 100644 (file)
@@ -46,8 +46,8 @@ nouveau_client_oclass = {
 };
 
 int
-nouveau_client_create_(u32 name, u64 devname, const char *cfg, const char *dbg,
-                      int length, void **pobject)
+nouveau_client_create_(const char *name, u64 devname, const char *cfg,
+                      const char *dbg, int length, void **pobject)
 {
        struct nouveau_object *device;
        struct nouveau_client *client;
@@ -75,7 +75,7 @@ nouveau_client_create_(u32 name, u64 devname, const char *cfg, const char *dbg,
        atomic_set(&nv_object(client)->usecount, 2);
 
        nouveau_object_ref(device, &client->device);
-       client->handle = name;
+       snprintf(client->name, sizeof(client->name), "%s", name);
        client->debug = nouveau_dbgopt(dbg, "CLIENT");
        return 0;
 }
index 134dd6d..6161eaf 100644 (file)
@@ -62,8 +62,8 @@ nv_printk_(struct nouveau_object *object, const char *pfx, int level,
                if (level > nv_client(object)->debug)
                        return;
 
-               snprintf(mfmt, sizeof(mfmt), "%snouveau %c[%8d] %s", pfx,
-                        name[level], nv_client(object)->handle, fmt);
+               snprintf(mfmt, sizeof(mfmt), "%snouveau %c[%8s] %s", pfx,
+                        name[level], nv_client(object)->name, fmt);
        } else {
                snprintf(mfmt, sizeof(mfmt), "%snouveau: %s", pfx, fmt);
        }
index f5f45f2..0193532 100644 (file)
@@ -7,7 +7,7 @@ struct nouveau_client {
        struct nouveau_namedb base;
        struct nouveau_handle *root;
        struct nouveau_object *device;
-       u32 handle;
+       char name[16];
        u32 debug;
        struct nouveau_vm *vm;
 };
@@ -34,7 +34,7 @@ nouveau_client(void *obj)
 #define nouveau_client_create(n,c,oc,od,d)                                     \
        nouveau_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
 
-int  nouveau_client_create_(u32 name, u64 device, const char *cfg,
+int  nouveau_client_create_(const char *name, u64 device, const char *cfg,
                            const char *dbg, int, void **);
 int  nouveau_client_init(struct nouveau_client *);
 int  nouveau_client_fini(struct nouveau_client *, bool suspend);
index e26358c..e96507e 100644 (file)
@@ -79,7 +79,8 @@ nouveau_name(struct pci_dev *pdev)
 }
 
 static int
-nouveau_cli_create(struct pci_dev *pdev, u32 name, int size, void **pcli)
+nouveau_cli_create(struct pci_dev *pdev, const char *name,
+                  int size, void **pcli)
 {
        struct nouveau_cli *cli;
        int ret;
@@ -246,7 +247,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
        struct nouveau_drm *drm;
        int ret;
 
-       ret = nouveau_cli_create(pdev, 0, sizeof(*drm), (void**)&drm);
+       ret = nouveau_cli_create(pdev, "DRM", sizeof(*drm), (void**)&drm);
        if (ret)
                return ret;
 
@@ -496,9 +497,12 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)
        struct pci_dev *pdev = dev->pdev;
        struct nouveau_drm *drm = nouveau_drm(dev);
        struct nouveau_cli *cli;
+       char name[16];
        int ret;
 
-       ret = nouveau_cli_create(pdev, fpriv->pid, sizeof(*cli), (void **)&cli);
+       snprintf(name, sizeof(name), "%d", fpriv->pid);
+
+       ret = nouveau_cli_create(pdev, name, sizeof(*cli), (void **)&cli);
        if (ret)
                return ret;