From: Jeff Garzik <jgarzik@pobox.com>
To: Roger Luethi <rl@hellgate.ch>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH 2.6] via-rhine: WOL band-aid
Date: Thu, 02 Dec 2004 17:40:17 -0500 [thread overview]
Message-ID: <41AF99D1.80105@pobox.com> (raw)
In-Reply-To: <20041130234526.GA32741@k3.hellgate.ch>
Roger Luethi wrote:
> On Tue, 30 Nov 2004 18:17:52 -0500, Jeff Garzik wrote:
>
>>I don't object to the patch, but I wonder if anything can be done to
>>reduce the usage of "magic numbers" (numeric rather than named constants)?
>
>
> That's a non-trivial task if you want to do it properly. There be dragons.
> Magic numbers may be evil but at least they are honest and convenient.
The reason why they are evil is that I have no clue what a change like
- iowrite8(ioread8(ioaddr + ConfigA) & 0xFE, ioaddr + ConfigA);
+ iowrite8(ioread8(ioaddr + ConfigA) & 0xFC, ioaddr + ConfigA);
does.
So two main points:
1) Linux is "evolution not revolution". I'm not asking for you to
change every magic number in the driver immediately to named constants.
Do it over time as you patch the driver. Add a couple WOL constants
now, a few more constants later, ...
2) Avoiding magic numbers is important to "reviewability" and long term
maintenance. Five years from now, changing "0xFE" to "0xFC" is just as
indecipherable as it is today, but without the memory of the current WOL
discussions and experiences to guide us. Source code needs to be
_readable_.
As I said in the other email though, I applied your patch to the
internal via-rhine queue, inside the netdev-2.6 queue. I simply ask
that you consider some remove-magic-numbers patches in the future.
Jeff
next prev parent reply other threads:[~2004-12-02 22:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-30 22:40 [PATCH 2.6] via-rhine: WOL band-aid Roger Luethi
2004-11-30 23:17 ` Jeff Garzik
2004-11-30 23:45 ` Roger Luethi
2004-12-02 22:40 ` Jeff Garzik [this message]
2004-12-01 0:46 ` [PATCH 2.6] via-rhine: WOL band-aid (patch against 2.6.9) Sven Ladegast
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=41AF99D1.80105@pobox.com \
--to=jgarzik@pobox.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rl@hellgate.ch \
/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