lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080913151906.GG28469@spacedout.fries.net>
Date:	Sat, 13 Sep 2008 10:19:06 -0500
From:	David Fries <david@...es.net>
To:	Atsushi Nemoto <anemo@....ocn.ne.jp>
Cc:	paul.gortmaker@...il.com, akpm@...ux-foundation.org,
	p_gortmaker@...oo.com, alan@...rguk.ukuu.org.uk, jeff@...zik.org,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] [PATCH] ne.c fix rmmod, platform driver improvements

On Sun, Sep 14, 2008 at 12:13:00AM +0900, Atsushi Nemoto wrote:
> On Sat, 13 Sep 2008 09:44:57 -0500, David Fries <david@...es.net> wrote:
> > 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
> ...
> >  	/* 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;
> >  }
> 
> For now rbtx49xx ne platform devices use -1 for pdev->id, but it may
> change.  Please don't assume it.

Does this work?
-	if (0 <= this_dev && this_dev < MAX_NE_CARDS) {
+	if (!res) {

diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index cd31e77..ede9b12 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 (!res) {
+		io[this_dev] = dev->base_addr;
+		irq[this_dev] = dev->irq;
+	}
 	return 0;
 }
 

-- 
David Fries <david@...es.net>
http://fries.net/~david/ (PGP encryption key available)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ