summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-12-19 11:28:40 +0100
committerKeith Packard <keithp@keithp.com>2014-01-29 15:29:43 -0800
commit48b489769e78fa20911630173ab708feecb0fb0e (patch)
tree29da79a4ffd68ba35a2f9b298ba771b2faef56af /hw
parent78f0667d6df9cc43a397d9f1490e540936a435d6 (diff)
xf86Events: refactor xf86VTLeave error handling
Use kernel goto style error handling for xf86VTSwitchAway() failure. This makes it much easier to read the straight path. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86Events.c94
1 files changed, 46 insertions, 48 deletions
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index e4ec1774f..e0ec76825 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -454,62 +454,60 @@ xf86VTLeave(void)
xf86AccessLeave(); /* We need this here, otherwise */
- if (!xf86VTSwitchAway()) {
+ if (!xf86VTSwitchAway())
+ goto switch_failed;
+
+#ifdef XF86PM
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ xf86OSPMClose = NULL;
+#endif
+
+ for (i = 0; i < xf86NumScreens; i++) {
/*
- * switch failed
+ * zero all access functions to
+ * trap calls when switched away.
*/
+ xf86Screens[i]->vtSema = FALSE;
+ }
+ if (xorgHWAccess)
+ xf86DisableIO();
- DebugF("xf86VTSwitch: Leave failed\n");
- xf86AccessEnter();
- for (i = 0; i < xf86NumScreens; i++) {
- if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
- FatalError("EnterVT failed for screen %d\n", i);
- }
- for (i = 0; i < xf86NumGPUScreens; i++) {
- if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
- FatalError("EnterVT failed for gpu screen %d\n", i);
- }
- if (!(dispatchException & DE_TERMINATE)) {
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
- }
- }
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
-
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
- EnableDevice(pInfo->dev, TRUE);
- pInfo->flags &= ~XI86_DEVICE_DISABLED;
- pInfo = pInfo->next;
- }
- for (ih = InputHandlers; ih; ih = ih->next) {
- if (ih->is_input)
- xf86EnableInputHandler(ih);
- else
- xf86EnableGeneralHandler(ih);
- }
- OsReleaseSIGIO();
+ return;
+switch_failed:
+ DebugF("xf86VTSwitch: Leave failed\n");
+ xf86AccessEnter();
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
+ FatalError("EnterVT failed for screen %d\n", i);
}
- else {
-#ifdef XF86PM
- if (xf86OSPMClose)
- xf86OSPMClose();
- xf86OSPMClose = NULL;
-#endif
-
+ for (i = 0; i < xf86NumGPUScreens; i++) {
+ if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+ FatalError("EnterVT failed for gpu screen %d\n", i);
+ }
+ if (!(dispatchException & DE_TERMINATE)) {
for (i = 0; i < xf86NumScreens; i++) {
- /*
- * zero all access functions to
- * trap calls when switched away.
- */
- xf86Screens[i]->vtSema = FALSE;
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
}
- if (xorgHWAccess)
- xf86DisableIO();
}
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
+ EnableDevice(pInfo->dev, TRUE);
+ pInfo->flags &= ~XI86_DEVICE_DISABLED;
+ pInfo = pInfo->next;
+ }
+ for (ih = InputHandlers; ih; ih = ih->next) {
+ if (ih->is_input)
+ xf86EnableInputHandler(ih);
+ else
+ xf86EnableGeneralHandler(ih);
+ }
+ OsReleaseSIGIO();
}
void