Re: 2.6.13-mm1

Alan Cox
2005-09-01T14:50:27Z

On Thu, Sep 01, 2005 at 07:22:53AM -0700, Martin J. Bligh wrote:
> - if (count > (TTY_FLIPBUF_SIZE - tty->flip.count))
> - count = TTY_FLIPBUF_SIZE - tty->flip.count;
> -
> + count = tty_buffer_request_room(tty, N_INBUF);
> +

Should be "int count = " yes

> /* If flip is full, just reschedule a later read */
> if (count == 0) {
> poll_mask |= HVC_POLL_READ;
>
> shouldn't be deleting the declaration of count.
> and possibly the "flip removal" was incomplete (line 636) ???

Yep. You can remove the tty->flip.count test or use count, but at that
point count is guaranteed to be > 0 I believe. Fixed both in my tree will
push a new diff to Andre soon.

Also if you are tidying up all the 'read 64 chars and take a break' stuff
should just go away. The kernel will buffer large chunks of data for you
now. In the ideal case if you know the total pending space you can do

int len = tty_buffer_request_room(tty, len)

and it'll look to kmalloc a big enough buffer for you if the buffer pool
isn't suitable. Even if that fails (its a hint) the tty layer will split the
data across multiple smaller buffers for you when you use tty_insert_flip_*

So you should be able to just ram data at it as it comes off the hvc.

Alan