Changeset 1628 for trunk

Show
Ignore:
Timestamp:
08/23/09 05:03:54 (14 years ago)
Author:
jwoithe
Message:

RME: If shared memory allocation fails, use a local duplicate of the shared memory structure. This alleviates the need to test for valid shared data before any of the housekeeping fields are used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/rme/fireface_hw.cpp

    r1627 r1628  
    5151    // device flash and adopt that.  For now (for initial testing purposes) 
    5252    // we'll go with a static state. 
    53     if (shared_data==NULL || shared_data->settings_valid==0) { 
     53    if (shared_data->settings_valid==0) { 
    5454        memset(settings, 0, sizeof(*settings)); 
    5555        settings->spdif_input_mode = FF_SWPARAM_SPDIF_INPUT_COAX; 
     
    6969        } 
    7070 
    71         if (shared_data != NULL) 
    72             shared_data->settings_valid = 1; 
     71        shared_data->settings_valid = 1; 
    7372    } 
    7473 
     
    8382    // Also configure the TCO (Time Code Option) settings for those devices 
    8483    // which have a TCO. 
    85     if (shared_data==NULL || shared_data->tco_settings_valid==0) { 
     84    if (shared_data->tco_settings_valid==0) { 
    8685        if (tco_present) { 
    8786            memset(tco_settings, 0, sizeof(*tco_settings)); 
    8887            write_tco_settings(tco_settings); 
    8988        } 
    90         if (shared_data != NULL) 
    91             shared_data->tco_settings_valid = 1; 
     89        shared_data->tco_settings_valid = 1; 
    9290    } 
    9391    return 0; 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r1627 r1628  
    288288    if (shared_data == NULL) { 
    289289        debugOutput( DEBUG_LEVEL_WARNING, "Could not create/access shared configuration memory object, using process-local storage\n"); 
    290         settings = &settings_localobj; 
    291         tco_settings = &tco_settings_localobj; 
    292         memset(settings, 0, sizeof(*settings)); 
    293         memset(tco_settings, 0, sizeof(*tco_settings)); 
    294     } else { 
    295         settings = &shared_data->settings; 
    296         tco_settings = &shared_data->tco_settings; 
    297     } 
     290        memset(&local_data_obj, 0, sizeof(local_data_obj)); 
     291        shared_data = &local_data_obj; 
     292    } 
     293    settings = &shared_data->settings; 
     294    tco_settings = &shared_data->tco_settings; 
    298295 
    299296    // If device is FF800, check to see if the TCO is fitted 
  • trunk/libffado/src/rme/rme_avdevice.h

    r1627 r1628  
    125125    FF_TCO_settings_t *tco_settings; 
    126126 
    127     rme_shm_t *shared_data; 
    128     FF_software_settings_t settings_localobj; 
    129     FF_TCO_settings_t tco_settings_localobj; 
     127    rme_shm_t *shared_data, local_data_obj; 
    130128 
    131129    signed int num_channels;