mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dave Hylands" <dhylands@gmail.com>
To: "Jaya Kumar" <jayakumar.lkml@gmail.com>
Cc: "David Brownell" <david-b@pacbell.net>,
	"Eric Miao" <eric.miao@marvell.com>,
	"Paulius Zaleckas" <paulius.zaleckas@teltonika.lt>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Russell King" <rmk@arm.linux.org.uk>,
	"Ben Gardner" <bgardner@wabtec.com>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC 2.6.28 1/1] gpiolib: add set/get batch v3
Date: Wed, 31 Dec 2008 07:22:08 -0800	[thread overview]
Message-ID: <c32efac40812310722x238c8348j5f4ed48ae87c4704@mail.gmail.com> (raw)
In-Reply-To: <12307156721518-git-send-email-jayakumar.lkml@gmail.com>

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/

  reply	other threads:[~2008-12-31 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-31  9:27 Jaya Kumar
2008-12-31 15:22 ` Dave Hylands [this message]
2008-12-31 17:58   ` Jaya Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c32efac40812310722x238c8348j5f4ed48ae87c4704@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=bgardner@wabtec.com \
    --cc=david-b@pacbell.net \
    --cc=eric.miao@marvell.com \
    --cc=geert@linux-m68k.org \
    --cc=jayakumar.lkml@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulius.zaleckas@teltonika.lt \
    --cc=rmk@arm.linux.org.uk \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®