 char *buf, size_t len) {  int count = 0;   while ((count < len) && (f->len != f->n)) {    int nwritten;    if (f->head <= f->tail) {    nwritten = len - count;    if (nwritten > f->n - f->tail)     nwritten = f->n - f->tail;   }   else {    nwritten = f->head - f->tail;    if (nwritten > len - count)     nwritten = len - count;   }    memcpy(f->data + f->tail, buf, nwritten);    count += nwritten;   buf += nwritten;   f->len += nwritten;   f->tail += nwritten;   f->tail %= f->n;  }   return count; }  int msnd_fifo_read_io(msnd_fifo *f, char __iomem *buf, size_t len) {  int count = 0;   while ((count < len) && (f->len > 0)) {    int nread;    if (f->tail <= f->head) {    nread = len - count;    if (nread > f->n - f->head)     nread = f->n - f->head;   }   else {    nread = f->tail - f->head;    if (nread > len - count)     nread = len - count;   }    memcpy