[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c32efac40812310722x238c8348j5f4ed48ae87c4704@mail.gmail.com>
Date: Wed, 31 Dec 2008 07:22:08 -0800
From: "Dave Hylands" <dhylands@...il.com>
To: "Jaya Kumar" <jayakumar.lkml@...il.com>
Cc: "David Brownell" <david-b@...bell.net>,
"Eric Miao" <eric.miao@...vell.com>,
"Paulius Zaleckas" <paulius.zaleckas@...tonika.lt>,
"Geert Uytterhoeven" <geert@...ux-m68k.org>,
"Sam Ravnborg" <sam@...nborg.org>,
"Russell King" <rmk@....linux.org.uk>,
"Ben Gardner" <bgardner@...tec.com>,
linux-arm-kernel@...ts.arm.linux.org.uk,
linux-fbdev-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [RFC 2.6.28 1/1] gpiolib: add set/get batch v3
Hi Jaya,
...snip...
> There was a question about why have both bitmask AND width when width
> could be worked out from bitmask. The reason for having both bitmask and
> length is for performance. Let's compare the following two scenarios:
>
> /* flash to black */
> for (i=0; i < 800*600; i++)
> gpio_set_batch(DB0, 0x00000000, 0x0000FFFF)
>
> Internally, the above implementation has to work out the length of bits
> that are being set in bitmask in order to figure out which register
> boundaries are being crossed. That means looping through the bitmask
> and counting bits. That would need to be repeated for every call of
> gpio_set_batch in the above loop and would be a relatively high expense.
>
> /* flash to black */
> for (i=0; i < 800*600; i++)
> gpio_set_batch(DB0, 0x00000000, 0x0000FFFF, 16)
>
> In the 2nd case, the implementation is able to skip all the bit counting.
> This usage method is also the intuitive way for drivers that are trying
> to push data across a gpio bus since they explicitly know the bus length.
...snip...
I haven't been following too closely, but what about
gpio_set_batch(DB0, 0x00000000, 0x00FF00FF, 16)
That also has 16 bits set, but in different positions.
Shouldn't you just not bother with the length and optimize particular
bitmasks (i.e. 0xFF, 0xFFFF, 0xFFFFFF, 0xFFFFFFFF)?
--
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists