]> git.hungrycats.org Git - linux/commitdiff
[PATCH] region changes for rocket
authorWilliam Stinson <wstinson@infonie.fr>
Thu, 1 Aug 2002 05:22:12 +0000 (22:22 -0700)
committerChristoph Hellwig <hch@sb.bsdonline.org>
Thu, 1 Aug 2002 05:22:12 +0000 (22:22 -0700)
this is a small patch for Rocketport device driver for Linux to
  1) remove two calls to check_region using request_region instead
  2) release allocated region resource in case of error.

I don't have this hardware so compilation checked only.

This patch does not remove all references to check_region in this driver
(one reference still left unchanged).

drivers/char/rocket.c

index 6513edfc3045106a4b58b779dea9e72aaa935a0e..4b1509ea7eb995034c17b215db54303eb4c0bb87 100644 (file)
@@ -1881,15 +1881,23 @@ static int __init init_ISA(int i, int *reserved_controller)
 {
        int     num_aiops, num_chan;
        int     aiop, chan;
+       int     extent = 0;
        unsigned int    aiopio[MAX_AIOPS_PER_BOARD];    
        CONTROLLER_t    *ctlp;
 
        if (rcktpt_io_addr[i] == 0)
                return(0);
 
-       if (check_region(rcktpt_io_addr[i],64)) {
+       if (rcktpt_io_addr[i] + 0x40 == controller) {
+               *reserved_controller = 1;
+               extent = 68;
+       } else {
+               extent = 64;
+       }
+       if (!request_region(rcktpt_io_addr[i], extent,
+                           "Comtrol Rocketport")) {
                printk("RocketPort board address 0x%lx in use...\n",
-                       rcktpt_io_addr[i]);
+                      rcktpt_io_addr[i]);
                rcktpt_io_addr[i] = 0;
                return(0);
        }
@@ -1901,6 +1909,7 @@ static int __init init_ISA(int i, int *reserved_controller)
                                    aiopio, MAX_AIOPS_PER_BOARD, 0,
                                    FREQ_DIS, 0);
        if (num_aiops <= 0) {
+               release_region(rcktpt_io_addr[i], extent);
                rcktpt_io_addr[i] = 0;
                return(0);
        }
@@ -1914,14 +1923,6 @@ static int __init init_ISA(int i, int *reserved_controller)
        printk("Rocketport controller #%d found at 0x%lx, "
               "%d AIOPs\n", i, rcktpt_io_addr[i],
               num_aiops);
-       if (rcktpt_io_addr[i] + 0x40 == controller) {
-               *reserved_controller = 1;
-               request_region(rcktpt_io_addr[i], 68,
-                                      "Comtrol Rocketport");
-       } else {
-               request_region(rcktpt_io_addr[i], 64,
-                              "Comtrol Rocketport");
-       }
        return(1);
 }