linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rasmus Andersen <rasmus@jaquet.dk>
To: ipslinux@us.ibm.com
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: [PATCH] drivers/scsi/ips.c check_region -> request_region (241p9)
Date: Tue, 23 Jan 2001 23:19:49 +0100	[thread overview]
Message-ID: <20010123231949.I607@jaquet.dk> (raw)

Hi.

The following patch makes drivers/scsi/ips.c use the return code
of request_region instead of calling check_region. It also moves
some resource freeing to ips_free since that made my error path
cleaner.

It applies cleanly against ac10 and 241p9.

Please comment.


--- linux-ac10-clean/drivers/scsi/ips.c	Sat Jan 20 15:17:13 2001
+++ linux-ac10/drivers/scsi/ips.c	Sun Jan 21 19:17:07 2001
@@ -668,7 +668,7 @@
                       ips_name, ips_next_controller, mem_addr, mem_len);
 
 #if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
-            if (check_mem_region(mem_addr, mem_len)) {
+            if (!request_mem_region(mem_addr, mem_len, "ips")) {
                /* Couldn't allocate io space */
                printk(KERN_WARNING "(%s%d) couldn't allocate IO space %x len %d.\n",
                       ips_name, ips_next_controller, io_addr, io_len);
@@ -677,8 +677,6 @@
 
                continue;
             }
-
-            request_mem_region(mem_addr, mem_len, "ips");
 #endif
 
             base = mem_addr & PAGE_MASK;
@@ -696,7 +694,7 @@
             DEBUG_VAR(1, "(%s%d) detect, IO region %x, size: %d",
                       ips_name, ips_next_controller, io_addr, io_len);
 
-            if (check_region(io_addr, io_len)) {
+            if (!request_region(io_addr, io_len, "ips")) {
                /* Couldn't allocate io space */
                printk(KERN_WARNING "(%s%d) couldn't allocate IO space %x len %d.\n",
                       ips_name, ips_next_controller, io_addr, io_len);
@@ -706,7 +704,6 @@
                continue;
             }
 
-            request_region(io_addr, io_len, "ips");
          }
 
          /* get planer status */
@@ -1031,6 +1028,7 @@
 
       if (!ha->active) {
          scsi_unregister(sh);
+         ips_free(ha); /* To free request_*'ed resources. */
          ips_ha[i] = NULL;
          ips_sh[i] = NULL;
 
@@ -1152,15 +1150,6 @@
    /* free extra memory */
    ips_free(ha);
 
-   /* Free I/O Region */
-   if (ha->io_addr)
-      release_region(ha->io_addr, ha->io_len);
-
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
-   if (ha->mem_addr)
-      release_mem_region(ha->mem_addr, ha->mem_len);
-#endif
-
    /* free IRQ */
    free_irq(ha->irq, ha);
 
@@ -4531,6 +4520,15 @@
          ha->mem_ptr = NULL;
          ha->mem_addr = 0;
       }
+      
+#if LINUX_VERSION_CODE >= LinuxVersionCode(2,3,17)
+      if (ha->mem_addr)
+         release_mem_region(ha->mem_addr, ha->mem_len);
+#endif
+
+      if (ha->io_addr)
+         release_region(ha->io_addr, ha->io_len);
+
    }
 }
 

-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

"You who hate the Jews so, why did you adopt their religion?" 
   -- Friedrich Nietzsche, addressing anti-semitic Christians 
-
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/

                 reply	other threads:[~2001-01-23 22:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010123231949.I607@jaquet.dk \
    --to=rasmus@jaquet.dk \
    --cc=ipslinux@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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).