From: David Miller <davem@davemloft.net>
To: shemminger@linux-foundation.org
Cc: netdev@vger.kernel.org, Ariel.Hendel@sun.com,
greg.onufer@sun.com, jeff@garzik.org
Subject: Re: [PATCH]: Preliminary release of Sun Neptune driver
Date: Wed, 19 Sep 2007 15:07:55 -0700 (PDT) [thread overview]
Message-ID: <20070919.150755.38714639.davem@davemloft.net> (raw)
In-Reply-To: <20070919145900.759ef19e@freepuppy.rosehill.hemminger.net>
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 19 Sep 2007 14:59:00 -0700
> > +#ifndef PCI_DEVICE_ID_SUN_NEPTUNE
> > +#define PCI_DEVICE_ID_SUN_NEPTUNE 0xabcd
> > +#endif
>
> Why bother defining the ID, and what good does driver_data do you?
Good point, I'll put this 0xabcd thing directly into the
table.
> > +#define nr64(reg) readq(np->regs + (reg))
> > +#define nw64(val, reg) writeq((val), np->regs + (reg))
>
> Macro's that make assumptions about context (ie variable name np)
> are evil and bad style.
Too bad, it saves developers who write 20,000 line drivers from carpel
tunnel symdrome.
It's so repetitive to state things over and over again, and this macro
scheme is 1) established widely (tg3 amonst many other drivers do it)
and 2) forces the driver to use a consistent naming convention for
primary driver private struct variables.
> Wrapping locking is poor style and makes code review harder.
I disagree, because in this case the macro says exactly what the thing
is doing, locking the parent of the port. The implementation is
arbitrary and can be reviewed independently of the uses.
> > +static int niu_wait_bits_clear_mac(struct niu *np, unsigned long reg, u64 bits,
> > + int limit, int delay)
> > +{
> > + BUILD_BUG_ON(limit <= 0 || delay < 0);
>
> There is no way compiler can evaluate limit or delay.
Check the callers, they all pass contant values.
> Why are you using __u32? That is reserved for values going out
> to user space.
Right, I'll fix those up, thanks.
next prev parent reply other threads:[~2007-09-19 22:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 22:15 [PATCH]: Preliminary release of Sun Neptune driver David Miller
2007-09-19 21:59 ` Stephen Hemminger
2007-09-19 22:05 ` Jeff Garzik
2007-09-19 22:11 ` David Miller
2007-09-19 22:37 ` Jeff Garzik
2007-09-19 22:07 ` David Miller [this message]
2007-09-19 22:40 ` Jeff Garzik
2007-09-19 23:05 ` Stephen Hemminger
2007-09-19 23:17 ` David Miller
2007-09-19 23:20 ` Rick Jones
2007-09-19 23:53 ` David Miller
2007-09-20 16:06 ` Ariel Hendel
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=20070919.150755.38714639.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Ariel.Hendel@sun.com \
--cc=greg.onufer@sun.com \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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).