/* * Copyright 2012 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs
*/ #include <core/object.h> #include <core/client.h> #include <core/engine.h>
nvif_debug(object, "%s children...\n", action);
time = ktime_to_us(ktime_get());
list_for_each_entry_reverse(child, &object->tree, head) {
ret = nvkm_object_fini(child, suspend); if (ret && suspend) goto fail_child;
}
nvif_debug(object, "%s running...\n", action); if (object->func->fini) {
ret = object->func->fini(object, suspend); if (ret) {
nvif_error(object, "%s failed with %d\n", action, ret); if (suspend) goto fail;
}
}
time = ktime_to_us(ktime_get()) - time;
nvif_debug(object, "%s completed in %lldus\n", action, time); return 0;
fail: if (object->func->init) { int rret = object->func->init(object); if (rret)
nvif_fatal(object, "failed to restart, %d\n", rret);
}
fail_child:
list_for_each_entry_continue_reverse(child, &object->tree, head) {
nvkm_object_init(child);
} return ret;
}
int
nvkm_object_init(struct nvkm_object *object)
{ struct nvkm_object *child;
s64 time; int ret;
nvif_debug(object, "init running...\n");
time = ktime_to_us(ktime_get()); if (object->func->init) {
ret = object->func->init(object); if (ret) goto fail;
}
nvif_debug(object, "init children...\n");
list_for_each_entry(child, &object->tree, head) {
ret = nvkm_object_init(child); if (ret) goto fail_child;
}
time = ktime_to_us(ktime_get()) - time;
nvif_debug(object, "init completed in %lldus\n", time); return 0;
fail_child:
list_for_each_entry_continue_reverse(child, &object->tree, head)
nvkm_object_fini(child, false);
fail:
nvif_error(object, "init failed with %d\n", ret); if (object->func->fini)
object->func->fini(object, false); return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.