]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] remove check_region from drivers_atm_ambassador.c
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 13 Jan 2003 12:12:32 +0000 (04:12 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Mon, 13 Jan 2003 12:12:32 +0000 (04:12 -0800)
From:  william stinson <wstinson@wanadoo.fr>

  this proposed patch for drivers/atm/ambassador.c atm driver for Linux
  removes one call to check_region using request_region instead

  I don't have this hardware so patch is not tested.  This patch removes
  all references to check_region in this driver.

  This is patch number 30 in a series of check_region patches I am doing as
   part of the kernel janitors project.

drivers/atm/ambassador.c

index d073bf012a4a49c5846b9a79516f66040d42d10b..b3754b96b3a6dd0627eea8a9c13ff62c0cceb25a 100644 (file)
@@ -2439,7 +2439,7 @@ static int __init amb_probe (void) {
            " IO %x, IRQ %u, MEM %p", iobase, irq, membase);
     
     // check IO region
-    if (check_region (iobase, AMB_EXTENT)) {
+    if (!request_region (iobase, AMB_EXTENT, DEV_LABEL)) {
       PRINTK (KERN_ERR, "IO range already in use!");
       return;
     }
@@ -2448,6 +2448,7 @@ static int __init amb_probe (void) {
     if (!dev) {
       // perhaps we should be nice: deregister all adapters and abort?
       PRINTK (KERN_ERR, "out of memory!");
+      release_region (iobase, AMB_EXTENT);
       return;
     }
     
@@ -2465,9 +2466,6 @@ static int __init amb_probe (void) {
        // free_irq is at "endif"
       } else {
        
-       // reserve IO region
-       request_region (iobase, AMB_EXTENT, DEV_LABEL);
-       
        dev->atm_dev = atm_dev_register (DEV_LABEL, &amb_ops, -1, NULL);
        if (!dev->atm_dev) {
          PRINTD (DBG_ERR, "failed to register Madge ATM adapter");
@@ -2499,14 +2497,14 @@ static int __init amb_probe (void) {
          atm_dev_deregister (dev->atm_dev);
        } /* atm_dev_register */
        
-       release_region (iobase, AMB_EXTENT);
        free_irq (irq, dev);
-      } /* request_region, request_irq */
+      } /* request_irq */
       
       amb_reset (dev, 0);
     } /* amb_init */
     
     kfree (dev);
+    release_region (iobase, AMB_EXTENT);
   } /* kmalloc, end-of-fn */
   
   PRINTD (DBG_FLOW, "amb_probe");