From: David Miller <davem@davemloft.net>
To: sathyap@serverengines.com
Cc: netdev@vger.kernel.org, jgarzik@pobox.com, subbus@serverengines.com
Subject: Re: [PATCH 11/11] benet: Kconfig, MAINTAINETS, drivers/net Makefile
Date: Tue, 09 Dec 2008 22:54:53 -0800 (PST) [thread overview]
Message-ID: <20081209.225453.183512699.davem@davemloft.net> (raw)
In-Reply-To: <1228832471.6435.104.camel@sperla-laptop>
Ok I looked at this driver some more and I have many comments.
The hardware library abstraction has to go. You aren't writing a
native linux driver if you split things up like this. I know you want
code sharing with your other supported platforms, but that's too bad.
If we let every vendor do this the whole tree would be one big
unmaintainable mess.
Many structures have all-caps or capitalized names. Good coding style
indicates that only CPP macros are to be named with capital letters.
(capital letterd symbols say to the reader "I'm a CPP macro and
probably have side-effects, beware") What's happening here looks ugly
and is inconsistent with the rest of the linux kernel.
The definition of the access to the chip registers is overly
obfuscated. All of this structure stuff and offsetof() business
adds complexity to the driver and makes it harder to understand.
The bit twiddling is difficult to understand and makes the compiler
work too hard.
I would suggest to fix all of this by simply using macros which
define chip register offsets, and next to those offset define
macros which define the bit values within the register. Endianness
is not an issue, and all read*()/write*() calls will write out
to the chip in little endian regardless of cpu endianness.
See other drivers such as drivers/net/tg3.[ch] or drivers/net/niu.[ch]
As you'll notice even such huge drivers as those can be done cleanly
in a single source file with no hardware abstraction library layer and
no funny register access structures and bit twiddling, so you can
strive for that as well.
So, this driver still needs a lot of work. :)
next prev parent reply other threads:[~2008-12-10 6:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 14:21 [PATCH 11/11] benet: Kconfig, MAINTAINETS, drivers/net Makefile Sathya Perla
2008-12-10 6:54 ` David Miller [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-12-11 11:43 Subbu Seetharaman
2008-12-27 15:41 Subbu Seetharaman
2008-12-28 2:23 ` David Miller
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=20081209.225453.183512699.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=sathyap@serverengines.com \
--cc=subbus@serverengines.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).