devicestate.c: Simplified some logic in _ast_device_state().