in devices/ipoctal.c [439:460]
static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,
const unsigned char *buf,
int count)
{
unsigned long flags;
int i;
unsigned int *pointer_read = &channel->pointer_read;
/* Copy the bytes from the user buffer to the internal one */
for (i = 0; i < count; i++) {
if (i <= (PAGE_SIZE - channel->nb_bytes)) {
spin_lock_irqsave(&channel->lock, flags);
channel->tty_port.xmit_buf[*pointer_read] = buf[i];
*pointer_read = (*pointer_read + 1) % PAGE_SIZE;
channel->nb_bytes++;
spin_unlock_irqrestore(&channel->lock, flags);
} else {
break;
}
}
return i;
}