From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: Joe Perches <joe@perches.com>
Cc: e1000-devel@lists.sourceforge.net,
netdev <netdev@vger.kernel.org>,
"Kok, Auke" <auke-jan.h.kok@intel.com>,
Jeff Garzik <jgarzik@pobox.com>
Subject: Re: [PATCH] - e1000_ethtool.c - convert macros to functions
Date: Wed, 31 Oct 2007 17:39:49 -0700 [thread overview]
Message-ID: <47292055.5070107@intel.com> (raw)
In-Reply-To: <1193872556.11020.34.camel@localhost>
Joe Perches wrote:
> On Wed, 2007-10-31 at 14:30 -0700, Kok, Auke wrote:
>> Joe Perches wrote:
>> that's not a bad idea, however see below:
>> can't we keep the macro here (and just make it call the function instead of
>> expanding). the resulting code is much more lenghty and contains all these logic
>> traps that the previous code didn't have.
>> just have the macro expand to `if (reg_pattern_test(...)) return 1)` and you don't
>> need to change any of the calling lines.
>
> You could define something like:
>
> #define REG_PATTERN_TEST(reg, mask, write) \
> if (reg_pattern_test(adapter, data, \
> E1000_REG(&adapter->hw, reg), \
> mask, write)) \
> return 1;
>
> But isn't the macro with an embedded return a bit too obfuscating?
in this case it saves a bunch of time reading and makes the code actually more
readable and robust IMO. Now we're explicitly mobming out on an error. with your
patch we need to assure that for every call to reg_pattern_test we check the
return value.
>>> +#define E1000_READ_REG_ARRAY(a, reg, offset) \
>>> + (readl((a)->hw_addr + \
>>> + (((a)->mac_type >= e1000_82543) \
>>> + ? E1000_##reg : E1000_82542_##reg) + \
>>> + ((offset) << 2)))
>> did you have to change these macro's ?
>
> No. Your choice to keep/remove.
> I did want to use the E1000_REG or a new E1000_REG_ADDR macro.
>
>> also, I'm a bit inclined to prefer a patch for e1000e for now as we're about to
>> move the pci-express hardware over, but we can certainly merge something like this
>> in e1000 after the move as well.
>
> Simple enough.
>
> When is e1000e scheduled to be part of defconfig?
I don't know about defconfig, but you can already get e1000 in 2.6.24rc1...
Auke
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
next prev parent reply other threads:[~2007-11-01 0:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 21:18 [PATCH] - e1000_ethtool.c - convert macros to functions Joe Perches
2007-10-31 21:30 ` Kok, Auke
2007-10-31 23:15 ` Joe Perches
2007-11-01 0:39 ` Kok, Auke [this message]
2007-11-01 0:34 ` Joe Perches
2007-11-01 3:29 ` [PATCH] - e1000e/ethtool.c " Joe Perches
2007-11-01 16:01 ` Kok, Auke
-- strict thread matches above, loose matches on Subject: below --
2007-11-01 21:16 [PATCH] - e1000_ethtool.c " Joe Perches
2007-11-01 21:29 ` Kok, Auke
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=47292055.5070107@intel.com \
--to=auke-jan.h.kok@intel.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jgarzik@pobox.com \
--cc=joe@perches.com \
--cc=netdev@vger.kernel.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).