linux-mips
[Top] [All Lists]

Re: [PATCH 2/3] ne: MIPS: Use platform_driver for ne on RBTX49XX

To: jeff@garzik.org
Subject: Re: [PATCH 2/3] ne: MIPS: Use platform_driver for ne on RBTX49XX
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Sun, 29 Apr 2007 02:24:28 +0900 (JST)
Cc: linux-mips@linux-mips.org, netdev@vger.kernel.org, ralf@linux-mips.org, sshtylyov@ru.mvista.com, akpm@linux-foundation.org
In-reply-to: <463363ED.3050307@garzik.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20070425.015549.108742168.anemo@mba.ocn.ne.jp> <463363ED.3050307@garzik.org>
Sender: linux-mips-bounce@linux-mips.org
On Sat, 28 Apr 2007 11:10:37 -0400, Jeff Garzik <jeff@garzik.org> wrote:
> >  static unsigned int netcard_portlist[] __initdata = {
> > -   0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0
> > +#if defined(CONFIG_ISA) || defined(CONFIG_M32R)
> > +   0x300, 0x280, 0x320, 0x340, 0x360, 0x380,
> > +#endif
> > +   0
> 
> This looks a bit strange, and perhaps more difficult to maintain long term.
> 
> I would suggest creating a NEEDS_PORTLIST cpp macro at the top of ne.c, 
> to be defined or undefined based on CONFIG_xxx symbols.  Then, down in 
> the code itself, conditionally include or exclude all portlist related 
> data tables and code.
> 
> Sound sane?

Sure.  Do you mean something like this?


#if !defined(MODULE) && (defined(CONFIG_ISA) || defined(CONFIG_M32R))
#define NEEDS_PORTLIST
#endif
...
#ifdef NEEDS_PORTLIST
static unsigned int netcard_portlist[] __initdata = {
        0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0
};
#endif
...
#ifdef NEEDS_PORTLIST
        int orig_irq = dev->irq;
#endif
...
#ifdef NEEDS_PORTLIST
        /* Last resort. The semi-risky ISA auto-probe. */
        for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) {
                int ioaddr = netcard_portlist[base_addr];
                dev->irq = orig_irq;
                if (ne_probe1(dev, ioaddr) == 0)
                        return 0;
        }
#endif

---
Atsushi Nemoto

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