Add explicit check for not set time inside cam_periph_freeze_after_event().

System time is set later on boot process then initial bus scan by CAM.
Until that moment microtime() is equal to microuptime(), and if system
boots quickly, the value can be close to zero. That causes settle time
waiting even for buses that don't use reset during probe.

On my test system this reduces boot time by 1 second if USB enabled, or
by 4 seconds if USB disabled.  CAM waited for ctl2cam0 bus "settle".
This commit is contained in:
mav 2012-10-14 08:50:05 +00:00
parent 45a414ab75
commit fdb8b5f8ba

View File

@ -1250,6 +1250,9 @@ cam_periph_freeze_after_event(struct cam_periph *periph,
struct timeval delta; struct timeval delta;
struct timeval duration_tv; struct timeval duration_tv;
if (!timevalisset(event_time))
return;
microtime(&delta); microtime(&delta);
timevalsub(&delta, event_time); timevalsub(&delta, event_time);
duration_tv.tv_sec = duration_ms / 1000; duration_tv.tv_sec = duration_ms / 1000;