Re: [PATCH] RFC: fix ethernet device initialization

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Sat Mar 10 2001 - 22:25:38 EST

  • Next message: John William: "RE: HP Vectra XU 5/90 interrupt problems"

    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
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    



    This archive was generated by hypermail 2b29 : Sat Mar 10 2001 - 22:46:05 EST