lkml.org 
[lkml]   [2008]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -mm v4 7/9] atmel_serial: Add DMA support
On Mon, 28 Jan 2008 02:20:00 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Mon, 28 Jan 2008 10:59:09 +0100 Haavard Skinnemoen <hskinnemoen@atmel.com> wrote:
>
> > > ho-hum. The generic uart buffer-handling code does ringbuffers the wrong
> > > way. Maybe it has to handle non-power-of-two buffer sizes.
> >
> > Hmm...I don't understand. What does it do wrong?
>
> An faq ;) If the buffer size is a power-of-two it's better to allow the
> head and tail indices wrap through 0xffffffff and only mask them when
> subscripting. It ends up faster (usually) and you can use all of the
> elements of the buffer (rather than all-1) and you get nice things like:
>
> is_empty = (head == tail)
> is_full = (tail - head == size)
> nr_items_in_ring = (tail - head)

Ok, that makes sense. Thanks for explaining. Not sure if want to start
improving things right now, although I'm pretty sure the circ stuff
can't handle non-power-of-two buffer size currently so it should be
possible.

> > > All those uart_circ_*() macros reference their arg more than once and ...
> > > you know the deal.
> >
> > Yeah. Would you like a patch that inline-ifies <linux/circ.h>?
>
> uh, if you're feeling especially keen. We have bigger problems than this.

Well, if you put it like that; no, not really.

I'll post a fix for the other things you pointed out shortly.

Haavard


\
 
 \ /
  Last update: 2008-01-28 12:45    [W:0.078 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site