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>
This commit is contained in:
Hans de Goede 2013-12-19 11:28:40 +01:00 committed by Keith Packard
parent 78f0667d6d
commit 48b489769e

View File

@ -454,11 +454,28 @@ xf86VTLeave(void)
xf86AccessLeave(); /* We need this here, otherwise */
if (!xf86VTSwitchAway()) {
/*
* switch failed
*/
if (!xf86VTSwitchAway())
goto switch_failed;
#ifdef XF86PM
if (xf86OSPMClose)
xf86OSPMClose();
xf86OSPMClose = NULL;
#endif
for (i = 0; i < xf86NumScreens; i++) {
/*
* zero all access functions to
* trap calls when switched away.
*/
xf86Screens[i]->vtSema = FALSE;
}
if (xorgHWAccess)
xf86DisableIO();
return;
switch_failed:
DebugF("xf86VTSwitch: Leave failed\n");
xf86AccessEnter();
for (i = 0; i < xf86NumScreens; i++) {
@ -491,25 +508,6 @@ xf86VTLeave(void)
xf86EnableGeneralHandler(ih);
}
OsReleaseSIGIO();
}
else {
#ifdef XF86PM
if (xf86OSPMClose)
xf86OSPMClose();
xf86OSPMClose = NULL;
#endif
for (i = 0; i < xf86NumScreens; i++) {
/*
* zero all access functions to
* trap calls when switched away.
*/
xf86Screens[i]->vtSema = FALSE;
}
if (xorgHWAccess)
xf86DisableIO();
}
}
void