static int do_cleanup(struct ggi_visual *vis) { ggi_libkgi_priv *priv = LIBKGI_PRIV(vis); /* We may be called more than once due to the LibGG cleanup stuff */ if (priv == NULL) return 0; DPRINT("display-libkgi: GGIdlcleanup start.\n"); if (LIBGGI_FD(vis) >= 0) close(LIBGGI_FD(vis)); if (vis->input != NULL) { giiClose(vis->input); vis->input = NULL; } free(priv); LIBKGI_PRIV(vis) = NULL; ggUnregisterCleanup((ggcleanup_func *)do_cleanup, vis); ggLock(_ggi_global_lock); refcount--; refcount--; if (refcount == 0) { ggLockDestroy(_ggi_libkgi_lock); _ggi_libkgi_lock = NULL; } ggUnlock(_ggi_global_lock); DPRINT("display-libkgi: GGIdlcleanup done.\n"); return 0; }
static int GGIclose(struct ggi_visual *vis, struct ggi_dlhandle *dlh) { suid_hook *priv = SUIDHOOK(vis); ggi_mode mode; int x; LIB_ASSERT(priv != NULL, "display-suidkgi: priv == NULL"); if (priv->is_up) { #if 1 /* Not sure, if this is needed, but ... */ mode.frames=1; mode.graphtype=GT_TEXT16; mode.visible.x=mode.virt.x=80; mode.visible.y=mode.virt.y=25; mode.dpp.x = 9;mode.dpp.y =14; x=GGI_suidkgi_checkmode(vis,&mode); DPRINT("TESTMODE1 says %d.\n",x); x=GGI_suidkgi_setmode(vis,&mode); DPRINT("SETMODE1 says %d.\n",x); #endif /* suidkgi_cleanup_module(); */ if (priv->vt_fd >= 0) { vtswitch_close(vis); priv->vt_fd = -1; } DPRINT("Cleanup went well.\n"); close(priv->dev_mem); priv->is_up=0; } if (vis->input) { giiClose(vis->input); vis->input = NULL; } free(priv); return 0; }
static int do_cleanup(ggi_visual *vis) { ggi_lcd823_priv *priv = LCD823_PRIV(vis); /* We may be called more than once due to the LibGG cleanup stuff */ if (priv == NULL) return 0; DPRINT("display-lcd823: do_cleanup start.\n"); _GGI_lcd823_free_dbs(vis); if (LIBGGI_FD(vis) >= 0) { if (priv->fb_ptr) { munmap(priv->fb_ptr, priv->fb_size); } ioctl(LIBGGI_FD(vis), 2); /* Disable LCD */ close(LIBGGI_FD(vis)); LIBGGI_FD(vis) = -1; } if (vis->input != NULL) { giiClose(vis->input); vis->input = NULL; } free(priv); LIBGGI_PRIVATE(vis) = NULL; if (LIBGGI_GC(vis)) { free(LIBGGI_GC(vis)); } ggUnregisterCleanup((ggcleanup_func *)do_cleanup, vis); DPRINT("display-lcd823: do_cleanup done.\n"); return 0; }