Lines 988-994
Link Here
|
988 |
{ |
988 |
{ |
989 |
unsigned long flags = 0; |
989 |
unsigned long flags = 0; |
990 |
unsigned long received = 0; |
990 |
unsigned long received = 0; |
991 |
unsigned long count = 0; |
991 |
unsigned long count = 0, AmountToCopy = 0; |
992 |
int status = 0, i=0; |
992 |
int status = 0, i=0; |
993 |
mem_buf_t *mb = NULL; |
993 |
mem_buf_t *mb = NULL; |
994 |
#if (ENABLE_MONO) |
994 |
#if (ENABLE_MONO) |
Lines 1011-1026
Link Here
|
1011 |
spin_unlock_irqrestore(&card->lock,flags); |
1011 |
spin_unlock_irqrestore(&card->lock,flags); |
1012 |
return 0; |
1012 |
return 0; |
1013 |
} |
1013 |
} |
1014 |
|
1014 |
|
|
|
1015 |
AmountToCopy = size; |
1015 |
while((received < size) && (!nvstream->buf[nvstream->drain_index].in_use)) { |
1016 |
while((received < size) && (!nvstream->buf[nvstream->drain_index].in_use)) { |
1016 |
mb = (mem_buf_t *) &nvstream->buf[nvstream->drain_index]; |
1017 |
mb = (mem_buf_t *) &nvstream->buf[nvstream->drain_index]; |
1017 |
count = size < (nvstream->frag_size - mb->count) ? size : nvstream->frag_size - mb->count; |
1018 |
count = AmountToCopy < (nvstream->frag_size - mb->count) ? AmountToCopy : nvstream->frag_size - mb->count; |
1018 |
|
1019 |
|
1019 |
if(nvstream->Channels > 1) { |
1020 |
if(nvstream->Channels > 1) { |
1020 |
if(copy_to_user(mem,(u8*)mb->page + mb->count ,count)) { |
1021 |
if(copy_to_user(mem,(u8*)mb->page + mb->count ,count)) { |
1021 |
break; |
1022 |
break; |
1022 |
} |
1023 |
} |
1023 |
mb->count += count; |
1024 |
mb->count += count; |
|
|
1025 |
AmountToCopy -= count; |
1024 |
} |
1026 |
} |
1025 |
#if (ENABLE_MONO) |
1027 |
#if (ENABLE_MONO) |
1026 |
else { |
1028 |
else { |
Lines 1040-1045
Link Here
|
1040 |
|
1042 |
|
1041 |
} |
1043 |
} |
1042 |
if(status) break; |
1044 |
if(status) break; |
|
|
1045 |
AmountToCopy = ((size - received) << 1); |
1043 |
} |
1046 |
} |
1044 |
#endif |
1047 |
#endif |
1045 |
// once the buffer is copied add the buffer back if possible |
1048 |
// once the buffer is copied add the buffer back if possible |