From fa6df8c163ddf1fba658059695ab9587f344712c Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 12 Sep 2012 13:09:23 +1000 Subject: [PATCH] drm/nouveau/core: have client-id be a string, rather than an integer Can be somewhat more informative that way... Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/core/core/client.c | 6 +++--- drivers/gpu/drm/nouveau/core/core/printk.c | 4 ++-- drivers/gpu/drm/nouveau/core/include/core/client.h | 4 ++-- drivers/gpu/drm/nouveau/nouveau_drm.c | 10 +++++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/core/client.c b/drivers/gpu/drm/nouveau/core/core/client.c index e190f1849118..c617f0480071 100644 --- a/drivers/gpu/drm/nouveau/core/core/client.c +++ b/drivers/gpu/drm/nouveau/core/core/client.c @@ -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; } diff --git a/drivers/gpu/drm/nouveau/core/core/printk.c b/drivers/gpu/drm/nouveau/core/core/printk.c index 134dd6d12975..6161eaf5447c 100644 --- a/drivers/gpu/drm/nouveau/core/core/printk.c +++ b/drivers/gpu/drm/nouveau/core/core/printk.c @@ -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); } diff --git a/drivers/gpu/drm/nouveau/core/include/core/client.h b/drivers/gpu/drm/nouveau/core/include/core/client.h index f5f45f228282..0193532ceac9 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/client.h +++ b/drivers/gpu/drm/nouveau/core/include/core/client.h @@ -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); diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index e26358c79151..e96507e11488 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -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; -- 2.34.1