netdev
[Top] [All Lists]

Re: [PATCH] RFC: fix ethernet device initialization

To: Jes Sorensen <jes@xxxxxxxxxxxxx>
Subject: Re: [PATCH] RFC: fix ethernet device initialization
From: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>
Date: Sat, 10 Mar 2001 22:25:38 -0500
Cc: Linux Knernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
Organization: MandrakeSoft
References: <3AA6A570.57FF2D36@mandrakesoft.com> <d3ofvcyxhh.fsf@lxplus012.cern.ch>
Sender: owner-netdev@xxxxxxxxxxx
Jes Sorensen wrote:
> I don't like the way you declare all the code in obscure macros in
> there.
> 
> +#define DECLARE_CHG_MTU(suffix,low,high) \
> +       static int suffix##_change_mtu(struct net_device *dev, int new_mtu) \
> ......
> 
> All it does is to make the code harder to read and debug for little/no
> gain.

I disagree, but you probably knew that when you saw the code :)

These macros are not used inside code, they declare entire functions. 
These functions are 100% duplicated across 2-4 protocols.  Duplicated
code means bugs in some portions of the code and no others, more
difficult to maintain, etc.  I even proved this point while developing
the patch -- one of the functions was missing an EXPORT_xxx symbol. 
Using a standard macro automatically fixed this, a small oversight that
had been in the kernel probably for over a year.

-- 
Jeff Garzik       | "You see, in this world there's two kinds of
Building 1024     |  people, my friend: Those with loaded guns
MandrakeSoft      |  and those who dig. You dig."  --Blondie

<Prev in Thread] Current Thread [Next in Thread>