From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ASoC: Add new TI TLV320AIC3204 CODEC driver
Date: Tue, 22 Jun 2010 11:15:00 +0100 [thread overview]
Message-ID: <20100622101500.GA15255@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20100621234314.GZ7759@www.longlandclan.yi.org>
On Tue, Jun 22, 2010 at 09:43:14AM +1000, Stuart Longland wrote:
> On Sat, Jun 19, 2010 at 02:12:21AM +0100, Mark Brown wrote:
> > On Sat, Jun 19, 2010 at 08:24:36AM +1000, Stuart Longland wrote:
> > > + /* Page 1 */
> > > + if (page == 1) {
> > > + if (reg <= 4)
> > > + return 1;
> > I can't help but think that this'd be more legible with switch ()
> > statements (GCC has an extension for ranges in switch statements which
> > you could use).
> One is to go on a page-by-page basis, which is how I do it using the if
> statements. Here; I define my ranges so that I start from the very
> end... anything beyond page 70 is invalid ... voila, I eliminate those
> early on. A number of pages have a similar register pattern, and so I
> make use of nested if statements to explain this. The if block for
> pages following always use the block before to define the upper,
> non-inclusive bound.
It's not so much the outer ifs that were bothering me, it's the inner
ones where you're doing the final register ranges as just a sequence of
if statements (not even if ... else) which really bothered me here. The
code just doesn't look like what it's trying to do.
> This is a function largely intended for debugging, in fact, I'm thinking
> I should probably wrap it in #ifdef CONFIG_DEBUG_FS, since the function
> isn't called unless debugfs is enabled. So I'm not certain that
> performance is worth chasing here given the intended purpose -- it's not
> something that's called all the time, nor something that will be used in
> a production environment.
Oh, I thought you were using it to filter the CODEC register displays?
> That's my thoughts on the issue, perhaps na??ve, but I'm not sure
> there's any real gain in refactoring this.
It's fairly hard to read at the minute -
prev parent reply other threads:[~2010-06-22 10:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-18 3:57 [PATCH] ASoC: Add new TI TLV320AIC3204 CODEC driver Stuart Longland
2010-06-18 11:01 ` Liam Girdwood
2010-06-18 11:33 ` Stuart Longland
2010-06-18 15:53 ` Mark Brown
2010-06-18 22:43 ` [alsa-devel] " Stuart Longland
2010-06-19 1:25 ` Mark Brown
2010-06-18 22:24 ` Stuart Longland
2010-06-19 1:12 ` Mark Brown
2010-06-19 9:49 ` [alsa-devel] " Stuart Longland
2010-06-19 10:57 ` Mark Brown
2010-06-21 23:43 ` Stuart Longland
2010-06-22 10:15 ` Mark Brown [this message]
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=20100622101500.GA15255@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).