asix-sigma: Read position only in CAPTURE state

Check the position of ForceStop and Trigger events only in case we
are in CAPTURE state, it's useless to do this unconditionally when
receive_data() is called.

Signed-off-by: Marek Vasut <marex@denx.de>
Этот коммит содержится в:
Marek Vasut 2014-04-20 19:57:02 +02:00 коммит произвёл Bert Vermeulen
родитель 011f1091fa
Коммит 58d6f20748
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -1136,13 +1136,14 @@ static int receive_data(int fd, int revents, void *cb_data)
sdi = cb_data; sdi = cb_data;
devc = sdi->priv; devc = sdi->priv;
/* Get the current position. */
sigma_read_pos(&devc->state.stoppos, &devc->state.triggerpos, devc);
if (devc->state.state == SIGMA_IDLE) if (devc->state.state == SIGMA_IDLE)
return TRUE; return TRUE;
if (devc->state.state == SIGMA_CAPTURE) { if (devc->state.state == SIGMA_CAPTURE) {
/* Get the current position. */
sigma_read_pos(&devc->state.stoppos, &devc->state.triggerpos,
devc);
numchunks = (devc->state.stoppos + 511) / 512; numchunks = (devc->state.stoppos + 511) / 512;
/* Check if the timer has expired, or memory is full. */ /* Check if the timer has expired, or memory is full. */