This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Mon May 6 18:28:19 2024 Received: from spaans.ds9a.nl (adsl-xs4all.ds9a.nl [213.84.159.51]) by kylie.puddingonline.com (8.11.6/8.11.6) with SMTP id g8HKDri11430 for ; Tue, 17 Sep 2002 22:13:54 +0200 Received: (qmail 15696 invoked from network); 17 Sep 2002 19:57:01 -0000 Received: from unknown (HELO spaans.ds9a.nl) (3ffe:8280:10:360:202:44ff:fe2a:a1dd) by mayo.ipv6.ds9a.nl with SMTP; 17 Sep 2002 19:57:01 -0000 Received: (qmail 15216 invoked by uid 1000); 17 Sep 2002 19:43:07 -0000 MBOX-Line: From linux-kernel-owner@vger.kernel.org Fri Sep 29 07:34:40 2000 Received: (maildatabase); juh Received: (qmail 1653 invoked by alias); 29 Sep 2000 07:09:41 -0000 Received: (qmail 1495 invoked from network); 29 Sep 2000 06:56:36 -0000 Received: from vger.kernel.org (199.183.24.194) by spaans.ds9a.nl with SMTP; 29 Sep 2000 06:56:36 -0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 29 Sep 2000 03:10:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 29 Sep 2000 03:10:20 -0400 Received: from orbita.don.sitek.net ([213.24.25.98]:28934 "EHLO orbita.don.sitek.net") by vger.kernel.org with ESMTP id ; Fri, 29 Sep 2000 03:10:02 -0400 Received: from pazke by orbita.don.sitek.net with local (Exim 3.03 #1) id 13eu40-0001vh-00 for linux-kernel@vger.kernel.org; Fri, 29 Sep 2000 10:54:32 +0400 Date: Fri, 29 Sep 2000 10:54:32 +0400 From: Andrey Panin To: linux-kernel@vger.kernel.org Subject: [PATCH] ne.c, 3c501.c, 3c503.c, 3c507.c: get rid of check_region() Message-Id: <20000929105431.A7125@orbita1.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, check_region() patches attached. Next patchset will be ready in monday. Best regards, Andrey -- --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-3c501 diff -urN /mnt/disk/linux/drivers/net/3c501.c /linux/drivers/net/3c501.c --- /mnt/disk/linux/drivers/net/3c501.c Tue Sep 12 23:47:56 2000 +++ /linux/drivers/net/3c501.c Thu Sep 28 20:48:23 2000 @@ -246,13 +246,8 @@ return -ENXIO; for (i = 0; netcard_portlist[i]; i++) - { - int ioaddr = netcard_portlist[i]; - if (check_region(ioaddr, EL1_IO_EXTENT)) - continue; - if (el1_probe1(dev, ioaddr) == 0) + if (el1_probe1(dev, netcard_portlist[i]) == 0) return 0; - } return -ENODEV; } --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-3c503 diff -urN /mnt/disk/linux/drivers/net/3c503.c /linux/drivers/net/3c503.c --- /mnt/disk/linux/drivers/net/3c503.c Tue Sep 12 23:49:16 2000 +++ /linux/drivers/net/3c503.c Thu Sep 28 21:23:06 2000 @@ -154,14 +154,18 @@ int __init el2_probe1(struct net_device *dev, int ioaddr) { - int i, iobase_reg, membase_reg, saved_406, wordlength; + int i, iobase_reg, membase_reg, saved_406, wordlength, retval; static unsigned version_printed = 0; unsigned long vendor_id; + if (!request_region(ioaddr, EL2_IO_EXTENT, "3c503")) + return -ENODEV; + /* Reset and/or avoid any lurking NE2000 */ if (inb(ioaddr + 0x408) == 0xff) { mdelay(1); - return -ENODEV; + retval = -ENODEV; + goto out; } /* We verify that it's a 3C503 board by checking the first three octets @@ -171,7 +175,8 @@ /* ASIC location registers should be 0 or have only a single bit set. */ if ( (iobase_reg & (iobase_reg - 1)) || (membase_reg & (membase_reg - 1))) { - return -ENODEV; + retval = -ENODEV; + goto out; } saved_406 = inb_p(ioaddr + 0x406); outb_p(ECNTRL_RESET|ECNTRL_THIN, ioaddr + 0x406); /* Reset it... */ @@ -183,7 +188,8 @@ if ((vendor_id != OLD_3COM_ID) && (vendor_id != NEW_3COM_ID)) { /* Restore the register we frobbed. */ outb(saved_406, ioaddr + 0x406); - return -ENODEV; + retval = -ENODEV; + goto out; } /* We should have a "dev" from Space.c or the static module table. */ @@ -191,8 +197,10 @@ printk("3c503.c: Passed a NULL device.\n"); dev = init_etherdev(0, 0); - if (!dev) - return -ENOMEM; + if (!dev) { + retval = -ENOMEM; + goto out; + } } if (ei_debug && version_printed++ == 0) @@ -202,8 +210,9 @@ /* Allocate dev->priv and fill in 8390 specific dev fields. */ if (ethdev_init(dev)) { printk ("3c503: unable to allocate memory for dev->priv.\n"); - return -ENOMEM; - } + retval = -ENOMEM; + goto out; + } printk("%s: 3c503 at i/o base %#3x, node ", dev->name, ioaddr); @@ -302,8 +311,6 @@ ei_status.block_input = &el2_block_input; ei_status.block_output = &el2_block_output; - request_region(ioaddr, EL2_IO_EXTENT, ei_status.name); - if (dev->irq == 2) dev->irq = 9; else if (dev->irq > 5 && dev->irq != 9) { @@ -330,6 +337,9 @@ dev->name, ei_status.name, (wordlength+1)<<3); } return 0; +out: + release_region(ioaddr, EL2_IO_EXTENT); + return retval; } static int --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-3c507 diff -urN /mnt/disk/linux/drivers/net/3c507.c /linux/drivers/net/3c507.c --- /mnt/disk/linux/drivers/net/3c507.c Tue Sep 26 19:48:54 2000 +++ /linux/drivers/net/3c507.c Thu Sep 28 22:42:41 2000 @@ -317,13 +317,9 @@ else if (base_addr != 0) return -ENXIO; /* Don't probe at all. */ - for (i = 0; netcard_portlist[i]; i++) { - int ioaddr = netcard_portlist[i]; - if (check_region(ioaddr, EL16_IO_EXTENT)) - continue; - if (el16_probe1(dev, ioaddr) == 0) + for (i = 0; netcard_portlist[i]; i++) + if (el16_probe1(dev, netcard_portlist[i]) == 0) return 0; - } return -ENODEV; } @@ -331,7 +327,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) { static unsigned char init_ID_done = 0, version_printed = 0; - int i, irq, irqval; + int i, irq, irqval, retval; struct net_local *lp; if (init_ID_done == 0) { @@ -348,15 +344,21 @@ init_ID_done = 1; } - if (inb(ioaddr) == '*' && inb(ioaddr+1) == '3' - && inb(ioaddr+2) == 'C' && inb(ioaddr+3) == 'O') - ; - else + if (!request_region(ioaddr, EL16_IO_EXTENT, "3c507")) return -ENODEV; + if ((inb(ioaddr) != '*') || (inb(ioaddr + 1) != '3') || + (inb(ioaddr + 2) != 'C') || (inb(ioaddr + 3) != 'O')) { + retval = -ENODEV; + goto out; + } + /* Allocate a new 'dev' if needed. */ if (dev == NULL) - dev = init_etherdev(0, 0); + if (!(dev = init_etherdev(0, 0))) { + retval = -ENOMEM; + goto out; + } if (net_debug && version_printed++ == 0) printk(version); @@ -371,11 +373,11 @@ irqval = request_irq(irq, &el16_interrupt, 0, "3c507", dev); if (irqval) { printk ("unable to get IRQ %d (irqval=%d).\n", irq, irqval); - return -EAGAIN; + retval = -EAGAIN; + goto out; } /* We've committed to using the board, and can start filling in *dev. */ - request_region(ioaddr, EL16_IO_EXTENT, "3c507"); dev->base_addr = ioaddr; outb(0x01, ioaddr + MISC_CTRL); @@ -419,8 +421,10 @@ /* Initialize the device structure. */ lp = dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); - if (dev->priv == NULL) - return -ENOMEM; + if (dev->priv == NULL) { + retval = -ENOMEM; + goto out; + } memset(dev->priv, 0, sizeof(struct net_local)); spin_lock_init(&lp->lock); @@ -436,6 +440,9 @@ dev->flags&=~IFF_MULTICAST; /* Multicast doesn't work */ return 0; +out: + release_region(ioaddr, EL16_IO_EXTENT); + return retval; } static int el16_open(struct net_device *dev) --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-ne --- /mnt/disk/linux/drivers/net/ne.c Wed Sep 27 22:46:30 2000 +++ /linux/drivers/net/ne.c Thu Sep 28 20:45:32 2000 @@ -210,10 +210,7 @@ #ifndef MODULE /* 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]; - if (check_region(ioaddr, NE_IO_EXTENT)) - continue; - if (ne_probe1(dev, ioaddr) == 0) + if (ne_probe1(dev, netcard_portlist[base_addr]) == 0) return 0; } #endif @@ -235,9 +232,6 @@ if (pci_enable_device(pdev)) continue; pci_ioaddr = pci_resource_start (pdev, 0); - /* Avoid already found cards from previous calls */ - if (check_region(pci_ioaddr, NE_IO_EXTENT)) - continue; pci_irq_line = pdev->irq; if (pci_irq_line) break; /* Found it */ } @@ -307,12 +301,17 @@ const char *name = NULL; int start_page, stop_page; int neX000, ctron, copam, bad_card; - int reg0 = inb_p(ioaddr); + int reg0, retval; static unsigned version_printed = 0; - if (reg0 == 0xFF) + if (!request_region(ioaddr, NE_IO_EXTENT, "ne")) return -ENODEV; + if ((reg0 = inb_p(ioaddr)) == 0xFF) { + retval = -ENODEV; + goto out; + } + /* Do a preliminary verification that we have a 8390. */ { int regd; @@ -324,7 +323,8 @@ if (inb_p(ioaddr + EN0_COUNTER0) != 0) { outb_p(reg0, ioaddr); outb_p(regd, ioaddr + 0x0d); /* Restore the old values. */ - return -ENODEV; + retval = -ENODEV; + goto out; } } @@ -363,7 +363,8 @@ break; } else { printk(" not found (no reset ack).\n"); - return -ENODEV; + retval = -ENODEV; + goto out; } } @@ -465,11 +466,13 @@ { printk(" not found (invalid signature %2.2x %2.2x).\n", SA_prom[14], SA_prom[15]); - return -ENXIO; + retval = -ENXIO; + goto out; } #else printk(" not found.\n"); - return -ENXIO; + retval = -ENXIO; + goto out; #endif } @@ -495,14 +498,16 @@ if (! dev->irq) { printk(" failed to detect IRQ line.\n"); - return -EAGAIN; + retval = -EAGAIN; + goto out; } /* Allocate dev->priv and fill in 8390 specific dev fields. */ if (ethdev_init(dev)) { printk (" unable to get memory for dev->priv.\n"); - return -ENOMEM; + retval = -ENOMEM; + goto out; } /* Snarf the interrupt now. There's no point in waiting since we cannot @@ -515,11 +520,11 @@ printk (" unable to get IRQ %d (irqval=%d).\n", dev->irq, irqval); kfree(dev->priv); dev->priv = NULL; - return -EAGAIN; + retval = -EAGAIN; + goto out; } } dev->base_addr = ioaddr; - request_region(ioaddr, NE_IO_EXTENT, name); for(i = 0; i < ETHER_ADDR_LEN; i++) { printk(" %2.2x", SA_prom[i]); @@ -549,6 +554,9 @@ dev->stop = &ne_close; NS8390_init(dev, 0); return 0; +out: + release_region(ioaddr, NE_IO_EXTENT); + return retval; } static int ne_open(struct net_device *dev) --azLHFNyN32YCQGCU-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/