- c -= copy_from_user(tmp_buf, buf, c);
- if (!c) {
- if (!ret) {
- ret = -EFAULT;
- }
- break;
- }
- CY_LOCK(info, flags);
- c1 = min(c, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
- (int)(SERIAL_XMIT_SIZE - info->xmit_head)));
-
- if (c1 < c)
- c = c1;
- memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
- info->xmit_head = ((info->xmit_head + c) & (SERIAL_XMIT_SIZE-1));
- info->xmit_cnt += c;
- CY_UNLOCK(info, flags);
- buf += c;
- count -= c;
- ret += c;
- }
- up(&tmp_buf_sem);
- } else {
- CY_LOCK(info, flags);
- while (1) {
- c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),