From: Kyle Moffett <mrmacman_g4@mac.com>
To: Heiko J Schick <schihei@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org,
linuxppc-dev@ozlabs.org, Christoph Raisch <RAISCH@de.ibm.com>,
Hoang-Nam Nguyen <HNGUYEN@de.ibm.com>,
Marcus Eder <MEDER@de.ibm.com>
Subject: Re: [PATCH 06/16] ehca: common include files
Date: Fri, 28 Apr 2006 01:11:11 -0400 [thread overview]
Message-ID: <12A9A218-DC60-4944-892D-150DF2D88F0C@mac.com> (raw)
In-Reply-To: <4450A183.6030405@de.ibm.com>
On Apr 27, 2006, at 06:48:35, Heiko J Schick wrote:
> +#define EHCA_EDEB_TRACE_MASK_SIZE 32
> +extern u8 ehca_edeb_mask[EHCA_EDEB_TRACE_MASK_SIZE];
> +#define EDEB_ID_TO_U32(str4) (str4[3] | (str4[2] << 8) | (str4[1]
> << 16) | \
> + (str4[0] << 24))
> +
> +inline static u64 ehca_edeb_filter(const u32 level,
> + const u32 id, const u32 line)
> +{
> + u64 ret = 0;
> + u32 filenr = 0;
> + u32 filter_level = 9;
> + u32 dynamic_level = 0;
> +
> + /* This is code written for the gcc -O2 optimizer which should
> colapse
> + * to two single ints filter_level is the first level kicked out by
> + * compiler means trace everythin below 6. */
> + if (id == EDEB_ID_TO_U32("ehav")) {
> + filenr = 0x01;
> + filter_level = 8;
> + }
> [...]
This whole mess should be a simpler with a table and a loop
struct edeb_filter_entry {
u32 filenr;
u32 filter_level;
};
# define EDEB_FILTER_ENTRY(name,nr,level) { .id = name, .filenr =
nr, .filter_level = level }
static const struct edeb_filter_entry edeb_filter_table[] = {
EDEB_FILTER_ENTRY("clas", 0x02, 8),
[...]
};
Then just iterate over that table in a loop. The end result is much
smaller code and data, and much clearer as to intent as well.
Cheers,
Kyle Moffett
prev parent reply other threads:[~2006-04-28 5:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 10:48 [PATCH 06/16] ehca: common include files Heiko J Schick
2006-04-27 11:19 ` Arnd Bergmann
2006-04-27 21:31 ` Heiko J Schick
2006-04-28 5:11 ` Kyle Moffett [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=12A9A218-DC60-4944-892D-150DF2D88F0C@mac.com \
--to=mrmacman_g4@mac.com \
--cc=HNGUYEN@de.ibm.com \
--cc=MEDER@de.ibm.com \
--cc=RAISCH@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=openib-general@openib.org \
--cc=schihei@de.ibm.com \
/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).