netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Fries <david@fries.net>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: paul.gortmaker@gmail.com, akpm@linux-foundation.org,
	p_gortmaker@yahoo.com, alan@lxorguk.ukuu.org.uk, jeff@garzik.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] [PATCH] ne.c fix rmmod, platform driver improvements
Date: Sat, 13 Sep 2008 09:44:57 -0500	[thread overview]
Message-ID: <20080913144457.GE28469@spacedout.fries.net> (raw)
In-Reply-To: <20080911.225503.59032738.anemo@mba.ocn.ne.jp>

On Thu, Sep 11, 2008 at 10:55:03PM +0900, Atsushi Nemoto wrote:
> This breaks current users of ne platform driver.  Here is a quick fix
> upon your patch.

I reformatted your patch and added a comment.  Does this work for you?

diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index cd31e77..9759aec 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -813,22 +813,37 @@ static int __init ne_drv_probe(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	int err, this_dev = pdev->id;
+	struct resource *res;
 
 	dev = alloc_eip_netdev();
 	if (!dev)
 		return -ENOMEM;
-	dev->base_addr = io[this_dev];
-	dev->irq = irq[this_dev];
-	dev->mem_end = bad[this_dev];
+
+	/* ne.c doesn't populate resources in platform_device, but
+	 * rbtx4927_ne_init and rbtx4938_ne_init do register devices
+	 * with resources.
+	 */
+	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (res) {
+		dev->base_addr = res->start;
+		dev->irq = platform_get_irq(pdev, 0);
+	} else {
+		dev->base_addr = io[this_dev];
+		dev->irq = irq[this_dev];
+		dev->mem_end = bad[this_dev];
+	}
 	err = do_ne_probe(dev);
 	if (err) {
 		free_netdev(dev);
 		return err;
 	}
 	platform_set_drvdata(pdev, dev);
+
 	/* Update with any values found by probing. */
-	io[this_dev] = dev->base_addr;
-	irq[this_dev] = dev->irq;
+	if (0 <= this_dev && this_dev < MAX_NE_CARDS) {
+		io[this_dev] = dev->base_addr;
+		irq[this_dev] = dev->irq;
+	}
 	return 0;
 }
 

-- 
David Fries <david@fries.net>
http://fries.net/~david/ (PGP encryption key available)

  reply	other threads:[~2008-09-13 14:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04  3:02 [PATCH] ne.c fix for hibernate and rmmod oops fix David Fries
2008-09-04  7:48 ` Jeff Garzik
2008-09-05  8:01 ` Paul Gortmaker
2008-09-09  2:54   ` David Fries
2008-09-09  2:58     ` [PATCH 1/2] [PATCH] ne.c fix rmmod, platform driver improvements David Fries
2008-09-11 13:55       ` Atsushi Nemoto
2008-09-13 14:44         ` David Fries [this message]
2008-09-13 15:13           ` Atsushi Nemoto
2008-09-13 15:19             ` David Fries
2008-09-13 15:29               ` Atsushi Nemoto
2008-09-13 16:47                 ` [PATCH 1/2] " David Fries
2008-09-13 16:54                   ` [PATCH 2/2] ne.c Fix suspend and resume for ISA PnP cards David Fries
2008-09-09  3:01     ` David Fries
2008-09-13 19:55       ` Jeff Garzik
2008-09-13 20:32         ` David Fries
2008-09-13 20:36           ` Jeff Garzik
2008-09-11 13:50     ` [PATCH] ne.c fix for hibernate and rmmod oops fix Atsushi Nemoto

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=20080913144457.GE28469@spacedout.fries.net \
    --to=david@fries.net \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=p_gortmaker@yahoo.com \
    --cc=paul.gortmaker@gmail.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).