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:
parent
78f0667d6d
commit
48b489769e
|
@ -454,11 +454,28 @@ xf86VTLeave(void)
|
||||||
|
|
||||||
xf86AccessLeave(); /* We need this here, otherwise */
|
xf86AccessLeave(); /* We need this here, otherwise */
|
||||||
|
|
||||||
if (!xf86VTSwitchAway()) {
|
if (!xf86VTSwitchAway())
|
||||||
/*
|
goto switch_failed;
|
||||||
* 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");
|
DebugF("xf86VTSwitch: Leave failed\n");
|
||||||
xf86AccessEnter();
|
xf86AccessEnter();
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
|
@ -491,25 +508,6 @@ xf86VTLeave(void)
|
||||||
xf86EnableGeneralHandler(ih);
|
xf86EnableGeneralHandler(ih);
|
||||||
}
|
}
|
||||||
OsReleaseSIGIO();
|
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
|
void
|
||||||
|
|
Loading…
Reference in New Issue