static void nouveau_cli_destroy(struct nouveau_cli *cli) { nvkm_vm_ref(NULL, &nvxx_client(&cli->base)->vm, NULL); nvif_client_fini(&cli->base); usif_client_fini(cli); }
int nvif_client_init(void (*dtor)(struct nvif_client *), const char *driver, const char *name, u64 device, const char *cfg, const char *dbg, struct nvif_client *client) { int ret, i; ret = nvif_object_init(NULL, (void*)dtor, 0, 0, NULL, 0, &client->base); if (ret) return ret; client->base.parent = &client->base; client->base.handle = ~0; client->object = &client->base; client->super = true; for (i = 0, ret = -EINVAL; (client->driver = nvif_drivers[i]); i++) { if (!driver || !strcmp(client->driver->name, driver)) { ret = client->driver->init(name, device, cfg, dbg, &client->base.priv); if (!ret || driver) break; } } if (ret) nvif_client_fini(client); return ret; }
int main(int argc, char **argv) { struct nvif_client client; struct nvif_device device; bool suspend = false, wait = false; int ret, c; while ((c = getopt(argc, argv, "sw"U_GETOPT)) != -1) { switch (c) { case 's': suspend = true; break; case 'w': wait = true; break; default: if (!u_option(c)) return 1; break; } } ret = u_device(NULL, argv[0], "info", true, true, ~0ULL, 0x00000000, &client, &device); if (ret) return ret; if (suspend) { nvif_client_suspend(&client); nvif_client_resume(&client); } while (wait && (c = getchar()) == EOF) { sched_yield(); } printf("shutting down...\n"); nvif_device_fini(&device); nvif_client_fini(&client); printf("done!\n"); return ret; }
static void nvif_client_del(struct nvif_client *client) { nvif_client_fini(client); kfree(client); }