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 <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2012-09-12 13:09:23 +10:00
parent b3ccd34ded
commit fa6df8c163
4 changed files with 14 additions and 10 deletions

View 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;
}

View 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);
}

View 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);

View 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;