netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, netdev@vger.kernel.org,
	ralf@linux-mips.org, sshtylyov@ru.mvista.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH 2/3] ne: MIPS: Use platform_driver for ne on RBTX49XX
Date: Sat, 28 Apr 2007 11:10:37 -0400	[thread overview]
Message-ID: <463363ED.3050307@garzik.org> (raw)
In-Reply-To: <20070425.015549.108742168.anemo@mba.ocn.ne.jp>

Atsushi Nemoto wrote:
> This patch lets RBTX49XX boards use generic platform_driver interface
> for the ne driver.
> 
> * Use platform_device to pass ioaddr and irq to the ne driver.
> * Remove unnecessary ifdefs for RBTX49XX from the ne driver.
> * Make the ne driver selectable on these boards regardless of CONFIG_ISA
> * Add an ifdef for netcard_portlist[] to avoid unnecessary auto-probe.
>   (I'm not sure M32R needs auto-probe but it is current behavior)
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
>  .../toshiba_rbtx4927/toshiba_rbtx4927_setup.c      |   19 +++++++++++++++++++
>  arch/mips/tx4938/toshiba_rbtx4938/setup.c          |   20 ++++++++++++++++++++
>  drivers/net/Kconfig                                |    2 +-
>  drivers/net/ne.c                                   |   13 ++++---------
>  4 files changed, 44 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
> index 0f7576d..7d2c9d0 100644
> --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
> +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
> @@ -1049,3 +1049,22 @@ static int __init toshiba_rbtx4927_rtc_init(void)
>  	return IS_ERR(dev) ? PTR_ERR(dev) : 0;
>  }
>  device_initcall(toshiba_rbtx4927_rtc_init);
> +
> +static int __init rbtx4927_ne_init(void)
> +{
> +	struct resource res[] = {
> +		{
> +			.start	= RBTX4927_RTL_8019_BASE,
> +			.end	= RBTX4927_RTL_8019_BASE + 0x20 - 1,
> +			.flags	= IORESOURCE_IO,
> +		}, {
> +			.start	= RBTX4927_RTL_8019_IRQ,
> +			.flags	= IORESOURCE_IRQ,
> +		}
> +	};
> +	struct platform_device *dev =
> +		platform_device_register_simple("ne", -1,
> +						res, ARRAY_SIZE(res));
> +	return IS_ERR(dev) ? PTR_ERR(dev) : 0;
> +}
> +device_initcall(rbtx4927_ne_init);
> diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
> index 66163ba..f5d1ce7 100644
> --- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
> +++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
> @@ -20,6 +20,7 @@
>  #include <linux/console.h>
>  #include <linux/pci.h>
>  #include <linux/pm.h>
> +#include <linux/platform_device.h>
>  
>  #include <asm/wbflush.h>
>  #include <asm/reboot.h>
> @@ -1037,3 +1038,22 @@ static int __init tx4938_spi_proc_setup(void)
>  
>  __initcall(tx4938_spi_proc_setup);
>  #endif
> +
> +static int __init rbtx4938_ne_init(void)
> +{
> +	struct resource res[] = {
> +		{
> +			.start	= RBTX4938_RTL_8019_BASE,
> +			.end	= RBTX4938_RTL_8019_BASE + 0x20 - 1,
> +			.flags	= IORESOURCE_IO,
> +		}, {
> +			.start	= RBTX4938_RTL_8019_IRQ,
> +			.flags	= IORESOURCE_IRQ,
> +		}
> +	};
> +	struct platform_device *dev =
> +		platform_device_register_simple("ne", -1,
> +						res, ARRAY_SIZE(res));
> +	return IS_ERR(dev) ? PTR_ERR(dev) : 0;
> +}
> +device_initcall(rbtx4938_ne_init);
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index aba0d39..a80e8ce 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -1088,7 +1088,7 @@ config ETH16I
>  
>  config NE2000
>  	tristate "NE2000/NE1000 support"
> -	depends on NET_ISA || (Q40 && m) || M32R
> +	depends on NET_ISA || (Q40 && m) || M32R || TOSHIBA_RBTX4927 || TOSHIBA_RBTX4938
>  	select CRC32
>  	---help---
>  	  If you have a network (Ethernet) card of this type, say Y and read
> diff --git a/drivers/net/ne.c b/drivers/net/ne.c
> index b8a181f..4e99e7a 100644
> --- a/drivers/net/ne.c
> +++ b/drivers/net/ne.c
> @@ -56,10 +56,6 @@ static const char version2[] =
>  #include <asm/system.h>
>  #include <asm/io.h>
>  
> -#if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
> -#include <asm/tx4938/rbtx4938.h>
> -#endif
> -
>  #include "8390.h"
>  
>  #define DRV_NAME "ne"
> @@ -81,7 +77,10 @@ static const char version2[] =
>  /* A zero-terminated list of I/O addresses to be probed at boot. */
>  #ifndef MODULE
>  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?

	Jeff




  parent reply	other threads:[~2007-04-28 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-24 16:55 [PATCH 2/3] ne: MIPS: Use platform_driver for ne on RBTX49XX Atsushi Nemoto
2007-04-24 17:03 ` Atsushi Nemoto
2007-04-28 15:08   ` Jeff Garzik
2007-04-28  8:04 ` Andrew Morton
2007-04-28 17:10   ` Atsushi Nemoto
2007-04-30 15:14     ` Atsushi Nemoto
2007-04-28 15:10 ` Jeff Garzik [this message]
2007-04-28 17:24   ` Atsushi Nemoto
2007-04-28 17:28     ` Jeff Garzik

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=463363ED.3050307@garzik.org \
    --to=jeff@garzik.org \
    --cc=akpm@linux-foundation.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-mips@linux-mips.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=sshtylyov@ru.mvista.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).